Method for detecting pesticide residues in wine grapes and wine

Through multi-instrument collaborative detection and full-cycle data association, combined with neural network models and optimization solutions, the problems of error and low detection efficiency in pesticide residue detection in wine grapes and wine have been solved, high-precision pesticide residue detection and full-process control have been achieved, and the pesticide residue compliance rate and wine quality have been improved.

CN120721829APending Publication Date: 2025-09-30NINGXIA HUI AUTONOMOUS REGION FOOD TESTING RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511051146.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-29
Publication Date
2025-09-30

AI Technical Summary

Technical Problem

Existing technologies for detecting pesticide residues in wine grapes and wine have problems such as large detection errors, poor sensitivity and selectivity, difficulty in unified analysis of multi-instrument detection results, and failure to correlate the impact of planting links and brewing processes on residues, resulting in low detection efficiency and low residue control efficiency.

Method used

By adopting multi-instrument collaborative detection, combined with neural network models and full-cycle data association, and through precise preprocessing and optimization solutions, we can achieve full-process control from terminal detection, locate the causes of excessive residues and generate feasible solutions.

Benefits of technology

The precision and accuracy of pesticide residue detection have been improved, ensuring the stability of wine quality and increasing the rate of pesticide residue compliance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120721829A_ABST
    Figure CN120721829A_ABST
Patent Text Reader

Abstract

The invention provides a method for detecting pesticide residues in wine grapes and wine, and belongs to the technical field of big data analys.The method comprises the steps that different detectors are adopted for conducting at least n times of pesticide residue detection on wine in the same designated field, a plurality of detection records of each detector are obtained, and first preprocessing is conducted on all the detection records; inputting the pesticide residues into a pre-trained neural network model to obtain final pesticide residues, and when the pesticide residues do not meet a residue standard, collecting a first data set of wine grapes in a specified field in a whole growth cycle and collecting a second data set of each brewing process of wine; and generating an optimization direction and an optimization scheme and carrying out residue simulation in combination with a residue association relationship between the planting period and the brewing period and a residue standard until the residue standard is met. The residue detection precision is improved, the standard reaching rate of pesticide residues is improved, and the quality stability of wine is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of big data analysis, and in particular to a method for detecting pesticide residues in wine grapes and wine. Background Art

[0002] Pesticide residue testing is a critical component of wine grape and wine quality and safety, directly impacting consumer health and the sustainable development of the industry. Existing technologies often rely on single chromatography-mass spectrometry instruments (such as GC-MS or LC-MS / MS) for detection. However, wine grape and wine matrices are complex, containing high concentrations of ethanol, tannins, and organic acids, which can easily interfere with pesticide residue signals. This can lead to large detection errors (relative standard deviations (RSDs) often exceeding 15%) even at low residue concentrations (e.g., <0.01 mg / kg). At the same time, the detection sensitivity and selectivity of different instruments vary significantly. A single device is difficult to cover all types of pesticides (for example, organophosphorus and carbamates require different detection conditions), which can easily lead to missed detections or misjudgments. Some schemes attempt to use multi-instrument joint detection, but lack targeted pretreatment methods: the retention time, peak area and other data of different instruments have significant deviations due to systematic errors, resulting in difficulty in unified analysis of multi-instrument detection results, resulting in low efficiency in pesticide residue detection. In addition, existing detection methods mostly focus on the determination of residues in terminal products, without correlating the effects of wine grape planting links (such as pesticide application time, meteorological conditions, soil characteristics) and brewing processes (such as fermentation temperature, filtration method) on residues. This leads to low residue control efficiency, which indirectly affects the subsequent judgment of whether pesticide residues meet the standard residue standards.

[0003] Therefore, the present invention provides a method for detecting pesticide residues in wine grapes and wine. Summary of the Invention

[0004] The present invention provides a method for detecting pesticide residues in wine grapes and wine, so as to solve the above-mentioned technical problems.

[0005] The present invention provides a method for detecting pesticide residues in wine grapes and wine, comprising: Step 1: Using different detectors, wine samples from the same designated field are tested for pesticide residues at least n times to obtain a number of test records for each detector. All test records are then preprocessed. The test records include: the model identification of the corresponding detector, the type of pesticide residue detected, and a continuous mass spectrometry signal. Step 2: Inputting the first preprocessing result into a pre-trained neural network model to obtain a final pesticide residue; when the final pesticide residue meets the residue standard, directly generating a first residue report based on the final pesticide residue; Step 3: When the final pesticide residue does not meet the residue standard, a first data set is collected from the wine grapes in the designated field during the entire growth cycle, and a second data set is collected for each brewing process of the wine; Step 4: Based on the first and second data sets, and in combination with the residue correlation relationship between the planting period and the brewing period and the residue standard, an optimization direction and an optimization plan are generated and a residue simulation is performed until the residue standard is met.

[0006] Preferably, the detection data is subjected to a first preprocessing, comprising: Perform the first intersection processing on the n test records under the same detector according to the pesticide residue types, determine the residue types of the full intersection and obtain the first residue type; The first residue types under different detectors are subjected to a second intersection process and a union process. When a residue type is identified by two or more detectors, it is determined that the corresponding residue type is effectively detected once; The residue types effectively detected once are corrected and retained based on the mass spectra under different detectors to obtain the mass spectrum set. ,in, represents the j1th calibration graph of the i-th detector based on a valid detection; m represents the number of detectors based on a valid detection; n represents the number of pesticide residue tests under each detector; Otherwise, the mass spectrum of the corresponding residue species is matched with the mass spectrum library, and when the matching degree is greater than a preset degree, the corresponding residue species is retained.

[0007] Preferably, performing a first preprocessing on the detection data further includes: Each continuous mass spectrum signal under the retained species is collapsed into a three-dimensional matrix according to the mass-to-charge ratio step and the retention time step. , where n1 is the number of retention time segments, m1 is the number of mass-to-charge ratio segments, and k1 is the signal intensity quantization level; Based on the historical mass-to-charge ratio drift range and retention time drift range of the corresponding detector, o1 intervals are expanded along the mass-to-charge ratio dimension and o2 intervals are expanded along the retention time dimension to construct the expansion matrix of the corresponding mass spectrum. ; Extract the metabolic characteristic peak of the wine, mark it as a rigid anchor point in the corresponding expansion matrix, mark the area where the rigid anchor point is located as the priority search submatrix, and set the element value of the priority search submatrix to 0 to obtain the remaining submatrix, where the area where the anchor point is located is 2o1 2o2; A first similarity matrix is ​​constructed by traversing the similarity coefficients of the priority search submatrix based on the same rigid anchor point among all detectors under the corresponding retained type to obtain a first eigenvector, and the first eigenvector is input into the vector analysis model to obtain an enhancement coefficient of the corresponding rigid anchor point. At the same time, a second similarity matrix is ​​constructed by traversing the similarity coefficients of the remaining submatrix under the same rigid anchor point among all detectors under the corresponding retained type to obtain a second eigenvector, and the second eigenvector is input into the vector analysis model to obtain an attenuation coefficient of the remaining submatrix of the corresponding rigid anchor point. Performing a first multiplication adjustment on the element values ​​of the corresponding first similarity matrix according to the enhancement coefficient, and at the same time, performing a second multiplication adjustment on the element values ​​of the second similarity matrix according to the attenuation coefficient, and replacing the values ​​of the element positions after the second multiplication adjustment one-to-one with the results of the first multiplication adjustment based on the same element position, to obtain a global similarity matrix of the corresponding rigid anchor point under the corresponding retention type; Based on the analysis of the global similarity matrix of each rigid anchor point, a correction scheme for adjusting the continuous mass spectrometry signal is obtained; After adjusting the continuous mass spectrometry signal based on the correction scheme and relying on the measurement weight of the detector involved in the corresponding effective detection, the required pesticide residue of the corresponding retained type is obtained, wherein the measurement weight is obtained based on the matching of the instrument quantity-instrument model-weight comparison table, and the first preprocessing result is the model identification of the corresponding detector, the retained pesticide residue type and the corresponding corrected mass spectrometry signal.

