Fruit and vegetable pesticide residue detection system and detection method

By generating a dynamic control library through temperature-based decoupling and batch updates, and combining it with a deep learning evaluation module, the detection accuracy problem of the fruit and vegetable pesticide residue detection system under multiple batches and variable temperature environments was solved, achieving accuracy and consistency of detection results.

CN121995017APending Publication Date: 2026-05-08YANTAI LIANLEI FOODS
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YANTAI LIANLEI FOODS
Filing Date
2026-04-10
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing pesticide residue detection systems for fruits and vegetables have low accuracy in multi-batch and variable temperature environments, resulting in false positives and exceeding of limits. Furthermore, deep learning models struggle to maintain the objectivity of detection results when sample distribution changes.

Method used

By decoupling temperature and matrix type and linking batch updates, a dynamic control library is generated. Combined with a deep learning evaluation module, the decoupling of ambient temperature and matrix type is achieved. Furthermore, a versionable test dataset is generated by driving the bias ratio, and dynamic compensation is performed to reduce detection bias.

Benefits of technology

Under multiple batches and rapid temperature changes, the deviation in pesticide residue concentration was reduced, misjudgment was avoided, and the accuracy and consistency of test results were ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121995017A_ABST
    Figure CN121995017A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of detection, and particularly discloses a fruit and vegetable pesticide residue detection system and a detection method, which are used for solving the problem that multiple batches of fruits and vegetables cannot detect pesticide residues when in a variable-temperature environment, matrix difference and reagent batch fluctuation. The problems that in pesticide residue detection, temperature lag and matrix drift are coupled, an evaluation sample set is fixed, implicit adaptation deviation is caused, compensation parameters and data versions are not synchronous, and detection deviation amplification and standard exceeding misjudgment are caused are solved. The system comprises an acquisition module, an establishment module, a first generation module, an output module, a second generation module, a temperature base decoupling module and a batch updating module, wherein the output module comprises a data evaluation module, a time sequence frequency spectrum coding module, a temperature base condition coupling module and a deep learning evaluation module; according to the method, the dynamic contrast library is linked through temperature-based decoupling and batch updating, and a versionable test data set is generated by deviation ratio driving, so that detection evaluation and compensation parameters are synchronously aligned, the pesticide residue concentration deviation is reduced, and misjudgment of exceeding the standard is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of detection technology, and in particular to a detection system and method for pesticide residues in fruits and vegetables. Background Technology

[0002] Chinese invention patent CN120404672A discloses a pesticide residue detection method and system for a pesticide residue detector. It acquires ambient temperature data, sample matrix type information, and chemical detection reagents for fruit and vegetable samples. Based on the ambient temperature data, sample matrix type information, and historical detection data, a dynamic control database is established. An initial pesticide residue detection value is obtained by inputting a prepared mixed detection solution and ambient temperature data into the pesticide detector. The initial pesticide residue detection value is then dynamically compensated based on the dynamic control database to generate a target pesticide residue detection value. This solves the problems of low accuracy and poor efficiency in pesticide residue detection using fixed temperature compensation coefficients in multi-batch fruit and vegetable samples and under varying temperature environments. Deep learning detection methods can utilize third-party test samples. By analyzing the signals and time-frequency transformations of batch, ambient temperature, fruit and vegetable matrix, and transmitted light intensity over time, and combining them with sample records labeled with pesticide residue reference concentrations, different deep learning models are trained and evaluated to obtain the model that performs best on the current sample. Although the current samples did not participate in the backpropagation training of the model parameters, their evaluation labels continuously influenced the adjustment of the model network structure and iteration direction. This caused the final model to gradually adapt to the environmental temperature range distribution and fruit and vegetable substrate of the samples, resulting in a continuous improvement in the evaluation indicators. However, under the influence of new fruit and vegetable batches, inherent differences in the substrate, and rapid temperature changes and thermal equilibrium lags caused by cold chain entry and exit, the pesticide residue detection concentration deviation increased, and the number of false positives for exceeding the standard increased. At the same time, there was a lack of independent samples with the same distribution and real labels on site: directly dividing the training samples would change the training scale, and it was difficult to ensure that the externally randomly constructed samples were consistent with the original samples in terms of fruit and vegetable substrate and environmental temperature. If new samples were constructed using the detection labels of the original samples, it would cause information leakage, making the pesticide residue detection results output by the model lose objectivity. Summary of the Invention

[0003] The technical problem to be solved by this invention is to provide a pesticide residue detection system and method for fruits and vegetables. By decoupling temperature and matrix and linking batch updates with a dynamic control library, and using deviation ratio to drive the generation of versionable test datasets, the detection evaluation and compensation parameters are synchronized and aligned, reducing the deviation of pesticide residue concentration under variable temperature and multi-matrix scenarios, and avoiding false judgments of exceeding the standard.

[0004] To achieve the above objectives, the present invention provides the following technical solution: In a first aspect, this invention proposes a pesticide residue detection system for fruits and vegetables, comprising an acquisition module, an establishment module, a first generation module, an output module, and a second generation module, and further including a temperature-base decoupling module and a batch update module. The temperature-base decoupling module obtains representative temperature and drift identifier by compensating for environmental temperature lag. The batch update module updates the influence coefficient based on batch and matrix deviation. The establishment module establishes a dynamic control library based on the environmental temperature, sample matrix, and chemical detection reagent information output by the acquisition module. The first generation module is used to generate a mixed detection solution. The output module includes a data evaluation module, a time-series spectral coding module, a temperature-base coupling module, and a deep learning evaluation module. The data evaluation module obtains data from... The system obtains a candidate sample set from historical detection data and newly added on-site detection records. It then calls a deep learning evaluation module to select an initial network, trains the target sample set to obtain candidate networks, and iterates the prediction output deviation ratio of the candidate networks with the candidate and target sample sets as inputs using a data correction model. This generates a target candidate sample set, which is then written into a dynamic control library. A time-series spectrum encoding module performs time-frequency transformation on the detection signal and encodes its features. A temperature-base coupling module couples the features with representative temperature, drift indicator, and influence coefficient conditions, inputs this to the deep learning evaluation module, and outputs the initial pesticide residue value. A second generation module calls the dynamic control library to dynamically compensate for the initial pesticide residue value to obtain the target residue value.

[0005] Optionally, the acquisition module includes a temperature time series acquisition unit, a matrix identification reading unit, a test batch reading unit, and a sample record packaging unit. The temperature time series acquisition unit, the matrix identification reading unit, and the test batch reading unit are all connected to the sample record packaging unit, which is also connected to a pesticide residue detector.

[0006] Optionally, in the acquisition module, the temperature time series acquisition unit acquires the environmental temperature time series for pesticide residue detection at a preset sampling rate, the matrix identification reading unit acquires the matrix type identifier of the fruit and vegetable samples, the reagent batch reading unit identifies and acquires the batch identifier of the chemical detection reagent, and the sample record encapsulation unit acquires the detection signal of the transmitted light intensity changing with time and the signal acquisition parameters from the pesticide residue detector interface, and encapsulates them together with the outputs of the temperature time series acquisition unit, the matrix identification reading unit, and the batch reading unit according to the data field structure of the target sample set into candidate sample records, and writes them into historical detection data.

[0007] It should be noted that by simultaneously collecting ambient temperature time series, fruit and vegetable matrix type identifiers, chemical testing reagent batch identifiers, and transmitted light intensity detection signals and acquisition parameters during the testing process, and encapsulating them into candidate sample records according to the unified field structure of the target sample set and writing them into historical testing data, the temperature conditions, matrix differences, and reagent batch variables required for subsequent dynamic control library construction, temperature-matrix decoupling, and batch updates have a traceable data carrier. At the same time, it ensures that the data caliber is consistent under different batches of samples, different temperature ranges, and different equipment acquisition parameters, which facilitates the calling and alignment of deep learning evaluation and data evaluation iteration within the same field system, thereby reducing evaluation bias and compensation parameter mismatch caused by missing data, inconsistent fields, or non-reproducible records.

