A foodborne pathogen classification method based on neural network structure search

Based on the method of searching for neural network structure, the deep neural network structure is optimized, and the problem of low accuracy and long training time of Raman spectrum classification of food -oriented germs, and achieves more efficient and accurate food -oriented germs recognition and classification.

CN119007823BActive Publication Date: 2025-01-24CHINA JILIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411336424.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-01-24
Estimated Expiration
2044-09-25

AI Technical Summary

Technical Problem

The prior art has problems with low classification accuracy and long training time in the Raman spectral classification of foodborne bacteria, especially under high noise conditions, making it difficult to accurately identify and classify foodborne bacteria.

Method used

The food -based germ classification method based on neural network structure search is adopted, and the deep neural network structure is optimized through the automated design mixed network architecture to combine the search technology of neural architecture to improve the accuracy and efficiency of classification. Specific steps include collecting and pre-processing Raman spectrum data, designing the U-Net neural network model, and using a block can be used to optimize the model of the search strategy of differential neuroma architectures, and finally generate a classifier for classification.

Benefits of technology

It significantly improves the classification accuracy of food -based germs, shortens the model optimization and training time, improves data quality, reduces interference during model training, and realizes more efficient food -oriented germs recognition and classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119007823B_ABST
    Figure CN119007823B_ABST
Patent Text Reader

Abstract

The present invention discloses a foodborne pathogen classification method based on neural network structure search, including: collecting surface enhanced Raman spectroscopy data of multiple sub-class pathogens corresponding to multiple foodborne pathogens, and performing preprocessing; automatically designing a U-Net neural network model architecture according to a hybrid network; training the U-Net neural network model, using a block-differentiable neural architecture search strategy to adjust the weights of each module of the U-Net neural network model; sampling the super network after pre-training optimized weight distribution, and determining the optimal module combination of each layer of the U-Net neural network model; using the architecture information obtained by sampling, constructing a new U-Net structure, training and generating a classifier, and realizing the classification of unknown foodborne pathogen samples. The method automatically designs the U-Net model architecture through a hybrid network, and can adaptively optimize the structure and parameters of the network, so that the model performs better in classifying different sub-class pathogens, and significantly improves the accuracy of classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical fields of Raman spectroscopy, neural network search and food safety detection, and more specifically to a foodborne pathogen classification method based on neural network structure search. Background Art

[0002] Foodborne pathogens such as Salmonella, Vibrio parahaemolyticus, Listeria monocytogenes, Escherichia coli O157:H7 and Shigella are harmful to human health. Traditional methods for detecting foodborne pathogens mainly rely on agar plate culture, which requires a long time of culture and identification based on physiological and biochemical characteristics. Although these methods are historically important, they are time-consuming and cumbersome under urgent detection needs.

[0003] In addition, with the development of technology, advanced technologies such as immunoassays, biosensors, gene probes and impedance methods have gradually been applied to pathogen detection. However, due to the diversity of bacterial species and the complexity of culture, these methods still face challenges in detection speed, cost and sensitivity.

[0004] As a fast, sensitive and non-destructive analytical tool, surface enhanced Raman spectroscopy (SERS) can achieve label-free rapid identification in foodborne pathogen detection applications, overcoming the time-consuming shortcomings of traditional detection methods. Through the microscopic Raman spectrometer system, the sampling of bacterial spectra at the submicron level can be achieved, providing a new technical solution for the instant diagnosis of foodborne diseases. However, due to the similarity of the main biological components (such as nucleic acids, proteins, lipids, carbohydrates, etc.) of different foodborne pathogens, the Raman spectra are similar, and the interference of noise in the spectra also increases the difficulty of distinguishing foodborne pathogens. General machine learning algorithms cannot meet the spectral classification under high noise conditions. Therefore, an accurate method must be used to extract and learn the features in Raman spectral data in order to accurately identify and classify foodborne pathogens.

[0005] Related deep learning techniques, especially convolutional neural networks (CNNs), have shown strong performance in image recognition and classification tasks, and are able to identify subtle differences in Raman spectra. However, choosing the right network architecture is crucial for classification performance. Existing studies, such as Resnet-based network architectures, mutual learning networks (CM-Net), and transformer-based network models, have demonstrated the ability of deep learning to handle high-dimensional and complex data.

[0006] Therefore, how to extract and learn features in Raman spectral data based on deep learning technology in order to accurately identify and classify foodborne pathogens is an urgent problem that technical personnel in this field need to solve. Summary of the invention

[0007] In view of this, the present invention provides a foodborne pathogen classification method based on neural network structure search, which aims to optimize the deep neural network (DNN) structure through the automated design of mixed network (Automated Design of Mixed Networks) architecture and the neural architecture search (NAS) technology to improve the accuracy and efficiency of foodborne pathogen classification. By implementing the block differentiable NAS (BDNAS) algorithm, the present invention can perform optimization search based on a predefined macro network architecture to obtain the most optimized model, thereby achieving high accuracy and design efficiency in Raman spectroscopy recognition tasks.

