Raman spectrum detection method for mixed fishery medicine

By applying RA-CTNet model and data amplification technology in fishery residue detection, the complex and time-consuming problems of traditional detection methods are solved, and the rapid and accurate quantitative analysis of mixed fishery drugs is achieved, and the robustness and efficiency of detection are improved.

CN119715492AActive Publication Date: 2025-03-28JIANGSU ACAD OF AGRI SCI

Patent Information

Application Number
CN202411775246.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-03-28
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

The prior art has problems such as complex operation, high cost and long-term operation in fishery residue detection, and traditional Raman spectroscopy analysis relies on manual experience, is inefficient, and it is difficult to effectively extract the characteristics of spectral data and establish models.

Method used

A hybrid fishing drug Raman spectroscopy detection method based on RA-CTNet is proposed. Through data preprocessing and amplification, combined with convolutional neural network and Transformer model, quantitative detection of banned drugs with nanomolar concentrations under low data samples is achieved.

Benefits of technology

It improves the accuracy and robustness of Raman spectroscopy detection, realizes rapid qualitative and quantitative analysis of mixed fishing drugs, reduces database construction costs, and enhances the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119715492A_ABST
    Figure CN119715492A_ABST
Patent Text Reader

Abstract

The invention discloses a mixed fishery medicine Raman spectrum detection method combining a data enhancement method and an RA-CTNet model. Data is expanded by combining a stoichiometric method and an experimental random error simulation method, so that the database building cost is reduced, and the model robustness is improved. In the aspect of model building, the advantages of CNN on local feature extraction and the capability of Transform on global feature modeling are fully utilized, training strategies of pre-training and transfer learning are adopted, rich feature information of a single fishery medicine is effectively utilized, the accuracy of mixed fishery medicine prediction is improved, and the prediction accuracy of the mixed fishery medicine is improved. And quantitative detection of a nanomole-level concentration mixture under a complex mixed sample is realized. Compared with the prior art, the technical scheme provided by the invention aims to detect forbidden fishery drugs in aquaculture water and realize nanomole-level concentration forbidden drug quantitative detection under a low data sample, and aims to improve the accuracy and robustness of Raman spectrum detection and quickly qualitatively and quantitatively analyze mixed fishery drugs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of spectral analysis, and in particular to a Raman spectroscopy detection method for mixed fishery drugs. Background Art

[0002] The safety of aquatic products is closely related to people's life and health, and excessive residues of fishery drugs are one of the main hidden dangers to the safety of aquatic products. In order to accurately detect the residues of fishery drugs in aquatic products, traditional methods for detecting fishery drug residues mainly include chromatography, immunoassay, capillary electrophoresis, etc. However, traditional detection methods often have technical problems such as complex operation, high cost, and long time consumption. In actual application, it is difficult to meet the needs of rapid detection. In addition, due to the large differences in aquaculture water bodies and the complex and variable composition, it may contain a large amount of organic matter and protein, which further increases the technical difficulty of detection.

[0003] In the prior art, Raman spectroscopy is a fast and non-destructive detection method. In recent years, it has attracted much attention in the field of fishery drug residue detection technology. Its principle is to obtain the molecular information inside the sample by analyzing the Raman scattering spectrum of the sample to be tested, and then to achieve qualitative and quantitative analysis of the sample structure, properties and composition. However, since traditional Raman spectroscopy analysis relies on the actual work experience of operators in practical applications, it often has limitations such as low efficiency and strong subjectivity. In addition, the amount of Raman spectroscopy data analysis is huge and high in dimensionality, making it difficult to effectively extract corresponding features and establish models.

[0004] However, deep learning has powerful feature extraction and nonlinear modeling analysis capabilities. It can automatically learn the composition information of materials from massive spectral data and realize fast and accurate material composition identification and quantitative analysis. Therefore, by applying deep learning to traditional Raman spectroscopy, the limitations of traditional analysis can be overcome.

[0005] In this regard, the prior art has already produced Raman spectroscopy analysis algorithms based on deep learning. For example, the publication number CN113670894A discloses a method for quantitatively monitoring the content of a substance by Raman spectroscopy, which introduces big data means to process Raman spectroscopy data to achieve quantitative monitoring of Raman spectroscopy. For another example, the patent authorization announcement number CN117935963B discloses a method for qualitative analysis of mixture Raman spectroscopy, which achieves qualitative analysis of the Raman spectroscopy of the mixture by means of a transformer deep model. However, the above-mentioned patent technical solutions all require a large amount of high-quality data for training. The data set construction is costly and time-consuming, the model generalization ability is limited, and it is difficult to adapt to complex detection scenarios such as different temperatures or water samples. It is also limited to qualitative analysis and cannot calculate the absolute content of the mixture. In the existing technology, Raman spectral data can be generated by generative neural networks to solve the problem of data scarcity. However, generating new Raman spectra through GAN requires training a high-quality generative model in advance, which requires a large amount of training data. Otherwise, the quality and diversity of the generated spectra are difficult to guarantee. At the same time, the Raman spectral data generated by GAN may have data bias problems, and the generated data may differ from the real data distribution, thereby affecting the generalization performance of the model. Summary of the invention

