Food-borne pathogen Raman spectrum classification method and system based on neural network

Through the Raman spectral classification method of foodborne pathogens based on recurrent neural network, the problems of long processing time, complex operation and high equipment cost in traditional detection technology are solved, and the rapid and accurate classification of foodborne pathogens is achieved, which enhances the Distinguish between ability and detection stability.

CN119202845APending Publication Date: 2024-12-27SHANGHAI INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411372743.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

Traditional microbial detection techniques have problems of long processing time, complex operation, high equipment cost, and limited sensitivity and specificity when distinguishing highly similar pathogens.

Method used

Raman spectral classification method for foodborne pathogens based on recurrent neural networks (RNNs) is used to preprocess Raman spectral data, build a recurrent neural network model, and evaluate the model performance using cross-validation to optimize the network model to achieve efficient classification.

Benefits of technology

It significantly improves the Raman spectral classification speed and accuracy of foodborne pathogens, reduces detection time and equipment dependence, enhances the ability to distinguish highly similar pathogens, and improves the generalization ability and detection stability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202845A_ABST
    Figure CN119202845A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of machine learning and Raman spectrum, in particular to a food-borne pathogen Raman spectrum classification method and system based on a neural network, and the method comprises the steps: carrying out the preprocessing of germ data obtained through an experiment; constructing a recurrent neural network (RNN) model, and processing and classifying the Raman spectrum data of the germs; and evaluating the performance of the model by using cross validation, and optimizing the network model. The food-borne pathogen Raman spectrum classification speed and accuracy are remarkably improved by utilizing the efficient data processing capacity of the recurrent neural network, the generalization capacity of the model for unseen data is improved through data enhancement and model optimization, the stability and reliability of detection are ensured, and the detection accuracy is improved. The method is suitable for large-scale data processing and real-time analysis, and the efficiency and application range of microbiological detection are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of machine learning and Raman spectroscopy technology, and in particular to a foodborne pathogen Raman spectroscopy classification method and system based on a neural network. Background Art

[0002] The increase in foodborne illnesses poses a serious threat to public health, driving the need for more efficient and accurate pathogen detection technologies. Traditional microbial detection techniques, such as culture and molecular biology methods, are widely used, but they typically require long processing times and have limited sensitivity and accuracy in complex samples. In contrast, Raman spectroscopy provides a rapid, non-invasive detection method, but how to process and analyze complex spectral data for efficient pathogen classification remains a major challenge.

[0003] This paper proposes a Raman spectroscopy classification method for foodborne pathogens based on a recurrent neural network (RNN). The Raman spectral data undergoes thorough preprocessing, including signal enhancement, background noise removal, and feature extraction, to ensure data quality meets the requirements of deep learning models. A RNN model utilizing long short-term memory (LSTM) units is designed and implemented to capture the time series features in spectral data, enabling efficient classification of 11 foodborne pathogens, including Escherichia coli, Salmonella, and Staphylococcus aureus. Summary of the Invention

[0004] In view of the above problems in the prior art, the present invention is proposed.

[0005] Therefore, the present invention provides a neural network-based Raman spectroscopy classification method for foodborne pathogens. This method addresses the long processing time, complex operation, and high equipment costs of traditional methods, as well as their limited ability to distinguish between highly similar pathogens. By leveraging the sequential data processing capabilities of recurrent neural networks, the present invention can more effectively process and analyze differences in spectral data, thereby accurately classifying multiple highly similar pathogens.

[0006] To solve the above technical problems, the present invention provides the following technical solution: a neural network-based Raman spectroscopy classification method for foodborne pathogens, including: preprocessing pathogen data obtained through experiments; constructing a recurrent neural network (RNN) model to process and classify pathogen Raman spectroscopy data; and using cross-validation to evaluate the performance of the model and optimize the network model.

[0007] As a preferred embodiment of the neural network-based Raman spectroscopy classification method for foodborne pathogens of the present invention, the preprocessing includes normalization, moving average denoising, Lasso regression dimensionality reduction, and data enhancement to generate new samples;