[0008] Preferably, a correction scheme for adjusting the continuous mass spectrometry signal is obtained by analyzing the global similarity matrix of each rigid anchor point, including: The global similarity matrix of all rigid anchor points is weighted to calculate the position of the same element to obtain a new matrix, and the position point of each rigid anchor point based on the expanded matrix is ​​matched with the new matrix one by one, and the corresponding position point of each rigid anchor point is used as the basis to determine the o1 based on the new matrix. The maximum value in the sub-matrix of o2, record the position coordinate Ai of the maximum value; Determine the mass-to-charge ratio offset and retention time offset based on each Ai, and obtain a mass-to-charge ratio offset sequence and a retention time offset sequence based on a rigid anchor point; Determining a first quantity ratio between the forward direction and the reverse direction in the mass-to-charge ratio shift sequence and a second quantity ratio between the forward direction and the reverse direction in the retention time shift sequence; Depending on the first quantity ratio and the second quantity ratio, a correction scheme is matched from a dual ratio-correction lookup table to adjust the continuous mass spectrometry signal of the corresponding retained species.

[0009] Preferably, the first preprocessing result is input into a pre-trained neural network model to obtain the final pesticide residue, comprising: The mass spectrometric features and instrument model identification from the first preprocessing results were extracted and combined with the wine matrix parameters to construct a multimodal input. This input was fed into a pre-trained neural network model to output the pesticide residue quantitative value, i.e., the final pesticide residue for each retained pesticide type.

[0010] Preferably, before generating the optimization direction and optimization plan and performing the residual simulation, the following steps are included: Establishing a time-correlation table for pesticide spraying, weather, and soil conditions based on the first dataset, wherein the first dataset comprises a pesticide spraying dataset collected for wine grapes from a specified field over the entire growth cycle, a weather dataset and a soil dataset recorded after each pesticide spraying according to the pesticide spraying type, and performing a second preprocessing on each of the collected datasets; A corresponding process residue table is established based on the second data set, and compared with the standard residue table to obtain an optimized reference relationship table, wherein the second data set is obtained by the process operation of each brewing process of the collected wine and the initial residue of the sample extracted after the corresponding process operation is completed.

[0011] Preferably, generating an optimization direction and an optimization plan includes: Based on the time control relationship table and the optimized reference relationship table, a random forest algorithm is used to quantify the association weights between the pesticide degradation rate during the planting period and the residue migration rate during the brewing period to obtain a planting-brewing residue association model, and based on the planting-brewing residue association model, an influence coefficient of the planting factor on the final residue amount is output; Determine the planting optimization direction and brewing optimization direction based on the comparison between the output of the correlation model and the residue standard; Based on the planting optimization direction and combined with local weather forecast data, a dynamic pesticide application schedule is generated to clarify the first adjustment strategy under different precipitation and sunshine probabilities; Based on the brewing optimization direction, the fermentation temperature gradient and the filter medium combination are determined to obtain a second adjustment strategy, wherein the second adjustment strategy is marked with the expected reduction in the residual volume due to the adjustment of each parameter; The first adjustment strategy and the second adjustment strategy are combined into an optimization solution.

[0012] Preferably, the optimization scheme is subjected to residual simulation, including: Based on the planting-brewing residue correlation model, the residue changes of each retained species after the optimization scheme are simulated in stages according to the growth cycle and brewing process, and the predicted residue values ​​of each pesticide type involved in each stage are output; If the residual prediction value does not meet the standard, the parameter adjustment mechanism will be automatically triggered and the optimization plan will be further adjusted.

[0013] Compared with the prior art, the present invention has the following advantages: By improving the accuracy of residue detection through multi-instrument collaborative detection and precise preprocessing, and combining full-cycle data correlation and intelligent optimization to achieve an upgrade from terminal detection to full-process management and control, the cause of excessive residues can be quickly located and feasible solutions can be generated, thereby increasing the compliance rate of pesticide residues and ensuring the stability of wine quality.

[0014] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the accompanying drawings.

[0015] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings: Figure 1 The figure is a flow chart of a method for detecting pesticide residues in wine grapes and wine according to an embodiment of the present invention. DETAILED DESCRIPTION

[0017] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0018] The present invention provides a method for detecting pesticide residues in wine grapes and wine. Figure 1 As shown, including: Step 1: Using different detectors, wine samples from the same designated field are tested for pesticide residues at least n times to obtain a number of test records for each detector. All test records are then preprocessed. The test records include: the model identification of the corresponding detector, the type of pesticide residue detected, and a continuous mass spectrometry signal. Step 2: Inputting the first preprocessing result into a pre-trained neural network model to obtain a final pesticide residue; when the final pesticide residue meets the residue standard, directly generating a first residue report based on the final pesticide residue; Step 3: When the final pesticide residue does not meet the residue standard, a first data set is collected from the wine grapes in the designated field during the entire growth cycle, and a second data set is collected for each brewing process of the wine; Step 4: Based on the first and second data sets, and in combination with the residue correlation relationship between the planting period and the brewing period and the residue standard, an optimization direction and an optimization plan are generated and a residue simulation is performed until the residue standard is met.

[0019] In this embodiment, different detectors refer to pesticide residue detection instruments with different principles or models, which are used for cross-validation to improve the reliability of the results, such as gas chromatography-mass spectrometry (GC-MS), liquid chromatography-tandem mass spectrometry (LC-MS / MS), and matrix-assisted laser desorption ionization time-of-flight mass spectrometry (MALDI-TOFMS).

[0020] The wine from a designated field comes from the same batch of wine brewed in a specific growing area (plot located by GPS), ensuring the traceability of the sample. For example, the dry red wine made from Cabernet Sauvignon grapes harvested in 2023 from Plot 3 of a certain production area has the batch number PC2023-003. Specifically: the plot coordinates, harvest date, and brewing batch are recorded during sampling, and the sample packaging is marked with a unique identification code.

[0021] In this embodiment, at least n tests are performed on the same sample in parallel, where n is the number of tests (n≥3), to reduce random errors. For example, for batch PC2023-003 wine, GC-MS tests were performed three times, LC-MS / MS tests were performed three times, and MALDI-TOFMS tests were performed three times, for a total of nine tests.

[0022] In this embodiment, the detection record is the raw data and identification information generated by a single detection, which is used for subsequent analysis, including "Instrument model: GC-MS7890A", "Pesticide residue type: chlorpyrifos", "Continuous mass spectrometry signal (mass-to-charge ratio 475.9→305.0, retention time 12.35min, peak area )".

