Pesticide detection model training method and device, and storage medium
By employing multi-dimensional spectroscopy and pre-set model training, combined with nanomaterials and infrared photo-enhanced catalysis, the problems of signal overlap and human intervention in pesticide detection have been solved, achieving both accuracy and efficiency in pesticide detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NINGBO FOTILE KITCHEN WARE CO LTD
- Filing Date
- 2026-02-03
- Publication Date
- 2026-06-23
Smart Images

Figure CN122266549A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of pesticide detection technology, and in particular to a method, apparatus and storage medium for training a pesticide detection model. Background Technology
[0002] In the process of detecting pesticide residues in agricultural products, components such as chlorophyll, cellulose, and moisture in the products can overlap with the spectral signals of pesticides, making it difficult for traditional methods to accurately identify pesticide characteristic peaks. For example, depressions on the surface of vegetables or their internal structures may obscure pesticide signals, leading to incomplete detection. Infrared detection requires steps such as crushing and extraction, while near-infrared detection, although capable of directly detecting solids, still requires manual baseline correction and noise reduction, and may miss pesticides that have penetrated into the interior. Summary of the Invention
[0003] This application provides a training method, device, and storage medium for a pesticide detection model. The resulting pesticide detection model can accurately and comprehensively detect pesticide residues in agricultural products, and can intelligently detect pesticides in agricultural products, thereby improving the detection efficiency of pesticide categories in agricultural products.
[0004] On the one hand, this application provides a method for training a pesticide detection model, the method comprising: At least two spectroscopic techniques are used to obtain multi-dimensional spectral information of each sample agricultural product in the sample agricultural product set; the sample agricultural product set includes sample agricultural products of various product categories and containing various pesticides; each sample agricultural product is labeled with a sample pesticide category label; The multi-dimensional spectral information of each sample agricultural product is preprocessed to obtain a preprocessed sample spectrum set; The preprocessed sample spectrum set is input into a preset model to extract the sample pesticide feature bands corresponding to each spectrum, and the sample pesticide category result of each sample agricultural product is obtained based on the sample pesticide feature bands; Based on the difference between the sample pesticide category results and the sample pesticide category labels, the preset model is trained to obtain a pesticide detection model.
[0005] On the other hand, a pesticide detection method is provided, the method comprising: Acquire multi-dimensional spectral information of the agricultural product to be tested by at least two spectral techniques; The multi-dimensional spectral information is input into the pesticide detection model for pesticide category prediction to obtain the pesticide category identification result of the agricultural product to be tested; the pesticide detection model is trained using the above method.
[0006] On the other hand, a training device for a pesticide detection model is provided, the device comprising: The sample multidimensional spectral acquisition module is used to acquire the multidimensional spectral information of each sample agricultural product in the sample agricultural product set using at least two spectral techniques; the sample agricultural product set includes sample agricultural products of various product categories and containing various pesticides; each sample agricultural product is labeled with a sample pesticide category label; The sample preprocessing module is used to preprocess the multi-dimensional spectral information of each sample agricultural product to obtain a preprocessed sample spectrum set. The sample pesticide category prediction module is used to input the preprocessed sample spectrum set into a preset model, extract the sample pesticide feature bands corresponding to each spectrum, and obtain the sample pesticide category result for each sample agricultural product based on the sample pesticide feature bands. The model training module is used to train the preset model based on the difference between the sample pesticide category results and the sample pesticide category labels, so as to obtain a pesticide detection model.
[0007] In some embodiments, the sample preprocessing module includes: The reference spectrum determination unit is used to determine the reference spectrum for element scattering correction based on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set. The spectral correction unit is used to correct the multi-dimensional spectral information of the multiple samples according to the reference spectrum using a meta-scattering correction algorithm to obtain a set of corrected sample spectra. The derivative parameter determination unit is used to perform cross-validation on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set to determine the derivative parameters of the digital filtering algorithm; the derivative parameters include at least one of the smoothing window size and the polynomial degree; The sample set processing unit is used to perform first-order derivative processing on the sample calibration spectrum set using the derivative parameter to obtain the preprocessed sample spectrum set.
[0008] In some embodiments, the sample pesticide category prediction module includes: The sample enhancement unit is used to perform data enhancement processing on the preprocessed sample spectral set to obtain a sample enhanced spectral set. The training spectrum construction unit is used to construct a sample training spectrum set based on the preprocessed sample spectrum set and the sample enhanced spectrum set. A preset spectrum acquisition unit is used to acquire preset multi-dimensional spectral information of each preset agricultural product in a preset agricultural product set; each preset agricultural product is labeled with a preset pesticide category label; the number of agricultural products in the preset agricultural product set is greater than the number of agricultural products in the sample agricultural product set; The preset pesticide prediction unit is used to input the preset multi-dimensional spectral information of each preset agricultural product into the preset network to predict the pesticide category and obtain the preset pesticide category result. A preset model training unit is used to train the preset network based on the difference between the preset pesticide category results and the preset pesticide category labels to obtain an initial pesticide detection model, and to use the initial pesticide detection model as the preset model. The model input unit is used to input the sample training spectrum set into the preset model.
[0009] In some embodiments, the sample multidimensional spectral acquisition module includes: An enrichment material acquisition unit is used to acquire sample extracts of each sample agricultural product and add nanomaterials to the sample extracts to obtain nanomaterials enriched with pesticides. The sample infrared detection unit is used to detect the sample infrared spectrum of the pesticide-enriched nanomaterial using infrared photo-enhanced catalysis technology; The sample preset spectrum acquisition unit is used to acquire the sample preset spectrum of each agricultural product sample using preset spectrum technology; The sample multidimensional spectral determination unit is used to determine the sample multidimensional spectral information of each sample agricultural product based on the sample infrared spectrum corresponding to each sample agricultural product and the sample preset spectrum.
[0010] In some embodiments, the sample preset spectrum acquisition unit is further configured to acquire the internal spectrum of each sample agricultural product using three-dimensional spectral imaging technology and construct a sample cube spectrum; acquire the sample Raman spectrum of each sample agricultural product using Raman spectroscopy technology; acquire the sample fluorescence spectrum of each sample agricultural product using fluorescence spectroscopy technology; and determine the sample cube spectrum, the sample Raman spectrum, and the sample fluorescence spectrum corresponding to each sample agricultural product as the sample preset spectrum for each sample agricultural product.
[0011] In some embodiments, the sample multidimensional spectral acquisition module includes: An environmental data acquisition unit is used to acquire the initial multidimensional spectrum of each sample agricultural product collected by at least two spectral techniques, as well as the real-time environmental data corresponding to the spectral acquisition environment of the sample agricultural product. The sample multidimensional spectral correction unit is used to correct the initial sample multidimensional spectrum based on the real-time environmental data to obtain the sample multidimensional spectral information of each sample agricultural product.
[0012] In some embodiments, each sample agricultural product is labeled with at least two sample pesticide category tags, and the sample pesticide category result is at least two; the model training module includes: The comparison unit is used to sequentially compare each of the pesticide category results of the sample with the pesticide category labels of the at least two samples to obtain the comparison results; The target loss determination unit is used to determine the target loss data based on the comparison results. The model training unit is used to adjust the model parameters of the preset model according to the target loss data until the training termination condition is met, and to determine the model at the end of training as the pesticide detection model.
[0013] On the other hand, a pesticide detection device is provided, including: The test spectrum acquisition module is used to acquire multi-dimensional spectral information of the test agricultural product collected by at least two spectral techniques; The result prediction module is used to input the multi-dimensional spectral information into the pesticide detection model for pesticide category prediction processing, and obtain the pesticide category identification result of the agricultural product to be tested; the pesticide detection model is trained using the above method.
[0014] On the other hand, an electronic device is provided, the device including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the training method of the pesticide detection model as described above.
[0015] On the other hand, a computer storage medium is provided, which stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the training method of the pesticide detection model as described above.
[0016] On the other hand, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform a training method for the pesticide detection model as described above.
[0017] The training method, apparatus, and storage medium for the pesticide detection model provided in this application have the following technical advantages: This application employs at least two spectroscopic techniques to acquire multi-dimensional spectral information of each sample agricultural product in a sample agricultural product set. The sample agricultural product set includes multiple product categories and samples containing multiple pesticides. Each sample agricultural product is labeled with a pesticide category tag. This multi-dimensional spectral information of each sample agricultural product is acquired through multiple spectroscopic techniques, enriching the spectral information of the sample agricultural products. Then, the multi-dimensional spectral information of each sample agricultural product is preprocessed to obtain a preprocessed sample spectrum set. The preprocessed sample spectrum set is then input into a preset model to extract the pesticide characteristic bands corresponding to each spectrum. This allows for accurate identification of pesticide characteristic bands through the model, effectively avoiding overlap between pesticide spectral signals and components such as chlorophyll, cellulose, and water in agricultural products. Based on the pesticide characteristic bands, the pesticide category result for each sample agricultural product is obtained. Finally, based on the difference between the pesticide category result and the pesticide category tag, the preset model is trained to obtain a pesticide detection model. The resulting pesticide detection model can accurately and comprehensively detect pesticide residues in agricultural products and can intelligently detect pesticides in agricultural products, improving the detection efficiency of pesticide categories in agricultural products. Attached Figure Description
[0018] To more clearly illustrate the technical solutions and advantages in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating a training method for a pesticide detection model provided in the embodiments of this specification; Figure 2 This is a flowchart illustrating a method for obtaining multi-dimensional spectral information of each sample agricultural product in a sample agricultural product set using at least two spectral techniques, as provided in the embodiments of this specification. Figure 3 This is a flowchart illustrating a method for obtaining the preset spectrum of each sample agricultural product using preset spectral technology, as provided in the embodiments of this specification. Figure 4 This is a flowchart illustrating a method for preprocessing multi-dimensional spectral information of each sample agricultural product to obtain a preprocessed sample spectral set, as provided in the embodiments of this specification. Figure 5 This is a schematic flowchart of a pesticide detection method provided in the embodiments of this specification; Figure 6This is a schematic diagram of the structure of a training device for a pesticide detection model provided in the embodiments of this specification; Figure 7 This is a schematic diagram of the structure of a pesticide detection device provided in the embodiments of this specification; Figure 8 This is a schematic diagram of the structure of a server provided in the embodiments of this specification. Detailed Implementation
[0020] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0022] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0023] The following describes a training method for a pesticide detection model according to this application. Figure 1This is a flowchart illustrating a training method for a pesticide detection model provided in the embodiments of this specification. This specification provides the operational steps of the method described in the embodiments or flowcharts, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or server product execution, the methods shown in the embodiments or drawings can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment). Specifically, as shown in the embodiments or drawings... Figure 1 As shown, the method may include: S101: At least two spectroscopic techniques are used to obtain multi-dimensional spectral information of each sample agricultural product in the sample agricultural product set; the sample agricultural product set includes sample agricultural products of multiple product categories and containing multiple pesticides; each sample agricultural product is labeled with a sample pesticide category label. In the embodiments of this specification, the sample agricultural products may include, but are not limited to, root, stem, and leaf products. Multispectral fusion technology can be used to jointly acquire multidimensional spectral information of the same sample agricultural product. Multiple spectral techniques may include, but are not limited to, Raman and fluorescence spectroscopy. A joint model can be constructed by combining Raman and fluorescence spectroscopy techniques to visualize pesticide penetration in fruit and vegetable tissues, overcoming the limitations of single spectra. Furthermore, the complementary nature of multidimensional spectral information improves detection reliability in complex scenarios, and is particularly suitable for samples with complex internal structures.
[0024] It can acquire sample agricultural products from multiple product categories and detect the types of pesticide residues in each sample agricultural product, thereby obtaining a sample pesticide category label for the sample agricultural product. A sample agricultural product can be labeled with one or more sample pesticide category labels.
[0025] S103: Preprocess the multi-dimensional spectral information of each sample agricultural product to obtain a preprocessed sample spectrum set.
[0026] In the embodiments of this specification, in order to improve the accuracy of the sample spectra, the multi-dimensional spectral information of each sample agricultural product can be preprocessed, such as noise and scattering correction and derivative calculation, to obtain a preprocessed sample spectrum set.
[0027] For example, spectral preprocessing may include the following methods: 1. Noise Removal: This is a crucial step in spectral preprocessing, designed to ensure the validity of the experimentally obtained spectral data. Depending on the characteristics of the spectral noise, statistical processing or model-based methods are typically employed. 2. Linear correction and spectral fitting: These methods are used to eliminate systematic errors such as baseline tilt and drift, as well as light intensity attenuation.
[0028] 3. Wavelet Transform: This is an effective signal analysis method that can decompose chemical signals into multiple scale components and apply corresponding sampling step sizes to different scale components, thereby enabling focus on any part of the signal and achieving complete extraction of signal data.
[0029] 4. Light Scattering Correction: This mainly addresses spectral differences caused by uneven particle size distribution during diffuse reflectance data acquisition. Currently, the main methods used to eliminate these differences are: Multiplicative Scatter Correction (MSC) and Standard Normal Variation (SNV). MSC primarily eliminates scattering phenomena caused by uneven particle distribution and particle size, while SNV eliminates the effects of solid particle size, surface scattering, and optical path transformation on diffuse reflectance.
[0030] 5. Fourier Transform: In spectral information processing, the FT, as a signal processing technique, can not only decompose spectral signals into a superposition of many sine waves of different frequencies, but also perform smoothing, interpolation, filtering, fitting, and resolution improvement operations on the original spectral data, as well as smoothing and noise reduction, data compression, and information extraction.
[0031] S105: Input the preprocessed sample spectrum set into a preset model, extract the sample pesticide feature bands corresponding to each spectrum, and obtain the sample pesticide category result for each sample agricultural product based on the sample pesticide feature bands.
[0032] In the embodiments of this specification, the preset model may include, but is not limited to, convolutional neural networks and Transformer models; the characteristic bands of pesticide samples (such as 4862 cm⁻¹) can be automatically extracted through deep learning of the preset model. - ¹、4615cm - ¹), which can effectively avoid the overlap of chlorophyll, cellulose, water and other components in agricultural products with pesticide spectral signals; thus, it can eliminate matrix interference; and it does not require manual feature selection, avoiding subjective bias, and is applicable to complex matrices of different agricultural products; then, the sample pesticide category result of each sample agricultural product is obtained according to the sample pesticide characteristic band.
[0033] S107: Based on the difference between the sample pesticide category results and the sample pesticide category labels, train the preset model to obtain a pesticide detection model.
[0034] In the embodiments of this specification, the target loss information is determined based on the difference between the sample pesticide category result and the sample pesticide category label. A target loss function of a preset model can be constructed in advance, and then the target loss information can be calculated based on this loss function.
[0035] This specification employs at least two spectroscopic techniques to acquire multi-dimensional spectral information of each sample agricultural product in a sample agricultural product set. The sample agricultural product set includes multiple product categories and samples containing multiple pesticides. Each sample agricultural product is labeled with a pesticide category tag. This multi-dimensional spectral information of each sample agricultural product is acquired through multiple spectroscopic techniques, enriching the spectral information of the sample agricultural products. Then, the multi-dimensional spectral information of each sample agricultural product is preprocessed to obtain a preprocessed sample spectrum set. The preprocessed sample spectrum set is then input into a preset model to extract the pesticide characteristic bands corresponding to each spectrum. This allows for accurate identification of pesticide characteristic bands through the model, effectively avoiding overlap between pesticide spectral signals and components such as chlorophyll, cellulose, and water in agricultural products. Based on the pesticide characteristic bands, the pesticide category result for each sample agricultural product is obtained. Finally, based on the difference between the pesticide category result and the pesticide category tag, the preset model is trained to obtain a pesticide detection model. The resulting pesticide detection model can accurately and comprehensively detect pesticide residues in agricultural products and can intelligently detect pesticides in agricultural products, improving the detection efficiency of pesticide categories in agricultural products.
[0036] In some embodiments, not only can qualitative analysis of the multi-dimensional spectral information of the samples be performed, but quantitative analysis can also be performed. Each sample pesticide category label also includes a corresponding content label, i.e., a sample pesticide content label; each sample agricultural product is labeled with a sample pesticide category label and a sample pesticide content label; the preprocessed sample spectrum set is input into a preset model, the sample pesticide feature bands corresponding to each spectrum are extracted, and the sample pesticide category result of each sample agricultural product is obtained based on the sample pesticide feature bands; and the curves corresponding to the sample pesticide feature bands can be processed to obtain the sample pesticide content result; for example, qualitative analysis can be performed using infrared spectroscopy: pesticide types are identified by parameters such as the position and intensity of characteristic peaks. Quantitative analysis: pesticide concentration is calculated using a standard curve, and detection parameters include peak height integral, calibration curve slope, etc. Finally, based on the difference between the sample pesticide category result and the sample pesticide category label, and the difference between the sample pesticide content result and the sample content label, the target loss information is determined, and the model parameters of the preset model are adjusted according to the target loss information until the training termination condition is met, thus obtaining the pesticide detection model. The resulting pesticide detection model can not only detect pesticide categories in agricultural products, but also automatically detect the pesticide content corresponding to each pesticide category.
[0037] In some embodiments, such as Figure 2 As shown, the method of using at least two spectroscopic techniques to obtain multi-dimensional spectral information of each sample agricultural product in the sample agricultural product set includes: S1011: Obtain the sample extract of each agricultural product sample, and add nanomaterials to the sample extract to obtain nanomaterials enriched with pesticides; S1013: The infrared spectrum of the pesticide-enriched nanomaterial sample was detected using infrared photo-enhanced catalysis technology; S1015: Use preset spectral technology to obtain the preset spectrum of each sample agricultural product; S1017: Determine the multi-dimensional spectral information of each sample agricultural product based on the sample infrared spectrum and the sample preset spectrum corresponding to each sample agricultural product.
[0038] In the embodiments of this specification, at least two spectroscopic techniques may include infrared photoenhanced catalysis and other preset spectroscopic techniques, which may include, but are not limited to, fluorescence and Raman spectroscopy. Nanomaterials with high affinity for target pesticide molecules can be designed.
[0039] Adsorption-type: such as porous metal-organic frameworks (MOFs), covalent organic frameworks (COFs), and graphene / graphene oxide. They have huge specific surface areas and can effectively "capture" and "concentrate" pesticide molecules through physical adsorption or chemical bonding.
[0040] Biomimetic: such as molecularly imprinted polymers (MIPs). They are like "artificial antibodies" with pores specifically designed in shape, size and functional groups to target specific pesticide molecules, resulting in extremely high selectivity.
[0041] Procedure: Nanomaterials are placed in the sample solution (such as soaked water or agricultural product extract). By stirring or shaking, pesticide molecules are selectively enriched on the surface or inside of the nanomaterials. Then, the pesticide-enriched nanomaterials are separated from the sample matrix by centrifugation or magnetic separation (if the nanomaterials are magnetic), achieving concentration and purification.
[0042] Traditional signal generation methods may rely on enzyme catalysis or chemiluminescence, while infrared-enhanced catalysis utilizes catalytic reactions and enhances them with infrared light.
[0043] Catalytic nanomaterials: The enriched material itself, or another nanomaterial supported on its surface (such as platinum Pt, gold Au nanoparticles, cerium dioxide CeO2, etc.), needs to possess peroxidase-like activity. That is, it can catalyze the decomposition of hydrogen peroxide (H2O2) to produce highly oxidizing free radicals (such as ·OH).
[0044] Signal generation: After enrichment, a colorless signal substrate (such as TMB, 3,3',5,5'-tetramethylbenzidine) is added to the system. Under the action of the catalytic material, H₂O₂ oxidizes TMB to generate a blue product (oxTMB), which exhibits strong absorption at a specific wavelength (e.g., 652 nm). The intensity of the color is positively correlated with the catalytic activity, which in turn is related to the pesticide concentration. The "enhancing" role of infrared light: Photothermal effect: Specially made nanomaterials (such as gold nanorods, copper sulfide, etc.) will generate a strong local thermal effect under infrared laser irradiation, instantly converting light energy into heat energy, creating a local "hot spot" around the nanomaterial.
[0045] Enhanced catalysis: Temperature is a key factor affecting the rate of catalytic reactions. According to the Arrhenius equation, the reaction rate increases by approximately 2-4 times for every 10 K increase in temperature. The localized high temperatures generated by infrared light can greatly accelerate the peroxidase-like catalytic reaction of H₂O₂ decomposing TMB, thereby significantly amplifying the signal.
[0046] Lowering the detection limit: The signal is amplified, which means that smaller amounts of pesticide can be detected, greatly reducing the method's detection limit (LOD).
[0047] The signal readout method is as follows: Colorimetric method: The simplest and most direct method. Semi-quantitative or quantitative analysis can be performed by measuring the color change (absorbance value) of the solution with the naked eye or a portable colorimeter / UV-Vis spectrophotometer. It is ideal for rapid on-site detection.
[0048] Fluorescence method: If a substrate that can produce a fluorescent signal is used, the catalytic reaction will produce a fluorescent signal after infrared light enhancement, which can be detected by a fluorescence spectrometer with higher sensitivity.
[0049] Electrochemical method: Catalytic reactions may be accompanied by changes in current or potential, which can be detected by portable electrochemical workstations, making them suitable for field applications as well.
[0050] This embodiment utilizes gold nanoparticles or defective nanozymes (such as Fe3O4 / Mo / P) to enrich pesticide molecules, combined with infrared light to enhance the catalytic reaction. For example, the Fe3O4 / Mo / P nanozyme exhibits a detection limit as low as 0.039 mg / kg for glyphosate under infrared light, with high specificity (no interference from other pesticides). For samples with complex matrices such as coffee beans and tea leaves, the detection sensitivity can be increased by more than two times through synergistic enhancement technology using nanomaterials, making it suitable for trace residue detection.
[0051] In some embodiments, obtaining the preset spectrum of each sample agricultural product using preset spectral techniques may include: obtaining the sample Raman spectrum of each sample agricultural product using Raman spectroscopy; obtaining the sample fluorescence spectrum of each sample agricultural product using fluorescence spectroscopy; and finally determining the multi-dimensional spectral information of each sample agricultural product based on the sample Raman spectrum, the sample fluorescence spectrum, and the sample infrared spectrum corresponding to each sample agricultural product.
[0052] In some embodiments, such as Figure 3 As shown, the method of obtaining the preset spectrum of each sample agricultural product using preset spectral technology includes: S10151: Use three-dimensional spectral imaging technology to obtain the internal spectrum of each sample agricultural product and construct a sample cube spectrum; S10153: Raman spectroscopy was used to obtain the sample Raman spectra of each agricultural product. S10155: Obtain the sample fluorescence spectrum of each agricultural product using fluorescence spectroscopy technology; S10157: The sample cube spectrum, the sample Raman spectrum, and the sample fluorescence spectrum corresponding to each sample agricultural product are determined as the sample preset spectrum for each sample agricultural product.
[0053] In the embodiments of this specification, 3D imaging analysis can be used to analyze the distribution of spectra within a sample. For example, a team from XX University used hyperspectral imaging technology to construct a spectral cube to achieve spatial localization of pesticide residues, with a detection limit as low as 0.01 mg / kg. This can analyze the penetration pathway of pesticides within fruits and vegetables, avoiding blind spots in surface detection, and is suitable for samples such as bananas and durians that are prone to internal contamination. Simultaneously, the sample cube spectrum, the sample Raman spectrum, and the sample fluorescence spectrum can be combined to determine the preset spectrum for each agricultural product sample, thereby obtaining multiple categories of spectra. This embodiment directly processes the raw spectral data through transfer learning and combines it with 3D imaging technology, solving the problem of traditional methods relying on cumbersome steps such as crushing and extraction, and achieving non-destructive testing and internal pesticide distribution analysis.
[0054] In some embodiments, the step of employing at least two spectroscopic techniques to obtain multi-dimensional spectral information of each sample agricultural product in the sample agricultural product set includes: Acquire the initial multidimensional spectra of each sample agricultural product collected by at least two spectroscopic techniques, as well as the real-time environmental data corresponding to the spectral acquisition environment of the sample agricultural product; The initial sample multidimensional spectrum is corrected based on the real-time environmental data to obtain the sample multidimensional spectral information of each agricultural product.
[0055] In the embodiments described in this specification, real-time environmental data may include, but is not limited to, temperature data and humidity data collected by temperature and humidity sensors. The temperature and humidity sensors are linked with an AI model to dynamically adjust the spectral data. For example, a Fourier transform infrared spectrometer uses AI to correct the environmental background in real time, reducing the error rate to <5%.
[0056] This solution adapts to complex environments such as fields and warehouses, ensuring that test results are unaffected by external conditions. The initial sample's multidimensional spectrum is then calibrated based on real-time environmental data, and AI algorithms can automatically compensate for instrument drift. For example, the hydrogel SERS substrate, through an ethanol-water replacement technique, ensures uniform distribution of silver nanoparticles, resulting in a signal repeatability RSD of <10% and stability under various environments. This reduces the frequency of manual calibration, extends equipment lifespan, and is suitable for long-term monitoring scenarios.
[0057] For example, this embodiment can train a spectral correction model using an AI algorithm. Specifically, it collects training environment data of the training agricultural products and real-time detected multi-dimensional spectra of the training products. The training agricultural products are labeled with corrected multi-dimensional spectral tags. The training environment data and the training multi-dimensional spectra are input into the machine learning model, and the training multi-dimensional spectra are corrected based on the training environment data to obtain the corrected spectral results. Finally, based on the difference between the corrected spectral results and the corrected multi-dimensional spectral tags, the machine learning model is trained to obtain the spectral correction model. In application, the real-time environmental data of each sample agricultural product and the initial sample multi-dimensional spectra can be input into the spectral correction model for correction to obtain the sample multi-dimensional spectral information of each sample agricultural product. This embodiment solves the detection error problem caused by temperature and humidity fluctuations and instrument drift by dynamically correcting spectral data through real-time environmental monitoring and combining it with intelligent equipment calibration, achieving stable and reliable detection results.
[0058] In some embodiments, such as Figure 4 As shown, the preprocessing of the multi-dimensional spectral information of each sample agricultural product to obtain a preprocessed sample spectral set includes: S1031: Determine the reference spectrum for element scattering correction based on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set; S1033: Based on the reference spectrum, the multi-dimensional spectral information of the multiple samples is corrected using the meta-scattering correction algorithm to obtain a set of corrected sample spectra; S1035: Cross-validate the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set to determine the derivative parameters of the digital filtering algorithm; the derivative parameters include at least one of the smoothing window size and the polynomial degree; S1037: The first derivative of the sample calibration spectrum set is processed using the derivative parameter to obtain the preprocessed sample spectrum set.
[0059] In the embodiments of this specification, AI algorithms (such as Savitzky-Golay smoothing and first derivative) automatically eliminate noise and enhance low-concentration signals. For example, in glyphosate detection, the AI model reduces the error rate to less than 8% through a combination of "first derivative + MSC" preprocessing. Based on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set, a reference spectrum for multiple scattering correction is determined. For a multi-dimensional sample spectral set, the sample spectral set for each dimension (each spectrum) of the sample agricultural product set can be determined sequentially according to each spectral technique, and then the reference spectrum corresponding to each spectral technique can be determined; specifically, the average value of each sample spectral set can be calculated as the reference spectrum for that set; then, the sample spectral set corresponding to each spectrum can be corrected according to the multiple scattering correction algorithm (MSC) and the reference spectrum corresponding to each spectrum; thus, the corrected spectral set corresponding to each spectrum is obtained, resulting in the sample corrected spectral set. Then, cross-validation is performed on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set to determine the derivative parameters of the digital filtering algorithm. The derivative parameters include at least one of the smoothing window size and the polynomial degree. The digital filtering algorithm can be Savitzky-Golay (SG), a commonly used digital filtering algorithm for smoothing and differentiating signals. After processing with "first derivative + MSC," baseline effects are effectively removed, and spectral features are more prominent. This significantly improves the performance of linear models (such as PLSR).
[0060] In the embodiments described in this specification, no chemical enrichment step is required, the detection time is shortened to less than 10 minutes, and the use of toxic reagents is avoided.
[0061] In some embodiments, inputting the preprocessed sample spectrum set into a preset model includes: The preprocessed sample spectral set is subjected to data augmentation processing to obtain a sample augmented spectral set; Based on the preprocessed sample spectral set and the enhanced sample spectral set, a sample training spectral set is constructed; Obtain the preset multi-dimensional spectral information of each preset agricultural product in the preset agricultural product set; each preset agricultural product is labeled with a preset pesticide category label; the number of agricultural products in the preset agricultural product set is greater than the number of agricultural products in the sample agricultural product set; The preset multi-dimensional spectral information of each preset agricultural product is input into the preset network to predict the pesticide category, and the preset pesticide category result is obtained. Based on the difference between the preset pesticide category results and the preset pesticide category labels, the preset network is trained to obtain an initial pesticide detection model, and the initial pesticide detection model is used as the preset model. Input the sample training spectrum set into the preset model.
[0062] In the embodiments of this specification, data augmentation processing can be performed on the preprocessed sample spectral set. Data augmentation refers to creating new and reasonable training samples on the basis of a limited dataset, thereby increasing the amount and diversity of data and preventing model overfitting.
[0063] Common spectral data enhancement techniques include: (1) Adding Noise Method: Add random Gaussian white noise to the original spectrum.
[0064] Objective: To simulate unavoidable random noise during instrument data acquisition and improve the model's anti-interference ability and robustness. Noise intensity needs to be controlled to avoid masking the true spectral characteristics.
[0065] (2) Shifting method: The entire spectrum is shifted slightly in the X-axis (wavelength / wavenumber) or Y-axis (intensity) direction.
[0066] Objective: Y-axis translation: simulates baseline shift. X-axis translation: simulates minor deviations in instrument wavelength calibration (use with caution, as it may alter the position of characteristic peaks).
[0067] Scaling methods: These methods amplify or reduce spectral intensity, either globally or locally. Purpose: To simulate signal intensity variations caused by differences in sample concentration, thickness, or measurement distance.
[0068] Stretching / Compressing Method: This method involves applying minute stretching or compression along the X-axis. Purpose: To simulate minute peak position shifts caused by instrumentation or measurement conditions. Extreme care must be taken when using this method to avoid disrupting the relative positional relationships between characteristic peaks.
[0069] Mixing Spectra method: weighted mixing of two sample spectra of different concentrations or one sample spectrum with background spectrum.
[0070] Objective: To simulate complex background interference and the coexistence of multiple substances in real samples. No data augmentation operation can change the essential category of the sample.
[0071] In the embodiments described in this specification, pre-trained models can be quickly adapted to new samples. For example, in durian maturity detection, transfer learning improves prediction accuracy from 50% to 91%. This reduces the need for labeling new samples, making it particularly suitable for detecting rare varieties or emerging pesticides. Transfer learning involves transferring a model or learned knowledge trained in one domain (source domain) to another related but data-scarce new domain (target domain), thereby improving the performance of the new domain model. This is extremely useful in spectral analysis because collecting large amounts of labeled spectral data (especially for specific pesticides or instruments) is costly, and other large datasets of other relevant data can be obtained.
[0072] Specifically, a sample training spectrum set is constructed based on the preprocessed sample spectrum set and the enhanced sample spectrum set; preset multi-dimensional spectral information of each preset agricultural product in the preset agricultural product set is obtained; then, the preset multi-dimensional spectral information of each preset agricultural product is input into a preset network for pesticide category prediction to obtain a preset pesticide category result; based on the difference between the preset pesticide category result and the preset pesticide category label, preset loss data is determined, and then the model parameters of the preset network are adjusted according to the preset loss data until the training termination condition is met to obtain an initial pesticide detection model; then, the initial pesticide detection model is transferred to the pesticide detection model training process of this embodiment; that is, further training is performed on the basis of the initial pesticide detection model to obtain a pesticide detection model.
[0073] This embodiment uses transfer learning to quickly adapt to new samples and combines data augmentation to simulate diverse spectra, solving the overfitting problem caused by differences in origin and variety in traditional models and improving cross-sample adaptability.
[0074] In this embodiment, transfer learning and data augmentation enable the AI model to directly process the raw spectrum, reducing preprocessing requirements. For example, the intelligent spectral sensor developed by the team at XX University can directly detect whole fruits and vegetables without complex preprocessing. Maintaining sample integrity, it is suitable for rapid screening of fresh agricultural products, reducing detection time to 1-2 seconds.
[0075] For example, generative adversarial networks (GANs) can be used to simulate spectral data from different origins and varieties. For instance, by generating spectral data using DCGAN and combining it with transfer learning, the model's prediction error rate on different instruments can be reduced to <5%, improving model robustness and avoiding misjudgments due to a single sample. This makes it suitable for detecting agricultural products from multiple origins worldwide.
[0076] In some embodiments, each sample agricultural product is labeled with at least two sample pesticide category tags, and the sample pesticide category results are at least two; the step of training the preset model based on the difference between the sample pesticide category results and the sample pesticide category tags to obtain a pesticide detection model includes: Each pesticide category result of the sample is compared with the pesticide category labels of at least two samples in turn to obtain the comparison results; Based on the comparison results, the target loss data is determined; The model parameters of the preset model are adjusted according to the target loss data until the training termination condition is met, and the model at the end of training is determined as the pesticide detection model.
[0077] In the embodiments of this specification, the preset model can be set as a multi-task model, that is, at least two pesticide category labels can be labeled for each sample agricultural product, so that the trained model can predict multiple pesticide categories at once; correspondingly, the pesticide content corresponding to each sample pesticide category can also be set. Then, the result of each sample pesticide category is compared with the at least two sample pesticide category labels to obtain the comparison result; based on the comparison result, the target loss data is determined; finally, the model parameters of the preset model are adjusted according to the target loss data until the training termination condition is met, and the model at the end of training is determined as the pesticide detection model. For example, the training termination condition can be determined based on at least one of the target loss data and the number of training iterations.
[0078] In the embodiments described in this specification, the trained model simultaneously identifies the spectral characteristics of multiple pesticides. For example, the USDA's AI system can simultaneously detect 12 pesticides in grapes with an error rate of <8%. It can detect multiple pesticides at once, reducing sample consumption and making it suitable for large-scale sampling.
[0079] In some embodiments, AI models can be embedded in portable devices (such as Fourier transform infrared spectrometers) to achieve "on-site detection + real-time analysis." For example, screening for organophosphate pesticides in vegetables can be completed within 10 minutes. No laboratory environment is required, making it suitable for field, market, and other scenarios, with response time reduced to the minute level.
[0080] This embodiment uses a multi-task learning training model to simultaneously identify multiple pesticide characteristics and combines edge computing to achieve real-time analysis, solving the problem of low efficiency in batch detection using traditional methods and realizing rapid screening of multiple residues.
[0081] This specification also provides a pesticide detection method, such as... Figure 5 As shown, the method includes: S501: Acquire multi-dimensional spectral information of the agricultural product to be tested by at least two spectral techniques; S503: Input the multi-dimensional spectral information into the pesticide detection model for pesticide category prediction processing to obtain the pesticide category identification result of the agricultural product to be tested; the pesticide detection model is trained using the above method.
[0082] The at least two spectroscopic techniques used in this embodiment may include, but are not limited to, Raman and fluorescence spectroscopic techniques. The pesticide category identification result predicted by the pesticide detection model may include one pesticide category or multiple pesticide categories; it can also predict the pesticide content corresponding to each pesticide category while predicting the pesticide category; thus, it achieves intelligent and accurate detection of pesticide categories and pesticide content in agricultural products.
[0083] This specification also provides a training device for a pesticide detection model, such as... Figure 6 As shown, the device includes: The sample multidimensional spectral acquisition module 610 is used to acquire the multidimensional spectral information of each sample agricultural product in the sample agricultural product set using at least two spectral techniques; the sample agricultural product set includes sample agricultural products of various product categories and containing various pesticides; each sample agricultural product is labeled with a sample pesticide category label; The sample preprocessing module 620 is used to preprocess the multi-dimensional spectral information of each sample agricultural product to obtain a preprocessed sample spectrum set. The sample pesticide category prediction module 630 is used to input the preprocessed sample spectrum set into a preset model, extract the sample pesticide feature bands corresponding to each spectrum, and obtain the sample pesticide category result for each sample agricultural product based on the sample pesticide feature bands. The model training module 640 is used to train the preset model based on the difference between the sample pesticide category results and the sample pesticide category labels to obtain a pesticide detection model.
[0084] In some embodiments, the sample preprocessing module includes: The reference spectrum determination unit is used to determine the reference spectrum for element scattering correction based on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set. The spectral correction unit is used to correct the multi-dimensional spectral information of the multiple samples according to the reference spectrum using a meta-scattering correction algorithm to obtain a set of corrected sample spectra. The derivative parameter determination unit is used to perform cross-validation on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set to determine the derivative parameters of the digital filtering algorithm; the derivative parameters include at least one of the smoothing window size and the polynomial degree; The sample set processing unit is used to perform first-order derivative processing on the sample calibration spectrum set using the derivative parameter to obtain the preprocessed sample spectrum set.
[0085] In some embodiments, the sample pesticide category prediction module includes: The sample enhancement unit is used to perform data enhancement processing on the preprocessed sample spectral set to obtain a sample enhanced spectral set. The training spectrum construction unit is used to construct a sample training spectrum set based on the preprocessed sample spectrum set and the sample enhanced spectrum set. A preset spectrum acquisition unit is used to acquire preset multi-dimensional spectral information of each preset agricultural product in a preset agricultural product set; each preset agricultural product is labeled with a preset pesticide category label; the number of agricultural products in the preset agricultural product set is greater than the number of agricultural products in the sample agricultural product set; The preset pesticide prediction unit is used to input the preset multi-dimensional spectral information of each preset agricultural product into the preset network to predict the pesticide category and obtain the preset pesticide category result. A preset model training unit is used to train the preset network based on the difference between the preset pesticide category results and the preset pesticide category labels to obtain an initial pesticide detection model, and to use the initial pesticide detection model as the preset model. The model input unit is used to input the sample training spectrum set into the preset model.
[0086] In some embodiments, the sample multidimensional spectral acquisition module includes: An enrichment material acquisition unit is used to acquire sample extracts of each sample agricultural product and add nanomaterials to the sample extracts to obtain nanomaterials enriched with pesticides. The sample infrared detection unit is used to detect the sample infrared spectrum of the pesticide-enriched nanomaterial using infrared photo-enhanced catalysis technology; The sample preset spectrum acquisition unit is used to acquire the sample preset spectrum of each agricultural product sample using preset spectrum technology; The sample multidimensional spectral determination unit is used to determine the sample multidimensional spectral information of each sample agricultural product based on the sample infrared spectrum corresponding to each sample agricultural product and the sample preset spectrum.
[0087] In some embodiments, the sample preset spectrum acquisition unit is further configured to acquire the internal spectrum of each sample agricultural product using three-dimensional spectral imaging technology and construct a sample cube spectrum; acquire the sample Raman spectrum of each sample agricultural product using Raman spectroscopy technology; acquire the sample fluorescence spectrum of each sample agricultural product using fluorescence spectroscopy technology; and determine the sample cube spectrum, the sample Raman spectrum, and the sample fluorescence spectrum corresponding to each sample agricultural product as the sample preset spectrum for each sample agricultural product.
[0088] In some embodiments, the sample multidimensional spectral acquisition module includes: An environmental data acquisition unit is used to acquire the initial multidimensional spectrum of each sample agricultural product collected by at least two spectral techniques, as well as the real-time environmental data corresponding to the spectral acquisition environment of the sample agricultural product. The sample multidimensional spectral correction unit is used to correct the initial sample multidimensional spectrum based on the real-time environmental data to obtain the sample multidimensional spectral information of each sample agricultural product.
[0089] In some embodiments, each sample agricultural product is labeled with at least two sample pesticide category tags, and the sample pesticide category result is at least two; the model training module includes: The comparison unit is used to sequentially compare each of the pesticide category results of the sample with the pesticide category labels of the at least two samples to obtain the comparison results; The target loss determination unit is used to determine the target loss data based on the comparison results. The model training unit is used to adjust the model parameters of the preset model according to the target loss data until the training termination condition is met, and to determine the model at the end of training as the pesticide detection model.
[0090] This specification also provides an embodiment of a pesticide detection device, such as... Figure 7 As shown, the device includes: The test spectrum acquisition module 710 is used to acquire multi-dimensional spectral information of the test agricultural product collected by at least two spectral technologies; The result prediction module 720 is used to input the multi-dimensional spectral information into the pesticide detection model for pesticide category prediction processing to obtain the pesticide category identification result of the agricultural product to be tested; the pesticide detection model is trained using the above method.
[0091] The apparatus and method embodiments described herein are based on the same inventive concept.
[0092] This specification provides an electronic device including a processor and a memory. The memory stores at least one instruction or at least one program, which is loaded and executed by the processor to implement the training method for the pesticide detection model provided in the above method embodiments.
[0093] Embodiments of this application also provide a computer storage medium, which can be disposed in a terminal to store at least one instruction or at least one program related to implementing a training method for a pesticide detection model in the method embodiment. The at least one instruction or at least one program is loaded and executed by the processor to implement the training method for the pesticide detection model provided in the above method embodiment.
[0094] Embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the training method for the pesticide detection model provided in the above-described method embodiments.
[0095] Optionally, in the embodiments of this specification, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0096] The memory described in the embodiments of this specification can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for the functions, etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory.
[0097] The pesticide detection model training method embodiments provided in this specification can be executed on mobile terminals, computer terminals, servers, or similar computing devices. Taking running on a server as an example, Figure 8This is a hardware structure block diagram of a server for a pesticide detection model training method provided in the embodiments of this specification. For example... Figure 8 As shown, the server 800 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 810 (CPUs 810 may include, but are not limited to, microprocessors (MCUs) or programmable logic devices (FPGAs), a memory 830 for storing data, and one or more storage media 820 (e.g., one or more mass storage devices) for storing application programs 823 or data 822. The memory 830 and storage media 820 may be temporary or persistent storage. The program stored in the storage media 820 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 810 may be configured to communicate with the storage media 820 and execute the series of instruction operations stored in the storage media 820 on the server 800. Server 800 may also include one or more power supplies 860, one or more wired or wireless network interfaces 850, one or more input / output interfaces 840, and / or one or more operating systems 821, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0098] The input / output interface 840 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 800. In one example, the input / output interface 840 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 840 may be a radio frequency (RF) module used for wireless communication with the Internet.
[0099] Those skilled in the art will understand that Figure 8 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 800 may also include... Figure 8 The more or fewer components shown, or having the same Figure 8 The different configurations shown.
[0100] As can be seen from the embodiments of the pesticide detection model training method, apparatus, equipment, or storage medium provided in this application, this application employs at least two spectroscopic techniques to obtain multi-dimensional spectral information of each sample agricultural product in a sample agricultural product set. The sample agricultural product set includes multiple product categories and sample agricultural products containing multiple pesticides. Each sample agricultural product is labeled with a pesticide category tag. Thus, by using multiple spectroscopic techniques, multi-dimensional spectral information of each sample agricultural product is obtained, enriching the spectral information of the sample agricultural products. Then, the multi-dimensional spectral information of each sample agricultural product is preprocessed to obtain a preprocessed sample spectrum set. The preprocessed sample spectrum set is then input into a preset model to extract the pesticide feature bands corresponding to each spectrum. This allows for accurate identification of pesticide feature bands through the model, effectively avoiding overlap between chlorophyll, cellulose, water, and other components in agricultural products and pesticide spectral signals. The pesticide category result for each sample agricultural product is obtained based on the pesticide feature bands. Finally, based on the difference between the pesticide category result and the pesticide category tag, the preset model is trained to obtain a pesticide detection model. The resulting pesticide detection model can accurately and comprehensively detect pesticide residues in agricultural products, and can intelligently detect pesticides in agricultural products, thus improving the detection efficiency of pesticide categories in agricultural products.
[0101] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, specific embodiments of this specification have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0102] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0103] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer storage medium, such as a read-only memory, a disk, or an optical disk.
[0104] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A training method for a pesticide detection model, characterized in that, The method includes: At least two spectroscopic techniques are used to obtain multi-dimensional spectral information of each sample agricultural product in the sample agricultural product set; the sample agricultural product set includes sample agricultural products of various product categories and containing various pesticides; each sample agricultural product is labeled with a sample pesticide category label; The multi-dimensional spectral information of each sample agricultural product is preprocessed to obtain a preprocessed sample spectrum set; The preprocessed sample spectrum set is input into a preset model to extract the sample pesticide feature bands corresponding to each spectrum, and the sample pesticide category result of each sample agricultural product is obtained based on the sample pesticide feature bands; Based on the difference between the sample pesticide category results and the sample pesticide category labels, the preset model is trained to obtain a pesticide detection model.
2. The method according to claim 1, characterized in that, The preprocessing of the multi-dimensional spectral information of each sample agricultural product yields a preprocessed sample spectral set, including: Based on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set, a reference spectrum for element scattering correction is determined; Based on the reference spectrum, the multi-dimensional spectral information of the multiple samples is corrected using a meta-scattering correction algorithm to obtain a set of corrected sample spectra; Cross-validation is performed on the multi-dimensional spectral information of multiple samples corresponding to the sample agricultural product set to determine the derivative parameters of the digital filtering algorithm; the derivative parameters include at least one of the smoothing window size and the polynomial degree; The first derivative of the sample spectral set is processed using the derivative parameter to obtain the preprocessed sample spectral set.
3. The method according to claim 1, characterized in that, The step of inputting the preprocessed sample spectrum set into a preset model includes: The preprocessed sample spectral set is subjected to data augmentation processing to obtain a sample augmented spectral set; Based on the preprocessed sample spectral set and the enhanced sample spectral set, a sample training spectral set is constructed; Obtain the preset multi-dimensional spectral information of each preset agricultural product in the preset agricultural product set; each preset agricultural product is labeled with a preset pesticide category label; the number of agricultural products in the preset agricultural product set is greater than the number of agricultural products in the sample agricultural product set; The preset multi-dimensional spectral information of each preset agricultural product is input into the preset network to predict the pesticide category, and the preset pesticide category result is obtained. Based on the difference between the preset pesticide category results and the preset pesticide category labels, the preset network is trained to obtain an initial pesticide detection model, and the initial pesticide detection model is used as the preset model. Input the sample training spectrum set into the preset model.
4. The method according to claim 1, characterized in that, The method employs at least two spectroscopic techniques to obtain multi-dimensional spectral information of each sample agricultural product in the sample agricultural product set, including: Obtain a sample extract of each agricultural product sample, and add nanomaterials to the sample extract to obtain nanomaterials enriched with pesticides; The infrared spectrum of the pesticide-enriched nanomaterial sample was detected using infrared photoenhanced catalysis technology. Preset spectra of each agricultural product sample were obtained using preset spectral technology; Based on the infrared spectrum of each sample agricultural product and the preset spectrum of the sample, the multi-dimensional spectral information of each sample agricultural product is determined.
5. The method according to claim 4, characterized in that, The method of obtaining the preset spectrum of each sample agricultural product using preset spectral technology includes: Three-dimensional spectral imaging technology was used to obtain the internal spectrum of each sample agricultural product, and a sample cube spectrum was constructed. Raman spectroscopy was used to obtain the sample Raman spectra of each agricultural product. Fluorescence spectroscopy was used to obtain the fluorescence spectra of each agricultural product sample; The sample cube spectrum, sample Raman spectrum, and sample fluorescence spectrum corresponding to each sample agricultural product are determined as the preset spectrum for each sample agricultural product.
6. The method according to claim 1, characterized in that, The method employs at least two spectroscopic techniques to obtain multi-dimensional spectral information of each sample agricultural product in the sample agricultural product set, including: Acquire the initial multidimensional spectra of each sample agricultural product collected by at least two spectroscopic techniques, as well as the real-time environmental data corresponding to the spectral acquisition environment of the sample agricultural product; The initial sample multidimensional spectrum is corrected based on the real-time environmental data to obtain the sample multidimensional spectral information of each agricultural product.
7. The method according to any one of claims 1-6, characterized in that, Each sample agricultural product is labeled with at least two pesticide category tags, and the pesticide category results are at least two; the process of training the preset model based on the difference between the pesticide category results and the pesticide category tags to obtain a pesticide detection model includes: Each pesticide category result of the sample is compared with the pesticide category labels of at least two samples in turn to obtain the comparison results; Based on the comparison results, the target loss data is determined; The model parameters of the preset model are adjusted according to the target loss data until the training termination condition is met, and the model at the end of training is determined as the pesticide detection model.
8. A method for detecting pesticides, characterized in that, The method includes: Acquire multi-dimensional spectral information of the agricultural product to be tested by at least two spectral techniques; The multi-dimensional spectral information is input into the pesticide detection model for pesticide category prediction processing to obtain the pesticide category identification result of the agricultural product to be tested; the pesticide detection model is trained using the method described in any one of claims 1-7.
9. A training device for a pesticide detection model, characterized in that, The device includes: The sample multidimensional spectral acquisition module is used to acquire the multidimensional spectral information of each sample agricultural product in the sample agricultural product set using at least two spectral techniques; the sample agricultural product set includes sample agricultural products of various product categories and containing various pesticides; each sample agricultural product is labeled with a sample pesticide category label; The sample preprocessing module is used to preprocess the multi-dimensional spectral information of each sample agricultural product to obtain a preprocessed sample spectrum set. The sample pesticide category prediction module is used to input the preprocessed sample spectrum set into a preset model, extract the sample pesticide feature bands corresponding to each spectrum, and obtain the sample pesticide category result for each sample agricultural product based on the sample pesticide feature bands. The model training module is used to train the preset model based on the difference between the sample pesticide category results and the sample pesticide category labels, so as to obtain a pesticide detection model.
10. A computer storage medium, characterized in that, The computer storage medium stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the training method of the pesticide detection model as described in any one of claims 1-7 or the pesticide detection method as described in claim 8.