[0008] Optionally, the module includes a target sample set management unit, a candidate sample set storage unit, a deviation ratio index unit, and a test dataset linking unit. The target sample set management unit stores and maintains the target sample set with pesticide residue reference concentration labels and its data field structure. The candidate sample set storage unit receives the candidate sample records encapsulated by the acquisition module and writes them into the dynamic control library according to the data field structure of the target sample set to form a candidate sample set. The deviation ratio index unit records the deviation ratio and iteration round identifier output by the data evaluation module and establishes an association index with the candidate sample records in the candidate sample set. When the deviation ratio meets the preset threshold, the test dataset linking unit links the test dataset output by the data correction model to the dynamic control library with the dataset version number and establishes a mapping relationship with the ambient temperature, sample matrix type, reagent batch identifier and representative temperature, drift identifier, and influence coefficient.

[0009] It should be noted that by introducing a systematic data organization and version control mechanism within the module, namely "target sample set field template management - isomorphic entry of candidate sample records - traceable index of bias ratio and iteration rounds - linking of test dataset version number - mapping of version to ambient temperature / matrix / batch and representative temperature, drift identifier, and influence coefficient," deep learning evaluation and data correction no longer rely solely on fixed evaluation samples or one-time partitioned datasets. Instead, it generates and solidifies reusable test dataset versions based on bias ratio convergence as the criterion, and establishes a queryable binding relationship between these versions and detection condition variables. This ensures consistent evaluation data caliber, traceability of model iteration processes, and synchronization and alignment of compensation parameter calls with test dataset versions under conditions of multiple batches of fruits and vegetables, variable temperature environments, and reagent batch changes. This avoids implicit overfitting and evaluation distortion caused by sample set distribution drift, label leakage, or mixed data sources, and reduces the risk of misjudgment of detection results in new batches and rapidly changing temperature conditions.

[0010] Optionally, the first generation module is connected to the acquisition module to read the sample matrix type identifier, and connected to the establishment module to call the sample preparation parameter table of the matrix type. Under the constraints of the sample preparation parameter table, the module drives and controls the rotary cutting of the fruit and vegetable sample to generate a fragmented sample. At the same time, under the constraints of the sample preparation parameter table, the module drives and controls the stirring of the fragmented sample and the chemical detection reagent to output a mixed detection solution. The sample preparation parameter table includes the rotary cutting speed, rotary cutting time, stirring speed, stirring time, and chemical detection reagent dosage.

[0011] It should be noted that by linking the sample matrix type identifier with the sample preparation parameter table, the rotary cutting speed and duration, stirring speed and duration, and reagent dosage are automatically called and controlled according to different fruit and vegetable matrices. This ensures the consistency of particle size and reagent mixing uniformity under different batches and samples of different textures, and makes the mixed detection solution entering the detector reproducible in terms of reaction volume, solid-liquid ratio, and reaction time. This reduces signal amplitude fluctuations and initial pesticide residue deviations caused by differences in manual sample preparation.

[0012] Optionally, the temperature-base decoupling module includes a temperature hysteresis compensation unit and a matrix drift identification unit. The temperature hysteresis compensation unit is connected to the acquisition module, receives the ambient temperature time series, and performs time-shift alignment and exponential smoothing on the ambient temperature time series based on a preset thermal inertia discrete state model to obtain a representative temperature. The thermal inertia discrete state model is obtained by simultaneously acquiring ambient temperature series and mixed detection liquid temperature series under multiple known temperature change conditions, and performing recursive least squares parameter identification to determine the model order, time constant, and sampling period discretization coefficients. The matrix drift identification unit is connected to the output module, receives the detection signal and its time-frequency spectrum point set, and statistically analyzes the baseline offset, peak position offset, and peak width change of the spectrum point set under the representative temperature constraint to generate a matrix drift identifier.

[0013] It should be noted that by introducing temperature hysteresis compensation based on a thermal inertia discrete state model into the temperature-base decoupling module, the ambient temperature time series acquired by the acquisition module is converted into a representative temperature characterizing the thermal equilibrium state of the sample and the detection chamber through time-shift alignment and exponential smoothing. Under the constraint of this representative temperature, the baseline offset, peak position offset, and peak width change of the time-frequency spectrum point set of the output module are statistically analyzed to form a matrix drift identifier. This means that the temperature effect no longer directly participates in the compensation with instantaneous ambient temperature, but participates in the library construction and retrieval with the thermal equilibrium representative temperature. At the same time, the spectral drift within the same matrix type is quantified into an indexable drift identifier and written into a dynamic reference library. Thus, in scenarios of rapid temperature change, cold chain entry and exit, and matrix changes caused by differences in maturity or moisture content, it provides an aligned temperature and matrix state input for deep learning evaluation and dynamic compensation, reducing overcompensation, undercompensation, and misjudgment caused by the superposition of temperature hysteresis and matrix drift.

[0014] Optionally, the data evaluation module extracts a candidate sample set with the same field structure as the target sample set from historical detection data and newly added on-site detection records; then calls the deep learning evaluation module to select multiple different initial pesticide residue detection networks from the preset network configuration set; then trains and saves each initial pesticide residue detection network using the target sample set to obtain multiple candidate networks; then generates a first prediction output and a second prediction output for each candidate network using the candidate sample set and the target sample set as inputs, and calculates the global deviation ratio between the first prediction output and the second prediction output; then uses the global deviation ratio as an iterative driving force to control the data correction model, performs deletion or supplementation on the candidate sample set to update the candidate sample set, and cyclically calls the global deviation ratio calculation until the global deviation ratio falls into the preset threshold range, outputs the target candidate sample set and writes it into the dynamic comparison library.

[0015] It should be noted that, in the data evaluation module, historical detection data and newly added on-site records are aggregated to form a candidate sample set using the field structure of the target sample set as a template. Multiple candidate networks with different configurations are trained based on the target sample set. The candidate networks then generate prediction outputs for both the candidate sample set and the target sample set, and the global bias ratio is calculated as the driving force. The data correction model iteratively controls the deletion or addition of candidate sample sets until the bias ratio converges. Thus, without directly reusing fixed evaluation sample labels for repeated screening, a test dataset with the same distribution as the target sample set and capable of independent reuse is generated and written into a dynamic comparison library. This achieves versioning and traceability of the evaluation dataset. Compared with existing practices that rely on a single test set or split the dataset once, this mechanism can suppress implicit adaptation bias caused by multiple rounds of comparison and selection, and ensure that the evaluation criteria remain consistent under multiple batches, varying temperatures, and multiple matrix conditions.

[0016] Optionally, in the data evaluation module, when updating the candidate sample set, the data correction model establishes a stratified index for the candidate sample set according to the sample matrix type identifier and the temperature range to which the representative temperature belongs, and sets the sample number constraint for each stratum. For each candidate sample record in each stratum, the sample deviation contribution is calculated based on the first prediction output and second prediction output statistics of multiple candidate networks. Samples are removed from the strata where the deviation contribution is higher than the first threshold and the number of samples in the stratum exceeds the sample number constraint. When samples need to be added, samples that are not selected into the current candidate sample set from the reserve sample pool of historical detection data and newly added on-site detection records are selected according to the stratified index and whose deviation contribution is lower than the second threshold and meets the sample number constraint. After each deletion or addition, the global deviation ratio and the deviation ratio of each stratum are recalculated until the global deviation ratio threshold and the stratified deviation ratio threshold requirements are met simultaneously. The stratified index uses the sample matrix type identifier and the temperature range to which the representative temperature belongs as a joint key to map candidate sample records to the corresponding strata, and maintains a sample ID set, sample number constraint, stratification bias statistic, and pointers for deleting or adding sample pools for each stratum. The lower limit of the sample size constraint for each layer is obtained by calculating the residual variance between the pesticide residue reference concentration of each layer and the output of the detection network after stratifying the historical detection data by matrix type identifier × representing temperature range, and substituting it into the sample size formula of the preset tolerance error and confidence parameter. The upper limit is determined by the product of the proportion of each layer in the historical detection data and the preset total size of the test dataset, and the minimum value is taken when compared with the preset maximum sample size.

[0017] By introducing a stratified index of "matrix type × representative temperature range" and upper and lower limits on the number of stratified samples during the candidate sample set update process, and using the sample bias contribution caused by the differences in outputs of multiple candidate networks to drive the deletion within the strata and the targeted addition of the backup pool, and by verifying convergence with the global bias ratio and the stratified bias ratio after each round of operation, compared with the existing technology's approach of randomly sampling candidate data or adjusting only according to global indicators, this method maintains the coverage ratio of the test dataset in each matrix temperature stratum and the predicted distribution synchronously aligned in the context of pesticide residues in multiple matrices, wide temperature ranges and uneven sample distribution. This reduces the evaluation distortion and mismatch of compensation parameter calls caused by the absence, excess or accumulation of local temperature range or specific matrix samples.

