Artificial intelligence in food safety testing

0
85
Food Times_intelligenza-artificiale-analisi-sicurezza-alimentare

Food safety has emerged as a critical global concern, with adulterationcontamination, and spoilage affecting products ranging from dairy to spices. Traditional testing methods, whilst precise, often prove too slow and costly for real-time monitoring across complex supply chains. A comprehensive review by Balakrishnan et al. (2025) examines how artificial intelligence (AI) and machine learning (ML) can revolutionise food safety protocols, offering rapid, non-invasive detection capabilities that transcend conventional laboratory-based approaches. This paradigm shift addresses the limitations of sequential testing workflows by enabling simultaneous data ingestion and predictive analytics (Balakrishanan et al., 2025; Karanth et al., 2023).

The review by Balakrishanan and colleagues (2025) systematically analysed multiple ML architectures applied to food safety applications. Supervised learning methods, including support vector machines (SVM), random forests (RF), and convolutional neural networks (CNNs), were identified as the predominant approaches for classification tasks. For instance, SVM trained on near-infrared (NIR) or Fourier transform infrared (FTIR) spectroscopy data achieved over 95% accuracy in detecting milk adulteration with urea, starch, and detergents (Balakrishnan et al., 2025; Goyal et al., 2024). The methodology integrated diverse data modalities: spectroscopy (visible, NIR, FTIR, Raman), hyperspectral imaging, electronic nose systems, and smart sensors coupled with algorithmic models (Balakrishnan et al., 2025).

Unsupervised learning techniques, particularly K-means clustering and principal component analysis (PCA), were employed for anomaly detection in scenarios lacking labelled data. These methods proved valuable for identifying unusual patterns in food processing environments, such as early spoilage indicators based on temperature, humidity, and gas emissions (Balakrishnan et al., 2025). The review also examined emerging reinforcement learning applications in autonomous decision-making systems for cold-chain logistics and optimal storage condition management (Kish, 2018).

Real-world applications and case studies

The review documented extensive case studies across multiple food categories, demonstrating AI’s practical efficacy. In dairy authentication, an IoT-enabled multi-sensor system incorporating pH, volatile organic compound (VOC), and conductivity sensors achieved 96% accuracy in detecting milk adulterants, with SHAP (SHapley Additive exPlanations) explainability enhancing model interpretability (Goyal et al., 2024). For edible oils, hyperspectral imaging combined with linear discriminant analysis (LDA) attained 100% validation accuracy in identifying adulteration with paraffin or argemone oil (Aqeel et al., 2024).

In the domain of beverages, one-dimensional CNNs analysed ATR-FTIR spectroscopy data to detect sugar-based adulterants in coconut water with 96% classification accuracy, eliminating manual feature engineering requirements (Teklemariam et al., 2024). Honey authentication studies employed Raman spectroscopy coupled with CNNs, achieving greater than 97% classification accuracy and R² values exceeding 0.98 for quantitative prediction of syrup adulterants (Wu et al., 2022). These applications demonstrated marked improvements over conventional chromatographic methods in speed and cost-efficiency.

For spices, visible-NIR spectroscopy combined with RF and DenseNet201 architectures detected starch adulteration in turmeric powder at trace levels, with F1-scores exceeding 92% (Lanjewar et al., 2024). Line-scan NIR hyperspectral imaging identified metanil yellow in chickpea flour down to 0.1% concentration, achieving R² of 0.992 through one-dimensional CNN and partial least squares (PLS) regression (Saha et al., 2023). These findings underscore AI’s capacity for non-invasive monitoring across diverse food matrices.

Shelf-life prediction and spoilage detection

Beyond adulteration detection, AI models demonstrated significant potential in shelf-life prediction for perishable products. Recurrent neural networks (RNNs), particularly long short-term memory (LSTM) architectures, proved effective for time-series analysis of spoilage progression. For packaged minced pork, SVM-based regression models trained on spectral and multispectral imaging data predicted microbial counts with root mean squared error (RMSE) as low as 0.886, outperforming conventional plate assays (Fengou et al., 2020).

In ready-to-eat meals, FTIR, fluorescence, and visible spectroscopy combined with PLS regression achieved RMSE of 0.63 log CFU/g in predicting microbial quality of pineapple samples, with greater than 85% accuracy in odour prediction (Manthou et al., 2020). Selected-ion flow-tube mass spectrometry coupled with ensemble models, including artificial neural networks (ANN) and support vector regression (SVR), successfully predicted microbial quality in fresh pork by analysing 37 volatile organic compounds (Chen et al., 2024).