[0008] In order to achieve the above object, the present invention adopts the following technical solution:

[0009] The present invention provides a foodborne pathogen classification method based on neural network structure search, comprising the following steps:

[0010] S10, collecting surface enhanced Raman spectroscopy data of various subtypes of pathogens corresponding to various foodborne pathogens, and dividing them into a test set, a training set and a validation set after preprocessing;

[0011] S20. Automatically design the U-Net neural network model architecture based on the hybrid network;

[0012] S30, using the preprocessed training set data to train the U-Net neural network model, using a block-differentiable neural architecture search strategy, and adjusting the weights of each module of the U-Net neural network model according to the feedback results of the validation set;

[0013] S40, sampling the super network after pre-training optimized weight distribution, and determining the optimal module combination of each layer of the U-Net neural network model; using the architecture information obtained by sampling, constructing a new U-Net structure to form the final model architecture;

[0014] S50, train the final model architecture and generate a classifier;

[0015] S60. Use the trained neural network classifier to classify unknown foodborne pathogen samples.

[0016] Furthermore, in step S10, preprocessing is performed, including:

[0017] The OTSU method was used to calculate the mean square error between each Raman spectrum data and the average spectrum;

[0018] Taking one thousandth of the mean square error from the minimum value to the maximum value as the search step length, determining the segmentation threshold;

[0019] Dividing the Raman spectrum data into two groups according to the segmentation threshold; one group is data with a mean square error less than or equal to the segmentation threshold; and the other group is data with a mean square error greater than the segmentation threshold;

[0020] Traverse N times and find the threshold that maximizes the difference between the two sets of data as the optimal classification threshold;

[0021] All data smaller than the optimal classification threshold are retained to obtain spectral data with abnormal data filtered out after cleaning.

[0022] Furthermore, the step S20 includes:

[0023] Establish a U-Net network structure with vacancies in up and down sampling positions;

[0024] Preset candidate module sets for each layer of the U-Net network, including residual modules, Transformer modules, graph convolution modules, and gated convolution modules;

[0025] Construct a hypernetwork so that the modules of each layer are selected from a preset set of candidate modules.

[0026] Furthermore, in the preset candidate module set, the candidate blocks are uniformly represented using an inverted residual form, allowing input channel expansion and potential residual connections, and the formula for the candidate blocks is expressed as:

[0027] (1)

[0028] In formula (1), Proj represents linear projection, the input channel expansion ratio is represented by e, the original number of channels is c, and ac represents the final number of channels after expansion; Op represents the operator of the residual module, Transformer module, graph convolution module or gated convolution module; X and Y represent the input and output features respectively.

[0029] Furthermore, the Transformer module operator consists of multiple attention heads H, each of which captures different global context information by measuring the pairwise correlation between tokens. The formula is defined as follows:

[0030] (2)

[0031] (3)

[0032] In formula (3), h represents the number of attention heads, i represents the index value of the attention head; Q, K, and V represent the hidden dimensions obtained by linearly projecting the input sequence of length n. Query, key and value vector encodings of ; Indicates the dimension size of K; softmax means normalizing the obtained attention scores, and Concat means concatenating the results of all heads. represents the weight matrix output, and W is the weight matrix.

[0033] Furthermore, the graph convolution module operator is used to perform convolution operations on graph data in non-Euclidean space; is defined as:

[0034] (4)

[0035] in, Respectively represent the nodes and edges of the graph; the graph convolution module operator Defined as:

[0036] (5)

[0037] in, represents the Laplace matrix, W is the weight matrix, D represents the degree matrix of the graph, and A represents the learnable adjacency matrix, which describes the connection relationship between different nodes.

[0038] Furthermore, the gated convolution module operator is used to enhance the model's ability to dynamically select features. As a spatial attention unit with a gating mechanism, in the forward propagation process, dynamic adjustment of features is achieved through convolution and normalization operations. The implementation formula is as follows:

[0039] (6)

[0040] (7)

[0041] In formulas (6) and (7), Conv and DWConv represent convolution and depthwise separable convolution operations, X represents the input raw data, and a and Represents two feature maps after channel splitting; scale represents a learnable parameter used to control the strength of gated convolution; Represents the final output of the gated convolution module operator.

[0042] Furthermore, the residual module operator combines point convolution, depthwise separable convolution, batch normalization, activation function, and optional channel mixing and compressed excitation modules; a residual connection is used to add the input directly to the processed output; the formula of the residual module operator is as follows:

[0043] (8)