[0023] In this embodiment, the first preprocessing is to standardize the test records, including residue type screening and mass spectrum correction, to ensure data consistency. For example, in the intersection of the three GC-MS tests with the same instrument, only "chlorpyrifos and chlorothalonil" detected in all three tests are retained ("triadimefon" detected only once is eliminated); The multi-instrument validation was that chlorpyrifos was detected by both GC-MS and LC-MS / MS and determined to be an effective residue; Mass spectrometry calibration is to align the mass spectra of the two instruments by using a rigid anchor point (such as the mass-to-charge ratio of tartaric acid 151.021) to correct the retention time deviation (from ±0.2 min to ±0.01 min).

[0024] The pre-trained neural network model is a machine learning model trained using historical data and is used to predict pesticide residues. It adopts a "convolutional neural network (CNN) + attention mechanism" structure, with inputs including mass spectrometry features (mass-to-charge ratio, peak area), instrument weights (GC-MS weight 1.2), and matrix parameters (alcohol content 13.5%). The training data contains 5,000 sets of "pretreatment results-actual residue" samples (the actual residue is determined using the standard external standard method).

[0025] The final pesticide residue is the quantitative result of pesticide residue output by the model, in mg / kg, for example, "chlorpyrifos: 0.023 mg / kg; chlorothalonil: 0.018 mg / kg". The residue standard is the maximum allowable pesticide residue stipulated by law or industry. For example, GB2763-2021 stipulates that chlorpyrifos in wine is ≤0.05 mg / kg and chlorothalonil is ≤0.1 mg / kg.

[0026] The first residue report is a test report generated when the residue standard is met, and contains key information, such as sample number: PC2023-003; test items: chlorpyrifos (0.023 mg / kg, qualified), chlorothalonil (0.018 mg / kg, qualified); testing instrument: GC-MS / LC-MS / MS; report date: 2023-10-01.

[0027] In this embodiment, the second processing result is a result that the final pesticide residue does not meet the residue standard (ie, exceeds the standard), for example, chlorpyrifos: 0.065 mg / kg (exceeds the standard, the standard is 0.05 mg / kg).

[0028] In this embodiment, the first data set of the entire growth cycle is the full cycle data of wine grapes from planting to harvesting, which is used to trace the source of residues. For example, the pesticide application record: 2023-06-10, spraying of chlorpyrifos, dosage 100g / mu; meteorological data: 2023-06-11 to 13, cumulative precipitation 50mm, average temperature 28°C; soil data: soil pH 6.5, organic matter content 2.5%. Specifically: collected through a combination of IoT sensors (such as soil moisture meters, weather stations) and manual records, and stored in a MySQL database.

[0029] In this embodiment, the second data set for each brewing process is the operating parameters and corresponding residue data of each step of the winemaking process, which is used to analyze the process impact. For example, the fermentation process is: "temperature 25°C, time 10 days, chlorpyrifos residue after fermentation is 0.07 mg / kg"; the filtration process is: "diatomaceous earth filtration, pressure 0.2 MPa, chlorpyrifos residue after filtration is 0.065 mg / kg".

[0030] In this embodiment, the residue correlation relationship between the planting period and the brewing period is the influence of planting factors (such as pesticide application) and brewing process on the residue amount. For example, during the planting period, if the precipitation is greater than 30 mm within 3 days after spraying, the degradation rate of chlorpyrifos increases by 20%; during the brewing period, if the fermentation temperature increases from 25°C to 30°C, the chlorpyrifos residue decreases by 15%. Specifically, SPSS is used to perform correlation analysis and establish a regression model (such as "residue amount = 0.8×application amount - 0.1×precipitation + 0.05×fermentation temperature").

[0031] In this embodiment, the optimization direction is to improve the target of excessive residues, which is divided into planting and brewing links, for example, "reducing the application amount of chlorpyrifos" at the planting end and "increasing the fermentation temperature" at the brewing end.

[0032] In this embodiment, the optimization plan is a specific measure to achieve the optimization direction, for example, the planting plan: "Reduce the application rate of chlorpyrifos from 100g / mu to 80g / mu, and apply it during the 7 days without precipitation after spraying"; the brewing plan: "Raise the fermentation temperature to 30°C, and add one activated carbon adsorption (dosage 2g / L)".

[0033] In this embodiment, the residue simulation is to predict the residue amount after the optimization scheme is implemented through the model. For example, the above scheme is simulated by MATLAB, and the predicted residue amount of chlorpyrifos is reduced to 0.045 mg / kg (meeting the standard).

[0034] The beneficial effects of the above technical solution are: improving the residue detection accuracy through multi-instrument collaborative detection and precise preprocessing, combining full-cycle data correlation and intelligent optimization to achieve an upgrade from terminal detection to full-process control, quickly locating the cause of excessive residues and generating feasible solutions, thereby improving the pesticide residue compliance rate and ensuring the stability of wine quality.

[0035] The present invention provides a method for detecting pesticide residues in wine grapes and wine, which performs a first preprocessing on the detection data, including: Perform the first intersection processing on the n test records under the same detector according to the pesticide residue types, determine the residue types of the full intersection and obtain the first residue type; The first residue types under different detectors are subjected to a second intersection process and a union process. When a residue type is identified by two or more detectors, it is determined that the corresponding residue type is effectively detected once; The residue types effectively detected once are corrected and retained based on the mass spectra under different detectors to obtain the mass spectrum set. ,in, represents the j1th calibration graph of the i-th detector based on a valid detection; m represents the number of detectors based on a valid detection; n represents the number of pesticide residue tests under each detector; Otherwise, the mass spectrum of the corresponding residue type is matched with the mass spectrum library. When the degree of match is greater than a preset degree, the corresponding residue type is retained. In this embodiment, the n test records under the same detector are raw data generated by the same instrument (e.g., GC-MS) performing n parallel tests on the same sample (n ≥ 3, to reduce random errors), including pesticide types, mass spectrometry signals, etc. The first intersection processing is to filter out pesticide types that appear in multiple tests with the same instrument and eliminate interference items that are detected accidentally. For example, if wine is tested three times by GC-MS (n = 3), the detection results are: first test: {chlorpyrifos, chlorothalonil, triadimefon}; second test: {chlorpyrifos, chlorothalonil, procymidone}; third test: {chlorpyrifos, chlorothalonil, propamocarb}; after the intersection calculation, the first residue type = {chlorpyrifos, chlorothalonil} (detected in all three tests).

[0036] The first residue type under the same detector is the set of residue types after the first intersection screening of multiple instruments (such as GC-MS, LC-MS / MS). The second intersection processing is to screen the pesticide types detected by multiple instruments (strong verification); the union processing: summarizes the types detected by all instruments (covering potential residues).

[0037] Effective detection at one time: A pesticide is identified by ≥2 instruments (cross-validation is passed to reduce false positives), for example: GC-MS first residue: {chlorpyrifos, chlorothalonil}; LC-MS / MS first residue: {chlorpyrifos, procymidone} The second intersection: {chlorpyrifos} (detected by both instruments), determined to be a valid detection, and the union set: {chlorpyrifos, chlorothalonil, procymidone} ("chlorothalonil, procymidone" detected by a single instrument will enter the subsequent verification).