[0006] The main purpose of the present invention is to propose a Raman spectroscopy detection method for mixed fishery drugs based on RA-CTNet, with the aim of detecting banned fishery drugs in aquaculture water, realizing quantitative detection of banned drugs at nanomolar concentrations under low data samples, improving the accuracy and robustness of Raman spectroscopy detection, and performing rapid qualitative and quantitative analysis of mixed fishery drugs.

[0007] To achieve the above object, the present invention proposes a mixed fishery drug Raman spectrum detection method, comprising the following steps:

[0008] Step S1: intercepting the full-band Raman spectrum according to the Raman spectrum characteristics of the target detection substance and the detection band of the Raman spectrometer, and then correcting the Raman spectrum baseline drift in the sample to eliminate the intensity difference and random error between different spectra;

[0009] Step S2: after inputting the spectral data, the corresponding spectral data is converted into amplified data by adding random errors, simulating periodic environmental interference to amplify the data, and generating spectral data of different concentrations by chemometric method to amplify the data;

[0010] Step S3: receiving the spectral data after preprocessing and data amplification, the input spectral data is represented as a one-dimensional vector;

[0011] Step S4: Using the Raman spectrum data of a single substance and its corresponding concentration label, a pre-trained model is built after pre-processing and data enhancement;

[0012] Step S5: input the pre-trained data set into the model, perform forward propagation, and calculate the predicted value;

[0013] Step S6: Read the predicted value of substance concentration and calculate the loss function value; use the loss function value as a reference, back propagate, update the model parameters, and repeat steps S5-S6 until the loss function value no longer decreases or the loss function value reaches the prediction accuracy requirement. After pre-training is completed, save the model parameters for subsequent mixed sample transfer learning;

[0014] Step S7: using the Raman spectrum data of the mixed fishery drugs and the corresponding labels of the concentrations of the fishery drugs as a data set for transfer learning after preprocessing and data enhancement;

[0015] Step S8: Input the mixed sample data set into the model, load the pre-trained model parameters, freeze the parameters of the convolution layer, train only the encoder and the fully connected layer, perform forward propagation, and calculate the predicted value;

[0016] Step S9: For the concentration regression task of multiple fishery drugs, the mixed sample mean square error is used as the loss function;

[0017] Step S10: Based on the mixed sample mean square error value as a reference, back propagate, update the model parameters and repeat the steps S8-S9 process until the mixed sample mean square error value does not decrease after multiple rounds, or the mixed sample mean square error value reaches the prediction accuracy requirement. After the training is completed, save the final model parameters.

[0018] Preferably, in step S1, the intensity difference and random error between different spectra are eliminated, and each sample point X of the original spectrum is raw Enter the following formula to obtain the preprocessed spectral data and complete the spectral preprocessing;

[0019]

[0020] Among them, μ and σ are respectively raw The mean and standard deviation of Indicates moving average smoothing, the window size is set to W, and the value of W is between 1 and 20;

[0021] and are the minimum and maximum values ​​of the smoothed data respectively.

[0022] Preferably, in step S2, the following conversion formula is used in the addition of random errors to convert the amplified data:

[0023] X aug1 =X norm +∈

[0024] Where ∈ is the simulated random noise parameter, which follows the distribution θ is the noise amplitude control parameter;

[0025] The simulated periodic environmental interference amplifies the data, and the amplified sample is a trigonometric function error. The simulated periodic environmental interference, the conversion formula is X aug2 =X norm +S, where S is the simulated periodic sinusoidal noise parameter, and its generation period is T, T is between 10 and 1000, and the parameter S obeys the following distribution:

[0026]

[0027] in is a random phase;

[0028] The method generates spectral data of different concentrations by chemometric method to amplify data. Based on chemometric method generation, spectral data at different concentrations are generated by chemometric method; the range of fishery drug concentration Cmin to Cmax is determined, and multiple concentration points {C1, C2, ..., Cm} are generated within the above range. According to the exponential function relationship between the fishery drug concentration and the Raman peak intensity, the spectral data at different concentrations are simulated, and the characteristic peak intensity corresponding to the concentration point Ci is calculated as I j,i :

[0029]

[0030] Among them, I j,i is the intensity of the jth Raman peak at Ci concentration, Ci is the concentration of fishery drugs, k j is the proportional constant; ∈ j is a random error term, which obeys normal distribution; using the generated peak intensity I j,i and the Raman peak Gaussian shape to reconstruct new spectral data X aug3 (υ), the formula is as follows:

[0031]

[0032] Where υ is the Raman shift, v j is the position of the jth Raman peak, σ j is the standard deviation of the jth Raman peak, indicating the peak width, and Noise(υ) is the background Gaussian noise of the overall spectrum.

[0033] Preferably, in step S2,

[0034] In outdoor scenes or when the equipment is unstable and there are many random errors in the original data, the data volume is amplified by adding random errors to convert, simulating periodic environmental interference to amplify the data volume, and generating spectral data of different concentrations by chemometric method in a ratio of 4:3:2;

[0035] When periodic interference is significant and the equipment has a large impact, the ratio of adding random errors to convert the amplified data volume, simulating periodic environmental interference to amplify the data volume, and generating spectral data of different concentrations by chemometric method to amplify the data volume is 2:4:3;

[0036] When the experimental random error is very small and the importance of the chemometric data is high, the ratio of adding random errors to transform the amplified data volume, simulating periodic environmental interference to amplify the data volume, and generating different concentration spectral data through chemometric method to amplify the data volume is 3:3:3.

[0037] Preferably, in step S3, the input spectral data is represented as a one-dimensional vector X∈R N , where N is the number of Raman spectral data points, ranging from 300 to 3000.

[0038] Preferably, in step S5, one-dimensional convolution is used to extract local features of the spectrum, the convolution kernel size is k, the number of convolution kernels is c, the step length is s, the padding is p, and the output of the convolution layer is calculated as follows:

[0039] H CNN =ReLU(Conv1D(X,W CNN )+b CNN )

[0040] Where W CNN is the convolution kernel weight, b CNN is the bias term, ReLU is the activation function;

[0041] The global features and long-distance dependencies of spectral data are captured by the Transformer encoder, which consists of a multi-head self-attention mechanism and a feedforward neural network. The input feature sequence is linearly transformed H CNN Get the query Q, key K and value V matrix:

[0042] Q=H CNN ·W Q ,K=H CNN ·W K ,V=H CNN ·W Q

[0043] Among them, W Q ,W K ,W Q is a learnable weight matrix;

[0044] Then calculate the attention weight and get the attention output:

[0045]

[0046] where d k is the dimension of the key vector, which is set according to the spectral information; several groups of attention weights are calculated at different spectral bands and spliced ​​into multi-head self-attention output;

[0047] Input the multi-head self-attention output into the feed-forward neural network to perform nonlinear transformation on the attention output;

[0048] Add residual connections to each sublayer and perform layer normalization to stabilize model training;

[0049] The output features of the encoder are passed through a fully connected layer and mapped to the predicted value of the substance concentration.

[0050] Preferably, in step S6, the predicted value of the substance concentration is read, and the loss function value is calculated using the mean square error method, and the formula is as follows:

[0051]

[0052] Where L pre Represents the error value obtained after calculation. The larger the value, the worse the prediction effect. N is the number of samples, y i is the true concentration of the ith sample, is the concentration predicted by the model.

[0053] Preferably, in step S9, the loss function value is calculated, and for the concentration regression task of multiple fishery drugs, the mixed sample mean square error is used as the loss function, which is defined as follows:

[0054]

[0055] Among them, M is the number of species contained in the mixed sample, y i,j is the true concentration of the jth substance in the ith sample, is the concentration predicted by the model.

[0056] The technical solution of the present invention has the following advantages over the prior art:

[0057] The technical solution of the present invention proposes a Raman spectroscopy detection method for mixed fishery drugs that combines a data enhancement method and a RA-CTNet model. The data is expanded by combining a chemometric method and an experimental random error simulation method to reduce the cost of database construction and improve the robustness of the model. In model construction, the advantages of CNN in local feature extraction and the ability of Transformer in global feature modeling are fully utilized. The training strategies of pre-training and transfer learning are adopted, and the rich feature information of a single fishery drug is effectively utilized. The accuracy of mixed fishery drug prediction is improved, and the quantitative detection of nanomolar concentration mixtures in complex mixed samples is realized. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0059] Figure 1 This is a flow chart of the Raman spectrum detection method for mixed fishery drugs of the present invention;

[0060] Figure 2 A model framework diagram for predicting the concentration of the mixed fishery drug Raman spectrum of the present invention;

[0061] Figure 3 This is a quantitative detection performance evaluation diagram of a single sample of pre-training of the present invention;

[0062] Figure 4 It is the MSE result diagram of the RA-CTNet model of the present invention;

[0063] Figure 5 This is a comparison chart of the results of the RA-CTNet model and the traditional partial least squares discriminant analysis algorithm.

[0064] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0065] 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.

[0066] The present invention proposes a Raman spectrum detection method for mixed fishery drugs, see Figures 1 to 5 .