[0008] The normalization process includes selecting Min-Max technology to process the Raman spectrum data;

[0009] The moving average denoising includes processing spectral data using a moving average method to reduce random noise and evaluating the smoothing effect of the data after moving average denoising.

[0010] As a preferred embodiment of the neural network-based Raman spectroscopy classification method for foodborne pathogens described in the present invention, the Lasso regression dimensionality reduction includes introducing an L1 penalty term to constrain the absolute value of the regression coefficient, select the influencing features on the output variable, and simplify the model structure;

[0011] The data enhancement method for generating new samples includes adding random noise as a data enhancement method to simulate measurement errors in experiments, thereby increasing the generalization ability of the model and reducing overfitting.

[0012] As a preferred embodiment of the neural network-based Raman spectroscopy classification method for foodborne pathogens described in the present invention, the recurrent neural network (RNN) model includes an input layer, a recurrent layer, a batch normalization layer, an activation layer, a dropout layer, a fully connected layer, and an output layer. Considering the complexity of the data and the requirements of the deep learning task, the number of units in the recurrent layer is set, the recurrent network layer is implemented using Python and a deep learning library, the number of layers and the number of nodes in each layer are determined, and the optimizer and loss function are selected.

[0013] Before training the model, summarize and verify the model architecture to ensure that all layers are configured correctly, preview the total number of model parameters, perform batch data training, update network parameters, and optimize the network structure.

[0014] As a preferred embodiment of the neural network-based Raman spectroscopy classification method for foodborne pathogens described in the present invention, the performance of the model evaluated using cross-validation is evaluated by dividing the data set into a test set and a training set, and evaluating the performance of the model on different data subsets.

[0015] As a preferred solution of the neural network-based Raman spectroscopy classification method for foodborne pathogens described in the present invention, wherein: said optimizing the network model includes adjusting model parameters and optimizing network configuration;

[0016] Adjusting the model parameters includes adjusting the learning rate to accelerate the convergence process and reduce the loss.

[0017] As a preferred embodiment of the neural network-based Raman spectroscopy classification method for foodborne pathogens described in the present invention, the optimized network configuration includes adjusting the number of neural network layers and the number of units in each layer to adapt to the complexity of the model, implementing a dropout regularization strategy to reduce overfitting, reducing the learning rate during training, adjusting the model, and optimizing performance.

[0018] Another objective of the present invention is to develop a neural network-based Raman spectroscopy classification system for foodborne pathogens, which has been plagued by long processing time, high equipment costs, complex operation, and limited sensitivity and specificity when identifying highly similar pathogens. The present invention proposes a Raman spectroscopy classification method based on a neural network (specifically a recurrent neural network, RNN) that, through automated and intelligent processing, can quickly and accurately classify foodborne pathogens.

[0019] As a preferred solution of the neural network-based Raman spectroscopy classification system for foodborne pathogens described in the present invention, it includes: a preprocessing and enhancement module, a model building and optimization module, and a model evaluation and verification module;

[0020] The preprocessing and enhancement module ensures the quality and consistency of the input data through normalization and moving average denoising, and enhances the Chinese data through Lasso regression dimensionality reduction to improve the generalization ability of the model and reduce overfitting;

[0021] The model construction and optimization module constructs a neural network model including an input layer, a recurrent layer, and an output layer, selects an optimizer and a loss function, and optimizes the model structure and performance by adjusting network parameters;

[0022] The model evaluation and validation module uses cross-validation to evaluate the performance of the model and ensure the stability and accuracy of the model, and improves the predictive ability of the model through systematic parameter adjustment.

[0023] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and wherein when the processor executes the computer program, the steps of any one of the methods for Raman spectroscopy classification of foodborne pathogens based on a neural network are implemented.

[0024] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of any one of the methods for Raman spectroscopy classification of foodborne pathogens based on a neural network are implemented.

