Rapid and non-destructive detection of pesticide residues on vegetable surfaces is crucial for ensuring food safety. This study proposes a one-dimensional convolutional neural network (1D-CNN) model based on visible-near infrared (Vis/NIR) spectroscopy for pesticide residue detection on pakchoi. Traditional machine learning models (partial least squares discriminant analysis, K-nearest neighbor, and support vector machine) were constructed for comparison. To enhance the 1D-CNN's performance, we introduced the spectral attention module (SAM) to strengthen its learning of key features, and employed a Wasserstein generative adversarial network integrated with a variational autoencoder (VAE-WGAN) for data augmentation to improve generalization and robustness. Results show that the baseline 1D-CNN outperformed traditional machine learning models without complex feature engineering. Furthermore, the 1D-SACNN, which integrates a baseline 1D-CNN and a SAM, achieved the best performance on the pakchoi dataset after data augmentation, with an accuracy of 97.92 ± 0.95%, recall of 97.92 ± 0.95%, precision of 98.07 ± 0.86%, and F1-score of 97.93 ± 0.96%. The findings demonstrate the potential of the data-augmented and attention-optimized 1D-SACNN model for detecting pesticide residues on pakchoi surfaces, providing a valuable, convenient, and efficient technical reference solution for food safety monitoring. • First application of Vis/NIR combined with DL for detecting pesticide residues in pakchoi • Compare the performance of 1D-SACNN with that of traditional machine learning • Adding the Spectral Attention Module enhances the feature extraction capability of 1D-CNN • Data augmented by VAE-WGAN enhances model generalization and robustness
Zhang et al. (Wed,) studied this question.