[0038] The types of residues that can be effectively detected at one time are pesticides that have been cross-validated by multiple instruments (such as "chlorpyrifos").

[0039] Mass spectrum calibration is the process of aligning mass spectra from different instruments (correcting retention time drift and mass-to-charge ratio deviation) to eliminate systematic errors.

[0040] In this embodiment, mass spectrum library matching is to compare the mass spectrum detected by a single instrument with a standard spectrum library (such as NIST, MassBank), calculate the matching degree (such as peak shape, mass-to-charge ratio coincidence), and retain it if it exceeds the preset degree. For example, LC-MS / MS detects "procymidone", but GC-MS does not detect it → extract the mass spectrum of procymidone (mass-to-charge ratio 180.0→125.0, retention time 8.20min). For example, it matches the procymidone standard spectrum in the NIST library: the peak position coincidence is 95%, the matching score is 920 (out of 1000 points), and the preset degree is 900 → retain "procymidone", wherein the matching degree is calculated by cosine similarity.

[0041] The beneficial effects of the above technical solution are: through the four-layer screening logic of same-instrument intersection stability inspection → multi-instrument intersection and union verification → effective residue correction and normalization → single-instrument spectral library backup, accurate determination of pesticide residue types can be achieved: false positives are reduced through multi-instrument cross-validation, and potential residues detected by a single instrument are covered through spectral library matching; mass spectrometry correction technology eliminates instrument system errors, laying a high-credibility data foundation for subsequent quantitative analysis.

[0042] To address the issue of inconsistent data from multiple instruments: Traditional single-instrument detection is susceptible to matrix interference, while multi-instrument detection can also lead to inconsistent results due to systematic errors. This solution uses anchor point correction, hierarchical similarity, and weighted fusion to reduce the deviation of multi-instrument mass spectrometry data from ±0.1 Da / ±0.2 min to ±0.001 Da / ±0.01 min, providing highly consistent data for subsequent residue quantification. To address the issue of misidentification of weak signals / interfering peaks: The complex wine matrix (high ethanol and tannins) can easily mask low-concentration pesticide peaks or generate interfering peaks. Three-dimensional matrix folding preserves the signal intensity dimension, and the hierarchical similarity matrix enhances the anchor point region and attenuates the interference region, effectively improving the detection accuracy and interference resistance of weak signals. To address the issue of insufficient generalization of the correction: the augmented matrix is ​​designed based on historical instrument drift statistics rather than fixed intervals, adapting to the drift characteristics of different instruments. Rigid anchor points select wine-specific metabolic peaks to ensure the solution's specificity to the wine matrix and prevent the failure of general correction models in complex matrices. The present invention provides a method for detecting pesticide residues in wine grapes and wine, which performs a first preprocessing on the detection data and further includes: Each continuous mass spectrum signal under the retained species is collapsed into a three-dimensional matrix according to the mass-to-charge ratio step and the retention time step. , where n1 is the number of retention time segments, m1 is the number of mass-to-charge ratio segments, and k1 is the signal intensity quantization level; Based on the historical mass-to-charge ratio drift range and retention time drift range of the corresponding detector, o1 intervals are expanded along the mass-to-charge ratio dimension and o2 intervals are expanded along the retention time dimension to construct the expansion matrix of the corresponding mass spectrum. ; Extract the metabolic characteristic peak of the wine, mark it as a rigid anchor point in the corresponding expansion matrix, mark the area where the rigid anchor point is located as the priority search submatrix, and set the element value of the priority search submatrix to 0 to obtain the remaining submatrix, where the area where the anchor point is located is 2o1 2o2; A first similarity matrix is ​​constructed by traversing the similarity coefficients of the priority search submatrix based on the same rigid anchor point among all detectors under the corresponding retained type to obtain a first eigenvector, and the first eigenvector is input into the vector analysis model to obtain an enhancement coefficient of the corresponding rigid anchor point. At the same time, a second similarity matrix is ​​constructed by traversing the similarity coefficients of the remaining submatrix under the same rigid anchor point among all detectors under the corresponding retained type to obtain a second eigenvector, and the second eigenvector is input into the vector analysis model to obtain an attenuation coefficient of the remaining submatrix of the corresponding rigid anchor point. Performing a first multiplication adjustment on the element values ​​of the corresponding first similarity matrix according to the enhancement coefficient, and at the same time, performing a second multiplication adjustment on the element values ​​of the second similarity matrix according to the attenuation coefficient, and replacing the values ​​of the element positions after the second multiplication adjustment one-to-one with the results of the first multiplication adjustment based on the same element position, to obtain a global similarity matrix of the corresponding rigid anchor point under the corresponding retention type; Based on the analysis of the global similarity matrix of each rigid anchor point, a correction scheme for adjusting the continuous mass spectrometry signal is obtained; After adjusting the continuous mass spectrometry signal based on the correction scheme and relying on the measurement weight of the detector involved in the corresponding effective detection, the required pesticide residue of the corresponding retained type is obtained, wherein the measurement weight is obtained based on the matching of the instrument quantity-instrument model-weight comparison table, and the first preprocessing result is the model identification of the corresponding detector, the retained pesticide residue type and the corresponding corrected mass spectrometry signal.

[0043] In this embodiment, the mass-to-charge ratio range is divided into equally spaced intervals (e.g., 100–500 Da, with each 0.05 Da as a segment) to discretize the mass spectrometry signal, and the retention time range is divided into equally spaced intervals (e.g., 0–30 min, with each 0.02 min as a segment) to discretize the time dimension.

[0044] In this embodiment, n1: total retention time / step length; m1: total mass-to-charge ratio range / step length; k1: Divide the signal strength into equally spaced levels (e.g. is level one, with a total of 100 levels); Take the mass spectrometry signal of chlorpyrifos in wine: mass-to-charge ratio range is 300-350Da, retention time range is 12 to 13min: n1=(13-12) / 0.02=50; m1=(350-300) / 0.05=1000; k1= 100, folded into a three-dimensional matrix , each element represents the signal intensity level of the corresponding interval, for example, the mass-to-charge ratio step is 0.05Da and the retention time step is 0.02min.

[0045] In this embodiment, the historical mass-to-charge ratio drift range (e.g., ±0.3Da) is the maximum deviation of the mass-to-charge ratio of the same pesticide in the historical detection of the statistical instrument (caused by instrument calibration error and environmental temperature drift), and the historical retention time drift range (e.g., ±0.15min) is the maximum deviation of the retention time of the same pesticide in the historical detection of the statistical instrument (caused by carrier gas flow rate fluctuation and column temperature change).

[0046] In this embodiment, , for example, o1=0.3 / 0.05 2=12; , for example, o2=0.15 / 0.02 2=15, then the expanded matrix is: .

[0047] In this embodiment, the metabolic characteristic peak is a metabolite peak that exists stably in wine, such as tartaric acid and malic acid. The priority search submatrix is ​​a small matrix centered on the anchor point (covering the drift range around the anchor point), which is marked as the priority matching area; the remaining submatrix is ​​the part of the expanded matrix except the priority search area. For example, the coordinates of the tartaric acid anchor point: the coordinate point corresponding to the mass-to-charge ratio segment is: xj=151.021 (mass-to-charge ratio) / 0.05=3020, and the corresponding retention time segment is yi=2.35 / 0.02=117. At this time, the priority search submatrix is ​​centered on (xj, yi)=(3020, 117), and takes a 30×24 interval to obtain , .