[0044] In formula (8), Represents the output of the residual module operator, X represents the input original data, and Residual represents the residual convolution operation, which is an optional operation. During the search process, it is determined whether to apply point convolution, channel mixing operation and / or depth-separable convolution operation.

[0045] Furthermore, the step S30 includes:

[0046] The U-Net neural network model is trained using the preprocessed training set data. During pre-training, the hypernetwork uses the Gumbel-Softmax strategy for search.

[0047] During each validation, the performance of the current model architecture on the validation set is evaluated and used as feedback to adjust the weights of each module.

[0048] Furthermore, the step S30 further includes:

[0049] An attention module is introduced into the output part of the U-Net neural network model to assist the neural network search and accelerate the convergence speed of the neural network search.

[0050] It can be seen from the above technical solution that compared with the prior art, the present invention has the following advantages:

[0051] 1. Improve classification accuracy

[0052] Adaptive network architecture design: By automatically designing the U-Net model architecture through a hybrid network and combining it with a block-differentiable neural architecture search strategy, the network structure and parameters can be adaptively optimized, making the model perform better in classifying different subclasses of pathogens, thereby significantly improving the classification accuracy.

[0053] 2. Accelerate model optimization and convergence

[0054] Combination of pre-training and automatic search: Using a block-differentiable neural architecture search strategy, the weights of each module of the model can be adjusted in real time according to the feedback of the validation set, and pre-training optimization can be performed before training. This method accelerates the optimization process of the model, allowing the model to converge faster and reduce training time.

[0055] 3. Innovative data cleaning solutions

[0056] The present invention uses the OTSU threshold segmentation algorithm as a cleaning algorithm for abnormal data, transplants the OTSU algorithm in the field of image processing to the field of Raman spectroscopy, optimizes the original data set, improves data quality, reduces interference in the model training process, and can help the model better learn the potential patterns in the data.

[0057] 4. Hybrid network automation design based on U-net architecture

[0058] The algorithm constructs a U-Net structure with vacancies in upper and lower sampling positions as a hypernetwork, and sets four search space modules, including residual modules, Transformer modules, graph convolution modules, and gated convolution modules. The design of multiple modules increases the diversity of the search space and helps to find a better architecture. In addition, the unique U-shaped structure of U-Net helps to capture contextual information and accurately locate the Raman spectra of biological samples that are severely affected by noise. The architecture obtained through automated search will be better than the manually designed architecture because the search process can explore architectural combinations that are difficult for humans to exhaust.

[0059] 5. Block-wise Differentiable Neural Architecture Search Strategy

[0060] The original discrete module selection problem is converted into a continuous optimization problem through a comprehensive loss function, which simplifies the search process. The use of the Gumbel-Softmax function and the validation set loss function to obtain feedback improves the search efficiency and allows the algorithm to easily add or replace modules in the search space to adapt to different tasks and needs. The sampling strategy that combines weights and random perturbations increases the randomness and diversity of the search process, which helps avoid local optimality.

[0061] 6. Attention Module Assisted Search

[0062] By adding an attention module to the output network, 0.1 of the output of the attention module is used as a reference for the final result. Therefore, in synchronous search, the network convergence speed can be accelerated and the efficiency can be improved. In addition, the attention module also returns the weight vector of the spectral data, allowing the network to better focus on the data at a specific location and improve the model's understanding of the Raman spectrum. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0064] Figure 1 A flow chart of the foodborne pathogen classification method based on neural network structure search provided by the present invention.

[0065] Figure 2 Schematic diagram of three step embodiments provided by the present invention.

[0066] Figure 3 This is a diagram of the OTSU data cleaning effect provided by the present invention.

[0067] Figure 4 A simplified diagram of the supernet search and search domain structure provided by the present invention.

[0068] Figure 5 The optimal network architecture diagram obtained by searching provided by the present invention.

[0069] Figure 6 Attention weight map of major categories of foodborne pathogens provided by the present invention.

[0070] Figure 7 The confusion matrix and ROC curve diagram of the test results provided by the present invention. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0072] Due to the large number of types of foodborne pathogens, for deep learning, on the one hand, deep learning network design is difficult, and manually designing a neural network architecture is a time-consuming and professional knowledge-requiring task. In addition, humans cannot manually search for all possible architectures in large-scale data and high-dimensional space. On the other hand, when building a database, each additional foodborne pathogen requires retraining. When the types of foodborne pathogens gradually increase, the model that originally had a good classification effect may not be able to adapt to the new database, resulting in a significant reduction in accuracy, which requires redesigning the model or increasing the network depth.

[0073] Neural architecture search can automatically search all possible architectures to find the best one, which greatly shortens the design time. In addition, neural network search can automatically tune without a lot of manual design and debugging, saving time and improving classification accuracy.

[0074] The present invention is based on neural network search technology and can solve the surface enhanced Raman spectroscopy (SERS) classification problem of foodborne pathogens through hybrid network automated design.