[0025] Beneficial effects of the present invention: The present invention significantly improves the speed and accuracy of Raman spectroscopy classification of foodborne pathogens by utilizing the efficient data processing capabilities of recurrent neural networks. Compared with traditional methods, the present invention not only shortens detection time, reduces dependence on expensive equipment and operational complexity, but also enhances sensitivity and specificity, effectively distinguishing highly similar pathogens. Through data enhancement and model optimization, the model's ability to generalize to unseen data is improved, ensuring the stability and reliability of detection. It is suitable for large-scale data processing and real-time analysis, greatly improving the efficiency and application range of microbial detection. These integrated advantages make the present invention a significant technological advancement and practical value in the field of foodborne pathogen detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0027] Figure 1 A schematic flow chart of a method for foodborne pathogen Raman spectroscopy classification based on a neural network according to an embodiment of the present invention.

[0028] Figure 2 Schematic diagram of the main connection layers of a basic RNN unit in a neural network-based Raman spectroscopy classification method for foodborne pathogens provided by one embodiment of the present invention.

[0029] Figure 3 Original Raman spectra of various pathogens according to the neural network-based Raman spectrum classification method for foodborne pathogens provided by one embodiment of the present invention.

[0030] Figure 4 This is a Raman spectrum diagram of various pathogens after processing using the neural network-based Raman spectrum classification method for foodborne pathogens provided by an embodiment of the present invention.

[0031] Figure 5 A graph showing the relationship between the number of retained features and the R^2 parameter after Lasso dimensionality reduction for a neural network-based Raman spectroscopy classification method for foodborne pathogens provided in one embodiment of the present invention.

[0032] Figure 6 A graph showing the relationship between the number of hidden layers and prediction accuracy of a recurrent neural network for a neural network-based Raman spectroscopy classification method for foodborne pathogens provided in one embodiment of the present invention. DETAILED DESCRIPTION

[0033] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, the following detailed description of the specific embodiments of the present invention is given in conjunction with the accompanying drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in this field without creative work should fall within the scope of protection of the present invention.

[0034] Example 1, reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, provides a foodborne pathogen Raman spectroscopy classification method based on a neural network, comprising:

[0035] S1: Preprocess the pathogen data obtained through experiments.

[0036] It should be noted that the raw Raman spectral data was normalized to reduce data deviations between different devices and improve data processing consistency. Min-Max normalization was selected for processing the Raman spectral data. This is a common data preprocessing technique used to scale the data to a specified range, typically 0 to 1. The maximum and minimum values ​​of each feature in the Raman spectral dataset were calculated, and these values ​​were used in subsequent data conversion processes.

[0037] The Min-Max formula is expressed as,

[0038]

[0039] Among them, x' is the normalized data, x min is the minimum value of the input data, x max is the maximum value of the input data, and x is the original value of the data;

[0040] It should be noted that the moving average method is used to smooth the spectral data to effectively reduce random noise and improve the signal-to-noise ratio of the data. The window size in the moving average is determined. The window size affects the denoising effect. A larger window can better reduce noise, but may cause the characteristics of the signal to become less obvious. The choice of window size depends on the specific characteristics of the data and the required degree of smoothing. The moving average formula is applied to each data point. In the moving average, the value of the current point is determined by itself and the values ​​of the adjacent points before and after it. The moving average formula is expressed as,

[0041]

[0042] Among them, y t is the output at time point t, N is the total number of points in the time window, k is the window radius, x t+i is the data at time point t+i in the input sequence, where i is the index offset;

[0043] Process the beginning and end of a data sequence. Because the window may not fully cover all data points at the sequence boundaries, this is typically addressed by expanding the boundary data or applying a smaller window. Evaluate the smoothing effect of moving average denoising on the data to ensure that noise reduction is achieved while preserving key data features.

[0044] It should be noted that the L1 penalty term is introduced to constrain the absolute value of the regression coefficients, pushing some regression coefficients toward zero. This penalty mechanism automatically selects features that significantly influence the output variable and eliminates unimportant features. This simplifies the model structure, controls complexity, and effectively reduces the risk of overfitting.