[0048] In this embodiment, similarity coefficient is an indicator for measuring the similarity of mass spectra of multiple instruments (such as Pearson correlation coefficient and cosine similarity).

[0049] First similarity matrix (priority search area): Calculate the similarity coefficients of the priority search submatrices across multiple instruments to construct a matrix (dimension: number of instruments × number of instruments). Second similarity matrix (remaining submatrix): Calculate the similarity coefficients of the remaining submatrices across multiple instruments to construct a matrix. Eigenvector: Perform principal component analysis (PCA) on the similarity matrix to extract the first principal component vector (representing the core feature of similarity). The element values ​​in the similarity matrix are the similarities between the average mass spectrum submatrices of n detections from different instruments.

[0050] The vector analysis model is a trained linear model (or regression tree), which inputs eigenvectors and outputs coefficients. The remaining submatrix is ​​the area in the expanded matrix except for the priority search submatrix (the mass spectrum range outside the anchor point). The second eigenvector is the principal component extracted by PCA of the second similarity matrix (representing the similarity features of the non-anchor point area).

[0051] For example: retained species: chlorpyrifos; detectors: GC-MS (1 unit), LC-MS / MS (1 unit); rigid anchor point: tartaric acid.

[0052] Prioritized search submatrix (5×5): The similarity coefficient of the tartaric acid region between GC-MS and LC-MS / MS is 0.9, and the first similarity matrix is ​​constructed , PCA extracts the eigenvector [0.707, 0.707], and the input model has an enhancement coefficient of 1.5.

[0053] The remaining submatrix: The similarity coefficient of the non-tartaric acid region between GC-MS and LC-MS / MS is 0.6, and the second similarity matrix is ​​constructed , PCA extracts the eigenvector [0.707, 0.707], and the attenuation coefficient input into the model is 0.6.

[0054] The first multiplication adjustment is to multiply the elements of the first similarity matrix by the enhancement coefficient (such as 0.9×1.5=1.35) to strengthen the similarity of the anchor point area.

[0055] The second multiplication adjustment is to multiply the elements of the second similarity matrix by the attenuation coefficient (such as 0.6×0.6=0.36) to weaken the interference in the non-anchor point area.

[0056] The same element position is the position of the corresponding instrument pair and corresponding coordinate in the first and second similarity matrices (such as the (10, 20) position of instrument 1 and instrument 2). Replacement: overwrite the "enhanced priority search area value" to the corresponding position of the global matrix, and fill the remaining positions with the "remaining area value after attenuation". The global similarity matrix is ​​the final similarity matrix that integrates anchor point enhancement and non-anchor point attenuation, and reflects the similarity of key areas and the global at the same time.

[0057] For example, the first similarity matrix element (instrument 1-instrument 2, (10, 20)) is 0.9, which is multiplied by 1.5 to get 1.35. The corresponding position element of the second similarity matrix is ​​0.6, which is multiplied by 0.6 to get 0.3. In the global similarity matrix, if the position point (10, 20) belongs to the priority search area, the value is 1.35; otherwise, it is 0.36.

[0058] Global similarity matrix analysis is to find the position of the maximum value in the matrix (representing the optimal matching point of mass spectra between instruments), and the correction scheme is to calculate the mass-to-charge ratio offset and retention time offset based on the offset of the maximum value position from the anchor point benchmark.

[0059] Measurement weights are assigned based on instrument model and quantity (e.g., GC-MS has a high precision weight of 1.2; LC-MS / MS has a weight of 1.0), reflecting differences in instrument reliability. The instrument quantity-instrument model-weight comparison table is a predefined dictionary (e.g., {"GC-MS":1.2,"LC-MS / MS":1.0}) that matches weights to instrument types.

[0060] The required pesticide residue is the weighted average of the data after multi-instrument calibration (e.g., (1.2×0.02+1.0×0.025) / (1.2+1.0)≈0.022 mg / kg).

[0061] The first preprocessing result is standardized data (e.g., in JSON format) that includes the instrument model, retained pesticide types, and corrected mass spectrometry signals. For example, instruments: 2 GC-MS (weight 1.2), 1 LC-MS / MS (weight 1.0); corrected residues: 0.02, 0.02, 0.025 mg / kg; Weighted sum: 0.02 × 1.2 + 0.02 × 1.2 + 0.025 × 1.0 = 0.024 + 0.024 + 0.025 = 0.073; Total weight: 1.2+1.2+1.0=3.4; Quantitative result: 0.073÷3.4≈0.0215mg / kg.

[0062] The beneficial effects of the above technical solution are: through the similarity fusion strategy of anchor region enhancement + non-anchor region attenuation, combined with the quantitative optimization of instrument weights, high-precision correction and unified quantification of multi-instrument mass spectrometry data can be achieved, ultimately providing reliable error results for pesticide residue detection, supporting subsequent risk assessment and optimization decisions.

[0063] The present invention provides a method for detecting pesticide residues in wine grapes and wine. The method analyzes the global similarity matrix of each rigid anchor point to obtain a correction scheme for adjusting the continuous mass spectrometry signal, including: The global similarity matrix of all rigid anchor points is weighted to calculate the position of the same element to obtain a new matrix, and the position point of each rigid anchor point based on the expanded matrix is ​​matched with the new matrix one by one, and the corresponding position point of each rigid anchor point is used as the basis to determine the o1 based on the new matrix. The maximum value in the sub-matrix of o2, record the position coordinate Ai of the maximum value; Determine the mass-to-charge ratio offset and retention time offset based on each Ai, and obtain a mass-to-charge ratio offset sequence and a retention time offset sequence based on a rigid anchor point; Determining a first quantity ratio between the forward direction and the reverse direction in the mass-to-charge ratio shift sequence and a second quantity ratio between the forward direction and the reverse direction in the retention time shift sequence; Depending on the first quantity ratio and the second quantity ratio, a correction scheme is matched from a dual ratio-correction lookup table to adjust the continuous mass spectrometry signal of the corresponding retained species.

[0064] In this embodiment, the global similarity matrix is ​​a multi-instrument mass spectrometry similarity matrix after fusion of anchor point enhancement and non-anchor point attenuation (dimension: expanded matrix size × number of instruments). The weighted calculation is weighted according to the stability of the anchor points (e.g., tartaric acid has a weight of 0.6, malic acid has a weight of 0.3), and the similarity values ​​at the same element position are weighted averaged to highlight high-confidence anchor points. For example, the global similarity matrix of three anchor points (tartaric acid, malic acid, citric acid) has corresponding weights of [0.6, 0.3, 0.1]: At this time, the new matrix element value = 0.6×H01+0.3×H02+0.1×H03, (H01 / H02 / H03 is the global similarity matrix of each anchor point).

[0065] In this embodiment, the expanded matrix position point is the coordinate of the point in the expanded matrix.

[0066] o1 The submatrix of o2 is centered on the anchor point coordinates, and is a local matrix intercepted along the retention time (o1 segment, such as segment 5) and mass-to-charge ratio (o2 segment, such as segment 5), covering the drift range around the anchor point.