[0075] Reference Figure 1 As shown, the embodiment of the present invention discloses a foodborne pathogen classification method based on neural network structure search, including steps S10 to S60:

[0076] S10, collecting surface enhanced Raman spectroscopy data of various subtypes of pathogens corresponding to various foodborne pathogens, and dividing them into a test set, a training set and a validation set after preprocessing;

[0077] For example, in this embodiment, surface enhanced Raman spectroscopy data of 22 sub-types of 5 foodborne pathogens were collected, and the spectral data of each foodborne pathogen was more than 1000. Due to the low signal-to-noise ratio characteristics of the spectrum of biological samples, the OTSU method is used to clean the spectral data of each foodborne pathogen. The OTSU method calculates the inter-class variance of the spectral data of each type, leaving the data that is closer to the average class and eliminating other abnormal data. After the data cleaning is completed, 100 pieces of each data are taken as the test set, and the remaining data are divided into the training set and the verification set in a ratio of 9:1.

[0078] By transplanting the OTSU algorithm from the field of image processing to the field of Raman spectroscopy, the original data set is optimized, the data quality is improved, and the interference in the model training process is reduced, which can help the model better learn the potential patterns in the data.

[0079] S20. Automatically design the U-Net neural network model architecture based on the hybrid network;

[0080] S30, using the preprocessed training set data to train the U-Net neural network model, using a block-differentiable neural architecture search strategy, and adjusting the weights of each module of the U-Net neural network model according to the feedback results of the validation set;

[0081] S40, sampling the super network after pre-training optimized weight distribution, and determining the optimal module combination of each layer of the U-Net neural network model; using the architecture information obtained by sampling, constructing a new U-Net structure to form the final model architecture;

[0082] S50, train the final model architecture and generate a classifier;

[0083] S60. Use the trained neural network classifier to classify unknown foodborne pathogen samples.

[0084] In steps S20 to S60, a U-Net network structure with vacancies in upper and lower sampling positions is first constructed, and the most suitable module combination needs to be found for these positions. Therefore, a supernet is first constructed, in which the modules of each layer are selected from a preset set of candidate modules. The supernet not only contains all possible module combinations, but also reflects the contribution of each module by dynamically adjusting the weights. During pre-training, the supernet uses the Gumbel-Softmax strategy for search, and at each verification, evaluates the performance of the current model architecture on the verification set, and uses this performance as feedback information to adjust the weights of each module. By taking the performance of the verification set into consideration, the algorithm can more accurately select those modules that contribute the most to the final performance. Once the supernet training is completed, the next step is the sampling stage. By sampling the supernet, the algorithm can determine the optimal module combination for each layer based on the optimized weight distribution. The architecture information obtained by sampling will be used to construct a new U-Net structure, and this new network is the final model architecture.

[0085] Finally, the sampled architecture is filled into the same empty network and retrained to further optimize the model parameters and obtain the final performance improvement. Through this series of operations, the algorithm achieves efficient search and optimization from the hypernetwork to the final model architecture, successfully finds the optimal U-Net module combination, and further improves the model performance through retraining.

[0086] Among them, the hybrid network automatic design based on the U-net architecture realizes that the architecture obtained through automatic search will be better than the manually designed architecture, because the search process can explore architectural combinations that are difficult for humans to exhaust. In addition, the original discrete module selection problem is converted into a continuous optimization problem through a comprehensive loss function, which simplifies the search process. The use of the Gumbel-Softmax function and the validation set loss function to obtain feedback improves the search efficiency and allows the algorithm to easily add or replace modules in the search space to adapt to different tasks and needs. The sampling strategy that combines weights and random perturbations increases the randomness and diversity of the search process, which helps to avoid local optimality. The model performs better in classifying different subclasses of pathogens, thereby significantly improving the accuracy of classification.

[0087] The technical solution of the present invention is explained in detail through three parts below:

[0088] Reference Figure 2 As shown, it includes three steps: OTSU data cleaning, building a hypernetwork and searching for the optimal architecture, and classification testing of the optimal architecture model.

[0089] 1. Figure 2 Step 1: Data cleaning is performed using the OTSU algorithm.

[0090] OTSU is an algorithm for binary segmentation threshold in the field of image processing. The present invention transplants the OTSU algorithm to the field of Raman spectroscopy by calculating the mean square error (MSE) between each spectrum and the average spectrum. For each surface-enhanced Raman spectral data of foodborne pathogens, after calculating the mean square error, one thousandth of the mean square error from the minimum to the maximum value is used as the search step to determine the segmentation threshold. According to this segmentation threshold, the spectral data of this foodborne pathogen will be divided into two groups, one group (group1) with a mean square error less than or equal to this threshold, and one group (gropu2) with a mean square error greater than this threshold. The next step is to traverse 1000 times until the maximum inter-class variance of the two groups of data is found, and the threshold at this time is the best classification threshold. Take all data less than this threshold to obtain the spectral data after cleaning and filtering out abnormal data.