[0067] Sample preparation and Raman spectrum acquisition

[0068] By mixing ofloxacin, sulfathiazole and malachite green in a concentration range of 10 -5 M to 10 -9 M, are dissolved separately in water used for aquaculture to prepare multiple solutions of single fishery medicines.

[0069] By using surface enhanced Raman spectroscopy (SERS) technology to detect single fishery drug samples at each concentration, 5-15 spectral data were collected at each concentration, and finally 300 single fishery drug sample data were obtained.

[0070] Then, any two of the above three types of fishery drugs with different concentrations were extracted and mixed to prepare a two-mixed solution. Raman spectroscopy was used for analysis, and finally 20 two-mixed fishery drug sample data were collected.

[0071] The three types of fishery drugs mentioned above were then extracted at different concentrations and mixed, and Raman spectroscopy was used to prepare 50 three-mixed fishery drug sample data.

[0072] Data preprocessing

[0073] According to the Raman spectrum analysis of the single fishery medicine sample, the two-mixed fishery medicine sample and the three-mixed fishery medicine sample obtained above, the Raman spectrum characteristics and the detection band of the Raman spectrometer were obtained, and the full-wavelength Raman spectrum was intercepted, and 800cm -1 ~1490cm -1 The bands within the range obtained 690 feature points.

[0074] At the same time, the Raman spectra in the samples were corrected for baseline drift to eliminate the intensity differences and random errors between different spectra.

[0075] Eliminate the intensity differences and random errors between different spectra, and convert each sample point X of the original spectrum raw Enter the following formula to obtain the preprocessed spectral data and complete the spectral preprocessing;

[0076]

[0077] Among them, μ and σ are respectively raw The mean and standard deviation of Indicates moving average smoothing, the window size is set to W, and the value of W is between 1 and 20; and are the minimum and maximum values ​​of the smoothed data respectively.

[0078] Standardize the spectral data to achieve mean normalization of all sample data;

[0079] After normalizing the mean of the sample data, the moving average smoothing method is used, and the window size W is set to 5 to achieve smoothing of the sample data to reduce the interference of noise;

[0080] The smoothed data is normalized to the minimum and maximum values, and the data is scaled to the data interval of [0,1] for normalization.

[0081] Data augmentation

[0082] The actual Raman spectral data is often interfered by various random noises or periodic noises during the acquisition process. For random noises such as instrument noise, environmental noise, etc. By adding random errors, we can effectively simulate the impact of these uncontrollable factors on spectral data, enhance the robustness of the model to noise, and improve its generalization ability in practical applications.

[0083] Periodic interference, such as power frequency fluctuations, mechanical vibration of the spectrometer, etc. This type of interference usually appears as a periodic signal. By introducing trigonometric function errors, the impact of these periodic interferences on spectral data can be simulated to help the model identify and mitigate the negative impact of such interference.

[0084] The amount of data collected by the technical solution of the present invention is not massive. In order to expand the scale of the data set and improve the robustness of the entire data model, the technical solution of the present invention simultaneously adopts three data augmentation methods to amplify the original data.

[0085] Since the data collected in the laboratory environment has a small data error and the experimental sample size is small, the technical solution of the present invention can amplify the data volume by a total of nine times through three data amplification methods.

[0086] To add random error to the amplification data, use the following transformation formula:

[0087] X aug1 =X norm +∈

[0088] Where ∈ is the simulated random noise parameter, which follows the distribution θ is the noise amplitude control parameter.

[0089] After the spectral data is input, the corresponding spectral data is converted and amplified by adding random errors, simulating periodic environmental interference to amplify the data, and generating spectral data of different concentrations by chemometric method to amplify the data. The technical solution of the present invention adopts the method of adding random errors to perform data amplification, adding random noise to the original spectral data, and the error range is 8% of the original value to amplify the data three times.

[0090] Specifically, a random noise matrix that obeys uniform distribution is generated according to a noise amplitude of 8% of the original data. The generated random noise is added to the original spectral data to obtain amplified data, and the amplification type is marked as "GAUSSIAN_0.08".

[0091] The simulated periodic environmental interference amplifies the data, and the amplified sample is a trigonometric function error. The simulated periodic environmental interference, the conversion formula is X aug2 =X norm +S, where S is the simulated periodic sinusoidal noise parameter, and its generation period is T, T is between 10 and 1000, and the parameter S obeys the following distribution:

[0092]

[0093] in is a random phase.

[0094] Specifically, the present invention performs data amplification by adding a sinusoidal function error, adding periodic noise in the form of a sinusoidal function to the original spectral data to simulate periodic environmental interference, wherein the period can be selected as 100 and the maximum amplitude is 8% of the original value, thereby amplifying three times the data.