For fresh produce, transfer learning enhanced CNN models (ResNet-50, EfficientNet, MobileNetV2) achieved over 94% accuracy in classifying mushroom freshness stages (Javanmardi & Ashtiani, 2025). Smart packaging systems incorporating CO₂-sensitive freshness labels analysed by lightweight CNNs (GhostNet, MobileNetv2) attained above 93% accuracy across multiple freshness levels for vegetables and fruits, demonstrating the fusion of chemical sensing and AI (Tang et al., 2025).

Performance metrics and model evaluation

The review emphasised the importance of comprehensive performance metrics beyond simple accuracy. Precision proved critical for minimising false alarms and food wastage, while sensitivity remained vital for catching genuine threats where missing contaminated products could endanger public health. The F1-score, combining precision and recall, offered balanced performance assessment, particularly relevant for honey adulteration detection where both false positives and false negatives carry significant consequences (Balakrishnan et al., 2025).

For regression tasks, such as quantifying adulterant concentrations or predicting shelf-life, mean absolute error (MAE) and RMSE provided measures of prediction accuracy. R² scores indicated model fit quality, with values exceeding 0.98 reported in several honey adulteration studies employing PLS regression (Wu et al., 2022). Inference time emerged as a critical metric for real-time industrial applications, where even one-second delays could impede high-speed sorting operations. The area under the receiver operating characteristic curve (ROC-AUC) facilitated model comparison across different threshold settings (Balakrishnan et al., 2025).

Challenges and limitations

Despite promising results, several challenges impede widespread AI adoption in food safety. Data availability and quality constitute fundamental obstacles, as robust AI models require large, diverse, labelled datasets representative of various geographies and food products. Food safety data often remains fragmented, inconsistent, or unavailable due to privacy concerns or infrastructure limitations (Balakrishnan et al., 2025; Mu et al., 2024). Models trained on samples from one region frequently exhibit 15-30% accuracy drops when tested in different climatic or processing conditions (Jadhav et al., 2024).

Model interpretability presents another significant barrier, particularly for deep learning approaches operating as ‘black boxes‘. Regulatory agencies and quality assurance professionals require transparent explanations for classification decisions, especially when predictions lead to product rejection or recall. The integration of explainable AI frameworks, such as SHAP and LIME (Local Interpretable Model-agnostic Explanations), has shown 28% improvements in user trust according to feedback surveys (ElShawi et al., 2021; Gambo et al., 2024). However, standardised validation protocols across jurisdictions remain absent, creating regulatory uncertainty (Abid et al., 2024).

Infrastructure constraints severely limit deployment in rural or resource-limited settings, where advanced imaging systems, cloud computing, and stable power supplies may be unavailable. This creates a digital divide wherein only industrial players benefit from predictive food quality systems, whilst smallholders rely on manual inspection (Balakrishnan et al., 2025; Lins et al., 2021). The high costs associated with sophisticated sensors and computing infrastructure further exacerbate accessibility issues, particularly in developing regions where food safety challenges are most acute (Vågsholm et al., 2020).

Proposed solutions and future directions

The review identified several promising approaches to address current limitations. Federated learning enables institutions across regions to collaboratively train models without sharing sensitive raw data, reducing privacy leakage by up to 47% compared to centralised training whilst maintaining model performance (Gbashi & Njobeh, 2024). Generative adversarial networks (GANs) for synthetic data generation have demonstrated 30-60% accuracy improvements when real-world data is sparse or imbalanced (Rahman et al., 2024).

Edge computing solutions employing lightweight AI models on affordable devices (smartphones, Raspberry Pi, Arduino-based systems) have reduced deployment costs by over 80% while maintaining above 92% accuracy for spoilage detection tasks (Yavuzer et al., 2024). These portable systems enable democratisation of AI-driven food safety tools, making them accessible to small-scale vendors and informal markets. Domain adaptation techniques and multi-task learning frameworks that share low-level features across food types whilst learning geography-specific differences offer scalable solutions for model generalisation (Castano-Duque et al., 2022).

Emerging research directions include zero-shot and few-shot learning methods that can generalise to new food types or contaminants with minimal prior data, potentially alleviating data collection burdens (Balakrishnan et al., 2025). The integration of blockchain technology with AI for end-to-end traceability represents another frontier, enabling immutable supply chain records whilst AI algorithms detect anomalies and verify product authenticity (Kumar et al., 2021). Biosensor integration for pathogen detection, combining ML with imaging technologies, shows promise for bacterial colony classification and predictive pathogen occurrence modelling (Balakrishnan et al., 2025).

Interim conclusions

The comprehensive review by Balakrishnan and colleagues (2025) demonstrates that AI and ML technologies are transitioning from theoretical potential to practical implementation in food safety applications. The synthesis of spectroscopic techniquesimaging modalities, and diverse ML architectures has yielded systems capable of real-time, non-invasive detection of adulteration, spoilage, and contamination across multiple food categories. Performance metrics consistently exceed 90% accuracy in controlled studies, with some applications achieving near-perfect classification (Balakrishnan et al., 2025).

However, realising AI’s full potential requires addressing fundamental challenges in data quality, model generalisability, interpretability, and accessibility. Strategic partnerships amongst academia, regulatory agencies, and industry stakeholders are essential for developing standardised validation protocols and ensuring equitable technology access.

Future research should prioritise affordable edge-AI solutions, explainable model architectures, and adaptive learning frameworks that accommodate regional variations. With appropriate investment in infrastructure, capacity building, and regulatory harmonisation, AI-driven systems can evolve into trusted, inclusive safeguards for global food systems (Balakrishnan et al., 2025; Dhal & Kar, 2025).

Dario Dongo

Photo by Pavel Danilyuk

References

  • Abid, H. M. R., Khan, N., Hussain, A., Anis, Z. B., Nadeem, M., & Khalid, N. (2024). Quantitative and qualitative approach for accessing and predicting food safety using various web-based tools. Food Control162, Article 110471. https://doi.org/10.1016/j.foodcont.2024.110471
  • Aqeel, M., Sohaib, A., Iqbal, M., Rehman, H. U., & Rustam, F. (2024). Hyperspectral identification of oil adulteration using machine learning techniques. Current Research in Food Science8, Article 100773. https://doi.org/10.1016/j.crfs.2024.100773
  • Balakrishnan, P., Anny Leema, A., Jothiaruna, N., Assudani, P. J., Sankar, K., Kulkarni, M. B., & Bhaiyya, M. (2025). Artificial intelligence for food safety: From predictive models to real-world safeguards. Trends in Food Science & Technology163, 105153. https://doi.org/10.1016/j.tifs.2025.105153
  • Castano-Duque, L., Vaughan, M., Lindsay, J., Barnett, K., & Rajasekaran, K. (2022). Gradient boosting and Bayesian network machine learning models predict aflatoxin and fumonisin contamination of maize in Illinois – First USA case study. Frontiers in Microbiology13, Article 1039947. https://doi.org/10.3389/fmicb.2022.1039947
  • Chen, L., Kuuliala, L., Somrani, M., Walgraeve, C., Demeestere, K., De Baets, B., & Devlieghere, F. (2024). Rapid and non-destructive microbial quality prediction of fresh pork stored under modified atmospheres by using selected-ion flow-tube mass spectrometry and machine learning. Meat Science213, Article 109505. https://doi.org/10.1016/j.meatsci.2024.109505
  • Dhal, S. B., & Kar, D. (2025). Leveraging artificial intelligence and advanced food processing techniques for enhanced food safety, quality, and security: A comprehensive review. Discover Applied Sciences7(1), Article 75. https://doi.org/10.1007/s42452-025-06472-w
  • ElShawi, R., Sherif, Y., Al-Mallah, M., & Sakr, S. (2021). Interpretability in healthcare: A comparative study of local machine learning interpretability techniques. Computational Intelligence37(4), 1633–1650. https://doi.org/10.1111/coin.12410
  • Fengou, L. C., Mporas, I., Spyrelli, E., Lianou, A., & Nychas, G. J. (2020). Estimation of the microbiological quality of meat using rapid and non-invasive spectroscopic sensors. IEEE Access8, 106614–106628. https://doi.org/10.1109/ACCESS.2020.3000690
  • Gambo, I., Massenon, R., Lin, C.-C., Ogundokun, R. O., Agarwal, S., & Pak, W. (2024). Enhancing user trust and interpretability in AI-driven feature request detection for mobile app reviews: An explainable approach. IEEE Access12, 114023–114045. https://doi.org/10.1109/ACCESS.2024.3443527
  • Gbashi, S., & Njobeh, P. B. (2024). Enhancing food integrity through artificial intelligence and machine learning: A comprehensive review. Applied Sciences14(8), Article 3421. https://doi.org/10.3390/app14083421
  • Jadhav, A., Sawesi, S., & Rashrash, B. (2024). Bias and generalizability challenges in machine learning models for leptospirosis. 2024 IEEE International Conference on Big Data (BigData), 4989–4995. https://doi.org/10.1109/BigData62323.2024.10825588
  • Karanth, S., Benefo, E. O., Patra, D., & Pradhan, A. K. (2023). Importance of artificial intelligence in evaluating climate change and food safety risk. Journal of Agriculture and Food Research11, Article 100485. https://doi.org/10.1016/j.jafr.2022.100485
  • Kumar, I., Rawat, J., Mohd, N., & Husain, S. (2021). Opportunities of artificial intelligence and machine learning in the food industry. Journal of Food Quality2021(1), Article 4535567. https://doi.org/10.1155/2021/4535567
  • Lanjewar, M. G., Asolkar, S., Parab, J. S., & Morajkar, P. P. (2024). Detecting starch-adulterated turmeric using Vis-NIR spectroscopy and multispectral imaging with machine learning. Journal of Food Composition and Analysis136, Article 106700. https://doi.org/10.1016/j.jfca.2024.106700
  • Lins, S., Pandl, K. D., Teigeler, H., Thiebes, S., Bayer, C., & Sunyaev, A. (2021). Artificial intelligence as a service. Business & Information Systems Engineering63(4), 441–456. https://doi.org/10.1007/s12599-021-00708-w
  • Manthou, E., Lago, S. L., Dagres, E., Lianou, A., Tsakanikas, P., Panagou, E. Z., Anastasiadi, M., Mohareb, F., & Nychas, G. J. E. (2020). Application of spectroscopic and multispectral imaging technologies on the assessment of ready-to-eat pineapple quality: A performance evaluation study of machine learning models generated from two commercial data analytics tools. Computers and Electronics in Agriculture175, Article 105529. https://doi.org/10.1016/j.compag.2020.105529
  • Mu, W., Kleter, G. A., Bouzembrak, Y., Dupouy, E., Frewer, L. J., Radwan Al Natour, F. N., & Marvin, H. J. P. (2024). Making food systems more resilient to food safety risks by including artificial intelligence, big data, and internet of things into food safety early warning and emerging risk identification tools. Comprehensive Reviews in Food Science and Food Safety23(1), Article e13296. https://doi.org/10.1111/1541-4337.13296
  • Saha, D., Senthilkumar, T., Singh, C. B., & Manickavasagan, A. (2023). Quantitative detection of metanil yellow adulteration in chickpea flour using line-scan near-infrared hyperspectral imaging with partial least square regression and one-dimensional convolutional neural network. Journal of Food Composition and Analysis120, Article 105290. https://doi.org/10.1016/j.jfca.2023.105290
  • Tang, T., Zhang, M., Jia, H., Bhandari, B., & Guo, Z. (2025). Intelligent monitoring of fruit and vegetable freshness in supply chain based on 3D printing and lightweight deep convolutional neural networks (DCNN). Food Chemistry480, Article 143886. https://doi.org/10.1016/j.foodchem.2025.143886
  • Teklemariam, T. A., Chou, F., Kumaravel, P., & Van Buskrik, J. (2024). ATR-FTIR spectroscopy and machine/deep learning models for detecting adulteration in coconut water with sugars, sugar alcohols, and artificial sweeteners. Spectrochimica Acta Part A: Molecular and Biomolecular Spectroscopy322, Article 124771. https://doi.org/10.1016/j.saa.2024.124771
  • Vågsholm, I., Arzoomand, N. S., & Boqvist, S. (2020). Food security, safety, and sustainability—getting the trade-offs right. Frontiers in Sustainable Food Systems4, Article 16. https://doi.org/10.3389/fsufs.2020.00016
  • Wu, X., Xu, B., Ma, R., Niu, Y., Gao, S., Liu, H., & Zhang, Y. (2022). Identification and quantification of adulterated honey by Raman spectroscopy combined with convolutional neural network and chemometrics. Spectrochimica Acta Part A: Molecular and Biomolecular Spectroscopy274, Article 121133. https://doi.org/10.1016/j.saa.2022.121133
  • Yavuzer, E., Kose, M., & Uslu, H. (2024). Determining the quality level of ready-to-eat stuffed mussels with Arduino-based electronic nose. Journal of Food Measurement and Characterization18(7), 5629–5637. https://doi.org/10.1007/s11694-024-02593-9
Dario Dongo
+ posts

Dario Dongo, lawyer and journalist, PhD in international food law, founder of WIISE (FARE - GIFT - Food Times) and Égalité.