[0018] Secondly, this invention proposes a detection method using the aforementioned fruit and vegetable pesticide residue detection system, comprising the following steps: Step 1, Information Acquisition: The acquisition module acquires the environmental temperature time series for pesticide residue detection, reads the matrix type identifier of fruit and vegetable samples and the batch identifier of chemical testing reagents, and acquires the detection signal and signal acquisition parameters of transmitted light intensity changing over time. Step 2, Temperature hysteresis compensation: The temperature-based decoupling module performs time-shift alignment and exponential smoothing on the ambient temperature time series based on a preset thermal inertia discrete state model to obtain a representative temperature; Step 3, Generate matrix drift identifiers: The temperature-base decoupling module generates matrix drift identifiers based on the time-frequency spectrum points of the detection signal and under the representation of temperature constraints; Step 4, Influence Coefficient Update: The batch update module updates the influence coefficient based on the batch identifier of the chemical testing reagent and the matrix deviation; Step 5, Construct a dynamic control library: The dynamic control library is built or updated by the module based on ambient temperature, sample matrix type, chemical detection reagent information, representative temperature, matrix drift identifier, influence coefficient and historical detection data; Step 6, Generate Test Dataset: The data evaluation module extracts candidate sample sets with the same field structure as the target sample set from historical detection data and newly added on-site detection records. The deep learning evaluation module selects multiple initial pesticide residue detection networks and trains multiple candidate networks with the target sample set. Based on the candidate networks, the first prediction output and the second prediction output are obtained by taking the candidate sample set and the target sample set as inputs respectively, and the global bias ratio is calculated. The global bias ratio drives the data correction model to perform deletion or addition iterations on the candidate sample set until the global bias ratio falls into the preset threshold range. The target candidate sample set is output as the test dataset and written into the dynamic control library. Step 7, generating sample preparation mixture: The first generation module drives the fruit and vegetable sample to be rotary cut and the fragmented sample to be stirred with chemical detection reagents according to the sample preparation parameter table of matrix type to obtain mixed detection solution; Step 8, Time-Frequency Coding and Conditional Coupling: The time-series spectrum coding module performs time-frequency transformation on the detection signal and encodes it to obtain a feature vector. The temperature-base conditional coupling module then conditionsally couples the feature vector with the temperature, matrix drift identifier, and influence coefficient. Step 9, Initial Residue Value Assessment: The deep learning assessment module outputs the initial pesticide residue value based on the features after conditional coupling; Step 10, Dynamic Compensation Output: The second generation module calls the dynamic control library to perform dynamic compensation on the initial pesticide residue value to obtain the target residue value.

[0019] Optionally, step S4 includes: the batch update module retrieves historical test records from the dynamic control library by chemical reagent batch identifier, sample matrix type identifier, and temperature range representing the temperature; extracts the pesticide residue reference concentration and the initial pesticide residue value output by the deep learning evaluation module for each historical test record; calculates the batch deviation between the reference concentration and the initial pesticide residue value; and weights and summarizes the batch deviation according to the test timestamp to form the current batch statistic; the batch update module recursively merges the current batch statistic with the existing batch influence coefficients in the dynamic control library according to a preset forgetting factor to obtain the updated batch influence coefficient; and writes the updated batch influence coefficient into the dynamic control library and outputs it synchronously to the temperature-base coupling module and the second generation module.

[0020] It should be noted that by retrieving historical records from the dynamic control library according to reagent batch identifier, matrix type identifier, and representative temperature range, the batch deviation is calculated using the difference between the reference concentration and the initial value of deep learning, and the current batch statistic is formed by weighting by timestamp. Then, the statistic is recursively merged with the existing batch influence coefficient using a preset forgetting factor and written back to the database, and the temperature base conditions are coupled and dynamically compensated. Compared with the existing method of using fixed batch correction or one-time calibration coefficient, the batch correction can be continuously updated with new records and is more sensitive to recent operating conditions, thereby suppressing the systematic deviation caused by reagent batch replacement, shelf life decay, and matrix differences.

[0021] The technical solution provided by this invention has the following technical effects: This invention provides basic data input for pesticide residue detection in fruits and vegetables, used for evaluation and compensation. A temperature-base decoupling module outputs representative temperature and matrix drift indicators, while a batch update module outputs batch influence coefficients, enabling the module to hierarchically organize and version-maintain a dynamic control library. A data evaluation module forms a candidate sample set from historical detection data and newly added field detection records, and a deep learning evaluation module trains multiple candidate networks. Combined with a data correction model, a test dataset with the same distribution as the target sample set is iteratively generated, driven by the global bias ratio, avoiding implicit adaptation bias caused by long-term participation of fixed evaluation samples in model selection. A time-series spectral encoding module performs time-frequency transformation on the detection signal and encodes it into a unified feature representation. A temperature-base condition coupling module then conditionally couples the features with representative temperature, matrix drift indicators, and batch influence coefficients, forming an input representation that can be used by the deep learning evaluation module to output the initial pesticide residue value. A second generation module, under the constraints of the dynamic control library, dynamically compensates the initial pesticide residue value and outputs the target residue value, thus maintaining consistency in data organization, model evaluation, and compensation calculations across multiple batches, rapid temperature changes, and multiple matrix conditions.

[0022] Furthermore, this invention establishes a hierarchical index of matrix type and representative temperature range for the candidate sample set, and sets sample number constraints for each layer. It uses a candidate network to calculate the global deviation ratio based on the difference in predicted output between the candidate sample set and the target sample set. Under the dual threshold constraints of the global deviation ratio and the hierarchical deviation ratio, it drives the data correction model to perform iterative deletion or addition of candidate sample sets until a target candidate sample set that meets the threshold range is generated as the test dataset and written into the dynamic control library. Simultaneously, the batch update module retrieves historical records by reagent batch identifier, matrix type, and representative temperature range. Based on the batch statistics between the reference concentration and the initial pesticide residue value, it recursively updates the batch influence coefficient and writes it into the dynamic control library. This makes the dynamic control library contain fields such as matrix type, representative temperature range, drift identifier, batch influence coefficient, historical control value, and its dataset version number, which are used to support subsequent deep learning evaluation and dynamic compensation calls.

[0023] Furthermore, by decoupling the generation mechanism of the test dataset from environmental temperature and matrix information, and incorporating the batch update mechanism into the construction and calling process of the dynamic control library, this invention achieves unified management of pesticide residue detection data and model evaluation data for fruits and vegetables under different temperature conditions, different matrix drift states, and different reagent batches. This enables the training and evaluation of the deep learning evaluation module to be performed based on the same field structure and the same distribution constraints, and the second generation module completes the reading and calculation of compensation parameters based on the same dynamic control library, thereby providing a traceable evaluation data version and compensation benchmark for real-time detection. Attached Figure Description

[0024] Figure 1 This is a system diagram of the present invention; Figure 2 This is a flowchart of the method of the present invention. Detailed Implementation

[0025] To enable those skilled in the art to better understand the solutions of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0026] In existing pesticide residue detection technologies for fruits and vegetables, apart from the fixed temperature compensation coefficient scheme which fails to compensate for inaccuracies under wide temperature ranges and multi-matrix conditions, the detection process based on deep learning generally relies on a fixed set of labeled evaluation samples to repeatedly compare and screen the model. Although it does not directly participate in backpropagation training, its evaluation labels have a long-term effect on the selection of model configuration and iteration direction, making it easy for the model to gradually adapt to the temperature range distribution and matrix composition of the existing sample set. At the same time, there is a lack of independent sample sources with the same distribution and real labels on site. The re-division of the training set will change the sample size and distribution. It is difficult to ensure that the matrix and temperature are consistent when the externally constructed samples are randomly constructed. The use of the original sample labels introduces information leakage, making it difficult to control the detection deviation under the conditions of differences in new batches of fruits and vegetables, matrix differences, and cold chain temperature change thermal balance lag.