[0067] The position coordinate Ai is the coordinate of the element with the largest similarity value in the submatrix. For example, the anchor point coordinate is (117, 3020). At this time, ±2 segments in the time direction and ±2 segments in the mass-to-charge ratio direction are retained. At this time, the submatrix range is: [115, 120] and [3018, 3022]. The maximum value searched is at (118, 3021), that is, Ai=(118, 3021).

[0068] In this embodiment, the mass-to-charge ratio offset is the difference between the mass-to-charge ratio coordinate of Ai and the anchor reference coordinate, multiplied by the step size (0.05 Da / segment); the retention time offset is the difference between the retention time coordinate of Ai and the anchor reference coordinate, multiplied by the step size (0.02 min / segment).

[0069] The offset sequence is an array of offset values ​​for all rigid anchor points (e.g., the offset sequence for the mass-to-charge ratio of three anchor points: [0.05, -0.02, 0.1]).

[0070] In this embodiment, for the positive offset, the offset value is greater than 0, for the negative offset, the offset value is less than 0, and the quantity ratio is: the positive offset quantity / the negative offset quantity.

[0071] In this embodiment, the dual ratio-correction comparison table is a predefined mass-to-charge ratio ratio + retention time ratio → correction strategy mapping table (e.g., ratios of 2:1 & 1:2 correspond to a mass-to-charge ratio forward correction of 0.03 Da and a retention time reverse correction of 0.01 min). Continuous mass spectrometry signal adjustment: According to the correction strategy, the mass-to-charge ratio and retention time of the original mass spectrometry signal are shifted. For example, the table lookup is: ratio 2:1 (mass-to-charge ratio) and 1:2 (retention time) → correction scheme: mass-to-charge ratio offset: -0.03 Da (more positive offset, reverse compensation), retention time offset: +0.01 min (more reverse offset, forward compensation), adjusted mass-to-charge ratio: 300.15 − 0.03 = 300.12 Da, adjusted retention time = 12.35 + 0.01 = 12.36.

[0072] The beneficial effects of the above technical solution are: through a closed-loop process of anchor point weighted fusion → sub-matrix precise search → offset direction statistics → table lookup intelligent correction, directional high-precision alignment of mass spectrometry signals can be achieved: anchor point offset statistics eliminate random errors, and the dual ratio strategy adapts to complex instrument drift patterns, providing reliable error input for subsequent pesticide residue quantification.

[0073] The present invention provides a method for detecting pesticide residues in wine grapes and wine, wherein a first preprocessing result is input into a pre-trained neural network model to obtain a final pesticide residue, comprising: The mass spectrometric features and instrument model identification from the first preprocessing results were extracted and combined with the wine matrix parameters to construct a multimodal input. This input was fed into a pre-trained neural network model to output the pesticide residue quantitative value, i.e., the final pesticide residue for each retained pesticide type.

[0074] In this embodiment, mass spectrometry feature extraction is to extract key signal attributes from the calibrated mass spectrum, including peak position, peak intensity, peak shape, etc., reflecting the mass spectrometry response law of the pesticide, such as: core features: mass-to-charge ratio peak (255.12Da), retention time (8.72min), peak area ( ), signal-to-noise ratio (22:1, peak height ÷ background noise standard deviation), half-peak width (0.08min); Derived characteristics: peak symmetry (skewness 0.15, close to symmetrical distribution).

[0075] The instrument model identifier is the brand and model code of the instrument, which is used to distinguish the detection accuracy (such as high-resolution mass spectrometry vs. ordinary mass spectrometry) and provide a basis for error compensation for the model. For example: Encoding method: one-hot encoding (such as GC-HRMS → [1,0,0], LC-MS / MS → [0,1,0], MALDI-TOF → [0,0,1]); The weight mapping is a predefined instrument precision weight table (GC-HRMS weight 1.3, LC-MS / MS weight 1.0, MALDI-TOF weight 0.8). Specifically, the following is done: Encoding: convert the instrument model string through sklearn.preprocessing.OneHotEncoder; Weight matching: create a dictionary {"GC-HRMS":1.3}, which is subsequently used for weighted fusion of quantitative results.

[0076] In this example, wine matrix parameters are the physical and chemical properties of wine (such as alcohol content and tannins), which affect the ionization efficiency and solubility of the pesticide and require correction for matrix interference on the signal. For example, key parameters include alcohol content (14.2% similar volume), tannin content (3.5 g / L), pH (3.3), and residual sugar (2.1 g / L). The preprocessing is min-max similarity normalization (values ​​are mapped to the [0,1] interval, formula: (x-min) / (max-min)) to eliminate dimensional differences.

[0077] In this embodiment, the multimodal input is constructed by splicing the mass spectrometry characteristics (numerical values), instrument identification (encoding vector), and matrix parameters (normalized values) to form a composite input that can be parsed by the model, covering the triple dimensions of "signal-instrument-environment". For example: dimensional composition: mass spectrometry characteristics (5 dimensions: mz, rt, peak area, signal-to-noise ratio, half-peak width) + instrument encoding (3 dimensions) + matrix parameters (4 dimensions) = 12-dimensional vector, example vector: [255.12, 8.72, 3.8e6, 22, 0.08, 1, 0, 0, 0.65, 0.42, 0.31, 0.25] (matrix parameters have been normalized).

[0078] In this embodiment, the pre-trained neural network model is a model trained based on a wine-specific dataset, integrating multimodal features and learning the nonlinear relationship of "mass spectrometry-instrument-matrix→residue" through a deep network. For example: model structure: 1D-CNN (extracting mass spectrometry peak sequence features) + Transformer (capturing the global correlation of instrument / matrix) + regression head (outputting quantitative values); training data: 8,000 sets of "multimodal input→true concentration" samples (true concentration is determined by isotope internal standard method with an accuracy of ±0.001 mg / kg).

[0079] In this example, the pesticide residue quantitative value is the pesticide concentration (mg / kg) output by the model, corresponding to each retained pesticide type, and is directly used for residue determination, for example: Input: 12-dimensional multimodal vector of imidacloprid; Output: 0.018 mg / kg (compared with the true value of the isotope internal standard method of 0.020 mg / kg, error 10%).

[0080] The beneficial effect of the above technical solution is: through the multimodal fusion of deep analysis of mass spectrometry signals + instrument deviation compensation + matrix effect correction, the neural network breaks through the limitations of traditional single-dimensional detection and provides core support for the accurate determination of pesticide residues in wine.

[0081] The present invention provides a method for detecting pesticide residues in wine grapes and wine, which comprises: generating an optimization direction and an optimization scheme and performing a residue simulation before performing the following steps: Establishing a time-correlation table for pesticide spraying, weather, and soil conditions based on the first dataset, wherein the first dataset comprises a pesticide spraying dataset collected for wine grapes from a specified field over the entire growth cycle, a weather dataset and a soil dataset recorded after each pesticide spraying according to the pesticide spraying type, and performing a second preprocessing on each of the collected datasets; A corresponding process residue table is established based on the second data set, and compared with the standard residue table to obtain an optimized reference relationship table, wherein the second data set is obtained by the process operation of each brewing process of the collected wine and the initial residue of the sample extracted after the corresponding process operation is completed.

