Abstract:Objective To achieve rapid, non-destructive, and high-precision detection of six nutritional components in tomatoes, including dry matter, soluble sugar, total acid, vitamin C, soluble solids, and lycopene.Methods A tomato nutritional component detection model based on near-infrared spectroscopy (NIRS) combined with light gradient boosting machine (LightGBM) optimized using the particle swarm optimization (PSO) algorithm (PSO-LightGBM) was proposed. Using the six nutritional components as detection indicators, near-infrared spectral data (scanning range: 400~2 500 nm) were collected from 471 tomato samples. Seven preprocessing methods were compared, and the optimal combination of standard normal variate (SNV) transformation and first derivative was selected to eliminate noise and baseline drift. The PSO algorithm was used to optimize the key hyperparameters of LightGBM (number of leaves, learning rate, tree depth, feature sampling ratio, and Bagging ratio) to construct a synchronous multi-component prediction model. Meanwhile, partial least squares regression (PLSR), unoptimized LightGBM, and grid search-optimized LightGBM (GS-LightGBM) models were established as comparison models.Results The PSO-LightGBM model achieved the highest prediction accuracy for all six nutritional components. The coefficients of determination for the prediction set (Rp2![]()
) for dry matter and soluble solids reached 0.987 and 0.973, respectively, with residual prediction deviation (ERPDp) values of 6.732 and 5.115, respectively. The Rp2![]()
values for total acid, soluble sugar, and vitamin C all exceeded 0.95, and their ERPDp values were all greater than 2.5. The Rp2![]()
for lycopene increased to 0.956, representing a 12.4% increase compared with that of the unoptimized LightGBM model. The prediction-set root mean square error (ERMSEP) of PSO-LightGBM was, on average, 34.7% lower than that of PLSR and 15.2% lower than that of GS-LightGBM.Conclusion This method addresses the insufficient generalization ability caused by the random setting of LightGBM parameters and enables synchronous and accurate detection of multiple nutritional components in tomatoes.