[0045] Lasso regression dimensionality reduction reduces the complexity of the model by reducing the number of features—that is, the amount of data and number of parameters required for model training and prediction—reducing the risk of overfitting and significantly improving computing speed, that is, the time required to complete a task under given resources, thereby optimizing overall data processing efficiency.

[0046] It should be noted that a suitable data enhancement technique is selected, and adding random noise (such as Gaussian noise) is selected as a way of data enhancement to simulate the measurement error in the experiment.

[0047] S2: Construct a recurrent neural network (RNN) model to process and classify pathogen Raman spectroscopy data.

[0048] It should be noted that if Figure 2 As shown, a recurrent neural network model is constructed. The model includes an input layer, multiple recurrent layers (such as LSTM or GRU layers), and an output layer. The recurrent layer uses its state units to capture long-term dependencies in time series data. Design a neural network that includes an input layer, multiple recurrent layers, and an output layer. Select the type of recurrent layer (such as LSTM or GRU) that can process time series data and capture long-term dependencies. The main connection layer settings of the basic RNN unit are as follows:

[0049] Mapping from input layer to hidden layer: using weight matrix W hh 、W hx and the bias vector b h , calculate the hidden state h(n) of the input data x(n) at each time step n, the formula is expressed as,

[0050] h(n)=φ(W hh h(n-1)+W hx x(n)+b h )

[0051] Where φ is the activation function (such as tanh or ReLU).

[0052] Mapping from hidden layer to output layer: Output y(n) is generated by hidden state h(n) through weight W yh and bias b y Conversion, commonly used softmax function for classification, the formula is expressed as,

[0053] y(n)=σ(W yh h(n)+b y )

[0054] Loss function: Use cross entropy or mean square error to calculate the loss L(n) at each time step and accumulate the total loss L for the entire sequence total , the formula is expressed as,

[0055]

[0056] Parameter update: Update the model parameters θ by gradient descent or its variants such as Adam and RMSprop, and the learning rate is set to α. The formula is expressed as,

[0057]

[0058] in, is the partial derivative.

[0059] The use of recurrent neural networks for Raman spectroscopy classification, through its ability to effectively process time series data - that is, the network uses a memory mechanism to identify and utilize the temporal dependencies in the input data - improves the model's ability to capture the characteristics of Raman spectroscopy data and significantly enhances the accuracy and efficiency of classification.

[0060] Parameter setting: Specify the number of units (neurons) for the recurrent layer, which usually depends on the complexity of the data and the requirements of the deep learning task. More units can capture more complex patterns, but may result in increased computational cost.

[0061] Implementing a recurrent network layer: Implement a recurrent network layer using Python and a deep learning library such as TensorFlow or PyTorch. Set the layer parameters, such as choosing LSTM or GRU, and determine the number of layers and the number of nodes per layer.

[0062] Configure the learning process: Set the model compilation parameters, such as loss function, optimizer, and evaluation metrics. Choose an appropriate optimizer and loss function to suit the classification task.

[0063] Model Summarization and Validation: Before training the model, summarize and validate the model architecture to ensure all layers are configured correctly and preview the total number of model parameters. Use the Adam optimizer to optimize the network model parameters. The pseudocode snippet for the Adam optimizer is shown in Table 1.

[0064] Table 1 Pseudo code table of Adam optimizer

[0065]

[0066] The Adam optimizer is used to optimize network model parameters. Its adaptive learning rate adjustment mechanism—that is, adjusting the learning rate of each parameter based on the mean of the squared historical gradients of the parameter—improves the efficiency and convergence speed of model training, thereby significantly improving the stability and performance of the overall training process.

[0067] S3: Use cross-validation to evaluate the performance of the model and optimize the network model.

[0068] The cross-validation method is used to evaluate the performance of the model by dividing the dataset into five equal parts, using one of the parts as a test set and the other four as training sets to train the RNN model, and summarizing and calculating the average of the five tests to evaluate the comprehensive performance of the model.