[0091] OTSU cleaning effect diagram Figure 3 As shown, A: represents the original data graph, from bottom to top: Escherichia, Listeria, Staphylococcus, Salmonella, Shigella; B: represents the data graph after OTSU cleaning, C: represents the PCA dimensionality reduction analysis graph of the original data graph, D: represents the PCA dimensionality reduction analysis graph after OTSU cleaning; Among them, PCA dimensionality reduction mainly plays a role in verification of different dimensions, such as Figure 3 C and D in Figure 2. By comparing these two 3D point group graphs, it can be seen that after OTSU cleaning, abnormal data will be cleaned up and the data distribution will be more concentrated. Figure 3 In the A and B parts, the spectral band diagram of part B is obviously smaller than that of part A, indicating that the data distribution is narrow and some abnormal data are filtered out. Comparing parts C and D, after PCA dimensionality reduction, the distribution of part D also has fewer free data points, and the whole picture is more compact and concentrated, indicating that the abnormal data is filtered out, which also shows that the OTSU data cleaning used in this case is more effective.

[0092] 2. For Figure 2 In Step 2, this embodiment uses a block-differentiable neural architecture search strategy to design a U-Net hybrid network. Figure 4 As shown in the figure, a U-Net structure with vacancies in up and down sampling positions is first constructed as a super network, and four search space modules are set, including: residual module (Residual), Transformer module, graph convolution module (Graphoemer) and gated convolution module (GSAU).

[0093] like Figure 5 As shown in the figure, it is the optimal network architecture diagram obtained by the search. The overall U-Net hybrid network consists of three parts, namely the front network, the network to be searched and the output network.

[0094] For the front network part, it is mainly composed of convolution layer, batch normalization layer and ReLU activation function. The input channel of the convolution layer is 1, the output channel is 16, and the size of the convolution kernel is [3,3]. The main function of this part is to change the shape of the input feature map and increase the feature channel.

[0095] For the part of the network to be searched, it is a sequential set of 6 blocks. In the invention, a macro search space is introduced, which contains general candidate blocks including Transformer, Graphormer, Gated Convolution (GSAU) and Residual Network (Residual), and attempts to assemble these blocks to create a novel high-performance Raman recognition network architecture. The candidate blocks are uniformly represented using an inverted residual form, allowing input channel expansion and potential residual connections (that is, the presence or absence of residual connections is also searchable). The formula of the candidate block can be expressed as:

[0096] (1)

[0097] In formula (1), Proj represents linear projection, the input channel expansion ratio is represented by e, which is usually a small integer such as 4, the original number of channels is c, and ac represents the multiplication of the 'input channel expansion ratio' and the 'original number of channels', that is, the final number of channels after expansion. Op can be a Residual operator, a Transformer operator, a Graphormer operator, or a GSAU operator, and X and Y represent the input and output features, respectively.

[0098] The Transformer operator consists of multiple attention heads H, each of which captures different global context information by measuring the pairwise correlation between tokens. The formula is defined as follows:

[0099] (2)

[0100] (3)

[0101] In formula (3), h represents the number of attention heads, Q, K, and V represent the hidden dimensions obtained by linearly projecting the input sequence of length n. The query, key, and value vector encodings of . is the dimension size of K; Denotes the weight matrix output, and W is the weight matrix. In this way, the Transformer operator first calculates the dot product between the key-query pair, then scales it to stabilize the training, normalizes the obtained attention score using softmax, and then calculates the weighted sum of the value vector encodings corresponding to different inputs. Finally, the results of all heads are concatenated (Concat operation) and further combined with the weight matrix output Project to generate output.

[0102] The Graphormer operator (abbreviated as Grcv operator) is a key operator in the graph convolutional network (GNN) that performs convolution operations on graph data in non-Euclidean space. is defined as:

[0103] (4)

[0104] in, Represent the nodes and edges of the graph respectively; the Graphormer operator is defined as:

[0105] (5)

[0106] in, represents the Laplace matrix, W is the weight matrix, D represents the degree matrix of the graph, and A represents the learnable adjacency matrix, which describes the connection relationship between different nodes. When the Raman spectrum passes through the Grcv operator, an adjacency matrix is ​​constructed to map the one-dimensional Raman spectrum to the graph structure. Therefore, the Raman intensity corresponding to different Raman shifts is assigned to each node in the graph structure, and the values ​​in the adjacency matrix represent the distance between the nodes. The fully connected layer can complete this task with the same number of input and output features. The structure of the constructed graph can be dynamically adjusted during the training process through certain parameter update methods. The Grcv calculation process along the graph structure can better preserve the structural information of the graph.

