Method for detecting pesticide residues in wine grapes and wine
Patent Information
- Application Number
- CN202511051146.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2045-07-29
AI Technical Summary
通过多仪器协同检测与精准预处理提升残留检测精度,结合全周期数据关联与智能优化实现从终端检测到全流程管控的升级,可快速定位残留超标原因并生成可行方案,使农药残留达标率提升,同时保障葡萄酒品质稳定性。
Smart Images

Figure CN120721829B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data analysis technology, and in particular to a method for detecting pesticide residues in wine grapes and wine. Background Technology
[0002] In the quality and safety of wine grapes and wines, pesticide residue detection is a crucial step, directly impacting consumer health and the sustainable development of the industry. Current technologies largely rely on single chromatography-mass spectrometry instruments (such as GC-MS or LC-MS / MS) for detection. However, the complex matrix of wine grapes and wines, containing high concentrations of ethanol, tannins, and organic acids, easily interferes with pesticide residue signals, leading to large detection errors (relative standard deviation RSD often >15%) for low-concentration residues (e.g., <0.01 mg / kg). Meanwhile, the detection sensitivity and selectivity of different instruments vary significantly, and a single device cannot cover all types of pesticides (such as organophosphates and carbamates, which require different detection conditions), easily leading to missed detections or misjudgments. Furthermore, some solutions 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, making it difficult to unify the analysis of multi-instrument detection results, resulting in low detection efficiency of pesticide residues. Moreover, existing detection methods mostly focus on the determination of residues in end products, without considering the impact of grape cultivation (such as pesticide application time, meteorological conditions, and soil characteristics) and winemaking processes (such as fermentation temperature and filtration methods) on residues, resulting in low residue control efficiency and indirectly affecting the subsequent judgment of whether pesticide residues meet the standard residue requirements.
[0003] Therefore, this invention proposes a method for detecting pesticide residues in wine grapes and wine. Summary of the Invention
[0004] This invention provides a method for detecting pesticide residues in wine grapes and wine, in order to solve the aforementioned technical problems.
[0005] This invention provides a method for detecting pesticide residues in wine grapes and wine, comprising: Step 1: Use different detectors to perform at least n pesticide residue tests on the wine from the same designated field, obtain several test records for each detector, and perform a first preprocessing on all test records. The test records include: the model identifier of the corresponding detector, the type of pesticide residue detected, and the continuous mass spectrometry signal. Step 2: Input the first preprocessing result into the pre-trained neural network model to obtain the final pesticide residue. When the final pesticide residue meets the residue standard, generate the first residue report directly based on the final pesticide residue. Step 3: When the final pesticide residue does not meet the residue standard, collect the first dataset of the entire growth cycle of wine grapes in the designated field and the second dataset of each winemaking process. Step 4: Based on the first dataset and the second dataset, and combined with the residue correlation during the planting and brewing periods and the residue standards, generate optimization directions and optimization schemes and perform residue simulations until the residue standards are met.
[0006] Preferably, the detection data undergoes a first preprocessing step, including: The first residue type is obtained by performing the first intersection processing on n detection records under the same detector according to the pesticide residue type; the residue types with full intersection are determined. The first residue type under different detectors is subjected to a second intersection processing and a union processing. When a residue type is identified by two or more detectors, the corresponding residue type is determined to be effectively detected once. The residue types detected in a single test are corrected and retained based on mass spectra from different detectors to obtain a mass spectra set. ,in, This represents the j1-th calibration chart based on a single valid detection by the i-th detector; m represents the number of detectors based on a single valid detection; n represents the number of pesticide residue detections per detector. Otherwise, the mass spectrum of the corresponding residual species is matched with the mass spectrum library. When the matching degree is greater than the preset degree, the corresponding residual species is retained.
[0007] Preferably, the first preprocessing of the detection data further includes: Each continuous mass spectrum signal under the retention category is folded into a three-dimensional matrix according to the mass-to-charge ratio step size and retention time step size. Where n1 is the number of retention time segments, m1 is the number of mass-to-charge ratio segments, and k1 is the signal strength quantization level; Based on the historical mass-to-charge ratio drift range and retention time drift range of the corresponding detector, an expansion matrix for the corresponding mass spectrum is constructed by expanding the mass-to-charge ratio by o1 intervals and the retention time by o2 intervals. ; Extract the metabolic characteristic peaks of the wine, mark them as rigid anchor points in the corresponding expanded matrix, mark the region where the rigid anchor points are located as the priority search submatrix, and set the element values of the priority search submatrix to 0 to obtain the remaining submatrix. The size of the region where the anchor points are located is 2o1×2o2. The first similarity matrix is constructed by traversing the similarity coefficients of the priority search submatrices of all detectors under the corresponding retention category based on the same rigid anchor point, and the first eigenvector is obtained. This eigenvector is then input into the vector analysis model to obtain the enhancement coefficient of the corresponding rigid anchor point. At the same time, the second similarity matrix is constructed by traversing the similarity coefficients of the remaining submatrices of all detectors under the corresponding retention category based on the same rigid anchor point, and the second eigenvector is obtained. This eigenvector is then input into the vector analysis model to obtain the attenuation coefficient of the remaining submatrices of the corresponding rigid anchor point. The element values of the corresponding first similarity matrix are adjusted by first multiplication according to the enhancement coefficient, and the element values of the second similarity matrix are adjusted by second multiplication according to the weakening coefficient. Based on the same element position, the values of the element positions after the second multiplication adjustment are replaced one-to-one according to the result of the first multiplication adjustment to obtain the global similarity matrix of the corresponding rigid anchor point under the corresponding retention category. Based on the global similarity matrix of each rigid anchor point, a correction scheme for adjusting the continuous mass spectrum signal is obtained. After adjusting the continuous mass spectrometry signal based on the calibration scheme and relying on the measurement weights of the detectors involved in the corresponding effective detection, the required pesticide residues of the corresponding retained types are obtained. The measurement weights are obtained based on the matching of the instrument quantity-instrument model-weight lookup table, and the first preprocessing result is the model identifier of the corresponding detector, the types of pesticide residues retained, and the corresponding calibrated mass spectrometry signal.
[0008] Preferably, a correction scheme for adjusting the continuous mass spectrum signal is obtained by analyzing the global similarity matrix of each rigid anchor point, including: A new matrix is obtained by weighting the positions of the same element in the global similarity matrix of all rigid anchor points. The position points of each rigid anchor point based on the extended matrix are then mapped one-to-one with the new matrix. Based on the corresponding position points of each rigid anchor point, the maximum value in the o1×o2 submatrix based on the new matrix is determined, and the position coordinates Ai of the maximum value are recorded. Determine the mass-to-charge ratio offset and retention time offset for each Ai to obtain the mass-to-charge ratio offset sequence and retention time offset sequence based on rigid anchor points; Determine the first quantity ratio of the positive direction to the negative direction in the mass-to-charge ratio offset sequence and the second quantity ratio of the positive direction to the negative direction in the retention time offset sequence; Based on the first quantity ratio and the second quantity ratio, a correction scheme is matched from the 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, including: Mass spectrometry features and instrument model identifiers are extracted from the first preprocessing result, and multimodal inputs are constructed by combining them with wine matrix parameters. These inputs are then fed into a pre-trained neural network model to output the quantitative values of pesticide residues, i.e., the final pesticide residues for each pesticide residue type.
[0010] Preferably, before generating the optimization direction and optimization scheme and performing residual simulation, the following steps are included: Based on the first dataset, a time-correspondence table of pesticide spraying, weather and soil was established. The first dataset consists of a pesticide spraying set collected from the entire growth cycle of wine grapes in a designated field, a weather set and a soil set recorded after each pesticide spraying according to the pesticide spraying type, and the collected sets were obtained by performing a second preprocessing on each set. Based on the second dataset, a corresponding process residue table is established, and an optimized reference relationship table is obtained by comparing it with the standard residue table. The second dataset consists of the process operation of each winemaking process collected and the initial residue of the sample extracted after the corresponding process operation.
[0011] Preferably, the optimization direction and optimization scheme are generated, including: Based on the aforementioned time-reference table and optimized reference table, and using the random forest algorithm to quantify the correlation weights between pesticide degradation rate during planting and residual migration rate during brewing, a planting-brewing residue correlation model is obtained. Based on the planting-brewing residue correlation model, the influence coefficient of planting factors on the final residue amount is output. Based on the comparison between the output of the correlation model and the residual standards, the directions for planting optimization and brewing optimization are determined. Based on the direction of planting optimization and combined with local meteorological forecast data, a dynamic plan table for pesticide application is generated, and the first adjustment strategy under different precipitation probabilities and sunshine probabilities is identified. Based on the direction of brewing optimization, the fermentation temperature gradient and the combination of filter media were determined to obtain the second adjustment strategy. The second adjustment strategy indicates the expected reduction of residual amount by each parameter adjustment. The first adjustment strategy and the second adjustment strategy are combined to form an optimization scheme.
[0012] Preferably, residual simulation is performed on the optimized scheme, including: Based on the planting-brewing residue correlation model, the residue changes of each retained species are simulated in stages according to the growth cycle and brewing process after optimization, and the residue prediction values of each pesticide species involved in each stage are output. If residual predicted values fail to meet the standard, the parameter adjustment mechanism will be automatically triggered to continue adjusting the optimization scheme.
[0013] Compared with the prior art, the beneficial effects of this application are: By improving the accuracy of residue detection through multi-instrument collaborative detection and precise pretreatment, and by combining full-cycle data association and intelligent optimization, we can upgrade from terminal detection to full-process control. This can quickly locate the cause of residue exceeding the standard and generate feasible solutions, thereby improving the pesticide residue compliance rate and ensuring the stability of wine quality.
[0014] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.
[0015] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0016] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of a method for detecting pesticide residues in wine grapes and wine according to an embodiment of the present invention. Detailed Implementation
[0017] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0018] This invention provides a method for detecting pesticide residues in wine grapes and wine, such as... Figure 1 As shown, it includes: Step 1: Use different detectors to perform at least n pesticide residue tests on the wine from the same designated field, obtain several test records for each detector, and perform a first preprocessing on all test records. The test records include: the model identifier of the corresponding detector, the type of pesticide residue detected, and the continuous mass spectrometry signal. Step 2: Input the first preprocessing result into the pre-trained neural network model to obtain the final pesticide residue. When the final pesticide residue meets the residue standard, generate the first residue report directly based on the final pesticide residue. Step 3: When the final pesticide residue does not meet the residue standard, collect the first dataset of the entire growth cycle of wine grapes in the designated field and the second dataset of each winemaking process. Step 4: Based on the first dataset and the second dataset, and combined with the residue correlation during the planting and brewing periods and the residue standards, generate optimization directions and optimization schemes and perform residue simulations until the residue standards are met.
[0019] In this embodiment, different detectors refer to pesticide residue detection instruments with different principles or models, used for cross-validation to improve the reliability of 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] Wines from designated vineyards are produced from the same batch of wine from a specific growing region (plots located via GPS) to ensure sample traceability. For example, a 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 production batch are recorded during sampling, and the sample is packaged with a unique identification code.
[0021] In this embodiment, at least n tests are multiple parallel tests performed on the same sample, where n is the number of tests (n≥3), to reduce random errors. For example, for batch PC2023-003 wine, GC-MS is used 3 times, LC-MS / MS is used 3 times, and MALDI-TOFMS is used 3 times, for a total of 9 tests.
[0022] In this embodiment, the detection record is the raw data and identification information generated from a single detection, used for subsequent analysis. It includes "Instrument Model: GC-MS7890A", "Pesticide Residue Type: Chlorpyrifos", and "Continuous Mass Spectrometry Signal (Mass-to-charge ratio 475.9→305.0, retention time 12.35 min, peak area 5.2×10⁻⁶)". 6 )".
[0023] In this embodiment, the first preprocessing is the standardization of the detection records, including residue screening and mass spectrometry correction, to ensure data consistency. For example, in the intersection of instruments: in the three GC-MS detections, only "chlorpyrifos and chlorothalonil" that were detected in all three detections are retained ("triazolone" that was detected only once is removed). Multi-instrument verification showed that chlorpyrifos was detected by both GC-MS and LC-MS / MS, which was determined to be a valid residue. Mass spectrometry calibration is achieved by aligning the mass spectra of the two instruments using rigid anchor points (such as tartrate mass-to-charge ratio 151.021) to correct retention time deviations (from ±0.2 min to ±0.01 min).
[0024] The pre-trained neural network model is a machine learning model trained on historical data to predict pesticide residues. It adopts a "convolutional neural network (CNN) + attention mechanism" structure. The inputs are 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 includes 5,000 sets of "preprocessing results - actual residues" samples (actual residues are determined using the 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 residue of pesticides as stipulated by law or industry. For example, GB2763-2021 stipulates that chlorpyrifos in wine ≤0.05 mg / kg and chlorothalonil ≤0.1 mg / kg.
[0026] The first residue report is a test report generated when the residue standards are met. It contains key information, such as: Sample number: PC2023-003; Test items: Chlorpyrifos (0.023mg / kg, qualified), Chlorothalonil (0.018mg / kg, qualified); Test instrument: GC-MS / LC-MS / MS; Report date: 2023-10-01.
[0027] In this embodiment, the second treatment result is the result that the final pesticide residue does not meet the residue standard (i.e., the result of exceeding the standard), for example, chlorpyrifos: 0.065 mg / kg (exceeding the standard, the standard is 0.05 mg / kg).
[0028] In this embodiment, the first dataset of the entire growth cycle is the full-cycle data of wine grapes from planting to harvest, which is used to trace the source of residues. For example, pesticide application records: June 10, 2023, sprayed with chlorpyrifos at a dose of 100g / mu; meteorological data: from June 11 to 13, 2023, the cumulative precipitation was 50mm and the average temperature was 28℃; soil data: soil pH 6.5 and organic matter content 2.5%. Specifically, the data is collected through a combination of IoT sensors (such as soil moisture meters and weather stations) and manual records, and stored in a MySQL database.
[0029] In this embodiment, the second dataset for each brewing process consists of the operating parameters and corresponding residual data for each stage of wine brewing, used to analyze the impact of the process. For example, for the fermentation process: "temperature 25℃, time 10 days, chlorpyrifos residue after fermentation 0.07mg / kg", and for the filtration process: "diatomaceous earth filtration, pressure 0.2MPa, chlorpyrifos residue after filtration 0.065mg / kg".
[0030] In this embodiment, the relationship between residues during the planting and brewing periods is the influence of planting factors (such as pesticide application) and brewing processes on residue levels. For example, during the planting period, if rainfall 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, correlation analysis is performed using SPSS to establish a regression model (such as "residue = 0.8 × application rate - 0.1 × rainfall + 0.05 × fermentation temperature").
[0031] In this embodiment, the optimization direction is to improve the problem of excessive residues, and it is divided into planting and brewing stages. For example, at the planting stage, "reduce the amount of chlorpyrifos applied"; at the brewing stage, "increase the fermentation temperature".
[0032] In this embodiment, the optimization scheme is a specific measure to achieve the optimization direction. For example, the planting scheme is: "reduce the application rate of chlorpyrifos from 100g / mu to 80g / mu, and choose to apply it during the period of no rainfall 7 days after spraying". The brewing scheme is: "raise the fermentation temperature to 30℃ and increase the adsorption of activated carbon (dosage 2g / L) once".
[0033] In this embodiment, the residue simulation is to predict the residue level after the implementation of the optimization scheme through a model. For example, using MATLAB to simulate the above scheme, it is predicted that the residue level of chlorpyrifos will be reduced to 0.045 mg / kg (meeting the standard).
[0034] The beneficial effects of the above technical solution are: improving the accuracy of residue detection through multi-instrument collaborative detection and precise pretreatment, and upgrading from terminal detection to full-process control by combining full-cycle data association and intelligent optimization. It can quickly locate the cause of residue exceeding the standard and generate feasible solutions, thereby improving the pesticide residue compliance rate and ensuring the stability of wine quality.
[0035] This invention provides a method for detecting pesticide residues in wine grapes and wine, comprising a first preprocessing step for the detection data, including: The first residue type is obtained by performing the first intersection processing on n detection records under the same detector according to the pesticide residue type; the residue types with full intersection are determined. The first residue type under different detectors is subjected to a second intersection processing and a union processing. When a residue type is identified by two or more detectors, the corresponding residue type is determined to be effectively detected once. The residue types detected in a single test are corrected and retained based on mass spectra from different detectors to obtain a mass spectra set. ,in, This represents the j1-th calibration chart based on a single valid detection by the i-th detector; m represents the number of detectors based on a single valid detection; n represents the number of pesticide residue detections per detector. Otherwise, the mass spectrum of the corresponding residue type is matched with the mass spectrometry library. When the matching degree is greater than the preset degree, the corresponding residue type is retained. In this embodiment, the n detection records under the same detector are the raw data generated by the same model of instrument (such as GC-MS) performing n parallel detections on the same sample (n≥3, to reduce random error), including pesticide types, mass spectrometry signals, etc. The first intersection processing is to screen the pesticide types that appear in multiple detections by the same instrument and exclude occasional interference items. For example, if wine is detected by GC-MS 3 times (n=3), the detection results are: 1st time: {chlorpyrifos, chlorothalonil, triadimefon}; 2nd time: {chlorpyrifos, chlorothalonil, iprodione}; 3rd time: {chlorpyrifos, chlorothalonil, propiconazole}; after intersection calculation, the first residue type = {chlorpyrifos, chlorothalonil} (detected in all 3 times).
[0036] The first residue type under the same detector is the set of residue types after screening by multiple instruments (such as GC-MS, LC-MS / MS) after the first intersection. The second intersection process is to screen the pesticide types detected by multiple instruments (strong validation). The union process is to summarize the types detected by all instruments (covering potential residues).
[0037] A single effective detection: A pesticide is identified by ≥2 instruments (cross-validation passes, reducing false positives), for example: GC-MS first residue: {chlorpyrifos, chlorothalonil}; LC-MS / MS first residue: {chlorpyrifos, iprodione}. The second intersection: {chlorpyrifos} (detected by both instruments), is determined to be a valid detection. The union: {chlorpyrifos, chlorothalonil, iprodione} (the "chlorothalonil and iprodione" detected by a single instrument will be subject to further verification).
[0038] The types of residues that can be effectively detected in a single test are pesticides that have been cross-validated by multiple instruments (such as "chlorpyrifos").
[0039] Mass spectrum correction processing aligns mass spectra from different instruments (correcting retention time drift and mass-to-charge ratio deviation) and eliminates systematic errors.
[0040] In this embodiment, mass spectrometry library matching involves comparing the mass spectrum detected by a single instrument with a standard spectral library (such as NIST or MassBank) and calculating the matching degree (such as peak shape and mass-to-charge ratio overlap). If the degree exceeds a preset limit, the spectrum is retained. For example, if LC-MS / MS detects "iprodione" but GC-MS does not, the mass spectrum of iprodione is extracted (mass-to-charge ratio 180.0 → 125.0, retention time 8.20 min). For example, matching with the standard iprodione spectrum in the NIST library: peak overlap 95%, matching degree score 920 (out of 1000), preset degree is 900 → "iprodione" is retained. The matching degree is calculated using cosine similarity.
[0041] The beneficial effects of the above technical solution are as follows: through a four-layer screening logic of instrument intersection stability detection → multi-instrument intersection and union verification → effective residue correction and normalization → single-instrument spectral library fallback, the accurate determination of pesticide residue types is achieved: it reduces false positives through multi-instrument cross-validation and covers potential residues detected by a single instrument through spectral library matching; mass spectrometry correction technology eliminates instrument system errors, laying a highly reliable data foundation for subsequent quantitative analysis.
[0042] To address the issue of inconsistent multi-instrument data: traditional single-instrument detection is susceptible to matrix interference, while multi-instrument detection results can be contradictory due to systematic errors. This solution uses anchor point correction, hierarchical similarity, and weighted fusion to compress 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 misjudgment of weak signals / interference peaks: wine matrices are complex (high in ethanol and tannins), easily masking low-concentration pesticide peaks or generating interference peaks. A three-dimensional matrix folding preserves the signal intensity dimension, and a hierarchical similarity matrix enhances the anchor point region and weakened interference region, effectively improving the detection accuracy and anti-interference capability of weak signals. To address the issue of insufficient calibration generalization: the expanded matrix is designed based on historical instrument drift statistics, rather than fixed intervals, adapting to the drift characteristics of different instruments; rigid anchor points are selected from winemaking-specific metabolic peaks, ensuring the solution's specificity to the wine matrix and preventing the failure of general calibration models in complex matrices. This invention provides a method for detecting pesticide residues in wine grapes and wine, which includes a first preprocessing of the detection data and further includes: Each continuous mass spectrum signal under the retention category is folded into a three-dimensional matrix according to the mass-to-charge ratio step size and retention time step size. Where n1 is the number of retention time segments, m1 is the number of mass-to-charge ratio segments, and k1 is the signal strength quantization level; Based on the historical mass-to-charge ratio drift range and retention time drift range of the corresponding detector, an expansion matrix for the corresponding mass spectrum is constructed by expanding the mass-to-charge ratio by o1 intervals and the retention time by o2 intervals. ; Extract the metabolic characteristic peaks of the wine, mark them as rigid anchor points in the corresponding expanded matrix, mark the region where the rigid anchor points are located as the priority search submatrix, and set the element values of the priority search submatrix to 0 to obtain the remaining submatrix. The size of the region where the anchor points are located is 2o1×2o2. The first similarity matrix is constructed by traversing the similarity coefficients of the priority search submatrices of all detectors under the corresponding retention category based on the same rigid anchor point, and the first eigenvector is obtained. This eigenvector is then input into the vector analysis model to obtain the enhancement coefficient of the corresponding rigid anchor point. At the same time, the second similarity matrix is constructed by traversing the similarity coefficients of the remaining submatrices of all detectors under the corresponding retention category based on the same rigid anchor point, and the second eigenvector is obtained. This eigenvector is then input into the vector analysis model to obtain the attenuation coefficient of the remaining submatrices of the corresponding rigid anchor point. The element values of the corresponding first similarity matrix are adjusted by first multiplication according to the enhancement coefficient, and the element values of the second similarity matrix are adjusted by second multiplication according to the weakening coefficient. Based on the same element position, the values of the element positions after the second multiplication adjustment are replaced one-to-one according to the result of the first multiplication adjustment to obtain the global similarity matrix of the corresponding rigid anchor point under the corresponding retention category. Based on the global similarity matrix of each rigid anchor point, a correction scheme for adjusting the continuous mass spectrum signal is obtained. After adjusting the continuous mass spectrometry signal based on the calibration scheme and relying on the measurement weights of the detectors involved in the corresponding effective detection, the required pesticide residues of the corresponding retained types are obtained. The measurement weights are obtained based on the matching of the instrument quantity-instrument model-weight lookup table, and the first preprocessing result is the model identifier of the corresponding detector, the types of pesticide residues retained, and the corresponding calibrated mass spectrometry signal.
[0043] In this embodiment, the mass-to-charge ratio range is divided into equidistant intervals (e.g., 100–500 Da, with each 0.05 Da segment) to discretize the mass spectrometry signal, and the retention time range is divided into equidistant intervals (e.g., 0–30 min, with each 0.02 min segment) to discretize the time dimension.
[0044] In this embodiment, n1: total retention time / step size; m1: Total mass-to-charge ratio range / step size; k1: Divide the signal strength into equal intervals (e.g., each...) (Level 1, out of 100) Mass spectrometry signal of chlorpyrifos in wine poisoning: mass-to-charge ratio range of 300-350 Da, retention time range of 12 to 13 min: 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 strength level of the corresponding interval, for example, the mass-to-charge ratio step size is 0.05 Da and the retention time step size is 0.02 min.
[0045] In this embodiment, the historical mass-to-charge ratio drift range (e.g., ±0.3 Da) 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.15 min) 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. In this case, the expanded matrix is: H0((50 + 12) × (1000 + 15) × 100).
[0047] In this embodiment, the metabolic characteristic peaks are stable metabolite peaks 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), marked as the priority matching region. The remaining submatrix is the part of the expanded matrix excluding the priority search region. For example, the coordinates of the tartaric acid anchor point are: the coordinates of the corresponding mass-to-charge ratio segment are: xj=151.021(mass-to-charge ratio) / 0.05=3020, and the corresponding retention time segment yi=2.35 / 0.02=117. At this time, the priority search submatrix is centered at (xj, yi) = (3020, 117), taking a 30×24 interval, to obtain... , .
[0048] In this embodiment, the similarity coefficient is an indicator that measures the similarity of mass spectra from multiple instruments (such as Pearson correlation coefficient and cosine similarity).
[0049] First similarity matrix (priority search region): Calculates the similarity coefficients of the priority search sub-matrices among multiple instruments, constructing a matrix (dimension: number of instruments × number of instruments). Second similarity matrix (remaining sub-matrices): Calculates the similarity coefficients of the remaining sub-matrices among multiple instruments, constructing a matrix. Eigenvectors: Perform principal component analysis (PCA) on the similarity matrices, extracting the first principal component vector (representing the core features of similarity). The element values in the similarity matrix represent the similarity between the average mass spectrometry sub-matrices of n detections from different instruments.
[0050] The vector analysis model is a trained linear model (or regression tree). The input is the feature vector, and the output is the coefficient. The remaining submatrix is the region outside the priority search submatrix (the mass spectrum range outside the anchor point) in the expanded matrix. The second feature vector is the principal component extracted by performing PCA on the second similarity matrix (representing the similarity features of the non-anchor point region).
[0051] For example: Species to be retained: Chlorpyrifos; Detection instruments: GC-MS (1 unit), LC-MS / MS (1 unit); Rigid anchor: Tartaric acid.
[0052] Prioritize searching the submatrix (5×5): The tartaric acid region similarity coefficient between GC-MS and LC-MS / MS is 0.9, constructing the first similarity matrix. PCA extracts the feature vector [0.707, 0.707], and inputs it into the model to obtain an enhancement coefficient of 1.5.
[0053] Remaining submatrix: The similarity coefficient between the non-tartaric acid regions of GC-MS and LC-MS / MS is 0.6, constructing a second similarity matrix. PCA extracts the feature vector [0.707, 0.707], and inputs it into the model to obtain a decay coefficient of 0.6.
[0054] The first multiplication adjustment involves multiplying the elements of the first similarity matrix by an enhancement coefficient (e.g., 0.9 × 1.5 = 1.35) to strengthen the similarity of the anchor point regions.
[0055] The second multiplication adjustment involves multiplying the elements of the second similarity matrix by a weakening coefficient (e.g., 0.6 × 0.6 = 0.36) to reduce interference in non-anchor regions.
[0056] The same element position is the position of the corresponding instrument pair and corresponding coordinates in the first and second similarity matrices (such as the (10, 20) position of instrument 1 and instrument 2). Replacement: the "enhanced priority search area value" is overwritten to the corresponding position of the global matrix, and the remaining positions are filled with the "weakened remaining area value". The global similarity matrix is the final similarity matrix that integrates anchor point enhancement and non-anchor point weakening, and reflects the similarity of key areas and the whole.
[0057] For example: the element of the first similarity matrix (instrument 1-instrument 2, (10, 20)) is 0.9, which is multiplied by 1.5 to get 1.35; the element of the corresponding position in 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 finds the location of the maximum value in the matrix (representing the optimal matching point between mass spectrometers). The calibration scheme calculates the mass-to-charge ratio offset and retention time offset based on the offset of the maximum value location from the anchor reference.
[0059] Measurement weights are assigned based on instrument model and quantity (e.g., GC-MS has a higher accuracy, weight 1.2; LC-MS / MS has a weight 1.0), reflecting differences in instrument reliability. The instrument quantity-instrument model-weight lookup table is a predefined dictionary (e.g., {"GC-MS":1.2,"LC-MS / MS":1.0}), with weights matched according to instrument type.
[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.022mg / kg).
[0061] The first preprocessing result is standardized data (e.g., in JSON format) containing the instrument model, pesticide type retained, and corrected mass spectrometry signal. 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.0215 mg / kg.
[0062] The beneficial effects of the above technical solution are: by using a similarity fusion strategy of anchor point region enhancement + non-anchor point region attenuation, combined with 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 and supporting subsequent risk assessment and optimization decisions.
[0063] This invention provides a method for detecting pesticide residues in wine grapes and wine. 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, including: A new matrix is obtained by weighting the positions of the same element in the global similarity matrix of all rigid anchor points. The position points of each rigid anchor point based on the extended matrix are then mapped one-to-one with the new matrix. Based on the corresponding position points of each rigid anchor point, the maximum value in the o1×o2 submatrix based on the new matrix is determined, and the position coordinates Ai of the maximum value are recorded. Determine the mass-to-charge ratio offset and retention time offset for each Ai to obtain the mass-to-charge ratio offset sequence and retention time offset sequence based on rigid anchor points; Determine the first quantity ratio of the positive direction to the negative direction in the mass-to-charge ratio offset sequence and the second quantity ratio of the positive direction to the negative direction in the retention time offset sequence; Based on the first quantity ratio and the second quantity ratio, a correction scheme is matched from the 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 (dimension: expanded matrix size × number of instruments) after fusing anchor point enhancement and non-anchor point attenuation. The weighted calculation is based on the anchor point stability (e.g., tartaric acid weight 0.6, malic acid weight 0.3), and the similarity values at the same element position are weighted and averaged to highlight high-confidence anchor points. For example, the global similarity matrix of 3 anchor points (tartaric acid, malic acid, citric acid) corresponds to weights [0.6, 0.3, 0.1]. At this point, the new matrix element value = 0.6×H01+0.3×H02+0.1×H03, (H01 / H02 / H03 are the global similarity matrices of each anchor point).
[0065] In this embodiment, the position point of the extended matrix is the coordinate of the point in the extended matrix.
[0066] The submatrix of o1×o2 is a local matrix centered on the anchor point coordinates, 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 coordinates Ai are the coordinates of the element with the largest similarity value in the submatrix. For example, if the anchor point coordinates are (117, 3020), then we retain ±2 segments in the time direction and ±2 segments in the mass-to-charge ratio direction. At this time, the submatrix range is [115, 120] and [3018, 3022]. The maximum value is found to be (118, 3021), which is Ai=(118, 3021).
[0068] In this embodiment, the mass-to-charge ratio offset is the difference between the mass-to-charge ratio coordinates of Ai and the anchor reference coordinates, multiplied by the step size (0.05 Da / segment); the retention time offset is the difference between the retention time coordinates of Ai and the anchor reference coordinates, 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 of the mass-to-charge ratio of 3 anchor points: [0.05, -0.02, 0.1]).
[0070] In this embodiment, forward offset: offset value > 0, reverse offset: offset value < 0, and the ratio of the number of forward offsets is the number of reverse offsets.
[0071] In this embodiment, the dual ratio-correction lookup table is a predefined mass-to-charge ratio + retention time ratio → correction strategy mapping table (e.g., ratios 2:1 & 1:2 correspond to a forward mass-to-charge ratio correction of 0.03 Da and a reverse retention time 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, looking up the table: ratio 2:1 (mass-to-charge ratio) and 1:2 (retention time) → correction scheme: mass-to-charge ratio offset: -0.03 Da (more forward 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 as follows: through the closed-loop process of anchor point weighted fusion → precise sub-matrix search → offset direction statistics → intelligent table lookup correction, high-precision directional alignment of mass spectrometry signals is achieved; anchor point offset statistics eliminate random errors; and the dual ratio strategy adapts to complex instrument drift modes, providing reliable error input for subsequent pesticide residue quantification.
[0073] This invention provides a method for detecting pesticide residues in wine grapes and wine, which involves inputting a first preprocessing result into a pre-trained neural network model to obtain the final pesticide residue, including: Mass spectrometry features and instrument model identifiers are extracted from the first preprocessing result, and multimodal inputs are constructed by combining them with wine matrix parameters. These inputs are then fed into a pre-trained neural network model to output the quantitative values of pesticide residues, i.e., the final pesticide residues for each pesticide residue type.
[0074] In this embodiment, mass spectrometry feature extraction extracts key signal attributes from the calibrated mass spectrum, including peak position, peak intensity, and peak shape, reflecting the mass spectrometry response of pesticides. For example, core features include: peak mass-to-charge ratio (255.12 Da), retention time (8.72 min), and peak area (3.8 × 10⁻⁶). 6 Signal-to-noise ratio (22:1, peak height ÷ background noise standard deviation), half-maximum width (0.08 min); 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, used to distinguish the detection accuracy (such as high-resolution mass spectrometry vs. ordinary mass spectrometry), and to provide a basis for error compensation for the model. For example, the coding method is: one-hot coding (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 accuracy weight table (GC-HRMS weight 1.3, LC-MS / MS weight 1.0, MALDI-TOF weight 0.8). Specifically: encoding: convert the instrument model string using sklearn.preprocessing.OneHotEncoder; weight matching: create a dictionary {"GC-HRMS":1.3}, which will be used for the weighted fusion of quantitative results later.
[0076] In this embodiment, the wine matrix parameters are the physicochemical properties of the wine (such as alcohol content and tannins), which affect the ionization efficiency and solubility of pesticides. It is necessary to correct for the interference of the matrix on the signal. For example, key parameters: alcohol content (14.2% similar vol), tannin content (3.5 g / L), pH (3.3), 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 construction involves concatenating mass spectrometry features (numerical values), instrument identifiers (encoded vectors), and matrix parameters (normalized values) to form a composite input that the model can parse, covering the three dimensions of "signal-instrument-environment". For example, the dimensional composition is: mass spectrometry features (5 dimensions: mz, rt, peak area, signal-to-noise ratio, half-maximum 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 on a brewing-specific dataset, which integrates multimodal features and learns the nonlinear relationship between "mass spectrometry-instrument-matrix → residue" through a deep network. For example, the model structure is: 1D-CNN (extracting mass spectrometry peak sequence features) + Transformer (capturing the global correlation between the instrument and the matrix) + regression head (outputting quantitative values); training data consists of 8000 sets of "multimodal input → true concentration" samples (the true concentration is determined by the isotope internal standard method with an accuracy of ±0.001 mg / kg).
[0079] In this embodiment, 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: A 12-dimensional multimodal vector of imidacloprid; Output: 0.018 mg / kg (compared to the true value of 0.020 mg / kg by the isotope internal standard method, with an error of 10%).
[0080] The beneficial effects of the above technical solution are: through multimodal fusion of mass spectrometry signal in-depth analysis, instrument deviation compensation, and 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] This invention provides a method for detecting pesticide residues in wine grapes and wine, comprising the following steps before generating optimization directions and optimization schemes and performing residue simulation: Based on the first dataset, a time-correspondence table of pesticide spraying, weather and soil was established. The first dataset consists of a pesticide spraying set collected from the entire growth cycle of wine grapes in a designated field, a weather set and a soil set recorded after each pesticide spraying according to the pesticide spraying type, and the collected sets were obtained by performing a second preprocessing on each set. Based on the second dataset, a corresponding process residue table is established, and an optimized reference relationship table is obtained by comparing it with the standard residue table. The second dataset consists of the process operation of each winemaking process collected and the initial residue of the sample extracted after the corresponding process operation.
[0082] Preferably, the optimization direction and optimization scheme are generated, including: Based on the aforementioned time-reference table and optimized reference table, and using the random forest algorithm to quantify the correlation weights between pesticide degradation rate during planting and residual migration rate during brewing, a planting-brewing residue correlation model is obtained. Based on the planting-brewing residue correlation model, the influence coefficient of planting factors on the final residue amount is output. Based on the comparison between the output of the correlation model and the residual standards, the directions for planting optimization and brewing optimization are determined. Based on the direction of planting optimization and combined with local meteorological forecast data, a dynamic plan table for pesticide application is generated, and the first adjustment strategy under different precipitation probabilities and sunshine probabilities is identified. Based on the direction of brewing optimization, the fermentation temperature gradient and the combination of filter media were determined to obtain the second adjustment strategy. The second adjustment strategy indicates the expected reduction of residual amount by each parameter adjustment. The first adjustment strategy and the second adjustment strategy are combined to form an optimization scheme.
[0083] Preferably, residual simulation is performed on the optimized scheme, including: Based on the planting-brewing residue correlation model, the residue changes of each retained species are simulated in stages according to the growth cycle and brewing process after optimization, and the residue prediction values of each pesticide species involved in each stage are output. If any residual predicted values fail to meet the standard, the parameter adjustment mechanism will be automatically triggered to continue adjusting the optimization scheme.
[0084] In this embodiment, the first dataset is a key dataset covering the entire growth cycle (bud break to harvest) of wine grapes in a specified field, containing three subsets: Pesticide spraying record: Record the time, type, dosage, and method of each pesticide application (e.g., "2023-06-10, imidacloprid, 100g / mu, foliar spray"). Weather data: Meteorological data for 7 days following each spraying (time-related, such as "June 10-16, 2023, average daily temperature 26℃, cumulative precipitation 35mm, sunshine 6.5h / day"). Soil data: Soil physicochemical parameters before and after spraying (spatial correlation, such as "2023-06-09 (before) and 6-17 (after), pH 6.5 → 6.4, organic matter 2.3% → 2.2%").
[0085] The second preprocessing step involves standardizing the three subsets, including: Time alignment (precisely matching spraying time with weather / soil sampling time, with an error ≤1h); Outlier removal (e.g., outliers in precipitation data that exceed the historical average by more than 3 times are replaced with the average of the nearest 3 days). Units should be standardized (e.g., dosage should be converted to g / ha of active ingredient, and precipitation should be standardized to mm).
[0086] Implementation method: Use Python pandas to process the data, link the data by timestamp using merge, and remove outliers using the IQR (interquartile range) method.
[0087] The time-to-time comparison table is a three-dimensional comparison table linked together by spraying time. An example of its format is shown in Table 1. Table 1
[0088] In this embodiment, the second dataset is process and residue data for the entire winemaking process (from crushing to aging), comprising two parts: Process operation: Key parameters for each step (e.g., "Fermentation: temperature 25℃, time 10 days, stirring frequency 2 times / day"). Initial residue: The amount of pesticide residue detected by sampling after the corresponding process (step-related, such as "after fermentation, the residue of imidacloprid is 0.07 mg / kg").
[0089] The process residue table is a "process-residue" comparison table arranged according to the brewing process, as shown in Table 2: Table 2
[0090] The standard residue table is the maximum residue limit for pesticides in wine as stipulated by the state / industry (e.g., imidacloprid ≤ 0.05 mg / kg in GB2763-2021), serving as a compliance benchmark.
[0091] The optimized reference relationship table is a comparison table between the process residue table and the standard residue table, indicating 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 weights 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: formulaic expression (such as "final residue = 0.7 × planting residue + 0.3 × brewing migration"). Impact coefficient: The marginal impact of a single factor on residues (e.g., "For every 10 mm increase in precipitation, the degradation rate during the planting stage increases by 15% → impact coefficient -0.15", a negative value indicates a reduction in residues). Specifically, a random forest regression model is constructed using scikit-learn, with the input being the time-to-time reference table and the process residue table, and the output being the feature importance (i.e., weights).
[0093] In this embodiment, the optimization direction for planting / brewing is to compare the model output with the standard and locate the key links that exceed the standard: Planting optimization directions: such as "Imidacloprid residues mainly originate from insufficient rainfall after spraying (slow degradation)"; Brewing optimization directions: such as "the residue in the filtration process does not meet the standards, and the adsorption efficiency needs to be enhanced".
[0094] The first adjustment strategy (planting end) is a dynamic pesticide application plan combined with weather forecasts, as shown in Table 4: Table 4
[0095] The second adjustment strategy (brewing end) is a specific optimization scheme for process parameters, for example: Fermentation temperature gradient: "28℃ for the first 3 days (accelerates degradation), 30℃ for the next 7 days (inhibits residual migration)"; Filter media combination: "diatomaceous earth (1 layer) + activated carbon (2 layers)", labeled "expected residue from 0.065 → 0.045 mg / kg (decrease of 0.02 mg / kg)".
[0096] The phased simulation is based on an association model, predicting residual changes in stages according to the "planting cycle (germination → harvest)" and "brewing process (crushing → aging)". Output: During the planting stage: "15 days after spraying during the flowering period, the imidacloprid residue was 0.08 mg / kg; at harvest, it decreased to 0.06 mg / kg"; Brewing stage: "0.05 mg / kg after fermentation; 0.045 mg / kg after filtration".
[0097] The parameter adjustment mechanism automatically triggers adjustments if the predicted value exceeds the standard at a certain stage (e.g., "residual at harvest 0.07 mg / kg > standard 0.05"). Prioritize adjusting sensitive parameters (e.g., "delay spraying time by 3 days" at the planting end, "increase activated carbon dosage by 5%" at the brewing end); The predictions were all achieved at all stages of the iteration (deviation ≤ 5%).
[0098] The beneficial effects of the above technical solution are: through a closed-loop process of linking all data of planting and brewing → quantifying the influence weight by algorithm → generating dynamic optimization schemes → and conducting phased simulation verification, the system can accurately trace the source of pesticide residue exceeding the standard and optimize the system, thereby improving the residue compliance rate while ensuring the quality of wine.
[0099] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for detecting pesticide residues in wine grapes and wine, characterized in that, include: Step 1: Use different detectors to perform at least n pesticide residue tests on the wine from the same designated field, obtain several test records for each detector, and perform a first preprocessing on all test records. The test records include: the model identification of the corresponding detector, the type of pesticide residue detected, and the continuous mass spectrometry signal. The detectors include: gas chromatography-mass spectrometry, liquid chromatography-tandem mass spectrometry, and matrix-assisted laser desorption / ionization time-of-flight mass spectrometry. Step 2: Input the first preprocessing result into a pre-trained neural network model to obtain the final pesticide residue. When the final pesticide residue meets the residue standard, generate a first residue report directly based on the final pesticide residue. The first preprocessing includes the following steps: The first residue type is obtained by performing the first intersection processing on n detection records under the same detector according to the pesticide residue type; the residue types with full intersection are determined. The first residual species under different detectors are subjected to a second intersection processing and a union processing to determine the effectively detected residual species, and the mass spectra of the effectively detected species are corrected, wherein the effectively detected residual species are regarded as the retained species. Each continuous mass spectrum signal under the retention category is folded into a three-dimensional matrix according to the mass-to-charge ratio step size and retention time step size. Where n1 is the number of retention time segments, m1 is the number of mass-to-charge ratio segments, and k1 is the signal strength quantization level; Based on the historical mass-to-charge ratio drift range and retention time drift range of the corresponding detector, expand the mass-to-charge ratio dimension by o1 intervals and the retention time dimension by o2 intervals to construct the expansion matrix of the corresponding mass spectrum; The metabolic characteristic peaks of wine are extracted as rigid anchor points. The priority search submatrices are marked in the expanded matrix, and the element values of the priority search submatrices are set to 0 to obtain the remaining submatrices. A similarity matrix is constructed by traversing the submatrices of all detectors, the enhancement coefficient and attenuation coefficient are calculated, the matrix elements are adjusted to obtain the global similarity matrix, and a mass spectrometry signal correction scheme is generated based on the global similarity matrix. The continuous mass spectrometry signal is adjusted based on the calibration scheme, and the calibrated mass spectrometry data is obtained by combining the measurement weights of the detector. The first preprocessing result is the model identifier of the corresponding detector, the types of pesticide residues retained, and the corresponding corrected mass spectrometry signal. At this time, the mass spectrometry features and instrument model identifier in the first preprocessing result are extracted, and multimodal input is constructed by combining the wine matrix parameters. This input is then fed into a pre-trained neural network model to output the quantitative value of pesticide residues, which is the final pesticide residue for each type of pesticide retained. The wine matrix parameters include: alcohol content, tannin content, pH, and residual sugar; Step 3: When the final pesticide residue does not meet the residue standard, collect the first dataset of the entire growth cycle of wine grapes in the designated field and the second dataset of each winemaking process. Step 4: Based on the first dataset and the second dataset, and combined with the residue correlation during the planting and brewing periods and the residue standards, generate optimization directions and optimization schemes and perform residue simulations until the residue standards are met.
2. The method for detecting pesticide residues in wine grapes and wine according to claim 1, characterized in that, Determining the types of residues that can be effectively detected includes: The first residue type under different detectors is subjected to a second intersection processing and a union processing. When a residue type is identified by two or more detectors, the corresponding residue type is determined to be effectively detected once. The residue types detected in a single test are corrected and retained based on mass spectra from different detectors to obtain a mass spectra set. ,in, This represents the j1-th calibration chart based on a single valid detection by the i-th detector; m represents the number of detectors based on a single valid detection; n represents the number of pesticide residue detections per detector. Otherwise, the mass spectrum of the corresponding residual species is matched with the mass spectrum library. When the matching degree is greater than the preset degree, the corresponding residual species is retained.
3. The method for detecting pesticide residues in wine grapes and wine according to claim 2, characterized in that, The first preprocessing of the detection data also includes: The first similarity matrix is constructed by traversing the similarity coefficients of the priority search submatrices of all detectors under the corresponding retention category based on the same rigid anchor point, and the first eigenvector is obtained. This eigenvector is then input into the vector analysis model to obtain the enhancement coefficient of the corresponding rigid anchor point. At the same time, the second similarity matrix is constructed by traversing the similarity coefficients of the remaining submatrices of all detectors under the corresponding retention category based on the same rigid anchor point, and the second eigenvector is obtained. This eigenvector is then input into the vector analysis model to obtain the attenuation coefficient of the remaining submatrices of the corresponding rigid anchor point. The element values of the corresponding first similarity matrix are adjusted by first multiplication according to the enhancement coefficient, and the element values of the second similarity matrix are adjusted by second multiplication according to the weakening coefficient. Based on the same element position, the values of the element positions after the second multiplication adjustment are replaced one-to-one according to the result of the first multiplication adjustment to obtain the global similarity matrix of the corresponding rigid anchor point under the corresponding retention category. Based on the global similarity matrix of each rigid anchor point, a correction scheme for adjusting the continuous mass spectrum signal is obtained. After adjusting the continuous mass spectrometry signal based on the calibration scheme and relying on the measurement weights of the detectors involved in the corresponding effective detection, the required pesticide residues for the corresponding retained species are obtained. The measurement weights are obtained based on the matching of the instrument quantity-instrument model-weight lookup table.
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 spectrum signal is obtained, including: A new matrix is obtained by weighting the positions of the same elements in the global similarity matrix of all rigid anchors. The position points of each rigid anchor based on the extended matrix are then mapped one-to-one with the new matrix. Based on the corresponding position points of each rigid anchor, the maximum value in the o1×o2 submatrix based on the new matrix is determined, and the position coordinates Ai of the maximum value are recorded. Here, o1 is the number of intervals extended along the mass-to-charge ratio dimension, and o2 is the number of intervals extended along the retention time dimension. Determine the mass-to-charge ratio offset and retention time offset for each Ai to obtain the mass-to-charge ratio offset sequence and retention time offset sequence based on rigid anchor points; Determine the first quantity ratio of the positive direction to the negative direction in the mass-to-charge ratio offset sequence and the second quantity ratio of the positive direction to the negative direction in the retention time offset sequence; Based on the first quantity ratio and the second quantity ratio, a correction scheme is matched from the 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, Before generating optimization directions and optimization schemes and performing residual simulations, the following steps are included: Based on the first dataset, a time-correspondence table of pesticide spraying, weather and soil was established. The first dataset consists of a pesticide spraying set collected from the entire growth cycle of wine grapes in a designated field, a weather set and a soil set recorded after each pesticide spraying according to the pesticide spraying type, and the collected sets were obtained by performing a second preprocessing on each set. Based on the second dataset, a corresponding process residue table is established, and an optimized reference relationship table is obtained by comparing it with the standard residue table. The second dataset consists of the process operation of each winemaking process collected and the initial residue of the sample extracted after the corresponding process operation.
6. The method for detecting pesticide residues in wine grapes and wine according to claim 5, characterized in that, Generate optimization directions and optimization schemes, including: Based on the aforementioned time-reference table and optimized reference table, and using the random forest algorithm to quantify the correlation weights between pesticide degradation rate during planting and residual migration rate during brewing, a planting-brewing residue correlation model is obtained. Based on the planting-brewing residue correlation model, the influence coefficient of planting factors on the final residue amount is output. Based on the comparison between the output of the correlation model and the residual standards, the directions for planting optimization and brewing optimization are determined. Based on the direction of planting optimization and combined with local meteorological forecast data, a dynamic plan table for pesticide application is generated, and the first adjustment strategy under different precipitation probabilities and sunshine probabilities is identified. Based on the direction of brewing optimization, the fermentation temperature gradient and the combination of filter media were determined to obtain the second adjustment strategy. The second adjustment strategy indicates the expected reduction of residual amount by each parameter adjustment. The first adjustment strategy and the second adjustment strategy are combined to form an optimization scheme.
7. The method for detecting pesticide residues in wine grapes and wine according to claim 6, characterized in that, Residual simulations were performed on the optimized scheme, including: Based on the planting-brewing residue correlation model, the residue changes of each retained species are simulated in stages according to the growth cycle and brewing process after optimization, and the residue prediction values of each pesticide species involved in each stage are output. If any residual predicted values fail to meet the standard, the parameter adjustment mechanism will be automatically triggered to continue adjusting the optimization scheme.
Citation Information
Patent Citations
Multi-pesticide residue determination method, pretreatment method and kit
CN116297973A
Grape wine astringency quality diagnosis method based on GA-BP neural network
CN117538494A