[0095] Specifically, by generating the horizontal coordinate array X, randomly generating the phase offset φ, and calculating the sinusoidal noise in The average value for each sample is obtained by adding sinusoidal noise to the original spectral data, and the amplified data is marked as "SIN_0.08".

[0096] The present invention also generates spectral data of different concentrations by chemometric method to amplify data. Based on chemometric generation, spectral data at different concentrations are generated by chemometric method; the range of fishery drug concentration Cmin to Cmax is determined, and multiple concentration points {C1, C2, ..., Cm} are generated within the above range. According to the exponential function relationship between the fishery drug concentration and the Raman peak intensity, the spectral data at different concentrations are simulated, and the characteristic peak intensity corresponding to the concentration point Ci is calculated as I j,i :

[0097]

[0098] Among them, I j,i is the intensity of the jth Raman peak at Ci concentration, Ci is the concentration of fishery drugs, k j is the proportional constant; ∈ j is a random error term, which obeys normal distribution; using the generated peak intensity I j,i and the Raman peak Gaussian shape to reconstruct new spectral data X aug3(υ), the formula is as follows:

[0099]

[0100] Where υ is the Raman shift, v j is the position of the jth Raman peak, σ j is the standard deviation of the jth Raman peak, indicating the peak width, and Noise(υ) is the background Gaussian noise of the overall spectrum.

[0101] The present invention performs data amplification based on a chemometrics method, utilizes the chemometrics principle, establishes a correlation between the concentration value and the Raman peak intensity according to a known concentration range, simulates and generates spectral data at different concentrations, and amplifies three times the data.

[0102] Specifically, in the concentration range of 10 -5 M to 10 -9 M, generate multiple concentration values, calculate the intensity of the characteristic peak at each concentration according to the exponential function relationship between concentration and Raman peak intensity, and then use Voigt function to simulate the Raman peak shape to generate each characteristic peak. By superimposing all characteristic peaks, adding background signal, noise and baseline drift, finally form a complete simulated spectral data. The generated simulated spectral data is used as the amplified data, and the amplification type is marked as "CHEMOMETRIC".

[0103] The present invention generates spectral data at different concentrations through chemometric methods, which can expand the diversity of samples and cover more possible chemical states. Especially for mixed component samples, due to the limitations of sample size, detection difficulty and workload, it is impossible to simulate the spectral data under each concentration mixture. At the same time, the chemometric simulation is based on Raman spectroscopy theory. The generated data input data set not only increases the data volume, but also integrates the physical and chemical mechanism as a priori information into the model, enriching the chemical information of the data, helping the model to more accurately capture the relationship between substance concentration and spectral characteristics, and increasing the interpretability of the model.

[0104] A single amplification method can often only solve the problem of insufficient data of a specific type. In real-world scenario data, random errors and periodic errors are coupled with each other, exist in large quantities in the data, and cannot be completely eliminated by data preprocessing alone. At the same time, although the data generation method based on chemometrics can deepen the model's understanding of physical and chemical theories and effectively amplify data that lacks experiments. However, there is a certain error between the data generated by chemometrics and the actual results, and its applicability needs to be enhanced with the help of a large amount of real-world scenario data. The combined use of these three methods is required to fully cover the various variation factors in the data, improve the diversity and authenticity of the amplified data, and thus significantly improve the performance and robustness of the model.

[0105] It should be adjusted according to the original sample size, data characteristics and specific needs of the model, including:

[0106] Balance data diversity with amplification performance, ensuring that each amplification method is appropriately represented in the data to cover different types of variants.

[0107] According to the noise level of the original data, if the original data has more noise, the proportion of random error addition can be appropriately increased; if the periodic interference is significant, the proportion of periodic interference simulation can be increased.

[0108] Based on experimental experience and model verification, the effects of different amplification ratios on model performance were tested through methods such as cross-validation, and the optimal ratio combination was selected.

[0109] In outdoor scenes or when the equipment is unstable and there are many random errors in the original data, the ratio of adding random errors to convert and amplify the data volume, simulating periodic environmental interference to amplify the data volume, and generating spectral data of different concentrations through chemometric methods to amplify the data volume is 4:3:2. Increasing the ratio of adding random errors to convert and amplify the data volume will help the model better cope with and generalize the noise in the data.

[0110] When periodic interference is significant and the impact of equipment is large, random errors are added to transform the amplified data volume, periodic environmental interference is simulated to amplify the data volume, and spectral data of different concentrations are generated by chemometric methods to amplify the data volume in a ratio of 2:4:3, which simulates the periodic environmental interference to amplify the data volume, making the model more capable of coping with periodic changes.

[0111] When the experimental random error is very small and the importance of the chemometric data is high, adding random error conversion to amplify the data volume, simulating periodic environmental interference to amplify the data volume, and generating spectral data of different concentrations through chemometric methods to amplify the data volume in a ratio of 3:3:3 can enhance the model's understanding and application of physical and chemical theories.