[0107] The GSAU operator is a variant that introduces a gating mechanism into a convolutional neural network to enhance the model's ability to dynamically select features. The GSAU of this algorithm is a spatial attention unit with a gating mechanism. During the forward propagation process, it implements dynamic adjustment of features through a series of convolution and normalization operations. The implementation formula is as follows:

[0108] (6)

[0109] (7)

[0110] In formulas (6) and (7), Conv and DWConv represent convolution and depthwise separable convolution operations, X represents the input raw data, and a and Represents two feature maps after channel splitting. scale represents a learnable parameter used to control the strength of the gated convolution. Represents the final output.

[0111] The Residual operator combines pointwise convolution, depthwise separable convolution, batch normalization, activation functions (such as ReLU), and optional channel shuffle and spatial expansion (SEModule). The Residual operator module can be regarded as a variant of residual convolution because it uses a residual connection to add the input directly to the output after a series of processing. The formula of the Residual operator is expressed as follows:

[0112] (8)

[0113] In formula (8), Represents the output of the Residual operator, X represents the original data, and Residual represents the residual convolution operation, including point convolution, channel mixing operation, depth-wise separable convolution operation, etc. These operations are optional operations and whether to apply them is determined during the search process.

[0114] By representing different candidate blocks in a unified format, each block can be characterized by the same set of configuration hyperparameters, except for the operation type, such as expansion rate and channel size. Therefore, the search space of operators is greatly simplified, which can speed up the search process. In addition, under the same network scale configuration, the computational cost of each candidate block is similar, and the comparison between different operator combinations is fairer.

[0115] Since different candidate blocks have different characteristics, it is not easy to merge them into a super network that can achieve excellent performance. In addition, since the newly introduced candidate blocks expand the search space, the mixed search space may make it more difficult to achieve effective NAS and further increase the search burden. Therefore, the algorithm uses a block-differentiable neural architecture search algorithm to solve the network architecture design problem. The neural architecture search problem is formulated as:

[0116] (9)

[0117] In formula (9), Loss represents the comprehensive loss, which is the weighted sum of the mean square error loss (MSE Loss) and the cosine similarity loss (Cosine Embedding Loss). Given an architecture space A, in order to find an optimal architecture a, the algorithm can only train its weights After that, it can achieve minimum loss This embodiment adopts a different paradigm to solve the problem. First, a random hypernetwork is used to represent the search space. In the hypernetwork reasoning process, each time a candidate operator is selected for sampling and execution, the probability of being sampled can be expressed as:

[0118] (10)

[0119] In formula (10), Op Indicates operator operation, It indicates the output obtained after the operator operates on the input data when the i-th operator is selected at the l-th layer. Contains parameters that determine the sampling probability distribution of each operator in the lth network layer . Equivalently, the output of the lth network module can be expressed as:

[0120] (11)

[0121] In formula (11), is a random variable between 0 and 1, Represents a given input feature map , operator The output in the lth network module. If the operator For sampling, The value of is 1, and the sampling probability is expressed by formula (10). We let each block sample independently, so the probability of sampling architecture a can be expressed as:

[0122] (12)

[0123] In formula (12), Represents that each operator on the lth layer All We no longer seek the best architecture with a discrete search space. , but rather relax the problem to optimize the probability of a random hypernetwork , to achieve the minimum expected cross entropy loss, that is:

[0124] (13)

[0125] Thus, overall, the loss function is relatively becomes differentiable, so it can be optimized by stochastic gradient descent (SGD). But specifically, due to the fact that is a discontinuous variable, so it is relatively In order to make the model trainable by gradient descent, this case uses the GumbelSoftmax function to Converted into a continuous vector as follows:

[0126] (14)

[0127] In formula (14), is random noise that follows a Gumbel distribution. Temperature parameter Controls the Gumbel Softmax function, when As it approaches 0, it will approximately obey discrete classification sampling. The final result is will become a continuous random variable. Therefore, through this method, the loss function is and architecture distribution parameters Fully differentiable, the SGD method can be used to update the weights and parameters of each block of the network.

[0128] At the same time, the loss function not only directly participates in the weight update process and guides the adjustment of weights, but also can be used as a feedback mechanism to provide a more direct and specific basis for the weight update. This means that during the training process, the value of the loss function and its changing trend are used to evaluate the current performance of the model, and based on this, decide how to adjust the model's weights in order to better fit the data and reduce future losses. Therefore, the loss function plays a vital role in deep learning. It is both the objective function of the optimization process and an important indicator for evaluating model performance. Our search process is equivalent to training a random hypernetwork. During the training process, we calculate To train the weight of each operator in the hypernetwork. After the operator training is completed, different operators contribute differently to the accuracy and efficiency of the entire network. Therefore, we calculate To update the sampling probability of each operator This step will select operators with higher accuracy and suppress operators with lower accuracy. After the hypernetwork training is completed, we can select the operators from the overall search architecture according to Get the optimal operator to form the optimal architecture.