[0027] To address the aforementioned issues, this invention proposes a pesticide residue detection system and method for fruits and vegetables. Its core lies in integrating temperature-base decoupling, batch updating, and data evaluation generation mechanisms into a dynamic control library management and deep learning evaluation process. During detection, the first generation module rotary cuts and stirs to prepare a mixed detection solution; the time-series spectrum encoding module performs time-frequency transformation on the transmitted light intensity detection signal and encodes features; the temperature-base decoupling module performs lag compensation on the ambient temperature to obtain a representative temperature and generates a drift identifier; the batch updating module updates the influence coefficient based on reagent batch and matrix deviations; the data evaluation module obtains a candidate sample set from historical detection data and newly added field records, calls the deep learning evaluation module to select multiple initial networks, and trains them with the target sample set to obtain candidate networks; the data correction model iteratively generates a target candidate sample set as a test dataset based on the predicted output deviation ratio of the candidate network on the candidate sample set and the target sample set, and writes it into the dynamic control library; the temperature-base condition coupling module couples the features with the representative temperature, drift identifier, and influence coefficient, and inputs the result into the deep learning evaluation module to output the initial pesticide residue value; the second generation module calls the dynamic control library to dynamically compensate the initial value to obtain the target residue value.

[0028] Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0029] Example 1 Figure 1 The present invention provides a pesticide residue detection system for fruits and vegetables, such as... Figure 1As shown, the system includes an acquisition module, a setup module, a first generation module, an output module, and a second generation module. It also includes a temperature-matrix decoupling module and a batch update module. The temperature-matrix decoupling module compensates for environmental temperature lag to obtain representative temperatures and drift indicators. The batch update module updates the influence coefficient based on batch and matrix deviation. The setup module establishes a dynamic control library based on the environmental temperature, sample matrix, and chemical reagent information output by the acquisition module. The first generation module generates mixed detection solutions. The output module includes a data evaluation module, a time-series spectral coding module, a temperature-matrix coupling module, and a deep learning evaluation module. The data evaluation module uses historical detection data and on-site data... The system acquires a candidate sample set by adding new detection records, calls the deep learning evaluation module to select an initial network, trains the target sample set to obtain a candidate network, and compares the prediction output deviation ratio of the candidate network with the candidate sample set and the target sample set as inputs through a data correction model. Iterates to generate a target candidate sample set and write it into a dynamic control library. The time-series spectrum encoding module performs time-frequency transformation on the detection signal and encodes features. The temperature-base condition coupling module couples the features with representative temperature, drift identifier and influence coefficient conditions, inputs them into the deep learning evaluation module, and outputs the initial pesticide residue value. The second generation module calls the dynamic control library to dynamically compensate the initial pesticide residue value to obtain the target residue value.

[0030] In this embodiment, the acquisition module includes a temperature time series acquisition unit, a matrix identification reading unit, a test batch reading unit, and a sample record packaging unit. The temperature time series acquisition unit, the matrix identification reading unit, and the test batch reading unit are all connected to the sample record packaging unit, which is also connected to a pesticide residue detector. Optionally, the temperature time series acquisition unit is implemented by a digital temperature sensor or a thermistor temperature measurement circuit, arranged near the detection chamber and the instrument air inlet, and polls and collects data according to a preset sampling rate to form a temperature time series; the matrix identification reading unit is implemented by a barcode, QR code scanner or RFID reader, which reads the matrix type code on the packaging label of the fruit and vegetable sample or the test task sheet; the reagent batch reading unit is implemented by a QR code scanner or RFID reader, preferably by affixing a QR code or RFID tag to the reagent bottle or reagent kit, reading the batch number, expiration date and reagent model, and outputting the reading result as the reagent batch identifier after verification; the sample record packaging unit is implemented by the main control processor and memory, which collects the detection signal and acquisition parameters of the transmitted light intensity changing over time through the communication interface with the pesticide residue detector; the sample record packaging unit is connected to the pesticide residue detector, and encapsulates it, along with the temperature time series, matrix identifier, and reagent batch identifier, into a candidate sample record according to the target sample set field structure, and then writes it to local storage or uploads it to the host computer. The connection method can be implemented by USB, UART, RS485 or BLE / Wi-Fi communication.

[0031] Furthermore, in the acquisition module, the temperature time series acquisition unit acquires the environmental temperature time series for pesticide residue detection according to a preset sampling rate, the matrix identification reading unit acquires the matrix type identifier of the fruit and vegetable samples, the reagent batch reading unit identifies and acquires the batch identifier of the chemical detection reagent, and the sample record encapsulation unit acquires the detection signal of the transmitted light intensity changing with time and the signal acquisition parameters from the pesticide residue detector interface, and encapsulates them with the outputs of the temperature time series acquisition unit, the matrix identification reading unit, and the batch reading unit according to the data field structure of the target sample set into candidate sample records, and writes them into historical detection data.

[0032] For example, in a rapid detection of organophosphorus pesticide residues in a batch of apples, the operator places the apple sample into the detection chamber and scans the QR code on the detection task sheet. The matrix identification reading unit reads the matrix type code "Apple-Pulp-Batch A20250306". Then, the organophosphorus pesticide detection kit is placed in the reading area, and the reagent batch reading unit reads the information "Reagent Model OP-TEST, Batch OP250218, Expiry Date 2026-10" and completes the verification. After the detection begins, the temperature timing acquisition unit polls and collects the ambient temperature near the outer wall of the detection chamber and the instrument air inlet at a sampling rate of 1Hz, forming a temperature reading that slowly rises from 19.6℃ to 20.3℃. The temperature time series is accompanied by a timestamp; simultaneously, the sample recording and packaging unit communicates with the pesticide residue detector via USB, receiving in real time the detection signal of transmitted light intensity changing over time (a light intensity sequence lasting 120s) output by the photoelectric detection channel, as well as the corresponding acquisition parameters (sampling rate 20Hz, integration time 12ms, gain ×4, exposure level 2). The sample recording and packaging unit encapsulates the temperature time series, matrix type code, reagent batch identifier, transmitted light intensity sequence, and acquisition parameters into a candidate sample record according to the target sample set field structure, writes it to the local SD card to form historical detection data, and synchronously uploads it to the host computer via Wi-Fi for subsequent dynamic control library construction and data evaluation.

[0033] In this embodiment, the module includes a target sample set management unit, a candidate sample set storage unit, a deviation ratio index unit, and a test dataset linking unit. The target sample set management unit stores and maintains the target sample set with pesticide residue reference concentration labels and its data field structure. The candidate sample set storage unit receives the candidate sample records encapsulated by the acquisition module and writes them into the dynamic control library according to the data field structure of the target sample set to form a candidate sample set. The deviation ratio index unit records the deviation ratio and iteration round identifier output by the data evaluation module and establishes an association index with the candidate sample records in the candidate sample set. When the deviation ratio meets the preset threshold, the test dataset linking unit links the test dataset output by the data correction model to the dynamic control library with the dataset version number and establishes a mapping relationship with the ambient temperature, sample matrix type, reagent batch identifier and representative temperature, drift identifier, and influence coefficient.

[0034] Specifically, the module is implemented by the host computer of the detection system, with a built-in CPU / memory and a database service program to support the dynamic control library; the target sample set management unit is implemented by the host computer's sample set management software and storage media (SSD / hard disk), used to store target sample set files with pesticide residue reference concentration labels and their field templates; the candidate sample set entry unit is implemented by the data access interface and entry service process, receiving candidate sample records from the acquisition module via USB, UART, RS485, or BLE / Wi-Fi, parsing them according to the field templates, and writing them into a local relational database or time series data. The library; the deviation ratio index unit is implemented by the database index table and the index maintenance program. At the end of each evaluation iteration, the deviation ratio, iteration round identifier, and corresponding sample ID are written into the index table and a queryable association key is generated; the test dataset attachment unit is implemented by the version control component and the mapping table generation program. When the deviation ratio meets the threshold, a dataset version number is generated for the test dataset, and the sample ID set of the test dataset is attached to the version table of the dynamic control library. At the same time, a mapping record of "ambient temperature, matrix type, reagent batch, representative temperature, drift identifier, and influence coefficient" to the version number is generated for subsequent modules to call according to the version.