[0069] To optimize the performance of the recurrent neural network model, the following parameters are adjusted:

[0070] Use a higher learning rate to quickly approach the optimal solution. Using a higher learning rate at the beginning can speed up the convergence process and quickly reduce the loss.

[0071] Adjust the number of neural network layers and the number of units in each layer to adapt to the complexity of the model, adjust the recurrent layer type (for example, from LSTM to GRU or vice versa), and choose the most suitable recurrent layer according to the needs of the specific task and the characteristics of the data.

[0072] Regularization strategies such as dropout are implemented to reduce overfitting, and the learning rate is gradually reduced during training to fine-tune the model and optimize performance.

[0073] Due to the adoption of the above technical solution, the present invention has faster processing speed and higher accuracy compared with the existing technology, can effectively process large amounts of data, support real-time analysis, and significantly improve the efficiency and accuracy of microbial detection.

[0074] Embodiment 2, the second embodiment of the present invention, is different from the previous embodiment in that:

[0075] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0076] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0077] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.

[0078] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0079] Example 3, the third embodiment of the present invention, provides a foodborne pathogen Raman spectroscopy classification system based on a neural network, characterized by comprising a preprocessing and enhancement module, a model building and optimization module, and a model evaluation and verification module;

[0080] The preprocessing and enhancement module ensures the quality and consistency of the input data through normalization and moving average denoising, and enhances the Chinese data through Lasso regression dimensionality reduction to improve the generalization ability of the model and reduce overfitting;

[0081] The model construction and optimization module constructs a neural network model including an input layer, a recurrent layer, and an output layer, selects an optimizer and a loss function, and optimizes the model structure and performance by adjusting network parameters;

[0082] The model evaluation and validation module uses cross-validation to evaluate the performance of the model and ensure the stability and accuracy of the model, and improves the predictive ability of the model through systematic parameter adjustment.

[0083] Example 4, reference Figure 3-Figure 6 The fourth embodiment of the present invention provides a foodborne pathogen Raman spectroscopy classification method based on a neural network. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.

[0084] like Figure 3The figure shows the original Raman spectra of various pathogens. The horizontal axis represents the Raman shift, which indicates the frequency shift in the spectrum. The vertical axis represents the Raman intensity, which indicates the intensity of the Raman scattered light. Curves of different colors represent the Raman spectra of different pathogens. The blue curve represents Yersinia enterocolitica, the orange curve represents Klebsiella pneumoniae, the green curve represents Salmonella enterica, the red curve represents Escherichia coli, the purple curve represents Shigella flexneri, the brown curve represents Burkholderia pseudomallei, the pink curve represents Staphylococcus aureus, the gray curve represents Vibrio parahaemolyticus, the yellow curve represents Acinetobacter baumannii, the turquoise curve represents Salmonella enterica, and the dark blue curve represents Vibrio cholerae. Figure 3 The spectral characteristics of each pathogen at different Raman shifts are displayed, which can be used to distinguish these pathogens. This spectral pattern can be used for the detection and classification of foodborne pathogens.

[0085] Normalize the raw Raman spectral data to reduce data bias between different devices and improve data processing consistency. Select the MinMaxScaler function from the sklearn.preprocessing library to perform Min-Max normalization on the Raman spectral data. Set the feature_range = (0, 1) parameter to ensure that all feature values ​​are converted to between 0 and 1.

[0086] The MinMaxScaler is used to automatically calculate the maximum value (max_attribute) and minimum value (min_attribute) of each feature from the Raman spectral dataset. Each feature value is transformed using the fit_transform method of the MinMaxScaler, and the data is normalized using the internally calculated maximum and minimum values.

[0087] The rolling method in the pandas library is used to perform moving average denoising on the Raman spectral data to effectively reduce random noise and improve the signal-to-noise ratio of the data.

