Volume 10,Issue 7
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.