[0035] For example, after testing for organophosphorus pesticide residues in an "apple-pulp-batch A20250306" sample, the acquisition module uploads a candidate sample record containing the ambient temperature time series (19.6℃~20.3℃), matrix type code, reagent batch identifier (OP-TEST / OP250218), transmitted light intensity time series signal, and acquisition parameters to the host computer via Wi-Fi. The candidate sample set storage unit receives this record, parses it according to the target sample set field template, writes it into the dynamic control library running in the host computer, and categorizes it into the candidate sample set stratification corresponding to "apple × 20℃ range × OP250218". Subsequently, the data evaluation module completes a round of data correction iteration and outputs the full data. With a local bias ratio r=0.047 and a round identifier t=3, the bias ratio indexing unit writes r, t, and the set of sample IDs participating in the current iteration into the index table and establishes a queryable association key. When subsequent iterations cause the bias ratio to fall within a preset threshold range, the test dataset linking unit generates a version number V20250306-01 for the test dataset output by the data correction model, links the set of sample IDs corresponding to this version to the version table, and generates and writes a mapping record from "ambient temperature range, matrix type, reagent batch, representative temperature, drift identifier, and influence coefficient" to the version number V20250306-01, so that the deep learning evaluation module and the second generation module can call it according to the version in subsequent detections.

[0036] In this embodiment, the first generation module is connected to the acquisition module to read the sample matrix type identifier, and is connected to the establishment module to call the sample preparation parameter table of the matrix type. Under the constraints of the sample preparation parameter table, the driver controls the rotary cutting of the fruit and vegetable sample to generate a fragmented sample. At the same time, under the constraints of the sample preparation parameter table, the driver controls the stirring of the fragmented sample and the chemical detection reagent to output a mixed detection solution. The sample preparation parameter table includes rotary cutting speed, rotary cutting time, stirring speed, stirring time, and chemical detection reagent dosage.

[0037] Specifically, the first generation module consists of a dual-axis motion mechanism, a cutting blade assembly, a stirrer assembly, a reagent dosing assembly, and a main control drive circuit. The dual-axis motion mechanism includes a first rotating shaft and a second rotating shaft. The first rotating shaft drives the cutting blade to perform rotary cutting on the fruit and vegetable samples in the sample container through a motor and a reducer. The second rotating shaft drives the stirrer, which is mechanically linked to the cutting blade, to stir the fragmented sample and chemical detection reagents through a motor. The main control drive circuit communicates with the acquisition module to receive the sample matrix type identifier and with the establishment module to read the sample preparation parameter table corresponding to the matrix type. The main control drive circuit performs closed-loop control on the speed and running time of the two motors according to the sample preparation parameter table. At the same time, it controls the reagent dosing assembly to add chemical detection reagents quantitatively according to the dosage. After the stirring duration reaches the stirring time, stirring stops and the mixed detection solution is output to the subsequent detection chamber.

[0038] For example, when detecting organophosphorus pesticide residues in the sample “Apple-Pulp-Batch A20250306”, the first generation module reads the matrix type code “Apple-Pulp” from the acquisition module and calls the sample preparation parameter table corresponding to the matrix to the creation module. The sample preparation parameter table sets the rotary cutting speed to 1800 rpm, the rotary cutting time to 18s, the stirring speed to 900 rpm, the stirring time to 45s, and the reagent addition volume to 3.0 mL. The main control drive circuit first controls the reagent addition component to add 3.0 mL of organophosphorus pesticide detection reagent into the container, and then drives the first rotating shaft to run at 1800 rpm for 18s to complete the rotary cutting and generate a fragmented sample. Subsequently, it drives the second rotating shaft to stir at 900 rpm for 45s to mix the fragmented sample and the detection reagent evenly. After the stirring time reaches 45s, the drive stops, and the resulting mixed detection liquid is output for the output module to collect the transmitted light intensity detection signal.

[0039] In this embodiment, the temperature-base decoupling module includes a temperature hysteresis compensation unit and a matrix drift identification unit. The temperature hysteresis compensation unit is connected to the acquisition module, receives the ambient temperature time series, and performs time-shift alignment and exponential smoothing on the ambient temperature time series based on a preset thermal inertia discrete state model to obtain a representative temperature. The thermal inertia discrete state model is obtained by simultaneously acquiring the ambient temperature series and the mixed detection liquid temperature series under multiple known temperature change conditions, and performing recursive least squares parameter identification to determine the model order, time constant, and sampling period discretization coefficient. The matrix drift identification unit is connected to the output module, receives the detection signal and its time-frequency spectrum point set, and statistically analyzes the baseline offset, peak position offset, and peak width change of the spectrum point set under the representative temperature constraint to generate a matrix drift identifier.

[0040] Specifically, the temperature decoupling module is implemented by a main control processor, a temperature acquisition interface, a signal acquisition interface, and a parameter storage area. The temperature hysteresis compensation unit runs on the main control processor and is connected to the data interface of the acquisition module to receive the time-stamped ambient temperature time series. The temperature hysteresis compensation unit pre-stores the model order, time constant, and discretization coefficients of the thermal inertia discrete state model. This thermal inertia discrete state model is obtained by simultaneously acquiring ambient temperature sequences and mixed detection liquid temperature sequences under multiple known temperature change conditions and performing recursive least squares identification. During compensation, the ambient temperature sequence is first time-shifted and aligned according to the discrete state model to obtain the compensation. The compensation sequence is then exponentially smoothed to output the thermal equilibrium representative temperature. The matrix drift identification unit is connected to the data interface of the output module to receive the detection signal and the set of spectral points obtained by its time-frequency transformation. Under the constraint of the temperature range corresponding to the thermal equilibrium representative temperature, the baseline offset, peak position offset, and peak width change of the set of spectral points relative to the reference spectral template of the same matrix type and temperature range in the dynamic reference library are calculated. The baseline offset, peak position offset, and peak width change are combined into a matrix drift identifier according to the preset coding rules and output to the establishment module to be written into the dynamic reference library and output to the temperature-base condition coupling module and the second generation module for calling.

[0041] For example, when detecting organophosphorus pesticide residues in the "apple-pulp-batch A20250306" sample, the ambient temperature time series output by the acquisition module shows that the ambient temperature slowly rose from 19.6℃ to 20.3℃ after the detection began. The temperature hysteresis compensation unit calls the identified second-order thermal inertia discrete state model, performs time-shift alignment and exponential smoothing on the temperature series, and obtains the thermal equilibrium representative temperature corresponding to this detection as 20.1℃ and determines its temperature range as 20℃. At the same time, the output module will record this... The detected transmitted light intensity signal is transformed by time and frequency to obtain a set of spectral points. Under the constraint of 20℃ range, the matrix drift identification unit compares the set of spectral points with the reference spectral template of "apple × 20℃ range" in the dynamic reference library. The baseline offset is 0.08, the peak position offset is 0.15, and the peak width change is 0.06. The drift identification code "D(0.08,0.15,0.06)" is generated according to the preset coding rules and output and written into the dynamic reference library for subsequent conditional coupling and dynamic compensation.

[0042] In this embodiment, the data evaluation module extracts a candidate sample set with the same field structure as the target sample set from historical detection data and newly added on-site detection records; then, it calls the deep learning evaluation module to select multiple different initial pesticide residue detection networks from a preset network configuration set; then, it trains and saves each initial pesticide residue detection network using the target sample set to obtain multiple candidate networks; then, it generates a first prediction output and a second prediction output for each candidate network using the candidate sample set and the target sample set as inputs, and calculates the global deviation ratio between the first prediction output and the prediction output; then, it uses the global deviation ratio as an iterative driving force to control the data correction model, performs deletion or addition to the candidate sample set to update the candidate sample set, and iteratively calls the global deviation ratio calculation until the global deviation ratio falls into a preset threshold range, outputs the target candidate sample set and writes it into the dynamic comparison library.

[0043] Specifically, the data evaluation module consists of a data extraction process, a network configuration manager, a training scheduler, an inference comparator, and a data correction iterator in the host computer. The data extraction process is connected to the dynamic comparison library of the establishment module. It performs field alignment, missing field filling, and unit normalization on historical detection data and newly added on-site detection records according to the target sample set field template to form a candidate sample set. The network configuration manager generates multiple initial pesticide residue detection network configurations from the preset network configuration set and passes them to the deep learning evaluation module. The training scheduler calls the deep learning evaluation module to train each initial network using the target sample set training set. The model weights are saved to obtain candidate networks. The inference comparator inputs the candidate sample set and the target sample set into each candidate network for inference, and obtains the first prediction output and the second prediction output. The inference results of the multiple networks are normalized and aggregated according to the preset global deviation ratio formula, and the global deviation ratio of the current iteration is output. The data correction iterator uses the global deviation ratio as the driving quantity to call the data correction model to perform deletion or supplementation and update of the candidate sample set and trigger the next round of inference comparison until the global deviation ratio falls into the preset threshold range. Then, the target candidate sample set is output as the test dataset and written into the dynamic comparison library and a dataset version number is generated.