[0129] For the output network part, this embodiment uses convolutional layers, average pooling layers, and fully connected layers as the output of the network to be searched, and introduces an attention module as an auxiliary output to speed up the convergence of the neural network search. In the final result output, the spectral data weight is returned to provide an interpretable analysis for the classification of foodborne pathogens. Since there are spectral samples of 22 subclasses of foodborne pathogens, the final result output is a vector of length 22, which stores the confidence of each foodborne pathogen. The output of the network to be searched accounts for 0.9 of this confidence, and the output of the attention module accounts for 0.1.

[0130] The attention module is mainly used to assist the output of the network to be searched, which can make the search converge faster, improve efficiency, and reduce convergence time. At the same time, the attention module will also return the global weight of the spectral data, which is convenient for interpretable analysis of the Raman spectra of foodborne pathogens, allowing the network to better focus on data at specific locations and improve the model's understanding of Raman spectra. Raman spectra are generally composed of some characteristic peak data and sparse vectors without obvious peaks. The Raman shift corresponding to the characteristic peak and its shape are often the key to determining what a substance is. Figure 6 The vertical axis represents relative intensity, and the horizontal axis represents Raman shift. In the spectrum of each foodborne pathogen, the dark part represents the greater contribution weight here, indicating that the model pays more attention to this part. The model has different attention points for different foodborne pathogens. This is specifically manifested in that the weights output by the model attention module are different at different Raman shifts. Some characteristic peaks have higher contribution weights, indicating that this characteristic peak or this Raman shift segment is the key to distinguishing these.

[0131] In this embodiment, the network architecture design problem is solved by using a block-differentiable neural architecture search algorithm. In the hypernetwork search process, although each search space module is discrete, we can make the search space continuous by predefining the macro architecture (hypernetwork) and the comprehensive loss function. At each layer of the network, the algorithm initializes multiple candidate modules and assigns an initial weight to each module. Next, sampling is performed using the Gumbel-Softmax strategy, which combines weight distribution and random perturbations, so that different modules have the opportunity to be selected in the early stages, increasing the diversity of exploration.

[0132] 3. For Figure 2 Step 3: Classification test of the optimal architecture model.

[0133] This embodiment uses resnet16 as a similar comparison model and compares it with the results of the optimal architecture NAS-U-net obtained by the present invention. Figure 7As shown, part A in the figure is a comparison diagram of the confusion matrix of resnet-16 and the algorithm proposed by the present invention. The green upper triangle in the confusion matrix represents the data of resnet-16, and its average accuracy is 89.18%. The red lower triangle represents the data of NAS-U-net, and its average accuracy is 92.77%; part B in the figure is the ROC curve of resnet-16, and part C in the figure is the ROC curve of NAS-U-net. The closer the area surrounded by the ROC curve is to 1, the higher the model accuracy is, so it can be seen that NAS-U-net has higher accuracy. Among them, the ordinate TPR (True Positive Rate, positive case coverage) of parts B and C: the proportion of true values ​​being positive and predicted to be positive, also called sensitivity; the abscissa FPR (False Positive Rate, negative case coverage): the proportion of true values ​​being negative and predicted to be positive, also called specificity.

[0134] That is, from the confusion matrix, the average accuracy of NAS-U-net on the test set is 92.77%, which is more than 3% higher than resnet16. From the ROC curve, the area surrounded by the ROC curve of NAS-U-net is closer to 1, indicating that the classification effect of NAS-U-net is better than that of resnet16.

[0135] In addition, the present invention was tested on a data set containing 5 foodborne pathogens (22 sub-class pathogens), and the average accuracy can reach 92.77%, which is better than the traditional resnet-16 model. The current practical application of the present invention is the result of a 6-layer network search under the U-net architecture, which is a better version of the network that combines network computing time and accuracy. In fact, the network can be added or replaced, such as searching for networks with 8, 9, or 10 layers or more. Although certain effects can be obtained, it often leads to an increase in model complexity and prolonged computing time.

