This study addresses the urgent need for the rapid, non-destructive assessment of key soybean components, including moisture, fat, and protein, using near-infrared (NIR) spectroscopy. This study provides technical and theoretical support for achieving the efficient and accurate detection of major soybean components and for the development of portable near-infrared (NIR) instruments. Thirty soybean samples from diverse sources were collected, and 360 spectral measurements were acquired using a 900–1700 nm NIR spectrometer after grinding and standardized sampling. To improve model robustness, preprocessing strategies such as standard normal variate (SNV), multiplicative scatter correction (MSC), and Savitzky–Golay derivatives were applied. Feature selection was conducted using competitive adaptive reweighted sampling (CARS), successive projections algorithm (SPA), and uninformative variable elimination (UVE), followed by model construction with partial least squares regression (PLSR), support vector regression (SVR), and random forest (RF). Comparative analysis revealed that the RF model consistently outperformed the others across most combinations. Specifically, the SPASNV + D1–RF combination achieved an RPD of 14.7 for moisture, CARS–SNV + D1–RF reached 5.9 for protein, and CARS–SG + D2–RF attained 12.0 for fat, all significantly surpassing alternative methods and demonstrating a strong nonlinear learning capacity and predictive precision. These findings show that integrating optimal preprocessing and feature selection strategies can markedly enhance the predictive accuracy in NIR-based soybean analyses. The RF model offers exceptional stability and performance, providing both technical reference and theoretical support for the development of portable NIR devices and practical rapid-quality assessment systems for soybeans in industrial applications.
Moisture content is an important indicator of grain storage safety, processing quality, and circulation efficiency. However, the performance of near-infrared spectroscopy (NIRS) models is affected by differences in grain crops, sample morphologies, preprocessing strategies, feature selection methods, and regression models, and the adaptation relationships among these factors remain insufficiently understood. In this study, soybean, maize, and wheat samples with whole-grain and powder morphologies were investigated to reveal the method adaptation patterns of NIRS-based moisture prediction under consistent experimental conditions. Spectra in the range of 900–1700 nm were collected, and 54 analytical pathways were established by combining six preprocessing strategies, three feature selection algorithms (SPA, CARS, and UVE), and three regression models (PLSR, SVR, and RF). The results showed that representative optimal pathways achieved Rp values above 0.9730 for powder samples and above 0.9587 for whole-grain samples. Different grain crops and sample morphologies exhibited distinct analytical pathway preferences, indicating that appropriate analytical strategies should be selected according to specific detection objects. Spectral variation analysis further demonstrated higher spectral variability in whole-grain samples than in powder samples. This study provides insights into the selection of suitable NIRS analytical strategies for grain moisture prediction and quality assessment.