[0088] The window parameter in the rolling method sets the moving average window size. The window size affects the denoising effect; larger windows provide better noise reduction but may cause signal features to become less distinct. Choosing the window size depends on the specific characteristics of the data and the desired degree of smoothing. The moving average formula is applied using the mean() function after the rolling method to smooth the data. When using the rolling method, the min_periods parameter is set to a smaller value to account for edge cases at the beginning and end of the data sequence, ensuring that the calculation can still be performed even when the window is at the sequence boundary.

[0089] Evaluate the smoothing effect of the moving average denoised data by visually inspecting the smoothed graph or using statistical methods (such as calculating the signal-to-noise ratio before and after smoothing) to ensure that the noise has been effectively reduced while retaining the key features of the data. This can be achieved by plotting the spectra before and after denoising for comparison.

[0090] Use the Lasso class in the sklearn.linear_model module to apply the Lasso regression method to reduce the data dimensionality. This optimizes feature selection by introducing an L1 penalty term. This L1 penalty term constrains the absolute values ​​of the regression coefficients, pushing some of them toward zero. The alpha parameter in the Lasso class controls the strength of the L1 penalty. A larger alpha value increases the constraint on the coefficients, pushing more coefficients toward zero.

[0091] Through the above penalty mechanism, features that have a significant impact on the output variable are automatically selected, while unimportant features are eliminated. Lasso regression uses its characteristics to achieve this, automatically performing feature selection, effectively simplifying the data model and improving prediction accuracy.

[0092] The effect of the number of retained features on the R^2 parameter after Lasso dimensionality reduction is as follows: Figure 4 As shown in the figure, the relationship between model performance and the number of retained features (Raman spectra of various pathogens) is shown. The horizontal axis in the figure represents the number of retained features (Number of Features Retained), and the vertical axis represents the cross-validated score (Cross-Validated Score, R 2 ). As can be seen in the figure, when the number of retained features is small, the cross-validation score of the model is low, and as the number of retained features increases, the performance of the model (R 2The value) gradually increases and reaches a peak (around 100 features). However, when the number of features continues to increase, the model performance begins to decline, indicating that introducing too many features will lead to overfitting of the model or introduce noise, which in turn reduces the generalization ability of the model. Figure 4 It shows that when the model is performing feature selection, retaining an appropriate amount of features can achieve the best performance. Too many or too few features will affect the performance of the model.

[0093] By reducing unnecessary model complexity, Lasso helps improve the generalization ability of the model, making the model more stable and reliable on unseen data. By using `Lasso` for regression analysis, high-dimensional data can be effectively processed, reducing data redundancy while retaining the most important information for model prediction. This method is particularly suitable for processing data sets with multicollinearity. After preprocessing, the Raman spectral data is as follows Figure 5 Figure 2 shows the normalized and smoothed Raman spectra of various pathogens. The horizontal axis represents the Raman shift, which represents the shift or frequency change in the Raman spectrum. The vertical axis represents the normalized Raman intensity, which ranges from 0 to 1 and represents the normalized spectral intensity. The different colored curves in the figure represent the Raman spectra of different pathogens. The blue curve represents Yersinia enterocolitica, the orange curve represents Klebsiella pneumoniae, the green curve represents Salmonella enterica, the red curve represents Escherichia coli, the purple curve represents Shigella flexneri, the brown curve represents Burkholderia pseudomallei, the pink curve represents Staphylococcus aureus, the gray curve represents Vibrio parahaemolyticus, the yellow curve represents Acinetobacter baumannii, the light blue curve represents Salmonella enterica, and the dark blue curve represents Vibrio cholerae. These curves show the spectral responses of different pathogens at different Raman shifts. The normalization process makes the intensity range of each spectral curve uniform, which is convenient for comparative analysis.

[0094] Generate new samples through data enhancement to increase the generalization ability of the model and reduce overfitting. Select appropriate data enhancement technology and add random noise (such as Gaussian noise) as a way of data enhancement to simulate measurement errors in the experiment.

[0095] Apply recurrent neural networks to process and classify pathogen Raman spectroscopy data. Construct and train a recurrent neural network (RNN), specifically using long short-term memory (LSTM) or gated recurrent units (GRU) to handle long-term dependencies in time series data. The RNN model will consist of an input layer, multiple recurrent layers (such as LSTM or GRU layers), and an output layer. Design the network architecture: Design a neural network with an input layer, multiple recurrent layers, and an output layer. Select recurrent layer types (such as LSTM or GRU) that are capable of processing time series data and capturing long-term dependencies.

[0096] The number of units specified for a recurrent layer typically depends on the complexity of the data and the requirements of the deep learning task. For example, in Keras, you can define an LSTM layer with 128 neurons by setting LSTM(units=128).

[0097] Use Python and a deep learning library such as TensorFlow or PyTorch to implement recurrent networks. In TensorFlow, you can use tf.keras.layers.LSTM(128) or tf.keras.layers.GRU(128). Determine the number of layers and the number of nodes per layer. Multi-layer networks can be implemented by stacking LSTM layers, such as model.add(LSTM(128, return_sequences = True)) to connect to another LSTM layer.

[0098] Set the model compilation parameters, including loss function, optimizer, and evaluation metrics. Use model.compile(optimizer = 'adam', loss = 'categorical_crossentropy', metrics = ['accuracy']) to configure the learning process.

[0099] Before training a model, use model.summary() to summarize and validate the model's architecture, ensure all layers are configured correctly, and preview the total number of parameters of the model.

[0100] Perform batch training and gradually update network parameters. Use model.fit(x_train,y_train,batch_size=32,epochs=10) to perform batch training. Adjust the network structure to improve classification accuracy. Based on the training results, you may need to adjust the number of layers, units, or other parameters to improve model performance, such as Figure 6 The figure shows the relationship between adjusting neural network parameters and prediction accuracy (Adjusting Neural Network Parameters vs. Prediction Accuracy). The horizontal axis represents the number of layers in the recurrent neural network (RNN), ranging from 1 to 10, indicating the depth of the neural network, that is, the increase in the number of layers. The vertical axis represents the prediction accuracy (Prediction Accuracy), ranging from 0.55 to 0.80, indicating the predictive performance of the neural network model. The figure shows that as the number of layers increases, the prediction accuracy increases accordingly. This shows that increasing the number of neural network layers can improve the model's predictive performance within a certain range.

[0101] Cross-validation and parameter optimization were used to ensure the accuracy and stability of the model.

[0102] Use the sklearn.model_selection.KFold class to implement 5-fold cross-validation. This method divides the dataset into five equal parts, rotating one of the parts as the test set and the other four as the training set. This method evaluates the model's performance on different data subsets and helps understand the model's generalization ability to unseen data.

[0103] To optimize the performance of the recurrent neural network model, the following parameters are adjusted:

[0104] The learning rate is adjusted using the lr parameter of the tensorflow.keras.optimizers.Adam optimizer.

[0105] An initial high learning rate can speed up the convergence process, and then gradually reduce the learning rate to optimize performance through tensorflow.keras.callbacks.LearningRateScheduler or manual adjustment.

[0106] Adjust the number of layers and neurons based on the complexity of the model. Choose the appropriate recurrent layer type based on the needs of the specific task and the characteristics of the data, such as switching from LSTM to GRU or vice versa.

[0107] By adding tensorflow.keras.layers.Dropout layers to reduce overfitting, the stability and accuracy of the model are improved.

[0108] In this example, the LSTM recurrent layer type was chosen based on its superior ability to process long-term dependencies. To determine the network capacity, namely the number of units and layers in the recurrent layer, these parameters were initially set to large values, and cross-validation (CV) results were used to find the optimal network size.

[0109] Next, we began adjusting key network parameters, such as the number of units per layer and the number of recurrent layers. Considering that high model complexity can lead to overfitting, we focused on feature selection at this stage using Lasso regression to automatically remove unimportant features and simplify the model. This not only helped control model complexity but also retained the information most critical for prediction.

[0110] To further reduce the risk of overfitting, a dropout regularization strategy is implemented in the network, and the learning rate is gradually reduced. A higher learning rate is used initially to facilitate rapid progress, and then, as training progresses, the learning rate is gradually reduced to fine-tune model parameters and optimize performance. This combination of strategies aims to improve the accuracy and generalization of recurrent neural networks in Raman spectroscopy data classification tasks.

[0111] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for Raman spectroscopy classification of foodborne pathogens based on neural networks, characterized in that: include, Preprocess the pathogen data obtained through experiments; Construct a recurrent neural network (RNN) model to process and classify pathogen Raman spectroscopy data; Use cross-validation to evaluate the performance of the model and optimize the network model.

2. The method for foodborne pathogen classification based on Raman spectrum of neural network as claimed in claim 1, characterized in that: The preprocessing includes normalization, moving average denoising, Lasso regression dimensionality reduction and data enhancement to generate new samples; The normalization process includes selecting the Min-Max technique to process the Raman spectrum data; The moving average denoising includes processing spectral data using a moving average method, reducing random noise, and evaluating the smoothing effect of the data after moving average denoising.

3. The method for foodborne pathogen Raman spectroscopy classification based on neural network according to claim 2, characterized in that: The Lasso regression dimensionality reduction includes introducing an L1 penalty term, constraining the absolute value of the regression coefficient, selecting the influencing features on the output variable, and simplifying the model structure; The data enhancement method for generating new samples includes adding random noise as a data enhancement method to simulate measurement errors in experiments, increase the generalization ability of the model and reduce overfitting.

4. The method for foodborne pathogen classification based on Raman spectrum of neural network as claimed in claim 3, characterized in that: The recurrent neural network RNN ​​model includes an input layer, a recurrent layer, a batch normalization layer, an activation layer, a dropout layer, a fully connected layer and an output layer. Considering the complexity of the data and the requirements of the deep learning task, the number of units in the recurrent layer is set, Python and a deep learning library are used to implement the recurrent network layer, the number of layers and the number of nodes in each layer are determined, and the optimizer and loss function are selected; Before training the model, summarize and verify the model architecture to ensure that all layers are configured correctly, preview the total number of model parameters, perform batch data training, update network parameters, and optimize the network structure.

5. The method for foodborne pathogen classification based on Raman spectrum of neural network as claimed in claim 4, characterized in that: The cross-validation method is used to evaluate the performance of the model by dividing the data set into a test set and a training set, and evaluating the performance of the model on different data subsets.

6. The method for foodborne pathogen Raman spectroscopy classification based on neural network according to claim 5, characterized in that: Optimizing the network model includes adjusting model parameters and optimizing network configuration; The adjusting of model parameters includes adjusting the learning rate to accelerate the convergence process and reduce the loss.

7. The method for foodborne pathogen classification based on Raman spectrum of neural network according to claim 6, characterized in that: The optimized network configuration includes adjusting the number of neural network layers and the number of units in each layer to adapt to the complexity of the model, implementing a dropout regularization strategy to reduce overfitting, reducing the learning rate during training, adjusting the model and optimizing performance.

8. A system based on the neural network-based Raman spectroscopy classification method for foodborne pathogens according to any one of claims 1 to 7, characterized in that: It includes preprocessing and enhancement modules, model building and optimization modules, and model evaluation and verification modules; The preprocessing and enhancement module ensures the quality and consistency of input data through normalization and moving average denoising, and reduces the dimension through Lasso regression to improve the generalization ability of the model and reduce overfitting; The model building and optimization module builds a neural network model including an input layer, a circulation layer and an output layer, selects an optimizer and a loss function, and optimizes the model structure and performance by adjusting network parameters; The model evaluation and validation module uses cross-validation to evaluate the performance of the model and ensure the stability and accuracy of the model, and improves the predictive ability of the model through systematic parameter adjustment.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • New coronavirus recognition and prediction model based on deep learning convolutional neural network

    CN114628037A

  • Method for classifying Raman spectrums by using stacking ensemble learning model

    CN115862007A