To achieve rapid and nondestructive detection of moldy in-shell walnuts, this study proposes a walnut mold detection method based on visible hyperspectral imaging combined with a one-dimensional convolutional neural network (1D-CNN). Complete in-shell walnuts were used as the research objects, and hyperspectral data of normal and moldy walnuts were collected in the wavelength range of 400–900 nm. The raw hyperspectral images were processed through reflectance correction, region of interest extraction, average spectral curve construction, Savitzky-Golay (SG) smoothing, and standard normal variate (SNV) transformation. These preprocessing steps were used to reduce the influence of system noise, background interference, and scattering effects caused by differences in walnut shell morphology. On this basis, the processed spectral data were used as the input of a 1D-CNN model to classify normal and moldy walnuts. The experimental results showed that the proposed model achieved an Accuracy of 0.867, Precision of 0.923, Recall of 0.800, and F1-score of 0.857 on the test set. The results indicate that visible hyperspectral imaging can capture spectral variations caused by mold development in in-shell walnuts, and the combination of visible hyperspectral imaging and 1D-CNN can effectively identify moldy walnuts. This study provides a feasible method for nondestructive quality detection of walnuts.
Gürses M, 2006, Mycoflora and Aflatoxin Content of Hazelnuts, Walnuts, Peanuts, Almonds and Roasted Chickpeas (LEBLEBI) Sold in Turkey. International Journal of Food Properties, 9(3): 395–399.
Xu J, Xu D, Bai X, et al., 2022, Non-Destructive Detection of Moldy Walnuts based on Hyperspectral Imaging Technology. Molecules, 27(20): 6776.
Huang H, Liu L, Ngadi M, 2014, Recent Developments in Hyperspectral Imaging for Assessment of Food Quality and Safety. Sensors, 14(4): 7248–7276.
Feng Y, Sun D, 2012, Application of Hyperspectral Imaging in Food Safety Inspection and Control: A Review. Critical Reviews In Food Science and Nutrition, 52(11): 1039–1058.
Liu Y, Pu H, Sun D, 2017, Hyperspectral Imaging Technique for Evaluating Food Quality and Safety during Various Processes: A Review of Recent Applications. Trends in Food Science & Technology, 2017(69): 25–35.
LeCun Y, Bengio Y, Hinton G, 2015, Deep Learning. Nature, 521(7553): 436–444.
Chen X, Cheng G, Liu S, et al., 2022, Probing 1D Convolutional Neural Network Adapted to Near-Infrared Spectroscopy for Efficient Classification of Mixed Fish. Spectrochimica Acta Part A: Molecular and Biomolecular Spectroscopy, 2022(279): 121350.
Kheiralipour K, Sajadipour F, Nadimi M, 2025, A Review of Nut Quality Assessment using Hyperspectral Imaging Technique. Journal of Food Composition and Analysis, 2025: 108184.
Naeem I, Ismail A, Rehman A, et al., 2022, Prevalence of Aflatoxins in Selected Dry Fruits, Impact of Storage Conditions on Contamination Levels and Associated Health Risks on Pakistani Consumers. International Journal of Environmental Research and Public Health, 19(6): 3404.
Elmasry G, Kamruzzaman M, Sun D, et al., 2012, Principles and Applications of Hyperspectral Imaging in Quality Evaluation of Agro-Food Products: A Review. Critical Reviews in Food Science and Nutrition, 52(11): 999–1023.
Burger J, Geladi P, 2005, Hyperspectral NIR Image Regression Part I: Calibration and Correction. Journal of Chemometrics: A Journal of the Chemometrics Society, 19(5–7): 355–363.
Pu Y, Feng Y, Sun D, 2015, Recent Progress of Hyperspectral Imaging on Quality and Safety Inspection of Fruits and Vegetables: A Review. Comprehensive Reviews in Food Science and Food Safety, 14(2): 176–188.
Savitzky A, Golay M, 1964, Smoothing and Differentiation of Data by Simplified Least Squares Procedures. Analytical Chemistry, 36(8): 1627–1639.
Barnes R, Dhanoa M, Lister S, 1989, Standard Normal Variate Transformation and De-Trending of Near-Infrared Diffuse Reflectance Spectra. Applied Spectroscopy, 43(5): 772–777.
Mishra P, Passos D, Marini F, et al., 2022, Deep Learning for Near-Infrared Spectral Data Modelling: Hypes and Benefits. TrAC Trends in Analytical Chemistry, 2022(157): 116804.
Malek S, Melgani F, Bazi Y, 2018, One‐Dimensional Convolutional Neural Networks for Spectroscopic Signal Regression. Journal of Chemometrics, 32(5): e2977.
He K, Zhang X, Ren S, et al., 2015, Delving Deep into Rectifiers: Surpassing Human-Level Performance on Imagenet Classification, Proceedings of the IEEE International Conference on Computer Vision, 1026–1034.
Kingma D, Ba J. Adam, 2014, A Method for Stochastic Optimization, arXiv preprint arXiv:1412.6980.