Aflatoxin detection in naturally contaminated peanuts based on vision transformer and multi-scale convolutional fusion.
Journal:
Food chemistry
Published Date:
Apr 9, 2025
Abstract
Aflatoxin is a highly toxic substance found in peanuts, posing a serious threat to human health. To address this issue, an improved 1D-MCFViT model combining the Vision Transformer with multi-scale convolutional fusion is proposed to detect aflatoxin-contaminated peanuts under natural conditions. After data cleaning, indistinguishable samples in RGB images were obtained, and their spectral curves were extracted. Data generation was performed using autoencoder network and Gaussian resampling techniques, significantly enhancing the model's feature discrimination capability. This approach achieved 92.6 % accuracy and 94.4 % recall on the validation set, improving accuracy by 1.23 % over the 1D-ViT model. The performance of traditional machine learning and deep learning models before and after data generation was compared, demonstrating this method outperforms traditional machine learning models as well as mainstream deep learning models. This approach improves aflatoxin detection accuracy and provides a robust foundation for developing online detection devices.