[0082] Preferably, generating an optimization direction and an optimization plan includes: Based on the time control relationship table and the optimized reference relationship table, a random forest algorithm is used to quantify the association weights between the pesticide degradation rate during the planting period and the residue migration rate during the brewing period to obtain a planting-brewing residue association model, and based on the planting-brewing residue association model, an influence coefficient of the planting factor on the final residue amount is output; Determine the planting optimization direction and brewing optimization direction based on the comparison between the output of the correlation model and the residue standard; Based on the planting optimization direction and combined with local weather forecast data, a dynamic pesticide application schedule is generated to clarify the first adjustment strategy under different precipitation and sunshine probabilities; Based on the brewing optimization direction, the fermentation temperature gradient and the filter medium combination are determined to obtain a second adjustment strategy, wherein the second adjustment strategy is marked with the expected reduction in the residual volume due to the adjustment of each parameter; The first adjustment strategy and the second adjustment strategy are combined into an optimization solution.

[0083] Preferably, the optimization scheme is subjected to residual simulation, including: Based on the planting-brewing residue correlation model, the residue changes of each retained species after the optimization scheme are simulated in stages according to the growth cycle and brewing process, and the predicted residue values ​​of each pesticide type involved in each stage are output; If the residual prediction value does not meet the standard, the parameter adjustment mechanism will be automatically triggered and the optimization plan will be further adjusted.

[0084] In this embodiment, the first dataset is a key data set for the entire growth cycle (bud break to harvest) of wine grapes in a specified field, and includes three subsets: Pesticide spraying data: records the time, type, dosage, and method of each pesticide application (e.g., "2023-06-10, imidacloprid, 100g / mu, foliar spray"); Weather data: corresponds to meteorological data within 7 days after each spraying (time-related, such as "2023-06-10 to 16, daily average temperature 26°C, cumulative precipitation 35mm, sunshine 6.5h / day"); Soil set: soil physical and chemical parameters before and after spraying (spatial correlation, such as "2023-06-09 (before), 6-17 (after), pH 6.5→6.4, organic matter 2.3%→2.2%").

[0085] The second preprocessing is the standardization of the three subsets, including: Time alignment (precisely matching spraying time with weather / soil sampling time, error ≤ 1h); Outlier removal (e.g., if the precipitation data exceeds the historical mean by three times, the outlier will be replaced by the mean of the adjacent three days); Units are standardized (e.g. dosage is converted to g of active ingredient / ha, precipitation is standardized to mm).

[0086] Implementation: Use Python pandas to process, merge data by timestamp, and use the IQR method (interquartile range) to remove outliers.

[0087] The time comparison table is a three-dimensional comparison table connected in series by spraying time. The format example is shown in Table 1: Table 1

[0088] In this embodiment, the second data set is the process and residue data of the entire winemaking process (from crushing to aging), which consists of two parts: Process operation: key parameters of each step (e.g., “fermentation: temperature 25°C, duration 10 days, stirring frequency 2 times / day”); Initial residue: The pesticide residue measured by sampling after the corresponding process is completed (step association, such as "after the fermentation is completed, the imidacloprid residue is 0.07 mg / kg").

[0089] The process residue table is a "process-residue" comparison table sorted by brewing process, as shown in Table 2: Table 2

[0090] The standard residue table is the maximum residue limit of pesticides in wine stipulated by the state / industry (such as imidacloprid ≤ 0.05 mg / kg in GB2763-2021), which serves as the compliance benchmark.

[0091] The optimization reference relationship table is a comparison table of the process residue table and the standard residue table, marked with "the difference between the current residue and the standard" and "the process parameter adjustment space", as shown in Table 3: Table 3

[0092] In this embodiment, the random forest algorithm quantifies the association weight by using a machine learning model (random forest) to analyze the influence weights of "planting factors (such as precipitation)" and "brewing factors (such as fermentation temperature)" on the final residue, and outputs: planting-brewing residue association model: a formulaic expression (such as "final residue = 0.7 × planting residue + 0.3 × brewing migration amount"); Impact coefficient: The marginal effect of a single factor on residue (e.g., "For every 10 mm increase in precipitation, the degradation rate during the planting stage increases by 15% → the impact coefficient decreases by -0.15," with negative values ​​indicating reduced residue). Specifically, a random forest regression model was constructed using scikit-learn, with the inputs being the time-to-time comparison table and the process residue table, and the output being the feature importance (i.e., weight).

[0093] In this example, the planting / brewing optimization direction is to compare the model output with the standard and identify the key links that exceed the standard: Planting optimization direction: For example, "imidacloprid residues are mainly caused by insufficient rainfall after spraying (degradation is slow)"; Brewing optimization direction: For example, "the residue in the filtration process does not meet the standard, and the adsorption efficiency needs to be enhanced."

[0094] The first adjustment strategy (planting side) is to combine dynamic pesticide application plan with weather forecast, as shown in Table 4: Table 4

[0095] The second adjustment strategy (brew side) is a specific optimization plan for process parameters, for example: Fermentation temperature gradient: "28°C for the first 3 days (accelerated degradation), 30°C for the last 7 days (inhibited residue migration)"; Filter media combination: "Diatomaceous earth (1 layer) + activated carbon (2 layers)", marked "Expected residual from 0.065→0.045 mg / kg (down 0.02 mg / kg)".

[0096] The staged simulation is based on the association model, predicting the residue changes in stages according to the "planting cycle (germination → harvest)" and "brewing process (crushing → aging)", and outputting: Planting stage: "15 days after spraying during the flowering period, the imidacloprid residue was 0.08 mg / kg; this dropped to 0.06 mg / kg at harvest." Brewing stage: "0.05 mg / kg after fermentation; 0.045 mg / kg after filtration".

[0097] The parameter adjustment mechanism is that if the predicted value at a certain stage exceeds the standard (for example, "residue at harvest 0.07mg / kg > standard 0.05"), the adjustment is automatically triggered: Prioritize adjusting sensitive parameters (e.g., "postpone spraying for 3 days" on the planting side, "increase activated carbon dosage by 5%" on the brewing side); Iterate until the predicted values ​​at all stages meet the standards (deviation ≤ 5%).

[0098] The beneficial effects of the above technical solution are: through a closed-loop process of associating all data of planting and brewing → algorithm quantification of influence weights → dynamic optimization solution generation → phased simulation verification, accurate traceability and system optimization of excessive pesticide residues can be achieved, and ultimately the residue compliance rate can be improved while ensuring the quality of the wine.

[0099] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. A method for detecting pesticide residues in wine grapes and wine, characterized in that: include: Step 1: Using different detectors, wine samples from the same designated field are tested for pesticide residues at least n times to obtain a number of test records for each detector. All test records are then preprocessed. The test records include: the model identification of the corresponding detector, the type of pesticide residue detected, and a continuous mass spectrometry signal. Step 2: Inputting the first preprocessing result into a pre-trained neural network model to obtain a final pesticide residue; when the final pesticide residue meets the residue standard, directly generating a first residue report based on the final pesticide residue; Step 3: When the final pesticide residue does not meet the residue standard, a first data set is collected from the wine grapes in the designated field during the entire growth cycle, and a second data set is collected for each brewing process of the wine; Step 4: Based on the first and second data sets, and in combination with the residue correlation relationship between the planting period and the brewing period and the residue standard, an optimization direction and an optimization plan are generated and a residue simulation is performed until the residue standard is met.