[0112] When the original data is extremely limited and the data error is small, it is recommended to add random error conversion to amplify the data volume, simulate periodic environmental interference to amplify the data volume, and generate spectral data of different concentrations through chemometric methods to amplify the data volume in a ratio of 3:3:3. With a smaller sample size, various methods are balanced to maximize data diversity and improve the generalization ability of the model.

[0113] Merge amplification data

[0114] The data amplified by the above three methods need to be merged to form a final amplified data set in a table format file named with a specific name.

[0115] After completing data preprocessing and data amplification, the present invention is used to predict the concentration of mixed fishery medicine Raman spectra. First, the preprocessed and amplified Raman spectrum data is input into the convolutional neural network to extract local features of the spectrum, such as the shape and position of the characteristic peak. The convolution layer uses a one-dimensional convolution operation, which can effectively capture the local pattern of the spectral data. Next, the feature sequence extracted by the convolution layer is input into the Transformer encoder. Transformer uses a multi-head self-attention mechanism to model the global correlation of spectral data and capture long-distance feature dependencies. By superimposing multiple layers of Transformer encoders, the model can deeply understand the complex characteristics of spectral data. Finally, after the fully connected layer, the extracted features are mapped to the concentration prediction values ​​of each fishery medicine. The training of the model is divided into two stages: pre-training and transfer learning, so as to make full use of the data of single fishery medicine and mixed fishery medicine and improve the generalization ability of the model.

[0116] Pre-training phase

[0117] The deep learning model RA-CTNet based on the combination of convolutional neural network (CNN) and transformer network is used to predict the concentration of mixed fishery drugs by Raman spectrum. The model framework is shown in the figure below: Figure 2 shown.

[0118] First, the Raman spectral data of a single fishery drug and its corresponding concentration label are used to pre-train the model. The data set of a single fishery drug is divided into a training set and a validation set, and the ratio of the training set to the validation set is 80%:20%, and the input data is normalized. Then the RA-CTNet model architecture is defined, including an input layer, two one-dimensional convolutional layers, and a fully connected layer to extract local features of the spectrum; then the mean square error MSE is used as the loss function, and the Adam optimizer is used for model training. During the training process, the loss of the validation set is monitored and the model parameters with the minimum validation loss are saved until the predetermined number of training rounds is reached or the prediction accuracy requirements are met.

[0119] Transfer learning stage,

[0120] The present invention applies the pre-trained model to the Raman spectrum data of mixed fishery drugs, and the specific steps are as follows:

[0121] The dataset of mixed fishery drugs is divided into training set and validation set with a ratio of 80%:20%, and the same normalization method as the pre-training stage is used; by loading the pre-training model parameters, the parameters of the convolution layer are frozen, and only the Transformer encoder and output layer are trained; the multi-task mean square error is defined as the loss function, and the model is trained for the concentration regression task of the three fishery drugs; during the training process, the loss of the validation set is monitored, and the model parameters with the smallest validation loss are saved until the predetermined number of training rounds is reached or the prediction accuracy requirements are met.

[0122] Model evaluation and prediction

[0123] The present invention uses the trained RA-CTNet model to predict unknown samples. The specific steps are as follows:

[0124] The Raman spectral data of the samples to be tested are preprocessed and amplified in a manner consistent with the training data; the processed data are input into the RA-CTNet model to quickly obtain the concentration prediction value of each fishery drug; the mean square error method is used to calculate the loss between the predicted value and the true value to evaluate the prediction accuracy and robustness of the model.

[0125] Pre-training single sample quantitative detection performance evaluation

[0126] like Figure 3 As shown in Figure 2, in the single sample quantitative detection, the mean square error (MSE) of the model reached 0.0024. The quantitative value is expressed as the negative logarithm of the concentration C. -5 M to 10 -9 Under the fishing drug sample of M, the classification accuracy of the model reached 100%.

[0127] Evaluation of quantitative detection performance of mixed samples

[0128] When processing mixed fishery drug samples, the MSE results of the RA-CTNet model are as follows: Figure 4 As shown in Figure 2, the mean of the three samples is 0.4, which is higher than the traditional partial least squares discriminant analysis (PLS-DA) algorithm (MSE = 0.5, such as Figure 5 ) performs better. This result shows that the model of the present invention exhibits higher prediction accuracy and robustness in processing mixed samples with complex background noise.

[0129] Computing platform configuration:

[0130] The training and testing of the model of the present invention are carried out on the following hardware configuration: CPU using Gold6226R CPU@2.90GHz supports large-scale data processing and complex computing needs. The GPU uses NVIDIA GeForce RTX3090, which provides efficient parallel processing capabilities and greatly accelerates the training process of deep learning models.

[0131] Processing time evaluation

