Method for detecting pesticide residues on surfaces of fruits and vegetables
By collecting multi-spectral data of pesticides on the surface of fruit and vegetable samples, expanding the data set and establishing an LSSVM model, the problems of harsh detection environment, high cost and poor real-time performance in the existing pesticide detection methods are solved, and high accuracy and high real-time detection of pesticide residues are achieved.
Patent Information
- Application Number
- CN202411799112.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-28
AI Technical Summary
The existing pesticide detection methods have problems such as harsh detection environment, high cost and poor real-time performance, and it is difficult to quickly and accurately identify the pesticide components and concentrations on the surface of fruits and vegetables.
By collecting pesticide multispectral data on the surface of fruit and vegetable samples, using linear functions to expand mixed pesticide data sets with different concentrations and compositions, establishing a least squares support vector machine (LSSVM) model, comparing the simulated data with the actual data to adjust the model parameters, and finally realizing spectral demix and component recognition of mixed pesticides to be tested.
It realizes high real-time and accuracy of pesticide residue detection on the surface of fruits and vegetables, and solves problems such as poor accuracy and harsh detection environment in the existing technology.
Smart Images

Figure CN119715416A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crop pesticide detection, and in particular to a method for detecting pesticide residues on the surface of fruits and vegetables. Background Art
[0002] At present, the problem of pesticide residues in fruit and vegetable agricultural products has attracted widespread attention, and a variety of pesticide detection methods have been developed. Existing pesticide detection methods include gas chromatography, enzyme inhibition method and spectral detection method. Among them, gas chromatography requires pretreatment of samples to remove interference from impurities, such as extraction and purification. The whole process has many steps, takes a long time, and the detection instrument is expensive; the enzyme inhibition method needs to use the inhibitory effect of organophosphorus and carbamate pesticides on acetylcholinesterase to detect pesticide residues, but it can only detect these two types of pesticides. For other types of pesticides, such as pyrethroids and fungicides, it cannot be detected. Therefore, the existing pesticide detection methods have problems such as harsh detection environment, high cost, and poor real-time performance. Summary of the invention
[0003] The present invention aims to overcome the problem that the prior art cannot quickly and accurately identify the composition and concentration of residual pesticides, and provides a method for detecting pesticide residues on the surface of fruits and vegetables.
[0004] To achieve the above object, the technical solution of the present invention is: to provide a method for detecting pesticide residues on the surface of fruits and vegetables, comprising: Step S1: taking fruit and vegetable samples containing mixed pesticides of known concentration and composition, using an instrument to collect multispectral data of the mixed pesticides, and changing the type and concentration of each single pesticide in the mixed pesticides to obtain multispectral data of different mixed pesticides and multispectral data of each single pesticide, which are used as standard multispectral data; Step S2: linearly combine the collected multispectral data of a single pesticide using a linear superposition method to generate simulated multispectral data of mixed pesticides with different concentrations and compositions, so as to expand the scale of the data set; Step S3: preprocessing the multispectral data in step S1 and step S2, and using the preprocessed multispectral data as a data set; Step S4: Establish a spectral unmixing model, input the data set into the spectral unmixing model, and calculate various parameters in the spectral unmixing model; Step S5: After the multispectral data of the mixed pesticide to be tested is input into the spectral unmixing model, the end-member multispectral data obtained by unmixing is compared with the standard multispectral data to determine the composition and content of the mixed pesticide in the fruit and vegetable sample to be tested.
[0005] In one embodiment, in step S2, the expression of linear superposition is: In the formula, For multispectral data of a single pesticide, is the abundance of each pesticide, Multispectral data of simulated pesticide mixtures.
[0006] In one embodiment, in step S4, the spectral unmixing model is a least squares support vector machine model, and the objective function is expressed as: In the formula, is a linear function, is the weight vector, is the bias vector.
[0007] In one embodiment, the spectral unmixing model in step S4 uses the structural risk minimization principle to determine the parameter vector of the objective function and , the structural risk expression is: In the formula, is the penalty coefficient, is the loss function, The error in learning predictions for the vector.
[0008] In one embodiment, the constraint condition is added in step S4: And introduce the Lagrange multiplier To construct the Lagrangian function: At the same time, the Lagrangian functions are summarized Find the partial derivative so that it is equal to 0 and obtain the condition for the optimal solution: Solve the corresponding linear equation: In the formula, for The unit matrix, , , ; is the kernel function matrix, whose elements for: The formula of the kernel function is: In the formula, is the kernel parameter; The final decision function is: In one embodiment, in step S5, the end member multispectral data and the standard multispectral data are normalized, compared and the confidence is calculated, and the calculation formula of the confidence is: In the formula, is the confidence level, is the number of equally distributed sampling points on the multispectral data, For the The difference between two multispectral data of sampling points.
[0009] In one embodiment, in step S3, the multispectral data is subjected to mean whitening processing, and the formula is: In the formula, is the initial multi-spectral data, mean represents the intensity mean of the multi-spectral data, for After averaging, the data is the preprocessed data vector, is the whitening matrix, The covariance matrix of is decomposed by singular value orthogonalization to obtain and the diagonal matrix of the characteristic values .
[0010] In one embodiment, in step S1, background information is deducted from the multispectral data of the single pesticide or the mixed pesticide, and the calculation formula is: In the formula, is the multispectral data of the single pesticide or the mixed pesticide, is the multispectral data of the single pesticide or the mixed pesticide originally collected, is the multispectral data of the fruit and vegetable samples, is the system noise.
[0011] In summary, the present invention provides a method for detecting pesticide residues on the surface of fruits and vegetables, by collecting multi-spectral data of pesticide residues on the surface of fruit and vegetable samples, using linear functions to expand mixed pesticide data sets with different concentrations and compositions, and establishing a machine learning model while comparing simulated data with actual data to adjust the parameters of the model, and finally achieving spectral unmixing of the mixed pesticide to be tested and component identification. The present invention can provide a method with high real-time and accuracy for the detection of mixed pesticides, solving the problems of poor accuracy and harsh detection environment in existing pesticide detection.
[0012] In order to make the above features and advantages of the invention more obvious and easy to understand, embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 The present invention provides a flow chart of the method for detecting pesticide residues on the surface of fruits and vegetables. DETAILED DESCRIPTION
[0014] In order to make the purpose and technical solution of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0015] like Figure 1 As shown, the present invention provides a method for detecting pesticide residues on the surface of fruits and vegetables, comprising the following steps: Step S1: Take fruit and vegetable samples containing mixed pesticides of known concentration and composition, use an instrument to collect multispectral data of the mixed pesticides, and change the type and concentration of each single pesticide in the mixed pesticides to obtain multispectral data of different mixed pesticides and multispectral data of each single pesticide, which are used as standard multispectral data.
[0016] Randomly select points to measure the spectra of fruit and vegetable samples with different compositions and concentrations of pesticide residues. Multiple measurements are performed on any selected point to obtain n-dimensional multispectral data sets of different types and concentration combinations. . The instrument for spectral measurement can be a multi-spectral imager, and irradiated with a wide-spectrum light source. The selected pesticides can be omethoate, acetamiprid, and high-efficiency cypermethrin, etc. The concentration range is set to 5% (v / v)-95% (v / v), and the gradient interval is 5% (v / v). Any concentration corresponds to different types of pesticides. The measured multi-spectral data includes a single multi-spectral curve of a single pesticide and a mixed multi-spectral curve of mixed pesticides.
[0017] The obtained multi-spectral data will use the spectral correction method to eliminate background interference, that is, to deduct the background information from the multi-spectral data of pesticides. The background information mainly includes the system noise and the spectral information of the fruit peel itself. The calculation formula for spectral correction is: In the formula, Multispectral data for single pesticide or mixed pesticides, The original multispectral data of a single pesticide or mixed pesticides are collected. is the multispectral data of fruit and vegetable samples, is the system noise.
[0018] Step S2: Linearly combine the collected multispectral data of a single pesticide using a linear superposition method to generate simulated multispectral data of mixed pesticides with different concentrations and compositions to expand the scale of the data set.
[0019] Since there is a linear relationship between the abundance and spectral data of pesticides, the multispectral data of mixed pesticides can be linearly superimposed by the multispectral data of multiple single pesticides. Therefore, the linear superposition method can be used to simulate the spectral data of single pesticides and generate simulated multispectral data of mixed pesticides. The expression of linear superposition is: In the formula, For multispectral data of a single pesticide, is the abundance of each pesticide, Multispectral data of simulated pesticide mixtures.
[0020] The multispectral data of each single pesticide actually measured are substituted into formula (2), multiplied by the corresponding abundance, and then linearly superimposed. A fitting curve is constructed, and then the multispectral data of more mixed pesticides are generated through the fitting curve, providing a rich data set for the subsequent spectral unmixing model.
[0021] Step S3: preprocessing the multispectral data in step S1 and step S2, and using the preprocessed multispectral data as a data set.
[0022] The multispectral data is processed by mean whitening, and the formula is: In the formula, is the initial multi-spectral data, mean represents the intensity mean of the multi-spectral data, for After averaging, the data is the preprocessed data vector, is the whitening matrix, The covariance matrix of is decomposed by singular value orthogonalization to obtain and the diagonal matrix of the characteristic values .
[0023] Mean whitening can remove redundant information from the data set, reduce the complexity of model learning, and maximize the non-Gaussianity of the separated single multispectral data without affecting the information entropy of the data set.
[0024] Step S4: Establish a spectral unmixing model, input the data set into the spectral unmixing model, and calculate various parameters in the spectral unmixing model. The spectral unmixing model uses the least squares support vector machine (LSSVM) model, and its objective function can be expressed as: In the formula, is a linear function, is the weight vector, is the bias vector.
[0025] Among them, the parameter vector of the objective function is determined by using the structural risk minimization principle. and , and its structural risk expression is: In the formula, is the penalty coefficient, is the loss function, The error in learning predictions for the vector.
[0026] And add constraints: And introduce the Lagrange multiplier To construct the Lagrangian function: At the same time, the Lagrangian functions are summarized Find the partial derivative so that it is equal to 0 and obtain the condition for the optimal solution: Solve the corresponding linear equation: In the formula, for The unit matrix, , , . is the kernel function matrix, whose elements for: The formula of the kernel function is: In the formula, is the kernel parameter.
[0027] The final decision function is: Since the LSSVM model training and generalization ability are determined by the penalty coefficient and kernel parameters Therefore, multiple simulations are needed to enrich the learning data set and continuously adjust the parameters to obtain an accurate classifier model.
[0028] Step S5: After the multispectral data of the mixed pesticide to be tested is input into the spectral unmixing model, the end-member multispectral data obtained by unmixing is compared with the standard multispectral data to determine the composition and content of the mixed pesticide in the fruit and vegetable sample to be tested.
[0029] Input the multispectral data and the number of end members of the mixed pesticide to be tested, obtain the multispectral data of each end member, normalize the end member multispectral data and the standard multispectral data, compare and calculate the confidence. The confidence calculation formula is: In the formula, is the confidence level, is the number of equally divided sampling points on the multi-spectral curve, For the The difference between two curves at sampling points.
[0030] The closer the confidence is to 1, the higher the similarity between the endmember multispectral data and the standard multispectral data. The one with the highest confidence is determined as the category of the endmember, thereby achieving the classification of the endmember components.
[0031] In summary, the present invention provides a method for detecting pesticide residues on the surface of fruits and vegetables, by collecting multi-spectral data of pesticide residues on the surface of fruit and vegetable samples, using linear functions to expand mixed pesticide data sets with different concentrations and compositions, and establishing a machine learning model while comparing simulated data with actual data to adjust the parameters of the model, and finally achieving spectral unmixing of the mixed pesticide to be tested and component identification. The method proposed by the present invention can effectively improve the real-time performance and accuracy of the mixed pesticide detection process, and solve the problems of poor accuracy and harsh detection environment in existing pesticide detection.
[0032] Although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Any person having ordinary knowledge in the technical field may make some changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be determined by the scope of the attached patent application.
Claims
1. A method for detecting pesticide residues on the surface of fruits and vegetables, characterized in that: include, Step S1: taking fruit and vegetable samples containing mixed pesticides of known concentration and composition, using an instrument to collect multispectral data of the mixed pesticides, and changing the type and concentration of each single pesticide in the mixed pesticides to obtain multispectral data of different mixed pesticides and multispectral data of each single pesticide, which are used as standard multispectral data; Step S2: linearly combine the collected multispectral data of a single pesticide using a linear superposition method to generate simulated multispectral data of mixed pesticides with different concentrations and compositions, so as to expand the scale of the data set; Step S3: preprocessing the multispectral data in step S1 and step S2, and using the preprocessed multispectral data as a data set; Step S4: Establish a spectral unmixing model, input the data set into the spectral unmixing model, and calculate various parameters in the spectral unmixing model; Step S5: After the multispectral data of the mixed pesticide to be tested is input into the spectral unmixing model, the end-member multispectral data obtained by unmixing is compared with the standard multispectral data to determine the composition and content of the mixed pesticide in the fruit and vegetable sample to be tested.
2. The method for detecting pesticide residues on the surface of fruits and vegetables as claimed in claim 1, characterized in that: In step S2, the expression of the linear superposition is: Where x1, x2, …, x m is the multispectral data of a single pesticide, b0, b1, …, b w is the abundance of each pesticide, Multispectral data of simulated pesticide mixtures.
3. The method for detecting pesticide residues on the surface of fruits and vegetables according to claim 1, characterized in that: In step S4, the spectral unmixing model is a least squares support vector machine model, and the objective function is expressed as: In the formula, is a linear function, q T is the weight vector and b is the bias vector.
4. The method for detecting pesticide residues on the surface of fruits and vegetables as claimed in claim 3, characterized in that: The spectral unmixing model in step S4 uses the structural risk minimization principle to determine the parameter vectors q and b of the objective function. The structural risk expression is: In the formula, C is the penalty coefficient, R emp is the loss function, ξ i The error in learning predictions for the vector.
5. The method for detecting pesticide residues on the surface of fruits and vegetables as claimed in claim 4, characterized in that: In step S4, a constraint condition is added: And introduce the Lagrange multiplier α i (i=1, 2, ..., l) to construct the Lagrangian function: At the same time, the partial derivatives of ξ, b, q, and λ summarized by the Lagrangian function are calculated to make their partial derivatives equal to 0, and the conditions for the optimal solution are obtained: Solve the corresponding linear equation: Where I is the l-order unit matrix, Q = [1, 1, ..., 1] t , α=[α1,α2,…,α n ] T , y=[y1,y2,…,y n ] T ; K is the kernel function matrix, whose element K ij for: The formula of the kernel function is: Where σ is the kernel parameter; The final decision function is:
6. The method for detecting pesticide residues on the surface of fruits and vegetables according to claim 1, characterized in that: In the step S5, the end member multispectral data and the standard multispectral data are normalized, compared and the confidence is calculated. The calculation formula of the confidence is: In the formula, ρ is the confidence level, n is the number of sampling points evenly distributed on the multispectral data, and d i is the difference between the two multispectral data of the i-th sampling point.
7. The method for detecting pesticide residues on the surface of fruits and vegetables according to claim 1, characterized in that: In step S3, the multispectral data is subjected to mean whitening processing, and the formula is: S′=S-mean(S) (4) In the formula, S is the initial multi-spectral data, mean represents the intensity mean of the multi-spectral data, and S′ is the data after S averaging. is the preprocessed data vector, Q is the whitening matrix, and the covariance matrix of S′ is decomposed by singular value orthogonalization to obtain E and the eigenvalue diagonal matrix D.
8. The method for detecting pesticide residues on the surface of fruits and vegetables according to claim 1, characterized in that: In step S1, background information is deducted from the multispectral data of the single pesticide or the mixed pesticide, and the calculation formula is: x i =x i ′-s-n (1) In the formula, x i is the multispectral data of the single pesticide or the mixed pesticide, x′ i is the originally collected multispectral data of the single pesticide or the mixed pesticide, s is the multispectral data of the fruit and vegetable sample, and n is the system noise.
Citation Information
Cited By
Pesticide residue detection method and system based on big data
CN119862795A