2. The method for detecting pesticide residues in wine grapes and wine according to claim 1, characterized in that: The detection data is first preprocessed, including: Perform the first intersection processing on the n test records under the same detector according to the pesticide residue types, determine the residue types of the full intersection and obtain the first residue type; The first residue types under different detectors are subjected to a second intersection process and a union process. When a residue type is identified by two or more detectors, it is determined that the corresponding residue type is effectively detected once; The residue types effectively detected once are corrected and retained based on the mass spectra under different detectors to obtain the mass spectrum set. ,in, represents the j1th calibration graph of the i-th detector based on a valid detection; m represents the number of detectors based on a valid detection; n represents the number of pesticide residue tests under each detector; Otherwise, the mass spectrum of the corresponding residue species is matched with the mass spectrum library, and when the matching degree is greater than a preset degree, the corresponding residue species is retained.

3. The method for detecting pesticide residues in wine grapes and wine according to claim 2, characterized in that: Performing a first preprocessing on the detection data further includes: Each continuous mass spectrum signal under the retention species is folded into a three-dimensional matrix according to the mass-to-charge ratio step and the retention time step. , where n1 is the number of retention time segments, m1 is the number of mass-to-charge ratio segments, and k1 is the signal intensity quantization level; Based on the historical mass-to-charge ratio drift range and retention time drift range of the corresponding detector, o1 intervals are expanded along the mass-to-charge ratio dimension and o2 intervals are expanded along the retention time dimension to construct the expansion matrix of the corresponding mass spectrum. ; Extract the metabolic characteristic peak of the wine, mark it as a rigid anchor point in the corresponding expansion matrix, mark the area where the rigid anchor point is located as the priority search submatrix, and set the element value of the priority search submatrix to 0 to obtain the remaining submatrix, where the area where the anchor point is located is 2o1 2o2; A first similarity matrix is ​​constructed by traversing the similarity coefficients of the priority search submatrix based on the same rigid anchor point among all detectors under the corresponding retained type to obtain a first eigenvector, and the first eigenvector is input into the vector analysis model to obtain an enhancement coefficient of the corresponding rigid anchor point. At the same time, a second similarity matrix is ​​constructed by traversing the similarity coefficients of the remaining submatrix under the same rigid anchor point among all detectors under the corresponding retained type to obtain a second eigenvector, and the second eigenvector is input into the vector analysis model to obtain an attenuation coefficient of the remaining submatrix of the corresponding rigid anchor point. Performing a first multiplication adjustment on the element values ​​of the corresponding first similarity matrix according to the enhancement coefficient, and at the same time, performing a second multiplication adjustment on the element values ​​of the second similarity matrix according to the attenuation coefficient, and replacing the values ​​of the element positions after the second multiplication adjustment one-to-one with the results of the first multiplication adjustment based on the same element position, to obtain a global similarity matrix of the corresponding rigid anchor point under the corresponding retention type; Based on the analysis of the global similarity matrix of each rigid anchor point, a correction scheme for adjusting the continuous mass spectrometry signal is obtained; After adjusting the continuous mass spectrometry signal based on the correction scheme and relying on the measurement weight of the detector involved in the corresponding effective detection, the required pesticide residue of the corresponding retained type is obtained, wherein the measurement weight is obtained based on the matching of the instrument quantity-instrument model-weight comparison table, and the first preprocessing result is the model identification of the corresponding detector, the retained pesticide residue type and the corresponding corrected mass spectrometry signal.

4. The method for detecting pesticide residues in wine grapes and wine according to claim 1, characterized in that: Based on the global similarity matrix of each rigid anchor point, a correction scheme for adjusting the continuous mass spectrometry signal is obtained, including: The global similarity matrix of all rigid anchor points is weighted to calculate the position of the same element to obtain a new matrix, and the position point of each rigid anchor point based on the expanded matrix is ​​matched with the new matrix one by one, and the corresponding position point of each rigid anchor point is used as the basis to determine the o1 based on the new matrix. The maximum value in the sub-matrix of o2, record the position coordinate Ai of the maximum value; Determine the mass-to-charge ratio offset and retention time offset based on each Ai, and obtain a mass-to-charge ratio offset sequence and a retention time offset sequence based on a rigid anchor point; Determining a first quantity ratio between the forward direction and the reverse direction in the mass-to-charge ratio shift sequence and a second quantity ratio between the forward direction and the reverse direction in the retention time shift sequence; Depending on the first quantity ratio and the second quantity ratio, a correction scheme is matched from a dual ratio-correction lookup table to adjust the continuous mass spectrometry signal of the corresponding retained species.

5. The method for detecting pesticide residues in wine grapes and wine according to claim 1, characterized in that: The first preprocessing result is input into the pre-trained neural network model to obtain the final pesticide residue, including: The mass spectrometric features and instrument model identification from the first preprocessing results were extracted and combined with the wine matrix parameters to construct a multimodal input. This input was fed into a pre-trained neural network model to output the pesticide residue quantitative value, i.e., the final pesticide residue for each retained pesticide type.

6. The method for detecting pesticide residues in wine grapes and wine according to claim 1, characterized in that: Before generating the optimization direction and optimization plan and performing the rest simulation, the following steps should be taken: Establishing a time-correlation table for pesticide spraying, weather, and soil conditions based on the first dataset, wherein the first dataset comprises a pesticide spraying dataset collected for wine grapes from a specified field over the entire growth cycle, a weather dataset and a soil dataset recorded after each pesticide spraying according to the pesticide spraying type, and performing a second preprocessing on each of the collected datasets; A corresponding process residue table is established based on the second data set, and compared with the standard residue table to obtain an optimized reference relationship table, wherein the second data set is obtained by the process operation of each brewing process of the collected wine and the initial residue of the sample extracted after the corresponding process operation is completed.

7. The method for detecting pesticide residues in wine grapes and wine according to claim 6, characterized in that: Generate optimization directions and optimization plans, including: Based on the time control relationship table and the optimized reference relationship table, a random forest algorithm is used to quantify the association weights between the pesticide degradation rate during the planting period and the residue migration rate during the brewing period to obtain a planting-brewing residue association model, and based on the planting-brewing residue association model, an influence coefficient of the planting factor on the final residue amount is output; Determine the planting optimization direction and brewing optimization direction based on the comparison between the output of the correlation model and the residue standard; Based on the planting optimization direction and combined with local weather forecast data, a dynamic pesticide application schedule is generated to clarify the first adjustment strategy under different precipitation and sunshine probabilities; Based on the brewing optimization direction, the fermentation temperature gradient and the filter medium combination are determined to obtain a second adjustment strategy, wherein the second adjustment strategy is marked with the expected reduction in the residual volume due to the adjustment of each parameter; The first adjustment strategy and the second adjustment strategy are combined into an optimization solution.

8. The method for detecting pesticide residues in wine grapes and wine according to claim 7, characterized in that: Perform residual simulation on the optimized solution, including: Based on the planting-brewing residue correlation model, the residue changes of each retained species after the optimization scheme are simulated in stages according to the growth cycle and brewing process, and the predicted residue values ​​of each pesticide type involved in each stage are output; If the residual prediction value does not meet the standard, the parameter adjustment mechanism will be automatically triggered and the optimization plan will be further adjusted.