[0044] For example, to construct a test dataset corresponding to "apple × 20℃ range × organophosphorus reagent", the data extraction process extracts 1200 candidate sample records from the dynamic control library, including historical test records from the past three months and newly added records from the current day. These candidate sample sets are then standardized according to the target sample set field template, which is structured as "temperature sequence, matrix code, reagent batch code, light intensity sequence, acquisition parameters, and reference concentration". The network configuration manager selects five different initial network configurations from a preset set, and the training scheduler calls the deep learning evaluation module to train the target sample set training set, resulting in five candidate networks. The inference comparator compares the 1200 candidate samples with the target... The sample set is input into five candidate networks, resulting in two sets of predicted outputs. The current global bias ratio is calculated to be 0.082. Based on this, the data correction iterator calls the data correction model to remove samples with high bias contribution from the candidate sample set and supplement them with samples from the backup sample pool that match the target stratification ratio to generate a new candidate sample set. Repeated inference and comparison are performed to reduce the global bias ratio to 0.061 and 0.049, respectively, until the global bias ratio reaches 0.047 in the third round and falls within the threshold range of 0.05. Finally, the target candidate sample set is output and written to the dynamic comparison library with version number V20250306-01 for subsequent evaluation and compensation.

[0045] In this embodiment, when updating the candidate sample set, the data correction model establishes a stratified index for the candidate sample set according to the sample matrix type identifier and the temperature range to which the representative temperature belongs, and sets a sample number constraint for each stratum. For each candidate sample record in each stratum, the sample deviation contribution is calculated based on the first prediction output and the second prediction output statistics of multiple candidate networks. Samples are removed from the stratum where the deviation contribution is higher than the first threshold and the number of samples in the stratum exceeds the sample number constraint. When samples need to be added, samples that are not selected into the current candidate sample set from the reserve sample pool of historical detection data and newly added on-site detection records are selected according to the stratified index and whose deviation contribution is lower than the second threshold and meets the sample number constraint. After each deletion or addition, the global deviation ratio and the deviation ratio of each stratum are recalculated until the global deviation ratio threshold and the stratified deviation ratio threshold requirements are met simultaneously. The stratified index uses the sample matrix type identifier and the temperature range to which the representative temperature belongs as a joint key to map candidate sample records to the corresponding strata, and maintains a sample ID set, sample number constraint, stratification bias statistic, and pointers for deleting or adding sample pools for each stratum. The lower limit of the sample size constraint for each layer is obtained by calculating the residual variance between the pesticide residue reference concentration of each layer and the output of the detection network after stratifying the historical detection data by matrix type identifier × representing temperature range, and substituting it into the sample size formula of the preset tolerance error and confidence parameter. The upper limit is determined by the product of the proportion of each layer in the historical detection data and the preset total size of the test dataset, and the minimum value is taken when compared with the preset maximum sample size.

[0046] Specifically, the data correction model consists of a hierarchical index builder, a sample number constraint calculator, a bias contribution calculator, a deletion executor, an addition executor, and a bias ratio checker. The hierarchical index builder reads the matrix type identifier and the temperature range representing the temperature of each sample record in the current candidate sample set. Using these two as a joint key, it maps the sample record to the corresponding hierarchical level and maintains the sample ID set, deletion pool pointer, and addition pool pointer for that hierarchical level. The sample number constraint calculator hierarchically in the historical detection data using the same joint key, calculates the variance of the residual between the reference concentration and the detection network output within each hierarchical level, and combines this with preset tolerance and confidence parameters to obtain the lower limit of the sample number for that hierarchical level. Simultaneously, it calculates the proportion of that hierarchical level in the historical detection data and multiplies it by the preset total size of the test dataset to obtain the upper limit of the sample number, taking the smaller value between this upper limit and the preset maximum sample number, thus forming the upper limit of the sample number for each hierarchical level. The system includes: a stratified sample number constraint; a bias contribution calculator that summarizes the first prediction outputs of multiple candidate networks for each sample record in the candidate sample set, and performs difference or normalized difference with the second prediction output statistics obtained by the same candidate network on the target sample set to obtain the bias contribution of that sample record; a pruning executor that, in strata where the number of stratified samples exceeds the upper limit, prunes samples with bias contribution higher than the first threshold in descending order of bias contribution and updates the stratification index; an addition executor that, in strata where the number of stratified samples is lower than the lower limit, selects samples with bias contribution lower than the second threshold from the spare sample pool according to the stratification index for addition and updates the stratification index; and a bias ratio checker that recalculates the global bias ratio and the bias ratio of each stratum after each pruning or addition, and outputs the updated candidate sample set as the target candidate sample set when the global bias ratio threshold and the stratification bias ratio threshold are met.

[0047] For example, in the second iteration of constructing the "Apple × 20℃ range" test dataset, the data correction model establishes a hierarchical index for the current candidate sample set according to "matrix type = apple" and "representative temperature range = 18-20℃, 20-22℃, 22-24℃", where the current number of samples in the "Apple × 20-22℃" stratum is 520. The sample number constraint calculator calculates a lower limit of 460 samples and an upper limit of 500 samples based on the historical records of this stratum. After the deviation contribution calculator calculates the deviation contribution of each sample in this stratum, the deletion executor removes samples from the top of the deviation contribution ranking. 20 samples above the first threshold are removed, reducing the number of samples in that stratum to 500. Meanwhile, the current number of samples in the "Apple × 18-20℃" stratum is 140, while the lower limit is 160. The supplementary executor selects 20 samples from the spare sample pool whose deviation contribution is below the second threshold according to the stratification joint key. After the removal and supplementation are completed, the deviation ratio checker recalculates and finds that the global deviation ratio has decreased from 0.061 to 0.049, and the deviation ratios of each stratum fall within the corresponding threshold range. Therefore, the updated candidate sample set is output as the target candidate sample set and written into the dynamic control library.

[0048] Here is a specific example: The operator places the apple sample to be tested into the sample preparation container and starts the testing task. The temperature time series acquisition unit in the acquisition module polls and collects the ambient temperature time series near the detection chamber and air inlet at a sampling rate of 1Hz. It records that the temperature of this test slowly changes from 24.7℃ to 25.3℃. The matrix identification reading unit scans the QR code on the task sheet to obtain the sample matrix type identification as "apple - pulp". The reagent batch reading unit scans the label of the organophosphorus pesticide detection kit to obtain the reagent model as OP-TEST, the batch number as OP250218 and the expiration date as 2026-10. The sample recording and packaging unit then writes the above temperature series, matrix identification and reagent batch identification into the candidate sample record header information. Subsequently, the first generation module retrieves the sample preparation parameter table corresponding to "apple-pulp" from the establishment module, which specifies a rotary cutting speed of 1800 rpm, a rotary cutting duration of 18 s, a stirring speed of 900 rpm, a stirring duration of 45 s, and a reagent addition volume of 3.0 mL. The system first quantitatively adds 3.0 mL of organophosphorus detection reagent, then drives the rotary cutting to generate a powdery sample according to the parameter table, and drives stirring to obtain a mixed detection solution. The output module acquires the detection signal of the transmitted light intensity of the mixed detection solution under light source illumination over time (lasting 120 s, sampling rate 20 Hz) through the USB interface with the pesticide residue detector, and simultaneously acquires acquisition parameters such as integration time, gain, and exposure level; the time-series spectrum encoding module performs time-frequency transformation on the detection signal to obtain a set of spectrum points and encodes them into a feature vector. Meanwhile, the temperature-base decoupling module receives the ambient temperature time series, calls the thermal inertia discrete state model pre-identified through multiple sets of temperature-changing conditions to perform time-shift alignment and exponential smoothing, obtains a representative thermal equilibrium temperature of 25.0℃, and determines its temperature range to be 25-30℃. Under the constraint of this representative temperature, the matrix drift identification unit statistically analyzes the baseline offset, peak position offset, and peak width change of the spectral point set relative to the reference template and generates a drift identifier. The batch update module recursively updates the batch influence coefficient based on the difference between the reference concentration and the initial predicted value of batch OP250218 in historical records. The establishment module writes the candidate sample records, representative temperature, drift identifier, and batch influence coefficient into the dynamic comparison library and attaches the corresponding dataset version number. The system's deep learning evaluation module, under the influence of the temperature-baseline coupling module, conditionally couples the encoded features with representative temperature, drift identifier, and batch influence coefficient, and outputs an initial pesticide residue value, for example, 0.62 mg / kg. The second generation module then retrieves the historical control value and parameter influence factor corresponding to "apple × 25-30℃ range × OP250218" from the dynamic control library, and performs dynamic compensation on the initial value in combination with representative temperature and batch influence coefficient to obtain the target pesticide residue value, for example, 0.58 mg / kg. The system then outputs the detection result and the corresponding data version number for traceability.

