Abstract:Objective To achieve rapid, non-destructive, and high-precision monitoring of pork freshness, addressing the low efficiency, high destructiveness, and insufficient prediction accuracy of single models in conventional monitoring.Methods A pork freshness monitoring model was proposed based on near-infrared spectroscopy (NIRS) combined with random forest (RF) improved by the fruit fly optimization algorithm (FOA). With the total volatile basic nitrogen (TVB-N) content as the freshness indicator, near-infrared spectral data of pork samples at different storage stages are collected (scanning range: 1 000~1 800 nm). Spectral noise and baseline drift are eliminated via a preprocessing method combining multiplicative scatter correction (MSC) and first-derivative transformation. Then, FOA is employed to optimize key hyperparameters (number of decision trees, minimum leaf node sample size, and maximum number of features) of RF to construct the FOA-RF model.Results Among all the prediction models evaluated, the FOA-RF model demonstrates the highest accuracy for predicting pork TVB-N content. The preprocessing method combining MSC and first-derivative transformation effectively enhances the quality of the spectral data. The FOA-RF model achieves a root mean square error of prediction (RMSEP) of only 1.582 mg/100 g, a correlation coefficient of prediction (Rp) of 0.978, a coefficient of determination of prediction (Rp2![]()
) as high as 0.956, and a residual prediction deviation of prediction (RPDp) of 4.723, significantly outperforming the other comparative models. The overall predictive performance of partial least squares regression (PLSR), the un-optimized RF model, and the grid search-optimized random forest (GS-RF) model is inferior to that of the FOA-RF model.Conclusion The method proposed in this study provides an efficient and accurate new approach for non-destructive monitoring of pork freshness, meeting the demand for rapid testing in the meat industry.