Milk antibiotic residue detection method
By collecting fluorescence hyperspectral images of cow casein and combining PCA and BP neural network algorithms, an antibiotic residue detection model was established, which solved the problems of long detection cycles and cumbersome operations in the existing technology, and achieved rapid and accurate milk antibiotic residue detection.
Patent Information
- Application Number
- CN202510319024.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-03-18
AI Technical Summary
The existing milk antibiotic residue detection methods have the problems of long detection cycles, cumbersome operation, easy to be disturbed by environmental factors, and expensive equipment, making it difficult to achieve rapid large-scale screening.
By collecting fluorescence hyperspectral images of cow casein, using PCA data dimensionality reduction and BP neural network algorithms, an antibiotic residue detection model is established to quickly judge the category and concentration of antibiotics in milk.
It realizes fast and accurate milk antibiotic residue detection, with fast and accurate detection speed, and is suitable for large-scale sample screening.
Smart Images

Figure CN120232859A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of food safety, and particularly relates to a method for detecting antibiotic residues in milk. Background Art
[0002] As an important daily consumer product, the safety of milk is directly related to public health. The widespread use of antibiotics in livestock and poultry farming may lead to low-concentration antibiotic residues in milk. Long-term intake can cause health risks such as imbalance of the human intestinal flora and infection with drug-resistant bacteria, and also affect the fermentation process and quality of dairy products. Therefore, it is of great practical significance to establish an efficient and sensitive method for detecting antibiotic residues in milk.
[0003] Currently, the detection of antibiotic residues in milk mainly relies on microbial detection methods and high-performance liquid chromatography (HPLC). Although the microbial detection method has a low cost, it has a long detection period (usually 18 - 24 hours), is cumbersome to operate, and is easily interfered by environmental factors, resulting in insufficient result stability. Although the high-performance liquid chromatography method has high sensitivity and accuracy, it requires complex sample pretreatment processes (such as extraction, purification, etc.), and the instrument equipment is expensive, and it is difficult to achieve rapid screening of a large number of samples. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for detecting antibiotic residues in milk, which obtains the fluorescence intensity and wavelength bands by collecting the fluorescence hyperspectral images of milk, so as to quickly detect the types of residual antibiotics in milk.
[0005] To solve the above problems, the present invention provides a method for detecting antibiotic residues in milk, including the following steps:
[0006] Step S1000: Prepare milk antibiotic residue samples with different concentrations;
[0007] Step S2000: Extract casein from the milk antibiotic residue samples as casein antibiotic residue samples;
[0008] Step S3000: Collect the fluorescence hyperspectral images of the casein antibiotic residue samples and pure milk casein samples, and collect a full-white calibration image and a full-black calibration image;
[0009] Step S4000: Perform black and white correction on the fluorescence hyperspectral images of the casein antibiotic residue samples and pure milk casein samples respectively;
[0010] Step S5000: Extract several pixel points in the central region of the fluorescence hyperspectral image as the region of interest, calculate the average spectral curve data, set a preset spectral range, and retain the data within the preset spectral range as the spectral curve data set;
[0011] Step S6000: Perform PCA data dimensionality reduction on the spectral curve data sets of the casein antibiotic residue samples and pure milk casein samples, input the BP neural network algorithm and train it to obtain an antibiotic residue detection model;
[0012] Step S7000: Extract the casein in the milk to be tested as a casein antibiotic residue sample, collect the fluorescence hyperspectral image of the casein antibiotic residue sample, input the spectral dimensionality reduction data into the antibiotic residue detection model and obtain a prediction result.
[0013] Furthermore, step S1000 in the above milk antibiotic residue detection method specifically includes:
[0014] Step S1100: Prepare aqueous solutions of antibiotics with different concentrations;
[0015] Step S1200: Add the aqueous antibiotic solutions to the milk without antibiotic residues respectively as milk antibiotic residue samples with different concentrations.
[0016] Furthermore, step S2000 in the above milk antibiotic residue detection method specifically includes:
[0017] Step S2100: Heat the milk antibiotic residue sample to 40 - 50 °C and adjust the pH value to 4.6 to cause the casein in the milk antibiotic residue sample to coagulate and precipitate;
[0018] Step S2200: Filter and separate the milk antibiotic residue sample to obtain a casein antibiotic residue sample.
[0019] Furthermore, step S6000 in the above milk antibiotic residue detection method specifically includes:
[0020] Step S6100: Perform PCA (Principal Component Analysis) data dimensionality reduction on the average spectral curve data to obtain dimensionality reduction data,
[0021] Step S6200: Use the BP neural network algorithm to read the spectral dimensionality reduction data, mark the antibiotic labels according to the types of antibiotics, and divide the spectral dimensionality reduction data into 10 non - overlapping subsets. Each time, select 9 subsets as the training set and the remaining one subset as the test set;
[0022] Step S6300: Normalize the spectral dimensionality reduction data of the training set to the interval [0, 1], create a BP neural network algorithm model, where the hidden layer contains 4 neurons, and set the training parameters;
[0023] Step S6400: Use the train function to train the BP neural network algorithm model. The input data is the spectral dimensionality reduction data after normalization of the training set, and the output data is the antibiotic category;
[0024] Step S6500: Use the trained BP neural network algorithm model to perform simulation prediction on the spectral dimensionality reduction data after normalization of the training set and the test set, compare the prediction results with the true results, and calculate the prediction accuracy rates of the training set and the test set. If the accuracy rate is above 90%, it is used as the antibiotic residue detection model.
[0025] Furthermore, in the above-mentioned milk antibiotic residue detection method, the step S6100 includes:
[0026] Step S6110: Perform data standardization processing on the average spectral curve data to obtain the standardized average spectral curve data;
[0027] Step S6120: Calculate the covariance matrix of the standardized average spectral curve data;
[0028] Step S6130: Solve the eigenvalues and corresponding eigenvectors of the covariance matrix of the standardized average spectral curve data;
[0029] Step S6140: Sort the eigenvalues according to their magnitudes, and select the eigenvectors corresponding to the top 3 largest eigenvalues as the first principal component, the second principal component, and the third principal component, and construct the eigenvector matrix;
[0030] Step S6150: Project the standardized average spectral curve data onto the selected principal components to obtain the spectral dimensionality reduction data of each casein antibiotic residue sample and the pure milk casein spectral data.
[0031] Furthermore, in the above-mentioned milk antibiotic residue detection method, the image correction calculation formula in the step S4000 is:
[0032]
[0033] Among them, R is the fluorescence hyperspectral image after black and white correction, I R is the original fluorescence hyperspectral image collected, I W is the all-white calibration image, I D is the all-black calibration image.
[0034] Furthermore, in the above-mentioned milk antibiotic residue detection method, the calculation formula for the data standardization processing is:
[0035]
[0036] Among them, X stdLet the standardized data of the average spectral curve be \(Y\), \(X\) be the original data matrix of the average spectral curve data, \(\mu\) be the mean of each column feature of the original data matrix, and \(\sigma\) be the standard deviation of each column of the original data matrix.
[0037] Further, in step S6120 of the above milk antibiotic residue detection method: calculate the covariance matrix of the standardized data of the average spectral curve, and the calculation formula is:
[0038]
[0039] Where, \(C\) is the covariance matrix of the standardized data of the average spectral curve, \(m\) is the number of rows of the original data matrix \(X\), that is, the number of samples, \(Y^T\) is the transpose of the standardized data of the average spectral curve.
[0040] The above technical solution of the present invention has the following beneficial technical effects: by extracting casein in milk and collecting fluorescence hyperspectral images, and casein forms non-covalent complexes through electrostatic interaction or hydrogen bond interaction with antibiotics, and by observing the influence of the non-covalent complexes on the fluorescence hyperspectral average spectral curve data to judge whether there are antibiotic residues and the types of antibiotics in milk, the detection speed is fast and accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 is a flowchart of an embodiment shown in the present invention;
[0042] Figure 2 is a schematic diagram of the average spectral curve data of casein antibiotic residue samples of different categories and concentrations. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0043] To make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with the specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present invention.
[0044] Refer to Figure 1 , the following shows an embodiment of the present invention, and a method for detecting milk antibiotic residues specifically includes the following steps:
[0045] Step S1000: Prepare milk antibiotic residue samples with different concentrations, and the specific steps include:
[0046] Step S1100: Prepare aqueous solutions of antibiotics with different concentrations.
[0047] In this embodiment, ciprofloxacin aqueous solutions with concentrations of 0 g / L, 0.08 g / L, 0.16 g / L, 0.24 g / L, 0.32 g / L, 0.40 g / L, 0.56 g / L, 0.72 g / L, 0.88 g / L, 1.04 g / L, and 1.20 g / L are prepared. Similarly, chloramphenicol aqueous solutions with corresponding concentrations can also be prepared.
[0048] Step S1200: Respectively add the antibiotic aqueous solutions into the milk without antibiotic residues to obtain milk antibiotic residue samples with different concentrations.
[0049] In this embodiment, a pipette is used to transfer 0.01 ml of antibiotic aqueous solutions with different concentrations into 40 ml of milk to prepare milk antibiotic residue samples with concentrations of 0 mg / L, 0.02 mg / L, 0.04 mg / L, 0.06 mg / L, 0.08 mg / L, 0.10 mg / L, 0.14 mg / L, 0.18 mg / L, 0.22 mg / L, 0.26 mg / L, and 0.3 mg / L. 15 samples are prepared for each concentration.
[0050] Since there are many types of antibiotics, the antibiotics remaining in the milk include ciprofloxacin and chloramphenicol. Milk antibiotic residue samples of these two antibiotics can be prepared separately. It should be noted that milk antibiotic residue samples of other antibiotics can also be prepared according to actual needs. When antibiotic aqueous solutions such as ciprofloxacin, ofloxacin, and chloramphenicol are added to milk, they will undergo electrostatic interaction or hydrogen bond interaction with casein in the milk to form non-covalent complexes.
[0051] Step S2000: Extract the casein in the milk antibiotic residue samples as casein antibiotic residue samples, and the casein in the pure milk samples as pure milk casein samples. The specific steps are as follows:
[0052] Step S2100: Heat the samples to 40 - 50 °C and adjust the pH value to 4.6. At this time, the casein in the samples gradually aggregates and precipitates.
[0053] Step S2200: Filter and separate the milk antibiotic residue samples and pure milk samples to obtain casein antibiotic residue samples and pure milk casein samples.
[0054] Step S3000: Collect the fluorescence hyperspectral images of the casein antibiotic residue samples and pure milk casein samples, as well as collect the full-white calibration image and full-black calibration image.
[0055] Step S4000: Perform black and white correction on the fluorescence hyperspectral images of the casein antibiotic residue samples and pure milk casein samples respectively. The formula for correcting the images is as follows:
[0056]
[0057] Among them, R is the fluorescence hyperspectral image after black and white correction, and I R is the original fluorescence hyperspectral image collected, and I W is the all-white calibration image, and I D is the all-black calibration image.
[0058] Step S5000: Extract several pixel points in the central region of all sample fluorescence hyperspectral images as the region of interest, calculate the average spectral curve data, set a preset spectral range, and retain the data within the preset spectral range as the spectral curve data set.
[0059] In this embodiment, 1000 pixel points in the central region of the fluorescence hyperspectral image are extracted as the region of interest. The corresponding band range for calculating the average spectral curve data is: 397.66nm - 1003.81nm. Since there is a lot of noise at both ends of this band, only 421.24nm - 699.09nm is retained as the preset spectral range after removing the noise at both ends. Finally, 105 spectral bands are retained, and the band interval is 2.7nm. The average spectral curve data of casein with different concentrations of ciprofloxacin residue and chloramphenicol residue is as Figure 2 shown.
[0060] From Figure 2 it can be seen that the overall trends of the average spectral curves of casein in different categories of antibiotic residue samples and casein in pure milk samples are similar, but the peak sizes are different and there are slight drifts in the peak positions. Therefore, it is possible to judge whether casein interacts with antibiotics according to the peaks, that is, whether there is antibiotic residue in milk.
[0061] Step S6000: Perform PCA data dimensionality reduction processing on the spectral curve data sets of the casein antibiotic residue samples and the pure milk casein samples, input the BP neural network algorithm and train it to obtain an antibiotic residue detection model.
[0062] To improve the detection accuracy, step S6000 further includes the following steps:
[0063] Step S6100: Perform PCA (Principal Component Analysis) data dimensionality reduction processing on the average spectral curve data to obtain spectral dimensionality reduction data, which specifically includes the following steps:
[0064] Step S6110: Perform data standardization processing on the average spectral curve data to obtain average spectral curve standardized data. The calculation formula for data standardization processing is:
[0065]
[0066] Among them, Xstd Let the standardized data of the average spectral curve be \( \overline{X} \), \( X \) be the original data matrix of the average spectral curve data, \( \mu \) be the mean of each column feature of the original data matrix, and \( \sigma \) be the standard deviation of each column of the original data matrix.
[0067] Step S6120: Calculate the covariance matrix of the standardized data of the average spectral curve. The calculation formula is:
[0068]
[0069] Where, is the covariance matrix of the standardized data of the average spectral curve, \( m \) is the number of rows of the original data matrix \( X \), that is, the number of samples, is the transpose of the standardized data of the average spectral curve.
[0070] Step S6130: Solve the eigenvalues and corresponding eigenvectors of the covariance matrix of the standardized data of the average spectral curve. The calculation formula is:
[0071]
[0072] Where, \( \nu \) is the eigenvector of the covariance matrix of the standardized data of the average spectral curve, and \( \lambda \) is the eigenvalue of the covariance matrix of the standardized data of the average spectral curve.
[0073] Step S6140: Sort the eigenvalues in descending order, and select the eigenvectors corresponding to the top 3 largest eigenvalues as the first principal component, the second principal component, and the third principal component, and construct an eigenvector matrix.
[0074] Step S6150: Project the standardized data of the average spectral curve onto the selected principal components to obtain the spectral dimensionality reduction data of each casein antibiotic residue sample and pure milk casein spectral data. The calculation formula for the scores of the standardized data of the average spectral curve on the first principal component, the second principal component, and the third principal component is:
[0075] Y = X std V(5)
[0076] Where, \( Y \) is the score of each casein antibiotic residue sample on the first principal component, the second principal component, and the third principal component, that is, the spectral dimensionality reduction data, and \( V \) is the eigenvector matrix.
[0077] Step S6200: Use the BP neural network algorithm to read the spectral dimensionality reduction data, label the antibiotic tags according to the antibiotic types, and divide the spectral dimensionality reduction data into 10 non-overlapping subsets. Each time, 9 subsets are selected as the training set, and the remaining one subset is used as the test set.
[0078] Step S6300: Normalize the spectral dimensionality reduction data of the training set to the interval [0, 1], and create a BP neural network algorithm model, where the hidden layer contains 4 neurons, and set the training parameters (maximum iteration 1000 rounds, target error 1e-6, learning rate 0.01).
[0079] Step S6400: Use the train function to train the BP neural network algorithm model. The input data is the spectral dimensionality reduction data of the normalized training set, and the output data is the antibiotic category.
[0080] Step S6500: Use the trained BP neural network algorithm model to perform simulation prediction on the spectral dimensionality reduction data of the normalized training set and test set, compare the prediction results with the real results, and calculate the prediction accuracy of the training set and test set. If the accuracy is above 90%, it is used as the antibiotic residue detection model.
[0081] Step S7000: Extract casein in the milk to be tested as the casein antibiotic residue sample, collect the fluorescence hyperspectral image of the casein antibiotic residue sample, and input the spectral dimensionality reduction data into the antibiotic residue detection model to obtain the prediction result.
[0082] In step S1000, milk antibiotic residue samples with different antibiotics can be prepared, such as ciprofloxacin, ofloxacin, chloramphenicol, etc. After obtaining the corresponding casein as the spectral dimensionality reduction data of the casein antibiotic residue sample and the pure milk casein sample, during the training process of the BP neural network algorithm, different antibiotic types are marked with labels. Thus, in step S7000, the antibiotic type can be judged according to the label.
[0083] If antibiotics such as ciprofloxacin, ofloxacin, and chloramphenicol remain in milk, casein in the milk will undergo electrostatic interaction or hydrogen bond interaction with the remaining ciprofloxacin, ofloxacin, chloramphenicol, etc. to form a non-covalent complex. This non-covalent complex will affect the fluorescence hyperspectral average spectral curve data of the milk, that is, the overall trend of the average spectral curve data of the fluorescence hyperspectral image of milk with antibiotic residues is similar to that of the fluorescence hyperspectral image of milk without antibiotic residues, but the peak sizes are different, and there are slight drifts in the peak positions. Therefore, by collecting the fluorescence hyperspectrum of the milk sample to be tested and comparing it with the antibiotic residue samples of different antibiotic types and concentrations, it is possible to determine whether there are antibiotic residues in the milk sample to be tested. However, other components in the milk, such as fat, will absorb or scatter the fluorescence signal, which may cause fluorescence quenching, reducing the fluorescence intensity and thus affecting the detection sensitivity of antibiotic residues. Therefore, in this embodiment, by extracting casein from the milk, the milk components that generate fluorescence are more enriched. Obtaining the fluorescence hyperspectral average spectral curve data of casein can determine whether there is a non-covalent complex in the milk sample to be tested, and then infer the type of antibiotic, which has higher accuracy compared to directly using the fluorescence hyperspectral average spectral curve data of the milk to be tested.
[0084] It should be understood that the above specific embodiments of the present invention are only for illustrative explanation or interpretation of the principle of the present invention, and do not constitute a limitation to the present invention. Therefore, any modifications, equivalent replacements, improvements, etc. made without departing from the spirit and scope of the present invention shall be included within the protection scope of the present invention. In addition, the appended claims of the present invention are intended to cover all changes and modifications that fall within the scope and boundaries of the appended claims, or equivalent forms of such scope and boundaries.
Claims
1. A method for detecting antibiotic residues in milk, characterized in that: The steps include: Step S1000: preparing milk antibiotic residue samples of different concentrations; Step S2000: extracting casein from the milk antibiotic residue sample as a casein antibiotic residue sample; Step S3000: collecting fluorescence hyperspectral images of the casein antibiotic residue sample and the pure milk sample, and collecting all-white calibration images and all-black calibration images; Step S4000: performing black and white correction on the fluorescence hyperspectral images of the casein antibiotic residue sample and the pure bovine casein sample respectively; Step S5000: extracting a number of pixel points in the central area of the fluorescence hyperspectral image as a region of interest, calculating average spectral curve data, setting a preset spectral range, and retaining the average spectral curve data within the preset spectral range as a spectral curve data set; Step S6000: performing PCA data dimensionality reduction processing on the spectral curve data sets of the casein antibiotic residue sample and the pure bovine casein sample, inputting the data sets into a BP neural network algorithm model and training the model to obtain an antibiotic residue detection model; Step S7000: extracting casein from the milk to be tested as the casein antibiotic residue sample, collecting the fluorescence hyperspectral image of the casein antibiotic residue sample, inputting the spectral dimension reduction data into the antibiotic residue detection model and obtaining a prediction result.
2. The method for detecting milk antibiotic residues according to claim 1, characterized in that: The step S1000 specifically includes: Step S1100: preparing antibiotic aqueous solutions of different concentrations; Step S1200: adding the antibiotic aqueous solution into milk without antibiotic residue to form milk antibiotic residue samples with different concentrations.
3. The method for detecting milk antibiotic residues according to claim 1, characterized in that: The step S2000 specifically includes: Step S2100: heating the milk antibiotic residue sample to 40-50° C. and adjusting the pH value to 4.6, so that casein in the milk antibiotic residue sample is aggregated and precipitated; Step S2200: filtering and separating the milk antibiotic residue sample and the pure milk sample to obtain the casein antibiotic residue sample and the pure milk casein sample.
4. The method for detecting milk antibiotic residues according to claim 1, characterized in that: The step S6000 specifically includes: Step S6100: performing PCA data dimension reduction processing on the average spectrum curve data to obtain the spectrum dimension reduction data; Step S6200: using the BP neural network algorithm model to read the spectral dimension reduction data, and marking antibiotic labels according to the types of antibiotics, and dividing the spectral dimension reduction data into 10 non-overlapping subsets, each time selecting 9 subsets as training sets, and the remaining subset as a test set; Step S6300: normalizing the spectral dimension reduction data of the training set to the interval [0, 1], and creating a BP neural network algorithm model, wherein the hidden layer includes 4 neurons, and setting training parameters; Step S6400: using the train function to train the BP neural network algorithm model, the input data is the spectral dimension reduction data after normalization of the training set, and the output data is the antibiotic category; Step S6500: Use the trained BP neural network algorithm model to simulate and predict the spectral dimension reduction data after normalization of the training set and the test set, compare the predicted results with the actual results, and calculate the prediction accuracy of the training set and the test set. If the accuracy is above 90%, it will be used as the antibiotic residue detection model.
5. The method for detecting antibiotic residues in milk according to claim 4, characterized in that: The step S6100 includes: Step S6110: performing data standardization processing on the average spectrum curve data to obtain average spectrum curve standardized data; Step S6120: Calculate the covariance matrix of the average spectrum curve standardized data; Step S6130: solving the eigenvalues and corresponding eigenvectors of the covariance matrix of the average spectrum curve standardized data; Step S6140: sort the eigenvalues by size, select the eigenvectors corresponding to the first three largest eigenvalues as the first principal component, the second principal component, and the third principal component, and construct an eigenvector matrix; Step S6150: Project the average spectral curve standardized data onto the selected principal component to obtain the spectral dimension reduction data of the average spectral curve data of each of the casein antibiotic residue samples and the pure cow casein sample.
6. The method for detecting milk antibiotic residues according to claim 1, characterized in that: The image correction calculation formula in step S4000 is: Wherein, R is the fluorescence hyperspectral image after black and white correction, I R is the original fluorescence hyperspectral image collected, I W is the all-white calibration image, I D is the all-black calibration image.
7. The method for detecting milk antibiotic residues according to claim 5, characterized in that: The calculation formula for the data standardization process is: Among them, X std is the standardized data of the average spectral curve, X is the original data matrix of the average spectral curve data, μ is the mean of the features of each column of the original data matrix, and σ is the standard deviation of each column of the original data matrix.
8. The method for detecting milk antibiotic residues according to claim 5, characterized in that: in, is the covariance matrix of the standardized data of the average spectral curve, m is the number of rows of the original data matrix X, that is, the number of samples, Normalize the transpose of the data for the mean spectral curve.
Citation Information
Patent Citations
Method for detecting tetracycline antibiotics based on fluorescence spectrometry
CN112304914A
IMMUNOCHROMATOGRAPHIC TEST STRIP FOR THE RAPID METHOD OF DETERMINING FOUR GROUPS OF ANTIBIOTICS IN MILK WITH THE EXCLUSION OF POSSIBLE FALSIFICATION OF THE SAMPLE
RU191660U1