[0049] Example 2 The difference between Embodiment 2 and Embodiment 1 is that this embodiment introduces a method for detecting pesticide residues in fruits and vegetables.

[0050] Figure 2 The present invention provides a detection method using a fruit and vegetable pesticide residue detection system as described in Example 1, comprising the following steps: Step 1, Information Acquisition: The acquisition module acquires the environmental temperature time series for pesticide residue detection, reads the matrix type identifier of fruit and vegetable samples and the batch identifier of chemical testing reagents, and acquires the detection signal and signal acquisition parameters of transmitted light intensity changing over time. Step 2, Temperature hysteresis compensation: The temperature-based decoupling module performs time-shift alignment and exponential smoothing on the ambient temperature time series based on a preset thermal inertia discrete state model to obtain a representative temperature; Step 3, Generate matrix drift identifiers: The temperature-base decoupling module generates matrix drift identifiers based on the time-frequency spectrum points of the detection signal and under the representation of temperature constraints; Step 4, Influence Coefficient Update: The batch update module updates the influence coefficient based on the batch identifier of the chemical testing reagent and the matrix deviation; Step 5, Construct a dynamic control library: The dynamic control library is built or updated by the module based on ambient temperature, sample matrix type, chemical detection reagent information, representative temperature, matrix drift identifier, influence coefficient and historical detection data; Step 6, Generate Test Dataset: The data evaluation module extracts candidate sample sets with the same field structure as the target sample set from historical detection data and newly added on-site detection records. The deep learning evaluation module selects multiple initial pesticide residue detection networks and trains multiple candidate networks with the target sample set. Based on the candidate networks, the first prediction output and the second prediction output are obtained by taking the candidate sample set and the target sample set as inputs respectively, and the global bias ratio is calculated. The global bias ratio drives the data correction model to perform deletion or addition iterations on the candidate sample set until the global bias ratio falls into the preset threshold range. The target candidate sample set is output as the test dataset and written into the dynamic control library. Step 7, generating sample preparation mixture: The first generation module drives the fruit and vegetable sample to be rotary cut and the fragmented sample to be stirred with chemical detection reagents according to the sample preparation parameter table of matrix type to obtain mixed detection solution; Step 8, Time-Frequency Coding and Conditional Coupling: The time-series spectrum coding module performs time-frequency transformation on the detection signal and encodes it to obtain a feature vector. The temperature-base conditional coupling module then conditionsally couples the feature vector with the temperature, matrix drift identifier, and influence coefficient. Step 9, Initial Residue Value Assessment: The deep learning assessment module outputs the initial pesticide residue value based on the features after conditional coupling; Step 10, Dynamic Compensation Output: The second generation module calls the dynamic control library to perform dynamic compensation on the initial pesticide residue value to obtain the target residue value.

[0051] In this embodiment, step S4 includes: the batch update module retrieves historical test records from the dynamic control library by chemical reagent batch identifier, sample matrix type identifier, and temperature range representing the temperature; extracts the pesticide residue reference concentration and the initial pesticide residue value output by the deep learning evaluation module for each historical test record; calculates the batch deviation between the reference concentration and the initial pesticide residue value; and weights and summarizes the batch deviation according to the test timestamp to form the current batch statistic; the batch update module recursively merges the current batch statistic with the existing batch influence coefficients in the dynamic control library according to a preset forgetting factor to obtain the updated batch influence coefficient; and writes the updated batch influence coefficient into the dynamic control library and outputs it synchronously to the temperature-base coupling module and the second generation module for calling.

[0052] For example, when testing an "apple-flesh" sample using organophosphorus pesticide detection reagent batch OP250218, the batch update module retrieves 50 historical test records from the dynamic control library within the past three months using the search criteria "reagent batch identifier = OP250218, matrix type identifier = apple-flesh, representative temperature range = 25-30℃". For each historical record, the module extracts the pesticide residue reference concentration value obtained from laboratory verification and the initial pesticide residue value output by the deep learning evaluation module, and calculates the batch deviation between the two. For example, if the reference concentration / initial value for three records are 0.60 / 0.66 mg / kg, 0.55 / 0.61 mg / kg, and 0.70 / 0.76 mg / kg, respectively, then the corresponding batch deviation is calculated. The values ​​are -0.06, -0.06, and -0.06 mg / kg, respectively. The batch update module then weights and summarizes all 50 deviations according to the detection timestamp. The weight of the most recent week's records is set to 1.0, the weight of the most recent month's records is set to 0.6, and the weight of the records from two to three months is set to 0.3. The weighted current batch statistic is then -0.052 mg / kg. Subsequently, the batch update module recursively merges the current batch statistic with the existing batch influence coefficient (e.g., -0.048 mg / kg) in the dynamic control library according to a preset forgetting factor. If the forgetting factor is 0.2, the merged updated batch influence coefficient is -0.049 mg / kg, which is then written into the dynamic control library and output to the temperature-base coupling module and the second generation module for use in this and subsequent detections.

[0053] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0054] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A pesticide residue detection system for fruits and vegetables, comprising an acquisition module, an establishment module, a first generation module, an output module, and a second generation module, characterized in that, It also includes a temperature-base decoupling module and a batch update module. The temperature-base decoupling module obtains representative temperature and drift identifier by compensating for environmental temperature lag. The batch update module updates the influence coefficient based on batch and matrix deviation. The module establishes a dynamic control library based on the environmental temperature, sample matrix, and chemical detection reagent information output by the acquisition module. The first generation module is used to generate mixed detection solutions. The output module includes a data evaluation module, a time-series spectrum encoding module, a temperature-base condition coupling module, and a deep learning evaluation module. The data evaluation module obtains candidate sample sets from historical detection data and newly added on-site detection records, calls the deep learning evaluation module to select an initial network, trains the candidate network with the target sample set, and compares the prediction output deviation ratio of the candidate network with the candidate sample set and the target sample set as inputs through a data correction model. Iteratively, it generates the target candidate sample set and writes it into the dynamic control library. The time-series spectrum encoding module performs time-frequency transformation on the detection signal and encodes features. The temperature-base coupling module couples the features with representative temperature, drift identifier, and influence coefficient conditions, then inputs them into the deep learning evaluation module to output the initial pesticide residue value; the second generation module calls the dynamic control library to dynamically compensate the initial pesticide residue value to obtain the target residue value.

2. The fruit and vegetable pesticide residue detection system according to claim 1, characterized in that, The acquisition module includes a temperature time series acquisition unit, a matrix identification reading unit, a reagent batch reading unit, and a sample record packaging unit. The temperature time series acquisition unit, matrix identification reading unit, and reagent batch reading unit are all connected to the sample record packaging unit, which is also connected to a pesticide residue detector.

3. The fruit and vegetable pesticide residue detection system according to claim 2, characterized in that, In the acquisition module, the temperature time series acquisition unit acquires the environmental temperature time series for pesticide residue detection according to a preset sampling rate, the matrix identification reading unit acquires the matrix type identifier of the fruit and vegetable samples, the reagent batch reading unit identifies and acquires the batch identifier of the chemical detection reagents, and the sample record encapsulation unit acquires the detection signal and signal acquisition parameters of the transmitted light intensity changing over time from the pesticide residue detector interface, and encapsulates them together with the outputs of the temperature time series acquisition unit, the matrix identification reading unit, and the reagent batch reading unit according to the data field structure of the target sample set into candidate sample records, and writes them into historical detection data.

4. The fruit and vegetable pesticide residue detection system according to claim 1, characterized in that, The module includes a target sample set management unit, a candidate sample set storage unit, a deviation ratio index unit, and a test dataset linking unit. The target sample set management unit stores and maintains the target sample set with pesticide residue reference concentration labels and its data field structure. The candidate sample set storage unit receives the candidate sample records encapsulated by the acquisition module and writes them into the dynamic control library according to the data field structure of the target sample set to form a candidate sample set. The deviation ratio index unit records the deviation ratio and iteration round identifier output by the data evaluation module and establishes an association index with the candidate sample records in the candidate sample set. When the deviation ratio meets the preset threshold, the test dataset linking unit links the test dataset output by the data correction model to the dynamic control library with the dataset version number and establishes a mapping relationship with the ambient temperature, sample matrix type, reagent batch identifier and representative temperature, drift identifier, and influence coefficient.

5. The fruit and vegetable pesticide residue detection system according to claim 1, characterized in that, The first generation module is connected to the acquisition module to read the sample matrix type identifier, and is connected to the establishment module to call the sample preparation parameter table of the matrix type. Under the constraints of the sample preparation parameter table, the module drives and controls the rotary cutting of fruit and vegetable samples to generate fragmented samples. At the same time, under the constraints of the sample preparation parameter table, the module drives and controls the stirring of the fragmented samples and chemical detection reagents to output a mixed detection solution. The sample preparation parameter table includes rotary cutting speed, rotary cutting time, stirring speed, stirring time, and chemical detection reagent dosage.

6. The fruit and vegetable pesticide residue detection system according to claim 1, characterized in that, The temperature-base decoupling module includes a temperature hysteresis compensation unit and a matrix drift identification unit. The temperature hysteresis compensation unit is connected to the acquisition module, receives the ambient temperature time series, and performs time-shift alignment and exponential smoothing on the ambient temperature time series based on a preset thermal inertia discrete state model to obtain a representative temperature. The thermal inertia discrete state model is obtained by simultaneously acquiring ambient temperature series and mixed detection liquid temperature series under multiple known temperature change conditions, and performing recursive least squares parameter identification to determine the model order, time constant, and sampling period discretization coefficients. The matrix drift identification unit is connected to the output module, receives the detection signal and its time-frequency spectrum point set, and statistically analyzes the baseline offset, peak position offset, and peak width change of the spectrum point set under the representative temperature constraint to generate a matrix drift identifier.

7. The fruit and vegetable pesticide residue detection system according to claim 1, characterized in that, The data evaluation module extracts a candidate sample set with the same field structure as the target sample set from historical detection data and newly added on-site detection records; then it calls the deep learning evaluation module to select multiple different initial pesticide residue detection networks from the preset network configuration set. Then, the target sample set is used to train and save each initial pesticide residue detection network to obtain multiple candidate networks. For each candidate network, the first prediction output and the second prediction output are generated by taking the candidate sample set and the target sample set as inputs, and the global deviation ratio between the first prediction output and the second prediction output is calculated. Then, the global deviation ratio is used as the iterative driving force to control the data correction model, and the candidate sample set is updated by deleting or supplementing it. The global deviation ratio calculation is called repeatedly until the global deviation ratio falls into the preset threshold range. The target candidate sample set is then output and written into the dynamic control library.

8. The fruit and vegetable pesticide residue detection system according to claim 7, characterized in that, In the data evaluation module, when updating the candidate sample set, the data correction model establishes a hierarchical index for the candidate sample set according to the sample matrix type identifier and the temperature range to which the representative temperature belongs, and sets the sample number constraint for each layer. For each candidate sample record in each layer, the sample bias contribution is calculated based on the first prediction output and second prediction output statistics of multiple candidate networks for the candidate sample record. Samples are removed from layers where the bias contribution is higher than the first threshold and the number of samples in the layer exceeds the sample number constraint. When additional samples are needed, samples that are not selected into the current candidate sample set from the backup sample pool of historical detection data and newly added on-site detection records are selected according to the stratified index. Samples with a deviation contribution rate lower than the second threshold and that meet the sample number constraint are added. After each deletion or addition, the global deviation ratio and the deviation ratio of each stratum are recalculated until the global deviation ratio threshold and the stratified deviation ratio threshold are met simultaneously. The stratified index uses the sample matrix type identifier and the temperature range to which the representative temperature belongs as a joint key to map candidate sample records to the corresponding strata, and maintains a sample ID set, sample number constraint, stratification bias statistic, and pointers for deleting or adding sample pools for each stratum. The lower limit of the sample size constraint for each layer is obtained by calculating the residual variance between the pesticide residue reference concentration of each layer and the output of the detection network after stratifying the historical detection data by matrix type identifier × representing temperature range, and substituting it into the sample size formula of the preset tolerance error and confidence parameter. The upper limit is determined by the product of the proportion of each layer in the historical detection data and the preset total size of the test dataset, and the minimum value is taken when compared with the preset maximum sample size.

9. A detection method, employing the fruit and vegetable pesticide residue detection system as described in any one of claims 1-8, characterized in that, Includes the following steps: Step 1, Information Acquisition: The acquisition module acquires the environmental temperature time series for pesticide residue detection, reads the matrix type identifier of fruit and vegetable samples and the batch identifier of chemical testing reagents, and acquires the detection signal and signal acquisition parameters of transmitted light intensity changing over time. Step 2, Temperature hysteresis compensation: The temperature-based decoupling module performs time-shift alignment and exponential smoothing on the ambient temperature time series based on a preset thermal inertia discrete state model to obtain a representative temperature; Step 3, Generate matrix drift identifiers: The temperature-base decoupling module generates matrix drift identifiers based on the time-frequency spectrum points of the detection signal and under the representation of temperature constraints; Step 4, Influence Coefficient Update: The batch update module updates the influence coefficient based on the batch identifier of the chemical testing reagent and the matrix deviation; Step 5, Construct a dynamic control library: The dynamic control library is built or updated by the module based on ambient temperature, sample matrix type, chemical detection reagent information, representative temperature, matrix drift identifier, influence coefficient and historical detection data; Step 6, Generate Test Dataset: The data evaluation module extracts candidate sample sets with the same field structure as the target sample set from historical detection data and newly added on-site detection records. The deep learning evaluation module selects multiple initial pesticide residue detection networks and trains multiple candidate networks with the target sample set. Based on the candidate networks, the first prediction output and the second prediction output are obtained by taking the candidate sample set and the target sample set as inputs respectively. The global bias ratio is calculated and the data correction model is driven by the global bias ratio to perform iterative deletion or addition of candidate sample sets until the global bias ratio falls into the preset threshold range. The target candidate sample set is output as the test dataset and written into the dynamic control library. Step 7, generating sample preparation mixture: The first generation module drives the fruit and vegetable sample to be rotary cut and the fragmented sample to be stirred with chemical detection reagents according to the sample preparation parameter table of matrix type to obtain mixed detection solution; Step 8, Time-Frequency Coding and Conditional Coupling: The time-series spectrum coding module performs time-frequency transformation on the detection signal and encodes it to obtain a feature vector. The temperature-base conditional coupling module then conditionsally couples the feature vector with the temperature, matrix drift identifier, and influence coefficient. Step 9, Initial Residue Value Assessment: The deep learning assessment module outputs the initial pesticide residue value based on the features after conditional coupling; Step 10, Dynamic Compensation Output: The second generation module calls the dynamic control library to perform dynamic compensation on the initial pesticide residue value to obtain the target residue value.

10. The detection method according to claim 9, characterized in that, Step S4 includes: The batch update module retrieves historical test records from the dynamic control library by chemical reagent batch identifier, sample matrix type identifier, and temperature range representing the temperature. It extracts the pesticide residue reference concentration and the initial pesticide residue value output by the deep learning evaluation module for each historical test record, calculates the batch deviation between the reference concentration and the initial pesticide residue value, and weights and summarizes the batch deviation according to the test timestamp to form the current batch statistic. The batch update module recursively merges the current batch statistic with the existing batch influence coefficients in the dynamic control library according to a preset forgetting factor to obtain the updated batch influence coefficient. The updated batch influence coefficient is written into the dynamic control library and synchronously output to the temperature-base coupling module and the second generation module for use.

Citation Information

Patent Citations

  • Pesticide residue detection method and system for pesticide residue detector

    CN120404672A