[0136] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0137] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A foodborne pathogen classification method based on neural network structure search, characterized in that: The following steps are involved: S10, collecting surface enhanced Raman spectroscopy data of various subtypes of pathogens corresponding to various foodborne pathogens, and dividing them into a test set, a training set and a validation set after preprocessing; S20. Automatically design the U-Net neural network model architecture based on the hybrid network; S30, using the preprocessed training set data to train the U-Net neural network model, using a block-differentiable neural architecture search strategy, and adjusting the weights of each module of the U-Net neural network model according to the feedback results of the validation set; S40, sampling the super network after pre-training optimized weight distribution, and determining the optimal module combination of each layer of the U-Net neural network model; using the architecture information obtained by sampling, constructing a new U-Net structure to form the final model architecture; S50, train the final model architecture and generate a classifier; S60, using the trained neural network classifier to classify unknown foodborne pathogen samples; Wherein, the step S20 includes: Establish a U-Net network structure with vacancies in up and down sampling positions; Preset candidate module sets for each layer of the U-Net network, including residual modules, Transformer modules, graph convolution modules, and gated convolution modules; Construct a hypernetwork so that the modules of each layer are selected from a preset set of candidate modules; In the preset candidate module set, the candidate blocks are uniformly represented using an inverted residual form, allowing input channel expansion and potential residual connections. The formula for the candidate block is expressed as: Y=X+Proj ec→c (Op(Proj c→ec (X))) (1) In formula (1), Proj represents linear projection, the input channel expansion ratio is represented by e, the original number of channels is c, and ec represents the final number of channels after expansion; Op represents the operator of the residual module, Transformer module, graph convolution module or gated convolution module; X and Y represent the input and output features respectively; The operator of the Transformer module consists of multiple attention heads H, each of which captures different global context information by measuring the pairwise correlation between tokens. The formula is defined as follows: Y Attn =Concat(H1,…,H h )·W O (2) In formula (3), h represents the number of attention heads, i represents the index value of the attention head; Q, K, and V represent the hidden dimension d obtained by linearly projecting the input sequence of length n. k The query, key and value vector encodings of d k represents the dimension size of K; softmax represents the normalization of the obtained attention scores, Concat represents the concatenation operation of the results of all heads, and W O represents the weight matrix output, W is the weight matrix; The operator of the graph convolution module is used to perform convolution operations on graph data in non-Euclidean space; is defined as: Wherein, Vn and E represent the nodes and edges of the graph respectively; the graph convolution module operator Y Grcv Defined as: Y Grcv =LXW,L=D-A (5) Among them, L=DA represents the Laplace matrix, W is the weight matrix, D represents the degree matrix of the graph, and A represents the learnable adjacency matrix, which describes the connection relationship between different nodes; The operator of the gated convolution module is used to enhance the model's ability to dynamically select features. As a spatial attention unit with a gating mechanism, dynamic adjustment of features is achieved through convolution and normalization operations during forward propagation. The implementation formula is as follows: a,X'=Conv1(X) (6) Y GSAU =X+scale(·)(Conv2(DWConv(a)·X′)) (7) In formulas (6) and (7), Conv and DWConv represent convolution and depthwise separable convolution operations, X represents the original input data, a and X′ represent the two feature maps after channel splitting; scale represents a learnable parameter used to control the strength of gated convolution; Y GSAU Represents the final output of the gated convolution module operator; The operator of the residual module combines point convolution, depth-separable convolution, batch normalization, activation function, and optional channel mixing and compressed excitation modules; residual connection is used to add the input directly to the processed output; the formula of the residual module operator is as follows: Y Conv =X+Residual(X) (8) In formula (8), Y Conv Represents the output of the residual module operator, X represents the input original data, and Residual represents the residual convolution operation, which is an optional operation. During the search process, it is determined whether to apply point convolution, channel mixing operation and / or depth-separable convolution operation.

2. A foodborne pathogen classification method based on neural network structure search according to claim 1, characterized in that: In the step S10, preprocessing is performed, including: The OTSU method was used to calculate the mean square error between each Raman spectrum data and the average spectrum; Taking one thousandth of the mean square error from the minimum value to the maximum value as the search step length, determining the segmentation threshold; Dividing the Raman spectrum data into two groups according to the segmentation threshold; one group is data with a mean square error less than or equal to the segmentation threshold; and the other group is data with a mean square error greater than the segmentation threshold; Traverse N times and find the threshold that maximizes the difference between the two sets of data as the optimal classification threshold; All data smaller than the optimal classification threshold are retained to obtain spectral data with abnormal data filtered out after cleaning.

3. A foodborne pathogen classification method based on neural network structure search according to claim 1, characterized in that: The step S30 includes: The U-Net neural network model is trained using the preprocessed training set data. During pre-training, the hypernetwork uses the Gumbel-Softmax strategy for search. During each validation, the performance of the current model architecture on the validation set is evaluated and used as feedback to adjust the weights of each module.

4. A foodborne pathogen classification method based on neural network structure search according to claim 3, characterized in that: The step S30 further includes: An attention module is introduced into the output part of the U-Net neural network model to assist the neural network search and accelerate the convergence speed of the neural network search.

Citation Information

Patent Citations

  • Agricultural plastic mulching film for controlling alternaria brassicicola of vegetables and preparation method thereof

    CN107778738A

  • Food-borne pathogenic bacterium classification method

    CN110245713A