[0132] Under the above hardware configuration, the total time consumed by this model in testing 10 pieces of data is 0.412 seconds, and the average time for identifying a piece of spectral data does not exceed 0.05 seconds, which meets the needs of most practical application scenarios.

[0133] Iterative optimization of loss function

[0134] In 1000 training iterations, the model loss showed a continuous downward trend, proving that the performance of the model is constantly improving. The nonlinear reduction in loss reflects the influence of random data and does not lead to unstable model performance, indicating that the model has good generalization ability.

[0135] The technical solution of the present invention has been successfully applied to the identification of binary and ternary mixtures, showing a strong recognition ability for more complex quaternary and quinary mixtures, and providing strong technical support for complex scenarios in practical applications. The present invention realizes efficient detection of the Raman spectrum of the absolute concentration of the mixture through the above steps, which can reduce the cost of building a data set. Through the data amplification method, it reduces the demand for large-scale real data and reduces the cost of database construction; improves detection accuracy, and the model architecture based on convolutional neural networks and Transformer networks makes full use of local and global features to improve the prediction accuracy of the model. It can also improve the detection speed. Compared with traditional chemometric methods, the model can achieve a microsecond prediction speed for the data after construction, and no complex preprocessing steps are required; enhance the robustness of the model, and through a variety of data amplification methods, improve the model's adaptability to different noises and interferences, ensuring stability and accuracy in complex detection scenarios.

[0136] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A Raman spectrum detection method for mixed fishery drugs, characterized in that: The following steps are involved: Step S1: intercepting the full-band Raman spectrum according to the Raman spectrum characteristics of the target detection substance and the detection band of the Raman spectrometer, and then correcting the Raman spectrum baseline drift in the sample to eliminate the intensity difference and random error between different spectra; Step S2: after inputting the spectral data, the corresponding spectral data is converted to amplify the data by adding random errors and / or simulating periodic environmental interference to amplify the data and / or generating spectral data of different concentrations by chemometric method to amplify the data; Step S3: receiving the spectral data after preprocessing and data amplification, the input spectral data is represented as a one-dimensional vector; Step S4: Using the Raman spectrum data of a single substance and its corresponding concentration label, a pre-trained model is built after pre-processing and data enhancement; Step S5: input the pre-trained data set into the model, perform forward propagation, and calculate the predicted value; Step S6: Read the predicted value of substance concentration and calculate the loss function value; use the loss function value as a reference, back propagate, update the model parameters, and repeat steps S5-S6 until the loss function value no longer decreases or the loss function value reaches the prediction accuracy requirement. After pre-training is completed, save the model parameters for subsequent mixed sample transfer learning; Step S7: using the Raman spectrum data of the mixed fishery drugs and the corresponding labels of the concentrations of the fishery drugs as a data set for transfer learning after preprocessing and data enhancement; Step S8: Input the mixed sample data set into the model, load the pre-trained model parameters, freeze the parameters of the convolution layer, train only the encoder and the fully connected layer, perform forward propagation, and calculate the predicted value; Step S9: For the concentration regression task of multiple fishery drugs, the mixed sample mean square error is used as the loss function; Step S10: Based on the mixed sample mean square error value as a reference, back propagate, update the model parameters and repeat the steps S8-S9 process until the mixed sample mean square error value does not decrease after multiple rounds, or the mixed sample mean square error value reaches the prediction accuracy requirement. After the training is completed, save the final model parameters.

2. The Raman spectrum detection method for mixed fishery drugs according to claim 1, characterized in that: In step S1, the intensity difference and random error between different spectra are eliminated, and each sample point X of the original spectrum is raw Enter the following formula to obtain the preprocessed spectral data and complete the spectral preprocessing; Among them, μ and σ are respectively raw The mean and standard deviation of Indicates moving average smoothing, the window size is set to W, and the value of W is between 1 and 20; )and ) are the minimum and maximum values ​​of the smoothed data.

3. The Raman spectrum detection method for mixed fishery drugs according to claim 1, characterized in that: In step S2, the random error is added to transform the amplified data, and the following transformation formula is used: X aug1 =X norm +∈ Where ∈ is the simulated random noise parameter, which follows the distribution θ is the noise amplitude control parameter; The simulated periodic environmental interference amplifies the data, and the amplified sample is a trigonometric function error. The simulated periodic environmental interference, the conversion formula is X aug2 =X norm +S, where S is the simulated periodic sinusoidal noise parameter, and its generation period is T, T is between 10 and 1000, and the parameter S obeys the following distribution: in is a random phase; The method generates spectral data of different concentrations by chemometric method to amplify data. Based on chemometric method generation, spectral data at different concentrations are generated by chemometric method; the range of fishery drug concentration Cmin to Cmax is determined, and multiple concentration points {C1, C2, ..., Cm} are generated within the above range. According to the exponential function relationship between the fishery drug concentration and the Raman peak intensity, the spectral data at different concentrations are simulated, and the characteristic peak intensity corresponding to the concentration point Ci is calculated as I j,i : Among them, I j,i is the intensity of the jth Raman peak at Ci concentration, Ci is the concentration of fishery drugs, k j is the proportional constant; ∈ j is a random error term, which obeys normal distribution; using the generated peak intensity I j,i and the Raman peak Gaussian shape to reconstruct new spectral data X aug3 (υ), the formula is as follows: Where υ is the Raman shift, v j is the position of the jth Raman peak, σ j is the standard deviation of the jth Raman peak, indicating the peak width, and Noise(υ) is the background Gaussian noise of the overall spectrum.

4. The Raman spectrum detection method for mixed fishery drugs according to claim 1, characterized in that: In the step S2, In outdoor scenes or when the equipment is unstable and there are many random errors in the original data, the data volume is amplified by adding random errors to convert, simulating periodic environmental interference to amplify the data volume, and generating spectral data of different concentrations by chemometric method in a ratio of 4:3:2; When periodic interference is significant and the equipment has a large impact, the ratio of adding random errors to convert the amplified data volume, simulating periodic environmental interference to amplify the data volume, and generating spectral data of different concentrations by chemometric method to amplify the data volume is 2:4:3; When the experimental random error is very small and the importance of the chemometric data is high, the ratio of adding random errors to transform the amplified data volume, simulating periodic environmental interference to amplify the data volume, and generating different concentration spectral data through chemometric method to amplify the data volume is 3:3:

3.

5. The Raman spectrum detection method for mixed fishery drugs according to claim 1, characterized in that: In step S3, the input spectral data is represented as a one-dimensional vector X∈R N , where N is the number of Raman spectral data points, ranging from 300 to 3000.

6. The Raman spectrum detection method for mixed fishery drugs according to claim 1, characterized in that: In step S5, one-dimensional convolution is used to extract local features of the spectrum, the convolution kernel size is k, the number of convolution kernels is c, the step length is s, the padding is p, and the output of the convolution layer is calculated as follows: H CNN =ReLU(Conv1D(X,W CNN )+b CNN ) Where W CNN is the convolution kernel weight, b CNN is the bias term, ReLU is the activation function; The global features and long-distance dependencies of spectral data are captured by the Transformer encoder, which consists of a multi-head self-attention mechanism and a feedforward neural network. The input feature sequence is linearly transformed H CNN Get the query Q, key K and value V matrix: Q=H CNN ·W Q ,K=H CNN ·W K ,V=H CNN ·W Q Among them, W Q ,W K ,W Q is a learnable weight matrix; Then calculate the attention weight and get the attention output: where d k is the dimension of the key vector, which is set according to the spectral information; several groups of attention weights are calculated at different spectral bands and spliced ​​into multi-head self-attention output; Input the multi-head self-attention output into the feed-forward neural network to perform nonlinear transformation on the attention output; Add residual connections to each sublayer and perform layer normalization to stabilize model training; The output features of the encoder are passed through a fully connected layer and mapped to the predicted value of the substance concentration.

7. The Raman spectrum detection method for mixed fishery drugs according to claim 1, characterized in that: In step S6, the predicted value of the substance concentration is read, and the loss function value is calculated using the mean square error method, and the formula is as follows: Where L pre Represents the error value obtained after calculation. The larger the value, the worse the prediction effect. N is the number of samples, y i is the true concentration of the ith sample, is the concentration predicted by the model.

8. The Raman spectrum detection method for mixed fishery drugs according to claim 1, characterized in that: In step S9, the loss function value is calculated. For the concentration regression task of multiple fishery drugs, the mixed sample mean square error is used as the loss function, which is defined as follows: Among them, M is the number of species contained in the mixed sample, y i,j is the true concentration of the jth substance in the ith sample, is the concentration predicted by the model.

Citation Information

Patent Citations

  • Method for quantitatively monitoring substance content by Raman spectroscopy

    CN113670894A

  • A mixture Raman spectroscopy qualitative analysis method, system and device

    CN117935963B

  • Method for quickly detecting agricultural product chemical constituents based on existing calibration model

    CN106872397A

  • Bird real-time identification method based on deep learning

    CN112331220A

  • Fixed star spectral data enhancement method and system

    CN113656754A

Cited By

  • Multi-component heavy metal spectrum deep learning detection method and system

    CN119935920A

  • Bacterial Raman spectrum chemical component cross-domain analysis method based on deep transfer learning

    CN120673875A

  • Spectrum detection method based on large language model assistance

    CN121231448A

  • A spectrum detection method based on a large language model assistance

    CN121231448B

  • Biomarker detection method and system based on biological spectrum

    CN121656160A