FOOD SCIENCE ›› 2025, Vol. 46 ›› Issue (19): 1-9.doi: 10.7506/spkx1002-6630-20250303-013

• Prevention and Control Technology of Foodborne Hazardous Substances •    

Qualitative Prediction of Aflatoxin in Raw Milk Based on Transformer Architecture

WANG Long, SONG Xiaodong, DING Haohan, DONG Guanjun, CUI Xiaohui, HUANG Huadi, ZHANG Cheng, WU Rina   

  1. (1. School of Artificial Intelligence and Computer Science, Jiangnan University, Wuxi 214122, China;2. State Key Laboratory of Dairy Quality Digital Intelligence Monitoring Technology, State Administration for Market Regulation, Hohhot 011517, China; 3. Science Center for Future Foods, Jiangnan University, Wuxi 214122, China; 4. School of Cyber Science and Engineering, Wuhan University, Wuhan 430072, China; 5. School of Environment & Ecology, Jiangnan University, Wuxi 214122, China)
  • Published:2025-09-16

Abstract: In this study, using machine learning and deep learning techniques, we collected raw milk composition data from different regions and seasons in China during the period of 2022–2024 and proposed a method for qualitative prediction of aflatoxin M1 (AFM1) based on easy-to-measure data, aiming to reduce the cost of batch testing in dairy factories. Based on the 16 selected classes of feature datasets, we conducted prediction experiments using various machine learning methods such as linear regression (LR), random forest (RF), support vector machine (SVM) and a method based on Transformer architecture, and analyzed the prediction performance and variance stability of these models on negative samples and positive samples through comparative experiments. The experimental results confirmed that the prediction method based on Transformer architecture had the best overall performance. Meanwhile, we also explored the effect of location coding and attention mechanism on model performance under Transformer architecture through ablation experiments. Overall, the new method based on deep learning enabled efficient qualitative prediction of AFM1, which can meet the demand for high throughput and significantly reduce the detection cost by eliminating redundant detection steps when compared with the traditional method, providing a solution of digital transformation and a theoretical basis for model optimization for dairy product safety detection.

Key words: food safety; machine learning; deep learning; aflatoxin; qualitative prediction

CLC Number: