Next Article in Journal
Bioactive, Functional, and Technological Properties of Gluten-Free Pasta Enriched with Mango (Mangifera indica L.) Leaf Powder
Previous Article in Journal
Mulberry Leaf Glutelin: Physicochemical, Functional, and Pancreatic Lipase Inhibitory Activity of Seven Varieties
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Review

Application of Machine Learning in Food Safety Risk Assessment

1
National Engineering Research Center for Agri-Product Quality Traceability, Beijing Technology and Business University, No. 11 and No. 33 Fucheng Road, Haidian District, Beijing 100048, China
2
Business School, Beijing Wuzi University, 321 Fuhe Street, Tongzhou District, Beijing 101149, China
*
Author to whom correspondence should be addressed.
Foods 2025, 14(23), 4005; https://doi.org/10.3390/foods14234005
Submission received: 3 November 2025 / Revised: 18 November 2025 / Accepted: 21 November 2025 / Published: 22 November 2025
(This article belongs to the Section Food Analytical Methods)

Abstract

With the increasing globalization of supply chains, ensuring food safety has become more complex, necessitating advanced approaches for risk assessment. This study aims to review the transformative role of machine learning (ML) and deep learning (DL) in enabling intelligent food safety management by efficiently analyzing high-quality and nonlinear data. We systematically summarize recent advances in the application of ML and DL, focusing on key areas such as biotoxin detection, heavy metal contamination, analysis of pesticide and veterinary drug residues, and microbial risk prediction. While traditional algorithms including support vector machines and random forests demonstrate strong performance in classification and risk evaluation, unsupervised methods such as K-means and hierarchical cluster analysis facilitate pattern recognition in unlabeled datasets. Furthermore, novel DL architectures, such as convolutional neural networks, recurrent neural networks, and transformers, enable automated feature extraction and multimodal data integration, substantially improving detection accuracy and efficiency. In conclusion, we recommend future work to emphasize model interpretability, multi-modal data fusion, and integration into HACCP systems, thereby supporting intelligent, interpretable, and real-time food safety management.

Graphical Abstract

1. Introduction

Food safety serves as a critical pillar of global public health [1]. Animal-derived foods (ADFPs) and cereal grains, which are fundamental sources of high-quality protein and essential nutrients, are highly susceptible to biological contaminants (e.g., mycotoxins) and chemical hazards (e.g., heavy metals and pesticide residues). These contaminants pose significant risks to human health and can undermine public trust in the food system. Hazards are cross-boundary, primarily including carcinogenic mycotoxins toxins [2], chronic heavy metal contaminants [3], microbial pathogens [4], and endocrine-disrupting residues [5]. These hazards often interact to form complex networks that challenge traditional assessment methods [6]. Existing approaches, relying on statistical models, increasingly struggle to process high-dimensional heterogeneous data and enable real-time early warning [7].
To address these limitations, Machine Learning (ML) offers innovative analytical tools [8,9,10,11]. Traditional algorithms like SVM and Random Forest have successfully applied multi-source data to pollutant detection and risk classification [12,13], while unsupervised methods (e.g., K-Means) provide value in pattern recognition for unlabeled data [14,15]. However, classical ML is limited by its reliance on hand-crafted feature extraction [6,14]. The emergence of DL marks a new phase [16,17]. Convolutional Neural Networks (CNNs) excel in automatic feature extraction from spectral data [18], while Recurrent Neural Networks (RNNs) capture dynamic dependencies in time-series data [19]. Recently, Transformers and Graph Neural Networks (GNN) have pushed boundaries by enabling global context modeling, advancing the field from single-hazard detection to systematic early warning [20,21,22].
The purpose of this paper is to systematically summarize the research status of ML and DL in recent years in the field of food safety risk assessment. To ensure a comprehensive and reproducible review, we conducted a systematic literature review guided by the following research questions: (1) What are the predominant ML and DL algorithms applied in food safety risk assessment? (2) How do these algorithms perform across the four major hazard categories: biotoxins, heavy metal pollution, pesticide and veterinary drug residues, and microbial risks? (3) What are the current challenges and future directions for the field?
First, we move beyond a general discussion by providing a systematic, side-by-side comparison of algorithmic performance across the four most critical food hazard categories—mycotoxins, heavy metals, pesticide and veterinary drug residues, and microbial risks—offering a clear roadmap for selecting the optimal tool for specific safety challenges. Second, we place a strong emphasis on the latest advancements in deep learning architectures, particularly Transformer-based models and their hybrid variants (e.g., CNN-Transformer), which are reshaping the field but have not been comprehensively covered in earlier summaries. Finally, and most importantly, our review extends beyond a technological survey to provide a critical discussion on translational challenges, such as model interpretability and data scarcity, and proposes concrete pathways for integrating these intelligent systems into existing food safety management frameworks like HACCP. This combination of a structured, multi-hazard analysis, a focus on cutting-edge models, and a critical perspective on implementation barriers provides a timely and actionable resource for advancing the field.
Our analysis is based on a systematic search of the Scopus, Web of Science, and PubMed databases, following the established practice of previous reviews in this domain. The search strategy combined keywords for machine learning (“unsupervised learning” OR “supervised learning” OR “deep learning” OR “machine learning”), food products (“dairy product” OR “meat” OR “vegetable” OR “fish” OR “fruit”), and specific food risks (“biotoxin”, “heavy metal pollution”, “pesticide and veterinary drug residue”, and “microbial risk”). This process initially identified 1000 records. After duplicate removal and application of inclusion/exclusion criteria (e.g., peer-reviewed articles published between 2015 and 2025, focusing on primary applications of ML/DL in the targeted risk categories), a total of 132 studies were selected for in-depth analysis and data extraction. The extracted information, including the food product, data type, algorithm, and key findings, forms the basis of the comparative tables and discussion in this review.

2. Unsupervised Machine Learning Algorithm

Unsupervised Learning refers to a class of ML algorithms whose purpose is to detect structures, patterns, and relationships from unlabeled datasets (Figure 1) [23]. Without relying on pre-defined output labels, these methods excel at exploratory data analysis, with their primary tasks being clustering (e.g., grouping similar data points) and dimensionality reduction. In addition to discovering the data structure and finding rules, unsupervised learning methods can also be used in dimensionality reduction and are usually regarded as an auxiliary measure to improve efficiency in data visualization or build later analysis/prediction models.

2.1. Hierarchical Cluster Analysis (HCA) Algorithm

Hierarchical cluster analysis (HCA) is a distance-based, unsupervised approach that commonly analyzes multivariate data [24]. This method uses a distance matrix to quantify the pair difference between observations. HCA iteratively combines the two most similar objects, which initially are individual observations (pairs), and in subsequent steps are clusters of observations [25]. This process takes until all data points are grouped, creating a hierarchy that represents the organization of the record structure. The results are typically visualized with a tree chart that shows the hierarchy and arrangement of the result cluster [26]. In the field of food safety, clustering algorithms have been used to identify foodborne pathogens [27]. For example, HCA was successfully applied as a tool for differentiating among several groups of foodborne pathogens [28].
In addition, HCA can be combined with other algorithms for food risk assessment. Previous studies have combined HCA with LDA to identify and detect heavy metal particles and pesticide residues in substrates such as soil, tap water, lettuce and apples [29]. Initially, HCA clustered similar samples effectively without supervision, revealed potential patterns in unmarked data, and provided information on differences between sample groups for downstream classification models [30]. LDA took advantage of these differences and used their advantages in monitoring classification tasks to achieve greater accuracy in analyte identification and quantitative evaluation [31]. This combined method can significantly improve the accuracy and reliability of identifying and distinguishing complex samples and thus the risk assessment for improving food safety [32].

2.2. K-Means Algorithm

K-means is a distance-based, unsupervised cluster algorithm, which mainly seeks to automatically divide similar samples into different classes/clusters [33]. Firstly, it randomly sets several initial cluster centroids; then, it iteratively computes the distance between all samples and the centroid coordinates and classifies them according to the closest distance. Next, calculate the centroid coordinates again based on the newly classified dataset until there is no change in the classification results or a fixed number of iterations are performed. Because of its simple principle, fast speed, and high-efficiency feature extraction ability, the K-means clustering algorithm plays a key role in food safety risk prediction and evaluation work. In a related research conducted earlier by other researchers, whose purpose was to predict and identify the infection intensity of Aflatoxin in Pistachio, K-means clustering algorithms were also used for data dimensional compression processing of hyperspectral imagers [34]. As an unsupervised classifier, the model successfully discovered the cluster distribution rules hidden beneath such large-scale image information, so as to effectively separate positive cases from negative samples.
In another study, K-means clustering is used as an important data preprocessing technology in image segmentation to detect symptoms of fungal disease on the surface of potato leaves [35]. The algorithm partitioned the leaf images into distinct clusters based on pixel color and intensity features, effectively separating regions of interest, which consisted of diseased or healthy leaf areas, from the background [36]. This process serves to accentuate disease-related features while concurrently mitigating background noise and irrelevant information. Together with later data enhancement processing, this treatment greatly promotes feature extraction in subsequent networks, which helps improve prediction accuracy.

2.3. Principal Component Analysis (PCA) Algorithm

Principal component analysis (PCA) is an unsupervised analytical technique widely applied for dimensionality reduction in multivariate datasets [37]. Its primary purpose is to simplify complex high-dimensional data while retaining as much of the original information as possible. PCA operates by transforming a set of correlated variables into a smaller number of uncorrelated principal components, following the principle of maximizing the variance captured by each successive component. Through this process, PCA eliminates redundant information and reveals the underlying structure of the data. It helps to interpret the covariance relationships among variables and identify the key factors that contribute most to the overall variability within the dataset.
For food safety risk prediction, PCA is usually used as a pre-processing link before modeling to conduct dimensional reduction processing on the original high-dimensional data and extract core features. Combined with data-driven models that can well characterize the nonlinear relationship between input and output variables, PCA can make the data analysis deeper and more accurate [38,39]. For example, in a study aiming to identify fungal contamination in rice samples, PCA was first applied to the hyperspectral data of rice to explore the intrinsic relationships among wavelength variables [40]. This reduces dimensions by retaining most of the variation information while removing data redundancy, so as to provide a more compact and effective feature representation for the later training of the Gaussian SVM model for sample prediction.

3. Machine Learning Algorithms

ML encompasses a broad family of computational methods designed to learn patterns, representations, and predictive rules from data. Depending on the availability of annotated information and the nature of the task, ML methods can be broadly categorized into unsupervised learning, supervised learning, and deep learning. Unsupervised learning focuses on discovering intrinsic structures, patterns, and relationships within unlabeled datasets, and is frequently used for clustering, pattern discovery, and dimensionality reduction. In contrast, supervised learning relies on labeled data to learn explicit input–output mappings and is widely applied when a clearly defined prediction target exists. Deep learning methods extend these capabilities by learning hierarchical feature representations directly from data, enabling more expressive modeling of complex, high-dimensional inputs such as neuroimaging or biomedical signals.

3.1. Linear Discriminant Analysis

Linear Discriminant Analysis (LDA) is a mature supervised technique for dimensionality reduction and classification, visually represented by its projection onto a discriminative axis (Figure 2). For food safety detection, the LDA method demonstrates good performance in multiple tasks, such as the online diagnosis of subclinical mastitis in milk, the classification of sea bass filet freshness using Raman spectra, and the identification of duck meat adulteration in beef [41,42,43]. Combined with other analytical techniques, the robustness of LDA is further strengthened. For instance, its integration into multimodal spectroscopy for predicting fish freshness and its application with hyperspectral imaging to identify milk adulteration with 100% validation accuracy confirm its competence in analyzing high-dimensional, multisource information [44,45]. The key advantages of LDA include its computational efficiency and the generation of interpretable, linear decision boundaries. However, the success of this approach is critically dependent on its strong underlying assumptions that data follow Gaussian distributions and share common covariance across classes, which can limit its applicability to complex, real-world food matrices where these assumptions are often violated.
Although there are some advantages from an explainability and computation point of view, the success of this approach is based on two strong assumptions about the data, namely, that the data come from Gaussian distributions and have common class-covariance. Even though the above-mentioned approaches have several drawbacks, they have been successfully applied in different food safety contexts, such as microbiological studies, detection of chemical hazards, and authentication tests, due to their properties of generating understandable decision boundaries and solving different kinds of problems efficiently.

3.2. Naive Bayes

The Naive Bayes (NB) algorithm is based on Bayes’ theorem and assumes that any two features are independent of conditional probability in any category term (Figure 3) [46]. Based on this assumption, the calculation is greatly simplified; even if there is little training data, NB can still perform good prediction performance and be calculated efficiently as well as implemented simply [47]. However, if there are highly correlated features, the assumption of independent attributes will degrade predictive accuracy greatly [48]. There have been many variants proposed from different perspectives so far. These variants are designed according to the different statistical characteristics of features, primarily including: Gaussian NB for continuous numerical data; Multinomial NB for discrete count data (e.g., word frequencies); Complement NB as an adaptation of Multinomial NB for imbalanced text datasets; Bernoulli NB for binary/Boolean features (e.g., word presence or absence); and Categorical NB for categorical discrete data [49]. Among them, the Gaussian Naive Bayes (GNB) algorithm (Figure 4) has demonstrated good performance for many tasks related to food safety risk assessment. For example, Vannya et al. [50], Soon et al. [51] adopted a kind of Bayesian method to forecast food fraud categories and spots of fake food ingredients, illustrating that NB-based approaches possess good interpretability and transferability for solving difficult food identification problems.
In a study on supply chain vulnerability, Bouzembrak et al. [52] applied a GNB model to assess the risk of food fraud in the spice supply chain. The researchers combined several data sources from the EU’s Rapid Alert System for Food and Feed (RASFF), such as historical records of infringements, and Product characteristics and geographical sources. This integration demonstrates GNB’s efficiency in analyzing complex, multidimensional food safety data. This dataset forms the basis for comparing GNB’s performance with more complex integration methods. Although GNB offers an explanatory and efficient method of calculation, its effectiveness is influenced by the properties of the character distribution and the hypothesis of the normality of continuous variables, especially when processing various supply chain data.

3.3. K-Nearest Neighbors

The K-Nearest Neighbors (K-NN) algorithm (Figure 4) is an instance-based, non-parametric learning method widely used in classification and regression tasks. It works so that data points with similar characteristics often belong to the same category. For classification, the labeling of the new sample is determined based on a predefined distance measurement (e.g., Euclidean distance or Manhattan distance), which is determined by the majority of K’ s nearest neighbors in the character space. The choice of K is crucial because it balances a compromise between model deviation and variance. Although KNN is easy to implement and does not require clear training phases, is challenging in terms of computational efficiency on large datasets and sensitive to dimensional disasters, which makes the selection of features and the reduction in dimensions an indispensable pre-processing step in many applications [53].
In food safety risk assessment, the K-NN algorithm was successfully used in spectral analysis and rapid contamination inspection [54]. For example, one study applied K-NN together with flexible Surface-Enhanced Raman Spectroscopy (SERS) substrates to identify pesticide residues in fruits and vegetables [55]. The researchers first used PCA to reduce the data dimensionality before performing the KNN classification. This method allows for high sensitivity and portability and allows for effective differentiation of contaminated and uncontaminated samples based on the spectral Characteristics. These studies demonstrate the advantages of K-NN in the analysis of high-dimensional spectral data and its potential for on-site food safety testing [56].
In addition, the K-NN algorithm has its unique features in predicting microbial hazard risks. In one research work, K-NN combined with a novel flexible SERS substrate was used for the detection of pesticide residues in fruit and vegetable samples [57]. It demonstrated good predictive performance for predicting the samples’ contamination risk grade after proper feature scaling, and the best neighbor number k was picked out. And its simple structure and easy interpretation features make it an ideal starting model for preliminary prediction and a reference standard for evaluation of complex algorithms [58].

3.4. Support Vector Machine

Support Vector Machines (SVM) represent a powerful supervised learning algorithm (Figure 5) that constructs an optimal hyperplane in high-dimensional feature space to maximize separation between classes [59,60]. For food safety risk assessment, SVM demonstrates exceptional versatility across multiple domains. It shows promise in constructing comprehensive evaluation models that analyze risk across the entire food supply chain from production to consumption [61]. More specifically, SVM excels in spectral data analysis, achieving strong performance in detecting biotoxins such as aflatoxin B in almonds using fluorescence spectroscopy [62], and in determining heavy metal concentrations like mercury speciation in squid [63].
The algorithm’s strengths include its solid theoretical foundation, robustness in high-dimensional spaces, and good generalization capability with limited samples. These characteristics make SVM particularly valuable for various food safety applications involving spectral signals, supply chain information, and chemical measurement data. However, SVM performance is critically dependent on appropriate kernel selection and parameter tuning, and its computational efficiency decreases significantly with large datasets. While deep learning approaches have surpassed SVM in some complex image-based tasks, SVM remains a reliable and interpretable choice for many classification problems in food safety, especially those involving spectral data and structured features.

3.5. Random Forest

Random Forest (RF), as a classical ensemble learning algorithm, operates by constructing multiple decision trees and aggregating their predictions for final results (Figure 6) [64]. In food safety risk analysis, RF’s prominent strength lies in its ability to handle high-dimensional data while providing intrinsic feature importance evaluation, which offers a convenient means to discover key risk factors from complex food matrices.
The method has demonstrated excellent performance in a comprehensive safety assessment. For grain resources, an AHP-RF model incorporating eight chemical contaminant indexes (heavy metals and mycotoxins) achieved a prognostic correlation coefficient exceeding 0.99, providing highly consistent risk projections [65]. Similarly, in supply chain risk prediction, a nationwide study of freshwater products based on over 300,000 samples demonstrated RF’s outstanding performance, with the model achieving 75.4% sensitivity and 78.0% accuracy while identifying five critical risk dimensions, including supply chain nodes, sampling areas, and environmental conditions [66].
RF’s key advantages include its robustness against overfitting, ability to handle complex nonlinear relationships, and provision of feature importance rankings. These characteristics explain its widespread adoption in processing complex food safety data [67]. However, the main limitations involve computational resource requirements with very large datasets and the inherent trade-off between improved accuracy and reduced interpretability compared to a single decision tree. Despite these limitations, as food supply chains grow more complex and data volumes increase, RF remains a fundamental algorithm for building intelligent early warning systems in food safety.

3.6. Gradient Boosting

The Gradient Boosting is a powerful ensemble learning method that can build models step by step (Figure 7). Each new model focuses on correcting the errors of previous models [68]. This sequential method typically allows for higher accuracy than a single model or other integrated methods. It is particularly effective in processing complex and high-dimensional data common in food safety research.
Under the context of large-scale public health protection, the integrated method based on tree models with gradient boosting has good development prospects in the construction of early warning systems [69]. One study used human salmonellosis case numbers and food surveillance data as examples; the results showed that compared with general decision trees, the Gradient Boosting model had better performance. The model found key predictor variables, i.e., the positive rate of Salmonella in foods, and the positive rate of Salmonella in ready-to-eat milk and pork products.
The flexible and powerful prediction ability of gradient boosting makes it become the core method based on which modern food safety risk evaluation is made [70]. Researchers have successfully applied it to chemical contaminant quantification, microbial growth prediction, and supply chain risk management [71]. Its strong ability to model complex nonlinear relationships allows it to deliver reliable predictions in diverse analytical contexts. In the future, as the global food system continues to develop in a complex way, gradient boosting will still be an important means and method to build smart and databased food safety governance systems.

4. Deep Learning

Recently, DL has emerged as one of the most revolutionary and representative methods of artificial intelligence, providing efficient tools for analyzing complex data and making smart decisions. Different from traditional ML, DL uses multi-layered neural models, which are able to learn the hierarchical representations of input signals automatically. By taking advantage of nonlinear interactions and multiplex interactions among features or neurons, we can conduct the joint training process for feature engineering and model training, i.e., an end-to-end training framework. Hierarchical representation is beneficial for dealing with the problems of high dimensionality, structurelessness, and multiple modalities of real-world data.
In the aspect of food safety risk assessment, the emergence of the DL method provides a new solution idea for modeling the food safety system. Food safety data usually have high heterogeneity, time shift changeability, and complex space correlation, which brings difficulties for traditional algorithm modeling and mining potential associations. Different structures of models in DL, such as convolutional models, recurrent models, attention mechanism-based models, chart models, and enhanced learning models, can jointly model and extract characteristics from image spectra, time series signals, text, and so on, ranging from single-task auditing to full-aspect risk provision from a systemic perspective. With the continuous improvement of data acquisition speed and computing power, DL has become one of the most prominent research hotspots to boost the intelligence level of food safety supervision and control.

4.1. Convolutional Neural Networks

Conventional Neural Networks (CNN) are one of the most basic and widely used architectures in DL and are known for their powerful capabilities for automatic character extraction and hierarchical representation of known patterns (Figure 8). The core concept of CNN is to use local sensing fields and parameter distribution, so that models can capture spatial or spectral correlations in high-dimensional data. As a rule, a CNN consists of a convolution layer, an activation layer, a pooling layer, and a complete connection layer. As shown in Figure 8, the conversion operation extracts local features; Nonlinear activation functions such as ReLU introduce nonlinearity. Sampling under the pool layer to reduce overmatching and calculation costs. The entire connection layer integrates features for the final classification or regression.
With the development of the DL architecture, CNN has experienced many structural innovations. From earlier architectures like LeNet and AlexNet to deeper variants like VGG, ResNet and DenseNet have continuously developed the function extraction capability and stability of gradient propagation through mechanisms such as Deep, Improved residual connectivity, and batch naturalization. Encoder–decoder architectures such as U-Net allow for space reconstruction with fine-grained size and representation in symmetrical convolution and sampling paths. Several scales that further extend CNN to semantic segmentation and intensive forecasting tasks.
Recently, the research community has further promoted the development of CNN models in multiscale, multispectrum, and interaction learning aspects. Park et al. [72] have come up with a deep convolutional segmentation framework based on the integration of spatial–spectral features for joint feature learning. Wang et al. [73] adopted one-dimensional convolutional layers to model sequential signals at different scales, showing that CNN operations can also be applied to frequency domain feature transformations. Hassan et al. [74] designed a hybrid deep convolutional structure with interaction blocks as an additional component to improve its adaptability and responsiveness. Chen et al. [75] proposed a Residual-based Convolutional Classifier for feature discrimination in the output space of neurons at deeper layers. Chakravartula et al. [76] implemented a multi-channel convolutional architecture for spectral data modeling, effectively capturing latent relationships across high-dimensional signals. Peng et al. [77] took advantage of ResNets with 1D CNN architecture and succeeded in predicting the copper stress grade of rapeseeds by hierarchically extracting representations from input spectra while preserving useful original information by shortcut connections in the deep layers. As for quantitative prediction, Guo et al. [78] reported a 2D CNN model for predicting AFB1 content in Aspergillus-infected peanuts using near-infrared hyperspectral imaging datasets, where the pixel values within each channel were considered as features for deep spatial–spectral feature learning [79].
CNN has hierarchical representation learning ability; it can automatically detect complex spatial/spectral patterns from raw data, reduce manual feature characterization, and combine the advantages such as good scalability, strong generalization ability, and fast convergence speed, so that CNN becomes an important and basic deep-learning framework. With the development of lightweight structures like MobileNet, EfficientNet series, and more emphasis on the interpretability study of models, we believe that CNN will still be the core supporting technology in the construction of various intelligent analysis and reasoning systems in future intelligent adaptability computation.

4.2. Recurrent Neural Networks

Recursive neural networks (RNNs) are a class of DL architectures designed specifically for modeling sequence and time dependencies in data. Unlike traditional forward-feeding neural networks, RNNs combine a cyclic connection that allows information to exist over time (Figure 9). The hidden state of each time step captures context information from previous inputs, so that the network maintains a form of memory and dynamic, can effectively simulate behavior that changes over time. This structural property makes RNN particularly suitable for tasks that include sequence modeling, time signal processing, and context perception prediction.
However, it is known that standard RNNs have problems with disappearance and explosion gradients when they propagate backwards through long sequences, which limits their ability to replicate. capture long-term dependencies. To overcome this limitation, the LSTM network was introduced. It reinforces the conventional circuit architecture through door control mechanisms (input, forget, and output doors) that regulate the flow of information within the cell state. These doors allow the model to selectively retain or discard time information to effectively reduce gradients and enable remote dependency learning. A related variant, the door control loop unit (GRU), simplifies this design by merging entrance and forget doors into an update door and reduces parameter complexity, while maintaining comparable performance, which is particularly advantageous in a resource-constrained environment.
With further development and improvement of the recurrence mechanism, various improved recurrence models were proposed later. Wu et al. [80] propose an attention mechanism-enhanced recurrent framework, which adaptively weights important features along with long-time sequences and strengthens global dependence among samples. Nagamalla et al. [81] detect and classify milk adulteration by using RNN and upload it through Internet of Things (IoT). Deng et al. [82] showed that RNN can well capture the sequence dependency information contained in Raman spectrum signals, which is beneficial for qualitative and quantitative analysis of aflatoxin content in edible oil. Zhu et al. [83] further introduce RNN-based structures to optimize the reconstruction of spectra and realize high-precision aflatoxin detection with smaller-sized models. Wang et al. [84] proposes a BiLSTM-based fusion network for Hyperspectral Imaging (HSI) and optimizes this model to further promote the pixel-wise detection performance of aflatoxin in peanut kernels.
Furthermore, bidirectional recurrent networks (BiRNNs) extend the model’s temporal context by processing sequences in both forward and backward directions, while stacked or multi-layer RNNs deepen the temporal abstraction hierarchy to enhance representational capacity. With the advent of transformer architecture, hybrid models such as Conv-LSTM and Attention LSTM gained attention, combining the cyclical properties of RNNs with the parallelization of transformer-based designs and the global attention benefits
Overall, RNNs and their extensions (LSTM, GRU, and BiRNN) form the foundational framework for temporal and sequential modeling in DL. Their inherent ability to capture dynamic dependencies, learn time conversions, and code sequence states makes them indispensable for time-dependent forecasting tasks. Although Transformer-based models have dominated long-distance learning in recent times, recursive networks are still very effective at problems that affect continuity. require small sample adjustment or real-time reasoning. With the continuous advances in hybrid architectures and lightweight recursive models, RNN-based frameworks play a central role in deep-time modeling and online sequence design.

4.3. Transformer and Attention Mechanism

The Transformer architecture has become one of the most influential advances in DL and has fundamentally redefined the modeling of sequence and context dependencies (Figure 10). The core innovation consists of an attention mechanism that dynamically assigns importance to the various input characteristics, so that the model can selectively focus on most of the data. Unlike recurrent architectures that rely on step-by-step computation, the Transformer enables full parallelization through self-attention, achieving efficient global dependency modeling and significantly improving representational depth and computational scalability. Unlike a circuit architecture that is based on step-by-step calculations, Transformer enables complete parallelization through self-attention. It provides efficient global dependency modeling and improves representation depth and computational scalability.
A standard transformer consists of an encoder–decoder framework in which each component contains a multi-head self-attention layer and a position forwarding network. The multi-head attention mechanism projects the inputs into several sub-spaces and calculates the attention distribution in parallel, so that the network can capture information across multiple relationship scales. The Positional encoding can maintain the relationships in the data. By stacking multiple attention and forwarding layers, Transformer can model complex contextual relationships and provide advanced semantic representations in a large Abstract feature space.
To improve efficiency and versatility, various improvements and extensions to the transformer architecture have been proposed. Aghamohammadesmaeilketabforoosh et al. [85] developed a Vision Transformer (ViT)-based framework to convert visual data into continuous patch embeddings and enable global function modeling through self-attention. Shao et al. [86] implemented a Transformer-based model for intermediate-level fusion of VNIR and SWIR hyperspectral data, enabling robust classification of moldy soybeans through global spectral dependency modeling and self-attention-driven feature integration. Wu et al. [87] proposed a SpecTransformer model for enabling accurate quantification of pesticide residues in cherry tomatoes through deep spectral feature learning via multi-head self-attention and positional encoding in a 1D spectral sequence. Chen et al. [88] developed an MLP-Transformer hybrid model for the identification of apple moldy core by capturing long-range dependencies and cross-modal interactions through self-attention mechanisms. Wang et al. [89] proposed a 1D-MCFViT model. They combined Vision Transformer with multi-scale convolutional fusion. Guo et al. [90] further demonstrated that integrating convolutional fusion and Transformer modules enhances model generalization on complex spectral data. Kim et al. [91] proposed a Compact Convolutional Transformer (CCT) for classifying wheat contaminated by multiple mycotoxins by integrating convolutional feature extraction with Transformer attention. These models integrate the local sensitivity of convolutional filters with the global dependency modeling of attention and achieved efficient fusion of localized and contextual information. For tasks with a long sequence, lightweight variants such as Performer, Longformer and Linformer use a strategy of low layout or thin attention, to reduce computational complexity while maintaining modeling capability.
In summary, the introduction of Transformer and attention mechanisms represents a paradigm shift from local feature extraction to global relational modeling in DL. Their ability to capture long-range dependencies and context-aware interactions has made them indispensable for a wide range of sequence, vision, and multimodal learning tasks. With ongoing innovations in architectural design and computational optimization, Transformer-based models are increasingly becoming the cornerstone of modern neural network architectures. Looking ahead, the integration of self-supervised learning and cross-modal attention mechanisms is expected to further enhance their adaptability and interpretability, paving the way for broader applications in complex system modeling and intelligent decision-making.

5. Application of Machine Learning and Deep Learning in Food Safety Risk Assessment

In this section, we will introduce the application of ML and DL technology in the key links of food safety risk assessment in four main categories of food safety risks: biotoxins, heavy metal pollution, Pesticide and veterinary drug residues and microbial hazards (Table 1, Table 2, Table 3 and Table 4). Food safety risks often come from multiple sources and show dynamic and complex characteristics. The existing methods mainly depend on statistical analysis and expert experience, which make it difficult to deal with high-heterogeneity data, and unable to handle nonlinear relationships and timely warnings [92]. As mentioned in previous chapters, a variety of calculation methods have already evolved to address these challenges. These include basic algorithms such as simple bayes and supported vector machines, integrated learning technologies such as random forests and gradient augmentation, as well as advanced DL architectures that can automatically learn the layer-based representation of features. These include convolutive neural networks, recursive neural networks and transformers [93].

5.1. Mycotoxins Risks

Mycotoxins are ubiquitous contaminants in the food supply chain, inducing severe health effects ranging from allergies to carcinogenesis even at trace levels [94]. Among the various types, Aflatoxin B1 (AFB1) and Deoxynivalenol (DON) pose the most significant public health threats [95]. AFB1 is a potent carcinogen prevalent in legumes and nuts, while DON is a thermally stable contaminant in cereals that persists throughout processing [83,96]. To mitigate these risks, global agencies enforce strict limits. The JECFA and FDA set a 1 mg/kg (ppm) guidance level for DON in finished foods, while Health Canada mandates stricter limits of 0.6 ppm for infant foods [97,98]. Similarly, the EU enforces Maximum Residue Limits (MRLs) for AFB1 in dairy feed at ≤5 μg/kg [99]. Given the heterogeneous distribution of these toxins and the need for parts-per-billion (ppb) level sensitivity, traditional methods often lack the necessary efficiency. Consequently, machine learning-based approaches have become essential for achieving the rapid, precise detection required for effective early warning systems.
Kim et al. [91] utilized a Compact Convolutional Transformer (CCT) model to detect early mycotoxin contamination in stored wheat caused by deoxynivalenol (DON) and aflatoxins. This approach facilitates the classification of wheat into healthy, incipient, and contaminated classes based on CO2 respiration rates and visual mold formation, achieving an overall accuracy of 83.33%. Furthermore, the method effectively identified the contaminated class with high performance metrics (precision of 1.0 and F1-score of 0.95), while the distinction between healthy and incipient stages (F1-scores of 0.81 and 0.75, respectively) requires further improvement.
Guo et al. [100] coupled a multi-scale attention transformer (MSAT) with HSI to classify Aspergillus flavus contamination in peanut kernels. By employing a sophisticated attention mechanism that captures features at varying resolutions, the MSAT model achieved a test accuracy of 98.42% in distinguishing healthy kernels from those contaminated with aflatoxigenic fungi.
Siripatrawan and Makino [40] utilized machine learning-assisted HSI to classify Penicillium contamination levels in brown rice. Among the algorithms tested, the Gaussian Support Vector Machine (SVM) yielded the best performance with an accuracy of 93.4%, successfully identifying contamination levels as low as 5% that were invisible to the naked eye. This model surpassed other classifiers, including linear DFA (67.6%), linear SVM (76.0%), and quadratic SVM (81.4%).
From a performance perspective, CNN models [78,84] show strong capabilities in automatic feature extraction, while the emerging Transformer architecture [87,90,91], by virtue of its self-attention mechanism, outperforms in capturing global spectral context and achieving pixel-level precise localization, improving classification or localization accuracy by 3–5% in certain tasks. A notable trend is the multi-modal data fusion of macro and micro features (e.g., fused VNIR, HMI, and SEM [90]), and hybrid models combining CNN and BiLSTM [84], which aim to more comprehensively characterize the complex features of toxins by synergizing spatial and spectral, spatial and temporal information. However, a key challenge lies in the heavy reliance of these high-performance models on high-quality annotated data and their high computational cost, hindering their real-time deployment on production lines. Future research must focus on developing lighter-weight models and exploring few-shot learning paradigms to address the practical problem of data scarcity.
Table 1. Applications of Machine and Deep Learning in the Detection of Mycotoxins Toxins.
Table 1. Applications of Machine and Deep Learning in the Detection of Mycotoxins Toxins.
ProductPurpose of StudyDataAlgorithm/ModelOutputReferences
Herbs and SpicesTo prioritize products and hazards for monitoring across the supply chainRASFF and Dutch national monitoring data (2005–2014)NBACC = 80%Bouzembrak, Y. et al. (2016) [101]
AlmondsNon-destructive detection of aflatoxin B contaminationFluorescence spectra of almond samples with known aflatoxin levels (2.7–320.2 ng/g)SVMACC = 94%Bertani, F. R. et al. (2020) [62]
WheatPredict early contamination of deoxynivalenol (DON) and aflatoxinsRGB images and CO2 respiration rate dataCNN, TransformerACC = 83.33%Kim, et al. (2024) [91]
Rice grainClassification of fungal contamination in brown riceHSI dataPCA, SVMACC = 93.4%Siripatrawan, et al. (2024) [40]
PeanutsPropose a novel aflatoxin B1 (AFB1) detection method.HSI data Autoencoder, LSTM, PCAACC = 98.3%Zhu et al. (2024) [83]
PeanutDetect fungal contamination caused by Aspergillus flavusHSI dataTransformerACC = 98.42%Guo, et al. (2024) [100]
SoybeanDetect fungal contamination caused by Aspergillus flavusVNIR (400–1000 nm) and SWIR (1000–2500 nm) HSI dataCNN, Transformer, SVM, PCAACC = 97.52%Shao, et al. (2025) [86]
Maize and PeanutsEarly detection and quantitative prediction of aflatoxin B1 contaminationBioluminescence signals from whole-cell biosensors; AFB1 levels measured by HPLCXGBoostR2 > 0.9Sun, L. et al. (2025) [102]
Food
(general)
Screening fungal toxin characteristics to predict toxicityMolecular descriptor representation and toxicity value of mycotoxinsHCA, K-means, SVM, LDA, Neural Networks-Cova, et al. (2025) [103]
Maize
silage
Detect aflatoxin B1 (AFB1) contentHSI dataCNNR2 =0.9458Guo, et al. (2025) [78]
PeanutDetect Aspergillus flavus contaminationVNIR hyperspectral imaging (400–1000 nm), Hyperspectral Microscopic Imaging (HMI), Scanning Electron Microscopy (SEM) imagesCNN, TransformerACC = 100%Guo, et al. (2025) [90]
PeanutPixel-level detection of aflatoxin B1 (AFB1)HSI data; spectral curve dataCNN, LSTMACC = 94.92%Wang, et al. (2025) [84]
PeanutDetect aflatoxin B1 (AFB1) contaminationVisible near-infrared (VNIR) hyperspectral imaging data (400–1000 nm)CNN, TransformerACC = 92.6%Wang, et al. (2025) [89]
Edible oilRapid, non-destructive detection of aflatoxin B1 (AFB1) contamination levelRaman spectroscopy dataCNN, RNNACC = 100%Deng, et al. (2025) [82]

5.2. Heavy Metal Pollution

Detection and evaluation of Heavy Metal Contamination in Food is an important issue in current food safety governance. Lead (Pb), Cadmium (Cd), Mercury (Hg), Arsenic (As) are all toxic heavy metals with accumulation effects and persistence in the food chain, which seriously affect human health. The traditional detection method, like Atomic Absorption Spectroscopy and Inductively Coupled Plasma Mass Spectrometry, has higher analysis precision but will take a long time, be costly, and not be applicable for such large-scale/real-time detection demands. Therefore, ML/DL-based methods are proposed as the promising alternative ways that can realize fast, non-destructive, and smart detection in multiple kinds of food and environmental sample detection scenarios.
With the development of DL methods in recent years, two advantages are mainly reflected, which are the efficiency and accuracy of prediction for heavy metals. CNN can extract hierarchical spatial spectral feature representations. To be specific, it can obtain the high-level abstraction of input samples by learning representation layers layer-by-layer, in terms of different concentration levels of target elements. Therefore, the model can identify and classify the soil pollution grade through such characteristics. For instance, Peng et al. [77] predicted copper and lead stress in oilseed rape leaves based on hyperspectral image data using CNN; meanwhile, good prediction performance was still obtained when faced with changes in the growth environment. In a separate study, the results showed that the risk assessment order was Cd > Ni > Cu > Pb > Cr > Zn [104]. In addition, the WT–SAE network is an improvement based on traditional methods. Compared with previous models, WT–SAE not only performs better in the aspects of denoising and extracting nonlinear features of spectra but also estimates the content of Pb in plants more accurately.
Hybrid modeling strategies that combine DL with traditional regression methods have also shown strong performance in quantitative analysis [105]. For instance, the Transfer Stacked Contractive Autoencoder combined with Support Vector Regression (T-SCAE + SVR) has good predictive ability and can be generalized well when predicting heavy metal contents based on images collected from experiments under different growth conditions. The hybrid framework combines two advantages: deep models provide high-level abstract feature extraction, while classical regression acts as an explainer of the relationships between target and features.
VM-based methods are still an important means of spectral and chemometric analysis, especially when the amount of data is not large; when they are used with fluorescence spectra, near-infrared spectra, etc., they can well be applied to determine pollution sources, origin identification, and so on. For example, one paper has successfully determined the level of mercury contamination in aquatic products by using this method [106]. It shows again that, regardless of the type of data as well as other analysis conditions, the model built based on SVM still performs well in terms of its stability and anti-jamming ability.
In general, the combination of ML, hyperspectral imaging, and chemometrics has upgraded heavy metals detection from traditional methods into an intelligent, fast-speed, large-scale analysis method [107]. Future research will likely emphasize multimodal data fusion that combines spectral, spatial, and physicochemical features. It will also focus on integrating interpretable AI models into regulatory monitoring systems to enable continuous and automated surveillance of heavy metal risks throughout the food supply chain.
In heavy metal pollution detection, the technological trajectory shows an evolution from traditional spectral analysis towards deep feature learning. Comparative analysis reveals that although traditional methods like SVM [63] remain effective in specific scenarios, deep learning models represented by CNN and Autoencoders [77,108,109,110] demonstrate clear advantages in extracting deep, nonlinear features related to heavy metal stress from fluorescence hyperspectral images, achieving higher prediction accuracy. An innovative direction is the combination of the feature extraction capability of deep learning with the interpretability of classical regression models (like SVR) [108,111]; this hybrid strategy enhances model understanding while maintaining performance. However, a limitation of current research is that most studies are conducted in controlled environments, and the practical robustness of the models faces severe challenges when dealing with complex and variable field environments, different crop varieties, and soil matrices. Future work should prioritize the model’s cross-environment generalization capability and integration with field sensors.
Table 2. Applications of Machine and Deep Learning in the Heavy metal pollution.
Table 2. Applications of Machine and Deep Learning in the Heavy metal pollution.
ProductPurpose of StudyDataAlgorithm/ModelOutputReferences
LettuceExtracting compound heavy metals detection deep features of lettuce leavesVisible near-infrared (400.68–1001.61 nm) hyperspectral imageAutoencoder, SVRR2 = 0.9319Zhou, et al. (2020) [111]
Boletus mushroomAssess whether cadmium (Cd) content exceeds safety limitsFourier Transform Near-Infrared (FT-NIR) spectroscopy dataResNetACC = 100%Wang, et al. (2021) [112]
Oilseed rapePrediction of lead (Pb) contentFHSI data (390 nm UV excitation)Autoencoder, SVR R2 = 0.9388 Zhou, et al. (2023) [109]
Oilseed rapePrediction of lead (Pb) content under silicon-present and silicon-absent conditionsFHSI data (390 nm UV excitation)Autoencoder, SVR R2 = 0.9467 Zhou, et al. (2022) [108]
edible oilsPredicting heavy metals in edible oilsmicrowave dataResNet R2 = 0.9605 Deng, et al. (2024) [113]
Oilseed rapeClassification of copper (Cu) stress levelsHSI dataCNNACC = 98.15%Peng, et al. (2025) [77]
SquidTo develop a method for mercury determination and geographical origin traceability.THg and MeHg concentrations in 50 squid samples from Mediterranean and Atlantic.SVMACC = 100%Piroutková, M. et al. (2025) [63]

5.3. Pesticide and Veterinary Drug Residues

Analysis of pesticide residue and veterinary drug residue is another aspect involving testing of pesticides and residues of veterinary drugs that belongs to food safety risk identification. Pesticide residue/veterinary drug residue exists widely in agriculture and may cause great harm to humans. Traditional chromatographic and mass spectrometric methods have high analytical sensitivity but generally require complicated sample treatment and costly equipment and cannot be used for rapid or on-site detection; while ML/DL approaches provide another efficient alternative solution and realize rapid, non-destructive, and data-driven measurement based on spectra, images, and fluorescence signals.
DL models like 1D and 2D CNN are developing well in residue detection, which does not require manually pretreated data and has a good ability for learning representative spectra features from the original signal. In fruit and vegetable samples, CNN architectures have been used for detect imidacloprid and acetamiprid residues through visible and near-infrared (VIS/NIR) spectroscopy. Moreover, one-dimensional residual networks (1D-ResNet) and spectral convolutional models have shown better performance than traditional chemometric techniques such as PLS-DA and SVM in classifying contaminated samples [55]. These models effectively capture subtle spectral changes caused by pesticide molecules, resulting in improved detection accuracy.
Transformer-based architectures have further expanded analytical capabilities in this field. Through their self-attention mechanisms, Transformer models such as SpecTransformer can capture long-range relationships and complex feature interactions within spectral data. This design enhances both interpretability and robustness. The combination of convolutional layers and attention modules allows these models to extract local and global features simultaneously, improving generalization across different types of food samples. In addition to spectrum analysis, image-based DL is also widely used for the detection of antibiotic and pesticide residues by fluorescence and Raman imaging [114].
For pesticide and veterinary drug residue detection, algorithm development is closely linked to the trend of portable detection technology. Performance comparison shows that architectures like 1D-CNN and 1D-ResNet [115] are particularly suitable for processing spectral sequence data from portable spectrometers, and their end-to-end learning capability surpasses that of SVM and KNN [116], which rely on manual feature selection. Particularly noteworthy is the SpecTransformer model [87] designed for sequence data, which shows potential for capturing long-range spectral dependencies and achieves higher accuracy in quantitative analysis. A prominent trend is the focus on on-site rapid detection, such as combining handheld Raman spectrometers with CNN models for detecting formaldehyde and antibiotics [117,118]. However, a major gap in this field is that most existing studies target single or a few residues; the model’s recognition capability, anti-interference ability, and accurate quantitative analysis for the complex scenario of multiple pesticide co-residues commonly found in practical agricultural applications still require in-depth verification. The future development is mainly concentrated in three aspects: how to build a lighter model structure, how to realize multi-modal data fusion, and how to achieve XAI. This would further promote the generalization ability and robustness of models, realizing accurate, controllable, automatic, and traceable detection of pesticide/residue content from production to the circulation of food.
Table 3. Applications of Machine and Deep Learning in the Pesticide and Veterinary Drug Residues.
Table 3. Applications of Machine and Deep Learning in the Pesticide and Veterinary Drug Residues.
ProductPurpose of StudyDataAlgorithm/ModelOutputReferences
Chili pepperDetection of imidacloprid and acetamiprid pesticide residuesVIS/NIR spectroscopy data (400–2498 nm)CNN, SVM, KNN,RMSE = 0.55Ong, et al. (2023) [116]
FoodRapid and user-friendly detection of tetracycline antibiotics (TCs)Fluorescence images under 365 nm UV light from PVA aerogel sensorResNetACC = 99%Chen, et al. (2024) [118]
AppleTo detect ten distinct types of pesticidesThe fingerprints of ten pesticidesCNNACC = 100%Wang, et al. (2024) [119]
Kumquat (Citrus japonica)Detection of surface pesticide residuesVNIR spectral data1D-ResNet, 1D-CNN, SPA-SVMACC = 97%Dai, et al. (2025) [115]
Cherry tomatoDetection of thiophanate-methyl pesticide content22-band spectral data from handheld spectrometer (210–1600 nm)TransformerR2 = 0.91Wu, et al. (2025) [87]
Pacific white shrimpRapid and non-destructive detection of formaldehyde (FA) adulterationRaman spectroscopy dataCNNACC = 84.40%Wei, et al. (2025) [117]
grapeDetection of pesticide residuesimages of grape samplesResNet, EfficientNetACC = 83.17%Saatçi, et al. (2025) [120]
bok choiDetection and monitoring of pesticide residues in cropsThe NIR spectral of bok choi with and without pesticide residue (chlorpyrifos)CNNACC = 100%Lapcharoensuk, et al. (2025) [121]

5.4. Microbial Risks

Microbial contamination is one of the most common and difficult problems in food safety globally. Microbial contamination may cause food spoilage, foodborne illness outbreaks, and huge economic burdens. Quick and precise detection of microorganisms can guarantee the quality of products and protect the public from the threat of pathogens.
The traditional microbiological method based on culture and/or biochemical tests is time-consuming, laborious, and not applicable for batch testing; while the development of ML/DL technology provides a new means for pathogen detection based on image/spectrum/sensor signal of microorganism [122].
CNNs have become the core of detecting microbial risks because they can learn complex visual and spectral features. In high-spectrum and fluorescence applications, CNN models can effectively distinguish between contaminated and clean samples. Advanced architectures such as EfficientNet and ResNeXt enable high accuracy in the classification of microbial corruption in meat and poultry products [123]. A semantic segmentation model, such as U-Net, further improves spatial positioning and enables precise pixel-level detection of bacterial colonies or contamination areas on the surface. food surface.
The Transformer-based models are increasingly used to integrate multimodal data sources, including visual, auditory, and spectral information [124]. They have shown strong performance in detecting early-stage fungal infections in fruits through hyperspectral fluorescence imaging. Combined CNN-LSTM models also offer advantages by modeling temporal changes in microbial growth, providing valuable insights into contamination dynamics over time.
The integration of IoT sensor networks with cloud-based AI frameworks has further enhanced microbial risk management [125]. These intelligent systems enable continuous data collection, real-time analysis, and automated decision-making. They represent an important step toward fully digital and self-adaptive microbial monitoring across the entire food supply chain.
In the field of microbial risk, DL is driving the transition of detection technology from culture-dependent methods towards rapid, non-destructive intelligent sensing [126]. Comprehensive analysis indicates that CNN models are the core tool for processing hyperspectral microscopic images [72,75], fluorescence images [127], and Raman spectra [73,128], achieving high accuracy in the identification and classification of various foodborne pathogens. Transformer models are beginning to be used for fusing multimodal data (e.g., acoustic signals and spectra) to capture richer contextual information. An important frontier involves combining object detection models (like YOLO) and semantic segmentation models to achieve automatic localization and counting of microorganisms, going beyond mere classification [129]. Despite this, a fundamental challenge remains: model performance is highly dependent on the scale and quality of training data. In real food systems, interference from background microbiota, the inherent complexity of the food matrix itself, and the requirement for detecting low concentrations of pathogens pose significant challenges to existing models. Developing models that remain robust against complex backgrounds is a key direction for the future.
Table 4. Applications of Machine Learning and Deep Learning in Microbial Risks.
Table 4. Applications of Machine Learning and Deep Learning in Microbial Risks.
ProductPurpose of StudyDataAlgorithm/ModelOutputReferences
Meat carcassesAutomatically identify and segment fecal contamination areas on meat surfacesFluorescence imaging (CSI-D device) video/image dataCNN AUC = 99.54% Gorji et al. (2022) [130]
ChickenNon-destructive assessment of microbial spoilageAC and DC images from SIRICNN, SVMACC = 76%Olaniyi, et al. (2024) [131]
StrawberryEarly detection of gray mold (Botrytis cinerea) infectionFHSI dataCNN, ResNetACC = 96.86%Chun, et al. (2024) [127]
Chicken rinse solutionAutomated segmentation and identification of foodborne bacteria (E. coli, Salmonella, etc.)HMI dataResNetACC = 97.4%Park, et al. (2023) [72]
StrawberryDetect diseases and quality (gray mold, powdery mildew, ripeness)RGB imagesTransformer, ResNetACC = 98.4%Aghamohammadesmaeilketabforoosh, et al. (2024) [85]
FoodMicroscopic identification of 6 types of foodborne pathogens (E. coli, S. aureus, etc.)Optical microscope imagesCNN6 kinds of foodborne pathogens with ACC ≥ 90%Chen, et al. (2024) [75]
AppleDetect and identify fungal sporesSERS dataCNNACC = 99.44%Wang, et al. (2024) [73]
FoodMultiplex detection of foodborne pathogensSERS dataCNN, Grad-CAMACC = 100%Kang, et al. (2024) [128]
AppleOnline detection of moldy core disease (caused by fungi)Acoustic signals and Vis-NIRS dataTransformerACC = 98.62%Chen, et al. (2025) [88]
Fresh porkDetect and visualize Escherichia coli contaminationHSI dataCNN, SVMACC = 87.50%Liu, et al. (2025) [132]

6. Summary of Findings

The application of ML and DL technologies in food safety risk assessment significantly enhances detection accuracy, efficiency, and system intelligence. Classical models such as SVM, RF, and gradient boosting perform well in risk grading and contamination source tracking, especially when processing structured or spectral data. Their balance between predictive performance and interpretability makes them suitable for early warning systems and regulatory decision support.
DL further advances food safety analytics. CNNs excel in handling hyperspectral and imaging data for locating aflatoxins and other biotoxins. RNNs, including LSTM variants, provide effective solutions for time-series tasks in microbial growth and supply chain monitoring. Recently, transformer-based models have demonstrated strong capabilities in multimodal data integration, global context representation, and modeling complex hazard interactions.
Unsupervised learning methods such as K-means, hierarchical clustering, and PCA remain essential when labeled samples are limited, supporting anomaly detection, sample grouping, and dimensionality reduction. These techniques help extract intrinsic patterns and enable the construction of more reliable supervised risk prediction models.
Across major risk categories, ML/DL approaches have shifted food safety analysis from single-hazard detection to integrated intelligent prediction. CNN–Transformer hybrids support pixel-level localization and quantification of mycotoxins in hyperspectral images. FHSI combined with autoencoders and SVR enables noninvasive estimation of heavy metals like Pb and Cu. Portable spectrometers paired with 1D-CNN and SpecTransformer models facilitate rapid detection of pesticide and veterinary drug residues, while DL-driven hyperspectral and acoustic sensors support real-time microbial contamination prediction.
Despite these advancements, several challenges remain, including limited model interpretability, poor adaptability under small-sample conditions, difficulties in integrating heterogeneous multimodal data, and insufficient high-quality labeled datasets. This review summarizes progress in ML/DL-based food safety risk assessment, tracing developments from classical ML to modern DL and transformer architectures. We highlight algorithmic contributions to major hazard domains and outline remaining bottlenecks, emphasizing future directions in interpretability, dataset standardization, and multimodal fusion to guide the development of next-generation intelligent food safety supervision systems.

7. Classification, Limitations, and Future Directions of Machine Learning and Deep Learning Applications in Food Safety

ML and DL have significantly advanced food safety applications, supporting early risk detection through Bayesian models, autoencoders, and ensemble algorithms such as random forests and XGBoost. These methods enhance real-time monitoring and regulatory decision making, yet face challenges including high computational demands and difficulties in integrating heterogeneous data from diverse sources. In microbial and chemical hazard detection, ML/DL enables rapid, non-destructive identification of pathogens and contaminants using imaging, spectroscopy, optical sensors, and hyperspectral techniques. Although detection accuracy has improved, background microbial interference, environmental fluctuations, high equipment costs, and regulatory limitations still restrict large-scale deployment. ML also contributes to food fraud and adulteration detection through ensemble learning and spectral analysis, and neural networks can support freshness evaluation and spoilage prediction.
Despite these advances, ML applications are constrained by limited, inconsistent, and region-specific datasets, which undermine model generalization across different food matrices and processing environments. Moreover, the black-box nature of advanced neural models reduces interpretability and weakens user trust, especially among food safety professionals. Differences in data quality related to microbial and chemical hazards may introduce systematic biases, further affecting the stability and accuracy of model predictions.
Future research should prioritize developing standardized, publicly accessible datasets that encompass diverse hazard types and food products to improve model robustness and applicability. Enhancing interpretability features is essential as ML models become more complex, while deeper integration with spectroscopy, real-time monitoring platforms, and IoT systems will support automated, on-site food safety assessment. The combination of portable AI-enabled sensing devices, multimodal data fusion, and integration into HACCP frameworks will be crucial for achieving intelligent, interpretable, and real-time food safety management.

8. Conclusions

AI has become a pivotal force in modernizing food safety risk assessment. The findings of this review emphasize the revolutionary potential of ML and DL to transition the field from traditional post-detection methods to proactive, multi-source early warning systems. While classical algorithms such as SVM and RF remain effective for structured risk classification, this review highlights the superior capability of advanced DL architectures. CNNs for spectral feature extraction and Transformers for global context modeling achieve precise, non-destructive quantification of biotoxins, heavy metals, pesticide residues, and microbial pathogens. However, as these algorithms continue to augment detection sensitivity, bridging the gap between academic research and practical application becomes increasingly necessary. The integration of DL with non-destructive spectroscopic techniques (e.g., Hyperspectral Imaging, Raman) and IoT-based sensors offers a rapid alternative to conventional laboratory analysis, yet the “black box” nature of these models hinders their broad adoption in regulatory frameworks. To further enhance food safety governance, future research should prioritize the development of Explainable AI (XAI) and lightweight models deployable on portable devices, ultimately establishing a resilient, intelligent, and data-driven global food safety monitoring network.

Author Contributions

Conceptualization, Q.Z., Z.L. (Zhe Lu), Z.L. (Zhenqiao Liu) and M.Z.; methodology, Q.Z., Z.L. (Zhe Lu), Z.L. (Zhenqiao Liu) and J.L.; formal analysis, M.C.; literature research, Z.L. (Zhe Lu), Z.L. (Zhenqiao Liu), J.L. and M.C.; writing—original draft preparation, Z.L. (Zhe Lu); writing—review and editing, Z.L. (Zhenqiao Liu), J.L. and M.C.; visualization, Q.Z. and M.Z.; project administration, Q.Z., Z.L. (Zhe Lu), Z.L. (Zhenqiao Liu) and J.L.; funding acquisition, Q.Z. and M.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Key Technology R&D Program of China under Grant No. 2021YFD2100605, and the National Natural Science Foundation of China under Grant No. 62433002 and 62476014.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

No new data were created or analyzed in this study. Data sharing is not applicable to this article.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ACCAccuracy
AIArtificial intelligence
ADFPsAnimal-Derived Foods
AFB1Aflatoxin B1
AHPAnalytic Hierarchy Process
BiLSTMBidirectional Long Short-Term Memory
BiRNNBidirectional Recurrent Neural Network
CCDCharge-Coupled Device
CCTCompact Convolutional Transformer
CNNConvolutional Neural Network
DONDeoxynivalenol
DLDeep Learning
DTDecision Tree
ELMExtreme Learning Machine
EUEuropean Union
FAFormaldehyde
FDAFood and Drug Administration
FHSIFluorescence Hyperspectral Imaging
GNBGaussian Naive Bayes
GNNGraph Neural Network
GRUGated Recurrent Unit
HACCPHazard Analysis and Critical Control Points
HCAHierarchical Cluster Analysis
HMIHyperspectral Microscopic Imaging
HSIHyperspectral Imaging
IoTInternet of Things
JECFAJoint FAO/WHO Expert Committee on Food Additives
K-NNK-Nearest Neighbors
LDALinear Discriminant Analysis
LOFLocal Outlier Factor
LSTMLong Short-Term Memory
MLMachine Learning
MRLsMaximum Residue Limits
MSATMulti-Scale Attention Transformer
NBNaive Bayes
PCAPrincipal Component Analysis
PLS-DAPartial Least Squares Discriminant Analysis
RASFFRapid Alert System for Food and Feed
ReLURectified Linear Unit
ResNetResidual Network
RFRandom Forest
RNNRecurrent Neural Network
SEMScanning Electron Microscopy
SERSSurface-Enhanced Raman Spectroscopy
SIRIStructured Illumination Reflectance Imaging
SVMSupport Vector Machine
SVRSupport Vector Regression
SWIRShort-Wave Infrared
TCTetracycline
VIS/NIRvisible and near-infrared
VNIRVisible Near-Infrared
ViTVision Transformer
WT–SAEWavelet Transform–Stacked Autoencoder
XAIExplainable Artificial Intelligence
XGBoostExtreme Gradient Boosting

References

  1. Kurman, T.; Kurman, O.; Tuieva, O. The legal foundations of food safety as a means of providing public health in globalization. Wiad. Lek. 2019, 72, 2626–2630. [Google Scholar] [CrossRef]
  2. Li, K.; Cai, H.; Luo, B.; Duan, S.; Yang, J.; Zhang, N.; He, Y.; Wu, A.; Liu, H. Recent Progress of Mycotoxin in Various Food Products—Human Exposure and Health Risk Assessment. Foods 2025, 14, 865. [Google Scholar] [CrossRef]
  3. Scutarașu, E.C.; Trincă, L.C. Heavy Metals in Foods and Beverages: Global Situation, Health Risks and Reduction Methods. Foods 2023, 12, 3340. [Google Scholar] [CrossRef]
  4. Abdelshafy, A.M.; Younis, H.A.; Osman, A.I.; Hussein, S.M.; El-Ela, A.S.A.; Mahmoud, E.A.; Elsherbiny, O.; Rashwan, A.K. Recent advances in detection and control strategies for foodborne bacteria in raw and ready-to-eat fruits and vegetables. Food Front. 2025, 6, 629–650. [Google Scholar] [CrossRef]
  5. Hua, Y.; Liu, G. Food Pesticide Residues Monitoring and Health Risk Assessment. Foods 2024, 13, 474. [Google Scholar] [CrossRef]
  6. Ropodi, A.I.; Panagou, E.Z.; Nychas, G.J.E. Data mining derived from food analyses using non-invasive/non-destructive analytical techniques; determination of food authenticity, quality & safety in tandem with computer science disciplines. Trends Food Sci. Technol. 2016, 50, 11–25. [Google Scholar]
  7. Hassoun, A.; Jagtap, S.; Garcia-Garcia, G.; Trollman, H.; Pateiro, M.; Lorenzo, J.M.; Trif, M.; Rusu, A.V.; Aadil, R.M.; Šimat, V.; et al. Food quality 4.0: From traditional approaches to digitalized automated analysis. J. Food Eng. 2023, 337, 111216. [Google Scholar] [CrossRef]
  8. Zhao, Z.; Dong, J.; Qi, B.; Duan, N.; Qian, H. A survey on machine learning methods for food safety risk assessment: Approaches, challenges, and future outlook. Eng. Appl. Artif. Intell. 2025, 154, 110960. [Google Scholar] [CrossRef]
  9. Queral-Beltran, A.; Lacorte, S.; Tauler, R. GC-Orbitrap-HRMS with ROIMCR and MSident targeted and non-targeted analysis of Persistent Organic Pollutants in fish-based certified reference materials. Anal. Chim. Acta 2025, 1383, 344892. [Google Scholar] [CrossRef]
  10. Sari, O.F.; Bader-El-Den, M.; Leadley, C.; Esmeli, R.; Mohasseb, A.; Ince, V. AI-driven food safety risk prediction: A transformer-based approach with RASFF database. Br. Food J. 2025, 127, 3427–3445. [Google Scholar] [CrossRef]
  11. Chhetri, K.B. Applications of Artificial Intelligence and Machine Learning in Food Quality Control and Safety Assessment. Food Eng. Rev. 2024, 16, 1–21. [Google Scholar] [CrossRef]
  12. Munir, N.; Jahangeer, M.; Bouyahya, A.; El Omari, N.; Ghchime, R.; Balahbib, A.; Aboulaghras, S.; Mahmood, Z.; Akram, M.; Shah, S.M.A.; et al. Heavy Metal Contamination of Natural Foods Is a Serious Health Issue: A Review. Sustainability 2022, 14, 161. [Google Scholar] [CrossRef]
  13. Khan, M.I.H.; Sablani, S.S.; Nayak, R.; Gu, Y. Machine learning-based modeling in food processing applications: State of the art. Compr. Rev. Food. Sci. Food Saf. 2022, 21, 1409–1438. [Google Scholar] [CrossRef]
  14. Yu, W.; Ouyang, Z.; Zhang, Y.; Lu, Y.; Wei, C.; Tu, Y.; He, B. Research progress on the artificial intelligence applications in food safety and quality management. Trends Food Sci. Technol. 2025, 156, 104855. [Google Scholar] [CrossRef]
  15. Yang, C.; Guo, Z.; Barbin, D.F.; Dai, Z.; Watson, N.; Povey, M.; Zou, X. Hyperspectral Imaging and Deep Learning for Quality and Safety Inspection of Fruits and Vegetables: A Review. J. Agric. Food. Chem. 2025, 73, 10019–10035. [Google Scholar] [CrossRef] [PubMed]
  16. Feng, Y.; Sun, D. Application of Hyperspectral Imaging in Food Safety Inspection and Control: A Review. Crit. Rev. Food Sci. Nutr. 2012, 52, 1039–1058. [Google Scholar] [CrossRef] [PubMed]
  17. Gowen, A.A.; O’Donnell, C.P.; Cullen, P.J.; Downey, G.; Frias, J.M. Hyperspectral imaging—An emerging process analytical tool for food quality and safety control. Trends Food Sci. Technol. 2007, 18, 590–598. [Google Scholar] [CrossRef]
  18. Mishra, P.; Passos, D. A synergistic use of chemometrics and deep learning improved the predictive performance of near-infrared spectroscopy models for dry matter prediction in mango fruit. Chemom. Intell. Lab. Syst. 2021, 212, 104287. [Google Scholar] [CrossRef]
  19. Yu, K.; Zhong, M.; Zhu, W.; Rashid, A.; Han, R.; Virk, M.S.; Duan, K.; Zhao, Y.; Ren, X. Advances in Computer Vision and Spectroscopy Techniques for Non-Destructive Quality Assessment of Citrus Fruits: A Comprehensive Review. Foods 2025, 14, 386. [Google Scholar] [CrossRef]
  20. Liu, X.; An, H.; Cai, W.; Shao, X. Deep learning in spectral analysis: Modeling and imaging. TrAC Trends Anal. Chem. 2024, 172, 117612. [Google Scholar] [CrossRef]
  21. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems, Long Beach, CA, USA, 4–9 December 2017; Curran Associates, Inc.: Red Hook, NY, USA, 2017; pp. 6000–6010. [Google Scholar]
  22. Balta, I.; Lemon, J.; Popescu, C.A.; McCleery, D.; Iancu, T.; Pet, I.; Stef, L.; Douglas, A.; Corcionivoschi, N. Food safety—The transition to artificial intelligence (AI) modus operandi. Trends Food Sci. Technol. 2025, 165, 105278. [Google Scholar] [CrossRef]
  23. Silva, R.F.; Mostaço, G.M.; Xavier, F.; Saraiva, A.M.; Cugnasca, C.E. Use of Unsupervised Machine Learning for Agricultural Supply Chain Data Labeling. In Information and Communication Technologies for Agriculture—Theme II: Data; Bochtis, D.D., Moshou, D.E., Vasileiadis, G., Balafoutis, A., Pardalos, P.M., Eds.; Springer International Publishing: Cham, Switzerland, 2022; pp. 267–288. ISBN 978-3-030-84148-5. [Google Scholar]
  24. Ma, T.; Tu, K.; Ou, Q.; Fang, Y.; Zhang, C. Comparing the Associations of Dietary Patterns Identified through Principal Component Analysis and Cluster Analysis with Colorectal Cancer Risk: A Large Case–Control Study in China. Nutrients 2024, 16, 147. [Google Scholar] [CrossRef]
  25. Goyeneche, R.; Roura, S.; Di Scala, K. Principal component and hierarchical cluster analysis to select hurdle technologies for minimal processed radishes. Food Sci. Technol. 2014, 57, 522–529. [Google Scholar] [CrossRef]
  26. Yao, Y.; Li, T.; Wu, W.; Zhang, G.; Zheng, L. PowerHierarchy: Visualization approach of hierarchical data via power diagram. Vis. Comput. 2024, 40, 1499–1514. [Google Scholar] [CrossRef]
  27. Muruvanda, T.; Rand, H.; Pettengill, J.; Pightling, A. RIPS (rapid intuitive pathogen surveillance): A tool for surveillance of genome sequence data from foodborne bacterial pathogens. Front. Bioinform. 2024, 4, 1415078. [Google Scholar] [CrossRef] [PubMed]
  28. Li, Y.; Chen, F.; Liu, Y.; Khan, M.A.; Zhao, H.; Cao, H.; Ye, D. Identification of multiple foodborne pathogens using single-atom nanozyme colorimetric sensor arrays and machine learning. Chem. Eng. J. 2025, 511, 162115. [Google Scholar] [CrossRef]
  29. Chen, M.; Zhang, Y.; Cheng, L.; Zhao, F.; Wang, P. Machine learning-powered fluorescent sensor arrays for rapid detection of heavy metals and pesticides in complex environments. Biosens. Bioelectron. 2025, 287, 117706. [Google Scholar] [CrossRef] [PubMed]
  30. Wakayama, R.; Takasugi, S.; Honda, K.; Kanaya, S. Application of a Two-Dimensional Mapping-Based Visualization Technique: Nutrient-Value-Based Food Grouping. Nutrients 2023, 15, 5006. [Google Scholar] [CrossRef]
  31. Tangorra, F.M.; Lopez, A.; Ighina, E.; Bellagamba, F.; Moretti, V.M. Handheld NIR Spectroscopy Combined with a Hybrid LDA-SVM Model for Fast Classification of Retail Milk. Foods 2024, 13, 3577. [Google Scholar] [CrossRef]
  32. Maciejewska, N.; Stefanou, C.; Stathas, L.; Koutsoumanis, K. Combined stochastic modelling of pathogenic and spoilage microorganisms. EFSA J. 2024, 22, e221112. [Google Scholar] [CrossRef]
  33. Ran, X.; Xi, Y.; Lu, Y.; Wang, X.; Lu, Z. Comprehensive survey on hierarchical clustering algorithms and the recent developments. Artif. Intell. Rev. 2023, 56, 8219–8264. [Google Scholar] [CrossRef]
  34. Williams, L.; Shukla, P.; Sheikh-Akbari, A.; Mahroughi, S.; Mporas, I. Measuring the Level of Aflatoxin Infection in Pistachio Nuts by Applying Machine Learning Techniques to Hyperspectral Images. Sensors 2025, 25, 1548. [Google Scholar] [CrossRef]
  35. Nishad, M.A.R.; Mitu, M.A.; Jahan, N. Predicting and Classifying Potato Leaf Disease using K-means Segmentation Techniques and Deep Learning Networks. Procedia Comput. Sci. 2022, 212, 220–229. [Google Scholar] [CrossRef]
  36. Wang, Z.; Wang, K.; Pan, S.; Han, Y. Segmentation of Crop Disease Images with an Improved K-means Clustering Algorithm. Appl. Eng. Agric. 2018, 34, 277–289. [Google Scholar] [CrossRef]
  37. Zhou, Z.; Tian, D.; Yang, Y.; Cui, H.; Li, Y.; Ren, S.; Han, T.; Gao, Z. Machine learning assisted biosensing technology: An emerging powerful tool for improving the intelligence of food safety detection. Curr. Res. Food Sci. 2024, 8, 100679. [Google Scholar] [CrossRef]
  38. Avian, C.; Leu, J.; Prakosa, S.W.; Faisal, M. An Improved Classification of Pork Adulteration in Beef Based on Electronic Nose Using Modified Deep Extreme Learning with Principal Component Analysis as Feature Learning. Food Anal. Methods 2022, 15, 3020–3031. [Google Scholar] [CrossRef]
  39. Rayhana, R.; Sangha, J.S.; Ruan, Y.; Liu, Z. Harnessing machine learning for grain mycotoxin detection. Smart Agric. Technol. 2025, 11, 100923. [Google Scholar] [CrossRef]
  40. Siripatrawan, U.; Makino, Y. Assessment of food safety risk using machine learning-assisted hyperspectral imaging: Classification of fungal contamination levels in rice grain. Microb. Risk Anal. 2024, 27–28, 100295. [Google Scholar] [CrossRef]
  41. Ren, T.; Lin, Y.; Su, Y.; Ye, S.; Zheng, C. Machine Learning-Assisted Portable Microplasma Optical Emission Spectrometer for Food Safety Monitoring. Anal. Chem. 2024, 96, 5170–5177. [Google Scholar] [CrossRef]
  42. Pereira, E.d.S.; Cruz-Tirado, J.; Crippa, B.L.; Morasi, R.M.; de Almeida, J.M.; Barbin, D.F.; Junior, S.B.; Silva, N.C.C. Portable near infrared (NIR) spectrometer coupled with machine learning to classify milk with subclinical mastitis. Food Control 2024, 163, 110527. [Google Scholar] [CrossRef]
  43. Wang, K.; Yue, Z.; Lin, H.; Wang, Q.; Wang, L.; Tian, Y.; Ren, L. Rapid classification of the freshness grades of sea bass (Lateolabrax japonicus) fillets using a portable Raman spectrometer with machine learning method. Microchem. J. 2023, 192, 108948. [Google Scholar] [CrossRef]
  44. Zadeh, H.K.; Hardy, M.; Sueker, M.; Li, Y.; Tzouchas, A.; MacKinnon, N.; Bearman, G.; Haughey, S.A.; Akhbardeh, A.; Baek, I.; et al. Rapid Assessment of Fish Freshness for Multiple Supply-Chain Nodes Using Multi-Mode Spectroscopy and Fusion-Based Artificial Intelligence. Sensors 2023, 23, 5149. [Google Scholar] [CrossRef] [PubMed]
  45. Aqeel, M.; Sohaib, A.; Iqbal, M.; Ullah, S.S. Milk adulteration identification using hyperspectral imaging and machine learning. J. Dairy Sci. 2025, 108, 1301–1314. [Google Scholar] [CrossRef]
  46. Ou, G.; He, Y.; Cheng, Y.; Huang, J.Z. Relaxed naïve Bayesian classifier based on maximum dependent attribute groups. Inf. Sci. 2025, 707, 122013. [Google Scholar] [CrossRef]
  47. Park, S.; Fürnkranz, J. Efficient implementation of class-based decomposition schemes for Naïve Bayes. Mach. Learn. 2014, 96, 295–309. [Google Scholar] [CrossRef][Green Version]
  48. Kuncheva, L.I. On the optimality of Naïve Bayes with dependent binary features. Pattern Recognit. Lett. 2006, 27, 830–837. [Google Scholar] [CrossRef]
  49. Ying, X.; Lu, A.; Cai, Q.; Lu, J. Bayesian network modeling applied to food risks: Data from General Administration of Customs of China as an example. Appl. Food Res. 2024, 4, 100565. [Google Scholar] [CrossRef]
  50. Vannya, R.; Hermawan, A. Performance Analysis of Chicken Freshness classification using Naïve Bayes, Decision Tree, and k-NN. J. Sisfokom 2023, 12, 394–400. [Google Scholar] [CrossRef]
  51. Soon, J.M.; Abdul Wahab, I.R. A Bayesian Approach to Predict Food Fraud Type and Point of Adulteration. Foods 2022, 11, 328. [Google Scholar] [CrossRef]
  52. Bouzembrak, Y.; Liu, N.; Mu, W.; Gavai, A.; Manning, L.; Butler, F.; Marvin, H. Data driven food fraud vulnerability assessment using Bayesian Network: Spices supply chain. Food Control 2024, 164, 110616. [Google Scholar] [CrossRef]
  53. Lu, J.; Gweon, H. Random k conditional nearest neighbor for high-dimensional data. PeerJ Comput. Sci. 2025, 11, e2497. [Google Scholar] [CrossRef] [PubMed]
  54. Sun, H.; Zhang, L.; Ni, L.; Zhu, Z.; Luan, S.; Hu, P. Study on Rapid Detection of Pesticide Residues in Shanghaiqing Based on Analyzing Near-Infrared Microscopic Images. Sensors 2023, 23, 983. [Google Scholar] [CrossRef] [PubMed]
  55. Sahin, F.; Celik, N.; Camdal, A.; Sakir, M.; Ceylan, A.; Ruzi, M.; Onses, M.S. Machine Learning-Assisted Pesticide Detection on a Flexible Surface-Enhanced Raman Scattering Substrate Prepared by Silver Nanoparticles. ACS Appl. Nano Mater. 2022, 5, 13112–13122. [Google Scholar] [CrossRef]
  56. Dewi, W.; Nisa, K.; Usman, M.; Herawati, N. Implementation of K-Nearest Neighbors Algorithm on Regional Food Security Classification in Indonesia. J. Mod. Appl. Stat. Meth. 2022, 21, 1–16. [Google Scholar]
  57. Silva, M.C.; Faria, B.M.; Reis, L.P. Knowledge discovery for risk assessment in economic and food safety. In Proceedings of the 15th International Joint Conference on Knowledge Discovery, Rome, Italy, 13–15 November 2023; SCITEPRESS—Science and Technology Publications, Lda: Setúbal, Portugal, 2023; pp. 445–452. [Google Scholar]
  58. Gong, C.; Su, Z.; Wang, P.; Wang, Q.; You, Y. Evidential instance selection for K-nearest neighbor classification of big data. Int. J. Approx. Reason. 2021, 138, 123–144. [Google Scholar] [CrossRef]
  59. Cortes, C.; Vapnik, V. Support-vector networks. Mach. Learn. 1995, 20, 273–297. [Google Scholar] [CrossRef]
  60. Schölkopf, B.; Smola, A.J. Learning with Kernels: Support Vector Machines, Regularization, Optimization, and Beyond; The MIT Press: Cambridge, MA, USA, 2001; ISBN 9780262256933. [Google Scholar]
  61. Hao, M.; Wang, Y.; Huang, W.; Wang, M.; Yang, H. Food Safety Risk Assessment Method Based on SVM Optimization Model. In Proceedings of the 7th International Conference on Multimedia Systems and Signal Processing, Virtually, 27–29 May 2022; ACM: New York, NY, USA, 2022; pp. 52–56. [Google Scholar]
  62. Bertani, F.; Businaro, L.; Gambacorta, L.; Mencattini, A.; Brenda, D.; Di Giuseppe, D.; De Ninno, A.; Solfrizzo, M.; Martinelli, E.; Gerardino, A. Optical detection of aflatoxins B in grained almonds using fluorescence spectroscopy and machine learning algorithms. Food Control 2020, 112, 107073. [Google Scholar] [CrossRef]
  63. Piroutková, M.; Varrà, M.O.; Husáková, L.; Bachtíková, T.; Kuba, M.; Zanardi, E. An analytical and machine learning approach for total mercury and methylmercury determination in squid: Enhancing food safety testing and traceability monitoring systems. Food Chem. 2025, 496, 146766. [Google Scholar] [CrossRef] [PubMed]
  64. Breiman, L. Random Forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef]
  65. Chen, Z.; Ding, L.; Cao, T.; Cheng, Y.; Wen, L.; Xu, Z.; Chen, M.; Jiao, Y.; Li, H. Risk assessment model of grain resources based on AHP and random forest regression algorithm. Food Mach. 2021, 37, 58–66. [Google Scholar]
  66. Ehsani, S.; Weller, P.; Parastar, H. Revolutionizing food integrity: Harnessing the power of ensemble learning algorithms. TrAC Trends Anal. Chem. 2025, 193, 118458. [Google Scholar] [CrossRef]
  67. Gu, W.; Cui, Z.; Stroika, S.; Carleton, H.A.; Conrad, A.; Katz, L.S.; Richardson, L.C.; Hunter, J.; Click, E.S.; Bruce, B.B. Predicting Food Sources of Listeria monocytogenes Based on Genomic Profiling Using Random Forest Model. Foodborne Pathog. Dis. 2023, 20, 579–586. [Google Scholar] [CrossRef] [PubMed]
  68. Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; ACM: New York, NY, USA, 2016; pp. 785–794. [Google Scholar]
  69. Garcia-Vozmediano, A.; Maurella, C.; Ceballos, L.A.; Crescio, E.; Meo, R.; Martelli, W.; Pitti, M.; Lombardi, D.; Meloni, D.; Pasqualini, C.; et al. Machine learning approach as an early warning system to prevent foodborne Salmonella outbreaks in northwestern Italy. Vet. Res. 2024, 55, 72. [Google Scholar] [CrossRef]
  70. Hao, C.; Zhang, Q.; Wang, S.; Jiang, T.; Dong, W. Prediction of Safety Risk Levels of Benzopyrene Residues in Edible Oils in China Based on the Variable-Weight Combined LSTM-XGBoost Prediction Model. Foods 2023, 12, 2241. [Google Scholar] [CrossRef]
  71. Castano-Duque, L.; Vaughan, M.; Lindsay, J.; Barnett, K.; Rajasekaran, K. Gradient boosting and bayesian network machine learning models predict aflatoxin and fumonisin contamination of maize in Illinois—First USA case study. Front. Microbiol. 2022, 13, 1039947. [Google Scholar] [CrossRef]
  72. Park, B.; Shin, T.; Kang, R.; Fong, A.; McDonogh, B.; Yoon, S. Automated segmentation of foodborne bacteria from chicken rinse with hyperspectral microscope imaging and deep learning methods. Comput. Electron. Agric. 2023, 208, 107802. [Google Scholar] [CrossRef]
  73. Wang, J.; Zhu, R.; Wu, Y.; Tang, L.; Wang, C.; Qiu, M.; Zheng, L.; Li, P.; Weng, S. Dynamic surface-enhanced Raman spectroscopy and positively charged probes for rapid detection and accurate identification of fungal spores in infected apples via deep learning methods. Food Control 2024, 157, 110151. [Google Scholar] [CrossRef]
  74. Hassan, S.A.; Khalil, M.A.; Auletta, F.; Filosa, M.; Camboni, D.; Menciassi, A.; Oddo, C.M. Contamination Detection Using a Deep Convolutional Neural Network with Safe Machine—Environment Interaction. Electronics 2023, 12, 4260. [Google Scholar] [CrossRef]
  75. Chen, Q.; Bao, H.; Li, H.; Wu, T.; Qi, X.; Zhu, C.; Tan, W.; Jia, D.; Zhou, D.; Qi, Y. Microscopic identification of foodborne bacterial pathogens based on deep learning method. Food Control 2024, 161, 110413. [Google Scholar] [CrossRef]
  76. Nallan Chakravartula, S.S.; Moscetti, R.; Bedini, G.; Nardella, M.; Massantini, R. Use of convolutional neural network (CNN) combined with FT-NIR spectroscopy to predict food adulteration: A case study on coffee. Food Control 2022, 135, 108816. [Google Scholar] [CrossRef]
  77. Peng, Y.; Sun, J.; Cai, Z.; Shi, L.; Wu, X.; Dai, C.; Xie, Y. Copper Stress Levels Classification in Oilseed Rape Using Deep Residual Networks and Hyperspectral False-Color Images. Horticulturae 2025, 11, 840. [Google Scholar] [CrossRef]
  78. Guo, L.; Tian, H.; Wan, D.; Yu, Y.; Zhao, K.; Zheng, X.; Li, H.; Sun, J. Detection of Aflatoxin B1 in Maize Silage Based on Hyperspectral Imaging Technology. Agriculture 2025, 15, 1023. [Google Scholar] [CrossRef]
  79. Javanmardi, S.; Ashtiani, S.M. AI-driven deep learning framework for shelf life prediction of edible mushrooms. Postharvest Biol. Technol. 2025, 222, 113396. [Google Scholar] [CrossRef]
  80. Wu, M.; Liu, W.; Zheng, S. Intelligent Food Safety: A Prediction Model Based on Attention Mechanism and Reinforcement Learning. Appl. Artif. Intell. 2024, 38, 2379731. [Google Scholar] [CrossRef]
  81. Nagamalla, V.; Kumar, B.M.; Janu, N.; Preetham, A.; Gangadharan, S.M.P.; Alqahtani, M.A.; Ratna, R. Detection of Adulteration in Food Using Recurrent Neural Network with Internet of Things. J. Food Qual. 2022, 2022, 6163649. [Google Scholar] [CrossRef]
  82. Deng, J.; Zhang, X.; Li, M.; Jiang, H.; Chen, Q. Feasibility study on Raman spectra-based deep learning models for monitoring the contamination degree and level of aflatoxin B1 in edible oil. Microchem. J. 2022, 180, 107613. [Google Scholar] [CrossRef]
  83. Zhu, H.; Zhao, Y.; Zhao, L.; Yang, R.; Han, Z. Pixel-level spectral reconstruction and compressed projection based on deep learning in detecting aflatoxin B1. Comput. Electron. Agric. 2025, 232, 110071. [Google Scholar] [CrossRef]
  84. Wang, C.; Zhu, H.; Zhao, Y.; Shi, W.; Fu, H.; Zhao, Y.; Han, Z. A multi-verse optimizer-based CNN-BiLSTM pixel-level detection model for peanut aflatoxins. Food Chem. 2025, 463, 141393. [Google Scholar] [CrossRef] [PubMed]
  85. Aghamohammadesmaeilketabforoosh, K.; Nikan, S.; Antonini, G.; Pearce, J.M. Optimizing Strawberry Disease and Quality Detection with Vision Transformers and Attention-Based Convolutional Neural Networks. Foods 2024, 13, 1869. [Google Scholar] [CrossRef]
  86. Shao, X.; Guo, Z.; Qin, Y.; Zhao, J.; Guo, Y.; Sun, X.; Du, F. Synergistic multi-level fusion framework of VNIR and SWIR hyperspectral data for soybean fungal contamination detection. Food Chem. 2025, 492, 145559. [Google Scholar] [CrossRef]
  87. Wu, T.; Li, L.; Zhu, L.; Bai, W.; Lin, L.; Liu, L.; Yang, L. Nondestructive detection of thiophanate-methyl pesticide content in cherry tomato based on handheld spectrometer and SpecTransformer algorithm. J. Food Meas. Charact. 2025, 19, 3048–3060. [Google Scholar] [CrossRef]
  88. Chen, N.; Zhang, X.; Liu, Z.; Zhang, T.; Lai, Q.; Li, B.; Lu, Y.; Hu, B.; Jiang, X.; Liu, Y. Fusion of Acoustic and Vis-NIRS Information for High-Accuracy Online Detection of Moldy Core in Apples. Agriculture 2025, 15, 1202. [Google Scholar] [CrossRef]
  89. Wang, C.; Zhao, Y.; Zhu, H.; Shi, W.; Wu, Q.; Fu, H.; Han, Z. Aflatoxin detection in naturally contaminated peanuts based on vision transformer and multi-scale convolutional fusion. Food Chem. 2025, 483, 144300. [Google Scholar] [CrossRef]
  90. Guo, Z.; Wang, H.; Auat-Cheein, F.A.; Ren, Z.; Xia, L.; Darwish, I.A.; Guo, Y.; Sun, X. Detection of Aspergillus flavus contamination in peanut kernels using a hybrid convolutional transformer-feature fusion network: A macro-micro integrated hyperspectral imaging approach and two-dimensional correlation spectroscopy analysis. Postharvest Biol. Technol. 2025, 225, 113489. [Google Scholar] [CrossRef]
  91. Kim, Y.; Kang, S.; Ajani, O.S.; Mallipeddi, R.; Ha, Y. Predicting early mycotoxin contamination in stored wheat using machine learning. J. Stored Prod. Res. 2024, 106, 102294. [Google Scholar] [CrossRef]
  92. Lin, H.; Chen, J.; Lin, C. A Deep Learning-Based Sensing System for Identifying Salmon and Rainbow Trout Meat and Grading Freshness for Consumer Protection. Sensors 2025, 25, 6299. [Google Scholar] [CrossRef] [PubMed]
  93. Val, I.L. The EU AI Act and the Food System: How the European Union Ai Act Applies to Agrifood. Eur. J. Risk Regul. 2025, 1–21. [Google Scholar] [CrossRef]
  94. Tian, Y.; Zhang, D.; Cai, P.; Lin, H.; Ying, H.; Hu, Q.-N.; Wu, A. Elimination of Fusarium mycotoxin deoxynivalenol (DON) via microbial and enzymatic strategies: Current status and future perspectives. Trends Food Sci. Technol. 2022, 124, 96–107. [Google Scholar] [CrossRef]
  95. Kępka-Borkowska, K.; Chałaśkiewicz, K.; Ogłuszka, M.; Borkowski, M.; Lepczyński, A.; Pareek, C.S.; Starzyński, R.R.; Lichwiarska, E.; Sultana, S.; Kalra, G.; et al. Current Approaches to Aflatoxin B1 Control in Food and Feed Safety: Detection, Inhibition, and Mitigation. Int. J. Mol. Sci. 2025, 26, 6534. [Google Scholar] [CrossRef]
  96. Zeweld, S.W.; Tarekegn, E.K.; Welearegay, M.A. A Systematic Review of Aflatoxin B1 Contamination in Livestock Feed and Detection Methods in Ethiopia. Vet. Med. Sci. 2025, 11, e70405. [Google Scholar] [CrossRef]
  97. Mishra, S.; Srivastava, S.; Dewangan, J.; Divakar, A.; Kumar Rath, S. Global occurrence of deoxynivalenol in food commodities and exposure risk assessment in humans in the last decade: A survey. Crit. Rev. Food. Sci. Nutr. 2022, 60, 1346–1374. [Google Scholar] [CrossRef]
  98. Chen, C.; Frank, K.; Wang, T.; Wu, F. Global wheat trade and Codex Alimentarius guidelines for deoxynivalenol: A mycotoxin common in wheat. Glob. Food Secur. 2021, 29, 100538. [Google Scholar] [CrossRef]
  99. Jubeen, F.; Zahra, N.; Nazli, Z.-I.; Saleemi, M.K.; Aslam, F.; Naz, I.; Farhat, L.B.; Saleh, A.; Alshawwa, S.Z.; Iqbal, M. Risk Assessment of Hepatocellular Carcinoma with Aflatoxin B1 Exposure in Edible Oils. Toxins 2022, 14, 547. [Google Scholar] [CrossRef]
  100. Guo, Z.; Zhang, J.; Wang, H.; Dong, H.; Li, S.; Shao, X.; Huang, J.; Yin, X.; Zhang, Q.; Guo, Y.; et al. Enhanced detection of Aspergillus flavus in peanut kernels using a multi-scale attention transformer (MSAT): Advancements in food safety and contamination analysis. Int. J. Food Microbiol. 2024, 423, 110831. [Google Scholar] [CrossRef]
  101. Bouzembrak, Y.; Marvin, H.J.P. Prediction of food fraud type using data from Rapid Alert System for Food and Feed (RASFF) and Bayesian network modelling. Food Control 2016, 61, 180–187. [Google Scholar] [CrossRef]
  102. Sun, L.; Ma, J.; Jiang, Y.; Purcaro, G.; Tian, Y.; Wang, G.; Li, W.; Tai, B.; Xing, F. A novel approach for predicting aflatoxin B1 production using regression models and whole-cell biosensors in moldy maize and peanut kernels. J. Hazard. Mater. 2025, 498, 139883. [Google Scholar] [CrossRef]
  103. Cova, T.F.; Ferreira, C.; Nunes, S.C.C.; Pais, A.A.C.C. Structural Similarity, Activity, and Toxicity of Mycotoxins: Combining Insights from Unsupervised and Supervised Machine Learning Algorithms. J. Agric. Food. Chem. 2025, 73, 6173–6188. [Google Scholar] [CrossRef] [PubMed]
  104. Wang, L.; Liu, D.; Sun, Y.; Zhang, Y.; Chen, W.; Yuan, Y.; Hu, S.; Li, S. Machine learning-based analysis of heavy metal contamination in Chinese lake basin sediments: Assessing influencing factors and policy implications. Ecotoxicol. Environ. Saf. 2024, 283, 116815. [Google Scholar] [CrossRef]
  105. Castro Gutiérrez, H.; Robles-Algarín, C.; Polo, A. Data Augmentation and Machine Learning for Heavy Metal Detection in Mulberry Leaves Using Laser-Induced Breakdown Spectroscopy (LIBS) Spectral Data. Processes 2025, 13, 1688. [Google Scholar] [CrossRef]
  106. Li, J.; Li, X.; Tai, X.-S.; Tuo, X.-Y.; Zhou, F.-Y.; Rong, Y.-J.; Zang, F. Machine learning-assisted source identification and probabilistic ecological-health risk assessment of heavy metal(loid)s in urban park soils. Sci. Rep. 2025, 15, 17451. [Google Scholar] [CrossRef]
  107. Xu, S.; Wang, X.; Zhou, Y.; Wang, D.; Zhang, W.; Li, Y. Application of machine learning in the study of heavy metal remediation in soil using biochar-based nanocomposites. Next Mater. 2025, 9, 101261. [Google Scholar] [CrossRef]
  108. Zhou, X.; Sun, J.; Tian, Y.; Yao, K.; Xu, M. Detection of heavy metal lead in lettuce leaves based on fluorescence hyperspectral technology combined with deep learning algorithm. Spectrochim. Acta Part A Mol. Biomol. Spectrosc. 2022, 266, 120460. [Google Scholar] [CrossRef]
  109. Zhou, X.; Zhao, C.; Sun, J.; Cao, Y.; Yao, K.; Xu, M. A deep learning method for predicting lead content in oilseed rape leaves using fluorescence hyperspectral imaging. Food Chem. 2023, 409, 135251. [Google Scholar] [CrossRef] [PubMed]
  110. Zhou, X.; Zhao, C.; Sun, J.; Cheng, J.; Xu, M. Determination of lead content in oilseed rape leaves in silicon-free and silicon environments based on deep transfer learning and fluorescence hyperspectral imaging. Spectrochim. Acta Part A Mol. Biomol. Spectrosc. 2024, 311, 123991. [Google Scholar] [CrossRef]
  111. Zhou, X.; Sun, J.; Tian, Y.; Lu, B.; Hang, Y.; Chen, Q. Hyperspectral technique combined with deep learning algorithm for detection of compound heavy metals in lettuce. Food Chem. 2020, 321, 126503. [Google Scholar] [CrossRef] [PubMed]
  112. Wang, L.; Liu, H.; Li, T.; Li, J.; Wang, Y. Verified the rapid evaluation of the edible safety of wild porcini mushrooms, using deep learning and PLS-DA. J. Sci. Food. Agric. 2022, 102, 1531–1539. [Google Scholar] [CrossRef]
  113. Deng, J.; Zhao, X.; Luo, W.; Bai, X.; Xu, L.; Jiang, H. Microwave detection technique combined with deep learning algorithm facilitates quantitative analysis of heavy metal Pb residues in edible oils. J. Food Sci. 2024, 89, 6005–6015. [Google Scholar] [CrossRef] [PubMed]
  114. Lapcharoensuk, R.; Fhaykamta, C.; Anurak, W.; Chadwut, W.; Sitorus, A. Nondestructive Detection of Pesticide Residue (Chlorpyrifos) on Bok Choi (Brassica rapa subsp. Chinensis) Using a Portable NIR Spectrometer Coupled with a Machine Learning Approach. Foods 2023, 12, 955. [Google Scholar] [CrossRef]
  115. Dai, Q.; Luo, Z.; Li, Z.; Lyu, S.; Xue, X.; Song, S.; Yu, S.; Huang, Y. Field-Based, Non-Destructive, and Rapid Detection of Pesticide Residues on Kumquat (Citrus japonica) Surfaces Using Handheld Spectrometer and 1D-ResNet. Agronomy 2025, 15, 625. [Google Scholar] [CrossRef]
  116. Ong, P.; Yeh, C.; Tsai, I.; Lee, W.; Wang, Y.; Chuang, Y. Evaluation of convolutional neural network for non-destructive detection of imidacloprid and acetamiprid residues in chili pepper (Capsicum frutescens L.) based on visible near-infrared spectroscopy. Spectrochim. Acta Part A Mol. Biomol. Spectrosc. 2023, 303, 123214. [Google Scholar] [CrossRef]
  117. Wei, C.; Zhang, J.; Li, G.; Zhong, Y.; Ye, Z.; Wang, H.; Li, K.; Wu, Y.; Wu, Y.; Luo, H.; et al. Rapid and non-destructive detection of formaldehyde adulteration in shrimp based on deep learning-assisted portable Raman spectroscopy. Food Chem. 2025, 492, 145343. [Google Scholar] [CrossRef]
  118. Chen, Z.; Li, Z.; He, H.; Liu, J.; Deng, J.; Jiang, L.; Liu, X. Ratiometric fluorescence sensor based on deep learning for rapid and user-friendly detection of tetracycline antibiotics. Food Chem. 2024, 450, 138961. [Google Scholar] [CrossRef]
  119. Wang, X.; Jiang, S.; Liu, Z.; Sun, X.; Zhang, Z.; Quan, X.; Zhang, T.; Kong, W.; Yang, X.; Li, Y. Integrated surface-enhanced Raman spectroscopy and convolutional neural network for quantitative and qualitative analysis of pesticide residues on pericarp. Food Chem. 2024, 440, 138214. [Google Scholar] [CrossRef]
  120. Saatçi, A.; Taşkan, E.; Şahın, M. A Deep Learning Approach for Rapid and Cost-Effective Detection of Pesticide Residues in Agricultural Products. In Proceedings of the 13th International Symposium on Digital Forensics and Security, Boston, MA, USA, 24–25 April 2025; Curran Associates, Inc.: Red Hook, NY, USA; pp. 1–6. [Google Scholar]
  121. Lapcharoensuk, R.; Fhaykamta, C.; Anurak, W.; Chadwut, W. Monitoring Pesticide Residue on Bok Choi using Convolution Neural Network with NIR spectral Data. In Proceedings of the 2024 5th Asia Service Sciences and Software Engineering Conference, Tokyo, Japan, 11–13 September 2025; ACM: New York, NY, USA, 2025; pp. 153–157. [Google Scholar]
  122. Jiang, Y.; Luo, J.; Huang, D.; Liu, Y.; Li, D. Machine Learning Advances in Microbiology: A Review of Methods and Applications. Front. Microbiol. 2022, 13, 925454. [Google Scholar] [CrossRef]
  123. Revelou, P.; Tsakali, E.; Batrinou, A.; Strati, I.F. Applications of Machine Learning in Food Safety and HACCP Monitoring of Animal-Source Foods. Foods 2025, 14, 922. [Google Scholar] [CrossRef]
  124. Niu, B. Editorial: Applications of bioinformatics, machine learning and risk analysis for microbial food safety. Front. Microbiol. 2024, 15, 1414261. [Google Scholar] [CrossRef] [PubMed]
  125. Panaligan, D.; Sy, I.C.B.; Sarza, R.M. Harnessing artificial intelligence in microbial food safety: Global progress and implications in the ASEAN region. Int. J. Food Sci. Technol. 2024, 59, 7754–7766. [Google Scholar] [CrossRef]
  126. Donaghy, J.A.; Danyluk, M.D.; Ross, T.; Krishna, B.; Farber, J. Big Data Impacting Dynamic Food Safety Risk Management in the Food Chain. Front. Microbiol. 2021, 12, 668196. [Google Scholar] [CrossRef] [PubMed]
  127. Chun, S.-W.; Song, D.-J.; Lee, K.-H.; Kim, M.-J.; Kim, M.S.; Kim, K.-S.; Mo, C. Deep learning algorithm development for early detection of Botrytis cinerea infected strawberry fruit using hyperspectral fluorescence imaging. Postharvest Biol. Technol. 2024, 214, 112918. [Google Scholar] [CrossRef]
  128. Kang, H.; Lee, J.; Moon, J.; Lee, T.; Kim, J.; Jeong, Y.; Lim, E.K.; Jung, J.; Jung, Y.; Lee, S.J.; et al. Multiplex Detection of Foodborne Pathogens using 3D Nanostructure Swab and Deep Learning-Based Classification of Raman Spectra. Small 2024, 20, 2308317. [Google Scholar] [CrossRef]
  129. Tian, Y.; Liu, Z.; Huang, Y.; Bist, R.B.; Xiao, Y.; Howe, S.M.; Tsai, T.C.; Howell, T.; Subbiah, J.; Looper, M.L.; et al. Deep-learning-enhanced automated coherent-light diffraction system for high-speed, highly accurate strain-specific foodborne bacterial recognition. J. Agric. Food Res. 2025, 24, 102357. [Google Scholar] [CrossRef]
  130. Gorji, H.T.; Shahabi, S.M.; Sharma, A.; Tande, L.Q.; Husarik, K.; Qin, J.; Chan, D.E.; Baek, I.; Kim, M.S.; MacKinnon, N.; et al. Combining deep learning and fluorescence imaging to automatically identify fecal contamination on meat carcasses. Sci. Rep. 2022, 12, 2392. [Google Scholar] [CrossRef] [PubMed]
  131. Olaniyi, E.O.; Lu, Y.; Zhang, X.; Sukumaran, A.T.; Thames, H.T.; Pokhrel, D. Non-Destructive Assessment of Microbial Spoilage of Broiler Breast Meat Using Structured Illumination Reflectance Imaging with Machine Learning. Food Anal. Methods 2024, 17, 652–663. [Google Scholar] [CrossRef]
  132. Liu, Y.; Chen, G.; Xu, X.; Zhou, W.; Xie, C. Detection and visualization of Escherichia coli in pork using hyperspectral imaging-based deep learning. J. Agric. Food Res. 2025, 23, 102107. [Google Scholar] [CrossRef]
Figure 1. Schematic diagram of unsupervised learning (PCA, K-means, HCA) algorithm.
Figure 1. Schematic diagram of unsupervised learning (PCA, K-means, HCA) algorithm.
Foods 14 04005 g001
Figure 2. Schematic diagram of the LDA algorithm. The dush lines in the figure represent the classification boundaries.
Figure 2. Schematic diagram of the LDA algorithm. The dush lines in the figure represent the classification boundaries.
Foods 14 04005 g002
Figure 3. Schematic diagram of the Gaussian Naive Bayes classification algorithm.
Figure 3. Schematic diagram of the Gaussian Naive Bayes classification algorithm.
Foods 14 04005 g003
Figure 4. Schematic diagram of K-NN algorithm. The red star in the figure represents the critical center point.
Figure 4. Schematic diagram of K-NN algorithm. The red star in the figure represents the critical center point.
Foods 14 04005 g004
Figure 5. Schematic diagram of the SVM model. The black dots in the figure represent category 1, and the white dots represent category 2.
Figure 5. Schematic diagram of the SVM model. The black dots in the figure represent category 1, and the white dots represent category 2.
Foods 14 04005 g005
Figure 6. Schematic diagram of the Random Forest model.
Figure 6. Schematic diagram of the Random Forest model.
Foods 14 04005 g006
Figure 7. Schematic diagram of the Extreme Gradient Boosting model.
Figure 7. Schematic diagram of the Extreme Gradient Boosting model.
Foods 14 04005 g007
Figure 8. Schematic diagram of a typical Convolutional Neural Network (CNN) architecture.
Figure 8. Schematic diagram of a typical Convolutional Neural Network (CNN) architecture.
Foods 14 04005 g008
Figure 9. Schematic diagram of a typical RNN architecture.
Figure 9. Schematic diagram of a typical RNN architecture.
Foods 14 04005 g009
Figure 10. Schematic diagram of a typical Transformer architecture.
Figure 10. Schematic diagram of a typical Transformer architecture.
Foods 14 04005 g010
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zhang, Q.; Lu, Z.; Liu, Z.; Li, J.; Chang, M.; Zuo, M. Application of Machine Learning in Food Safety Risk Assessment. Foods 2025, 14, 4005. https://doi.org/10.3390/foods14234005

AMA Style

Zhang Q, Lu Z, Liu Z, Li J, Chang M, Zuo M. Application of Machine Learning in Food Safety Risk Assessment. Foods. 2025; 14(23):4005. https://doi.org/10.3390/foods14234005

Chicago/Turabian Style

Zhang, Qingchuan, Zhe Lu, Zhenqiao Liu, Jialu Li, Mingchao Chang, and Min Zuo. 2025. "Application of Machine Learning in Food Safety Risk Assessment" Foods 14, no. 23: 4005. https://doi.org/10.3390/foods14234005

APA Style

Zhang, Q., Lu, Z., Liu, Z., Li, J., Chang, M., & Zuo, M. (2025). Application of Machine Learning in Food Safety Risk Assessment. Foods, 14(23), 4005. https://doi.org/10.3390/foods14234005

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop