A crop pesticide residue detection method and system based on a convolutional neural network

By combining convolutional neural networks and hyperspectral technology, the problems of high cost and low efficiency in pesticide residue detection of crops have been solved, achieving low-cost and high-efficiency pesticide residue detection with non-destructive and automated features.

CN116884512BActive Publication Date: 2026-02-24WUHAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310672849.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-07
Publication Date
2026-02-24
Estimated Expiration
2043-06-07

AI Technical Summary

Technical Problem

Existing methods for detecting pesticide residues in crops are costly, inefficient, and may damage the samples.

Method used

A method for detecting pesticide residues in crops based on convolutional neural networks and hyperspectral technology is adopted. Hyperspectral images are acquired, preprocessed, and then input into a convolutional neural network for pesticide residue detection. The method combines a multi-scale attention module, a residual module, and a random forest classifier to detect pesticide residues.

Benefits of technology

It achieves low-cost and high-efficiency pesticide residue detection, and features non-destructive and automated characteristics, improving the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116884512B_ABST
    Figure CN116884512B_ABST
Patent Text Reader

Abstract

The application discloses a crop pesticide residue detection method and system based on a convolutional neural network, first, a hyperspectral image of a crop sample is collected, and data preprocessing is performed; then, the preprocessed hyperspectral image is input into a pesticide residue detection convolutional neural network for pesticide residue detection; the application combines a hyperspectral imaging technology and a deep learning method, and has the advantages of non-damage, automation and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of pesticide residue detection technology, and relates to a method and system for detecting pesticide residues in crops. Specifically, it is a method and system for detecting pesticide residues in crops based on convolutional neural networks and hyperspectral imaging. Background Technology

[0002] Currently, the main methods for detecting pesticide residues in crops include liquid chromatography-mass spectrometry (Literature 1), gas chromatography-chromatography (Literature 2), and immunoassay (Literature 3). While these methods offer advantages such as high sensitivity and wide detection range, they are costly, complex, and time-consuming; some methods can even cause irreversible damage to the sample. Therefore, establishing a rapid, accurate, and non-destructive method for detecting pesticide residues in tea is of significant practical value.

[0003] [1]Jiang B,He J,Yang S,et al.Fusion of machine vision technology andAlexNet-CNNs deep learning network for the detection of postharvest applepesticide residues[J].Artificial Intelligence in Agriculture,2019,1:1-8.

[0004] [2]Sapahin HA, Makahleh A, Saad B. Determination of organophosphoruspesticide residues in vegetables using solid phase micro-extraction coupled with gas chromatography–flame photometric detector[J]. Arabian Journal of Chemistry, 2019, 12(8): 1934-1944.

[0005] [3]Tang X, Zhang Q, Zhang Z, et al. Rapid, on-site and quantitative paper-based immunoassay platform for concurrent determination of pesticide residues and mycotoxins[J]. Analytica Chimica Acta, 2019,1078:142-150. Summary of the Invention

[0006] To address the shortcomings of high cost and low efficiency in existing technologies for detecting pesticide residues in crops, this invention provides a method and system for detecting pesticide residues in crops based on convolutional neural networks and hyperspectral imaging, which can be applied to the detection of pesticide residues in tea.

[0007] The technical solution adopted by the method of the present invention is: a method for detecting pesticide residues in crops based on convolutional neural networks, comprising the following steps:

[0008] Step 1: Acquire hyperspectral images of crop samples and perform data preprocessing;

[0009] Step 2: Input the preprocessed hyperspectral image into the pesticide residue detection convolutional neural network for pesticide residue detection;

[0010] The pesticide residue detection convolutional neural network consists of two three-dimensional convolutional layers C0 and C5, two multi-scale attention modules, two residual modules, and a fully connected module. The multi-scale attention module includes three parallel three-dimensional convolutional layers C1, C2, and C3, followed by a cascaded three-dimensional convolutional layer C4 and a spatial-spectral attention module. Normalization layers and modified linear unit activation function layers are added after C0, C1, C2, C3, C4, and C5. The input to C0 is the preprocessed hyperspectral image X of the crop; the inputs to C1, C2, and C3 are the output feature maps of C0; the input to C4 is the combined output features of C1, C2, and C3; the input to the first residual module is the output feature map of C0, which is then combined with the output features of the first spatial-spectral attention module and input to C5; the output feature map of C5 is input to the second multi-scale attention module and the second residual module, and the combined output features are then input to the output feature map of the second residual module.

[0011] Preferably, in step 1, black and white correction is performed on the acquired hyperspectral image, and the mathematical formula is as follows:

[0012]

[0013] Where R1 represents the corrected hyperspectral image, R represents the original hyperspectral image, and W and B represent the whiteboard image and blackboard image, respectively;

[0014] Multiplicative scattering correction is performed on the corrected hyperspectral image R1 to reduce the noise in the extracted spectral data, resulting in a preprocessed hyperspectral image of the crop.

[0015] Preferably, the spatial spectral attention module of the pesticide residue detection convolutional neural network includes channel-dimensional attention and spatial-dimensional attention. The mathematical formula for channel-dimensional attention CA(F) is as follows:

[0016]

[0017] Where F is the input feature matrix, SN represents the shared network, AvgPool and MaxPool are global average pooling and global max pooling, respectively, W0 and W1 are weights, and represent sigmoid and modified linear unit activation functions, respectively, and represent channel descriptors generated by average pooling and max pooling, respectively.

[0018] The mathematical formula for spatial attention SA(F) is as follows:

[0019]

[0020] Where, represents a three-dimensional convolution operation with a kernel size of , and represent two different spatial feature descriptors generated by global average pooling and global maximum pooling, respectively;

[0021] The channel-dimensional attention CA(F) and spatial-dimensional attention SA(F) are respectively superimposed on the input feature map of the spatial-spectral attention module using matrix multiplication to obtain the refined channel-dimensional output feature map and spatial-dimensional output feature map. A residual module is then set up after the channel-dimensional and spatial-dimensional output feature maps to connect the high-level features corrected by the channel and spatial attention with the input feature residuals and perform a concatenation operation to finally obtain the jointly corrected output feature F1. The process can be mathematically represented as follows:

[0022] F1=[(F+F CA (F+F) SA )];

[0023] Where F represents the input features of the spatial spectral attention module;

[0024] Preferably, the pesticide residue detection convolutional neural network replaces the third fully connected layer with a Softmax classification function in the fully connected module with a random forest classifier, and the classification is performed by the random forest classifier, which is the CNN-RF model proposed in this invention, to alleviate the model overfitting problem.

[0025] Preferably, in step 2, the pesticide residue detection convolutional neural network is a trained pesticide residue detection convolutional neural network; its training process includes the following steps:

[0026] Step 2.1: Obtain several crop samples at different concentrations;

[0027] Step 2.2: Acquire hyperspectral images of crops at different concentrations and perform preprocessing operations;

[0028] Step 2.3: Divide the preprocessed hyperspectral images of crops into training and test sets according to a certain ratio;

[0029] Step 2.4: Train the convolutional neural network for pesticide residue detection using crop samples in the training set;

[0030] Step 2.5: Combine the trained pesticide residue detection convolutional neural network with a random forest classifier, and use the combined classification model to detect pesticide residues in crop samples in the test set.

[0031] Preferably, in step 2.1, pesticide solutions are prepared using distilled water in different proportions; pesticides of different concentrations are evenly sprayed onto the surface of crops, and crop samples are placed under experimental conditions to air dry for a preset time before data collection.

[0032] Preferably, in step 2.2, crop samples of equal weight are evenly spread on the platform of the hyperspectral image acquisition device; the hyperspectral image acquisition device is used to acquire original hyperspectral images of crop samples at different pesticide concentrations; the acquired original hyperspectral images of crop samples at different pesticide concentrations are then subjected to black and white correction, the mathematical formula of which is as follows:

[0033]

[0034] Where R1 represents the corrected hyperspectral image, R represents the original hyperspectral image, and W and B represent the whiteboard image and blackboard image, respectively;

[0035] Multiplicative scattering correction (MSC) is performed on the corrected hyperspectral image R1 to reduce the noise in the extracted spectral data, resulting in a preprocessed hyperspectral image of the crop.

[0036] Preferably, in step 2.3, competitive adaptive reweighted sampling is performed on the crop hyperspectral image data training set to extract feature spectral bands; the extracted feature spectral bands are then subjected to secondary dimensionality reduction using a continuous projection algorithm to further eliminate redundant data information, thereby obtaining the crop hyperspectral image to be trained.

[0037] Preferably, in step 2.4, the pesticide residue detection convolutional neural network is fully trained using an adaptive learning rate gradient descent algorithm and a preset number of iterations.

[0038] The technical solution adopted by the system of the present invention is: a crop pesticide residue detection system based on convolutional neural networks, comprising:

[0039] One or more processors;

[0040] A storage device for storing one or more programs, which, when executed by one or more processors, enable the one or more processors to implement the crop pesticide residue detection method based on convolutional neural networks.

[0041] Compared with existing technologies, this invention achieves low-cost and high-efficiency detection of pesticide residues in tea. Combining hyperspectral imaging technology and deep learning methods, this invention offers advantages such as non-destructive, automated, and efficient operation. First, due to the influence of sensor hardware and the imaging environment, hyperspectral images are easily affected by noise during acquisition, limiting data interpretation accuracy. Traditional single algorithms lack stability in feature extraction. Therefore, this invention employs multiplicative scattering correction to remove noise background during the preprocessing stage and uses a secondary dimensionality reduction method combining competitive adaptive reweighted sampling and continuous projection algorithms to retain key information, further removing redundant information from the hyperspectral image. Second, addressing the problem of poor model classification performance caused by using only a single receptive field in convolutional neural networks, this invention establishes a multi-scale attention module to extract multi-scale spatial-spectral features from hyperspectral images to increase information flow. It also introduces attention mechanisms in the spatial and channel dimensions to refine the feature map, reallocating feature weights to highlight features that positively impact model classification performance while suppressing unimportant features. Furthermore, to address the overfitting problem caused by the continuous deepening of the network structure under a limited sample size, this invention introduces a residual connection module to alleviate the gradient vanishing phenomenon. Moreover, to address the complex data structure of hyperspectral images and to simplify the computational complexity and shorten training time of deep convolutional neural networks, this invention introduces normalized BN layers, Dropout layers, and pooling layers, and uses ReLU as the activation function of the neural network. This prevents overfitting, reduces the number of training parameters, and enables the classification model to converge faster. Attached Figure Description

[0042] The technical solutions described herein are further illustrated below using examples and specific implementation methods. Additionally, accompanying drawings are used in the description of the technical solutions. Those skilled in the art can, without any creative effort, obtain other drawings and the intent of the present invention based on these drawings.

[0043] Figure 1 This is a flowchart of a method according to an embodiment of the present invention;

[0044] Figure 2 This is a diagram of the convolutional neural network structure for pesticide residue detection in an embodiment of the present invention.

[0045] Figure 3 The flowchart for training a convolutional neural network for pesticide residue detection is provided in an embodiment of the present invention. Detailed Implementation

[0046] To facilitate understanding and implementation of the present invention by those skilled in the art, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0047] This embodiment uses the detection of pesticide residues in tea as an example to further illustrate the present invention. Please see... Figure 1 This embodiment provides a method for detecting pesticide residues in tea based on convolutional neural networks, comprising the following steps:

[0048] Step 1: Acquire hyperspectral images of tea samples and perform data preprocessing;

[0049] In one implementation, black-and-white correction is performed on the acquired hyperspectral image, and the mathematical formula is as follows:

[0050]

[0051] Where R1 represents the corrected hyperspectral image, R represents the original hyperspectral image, and W and B represent the whiteboard image and blackboard image, respectively;

[0052] Multiplicative scattering correction (MSC) is performed on the corrected hyperspectral image R1 to reduce the noise in the extracted spectral data, resulting in a preprocessed hyperspectral image of tea leaves.

[0053] Step 2: Input the preprocessed hyperspectral image into the pesticide residue detection convolutional neural network for pesticide residue detection;

[0054] Please see Figure 2The pesticide residue detection convolutional neural network in this embodiment consists of two three-dimensional convolutional layers C0 and C5, two multi-scale attention modules, two residual modules, and one fully connected module. The multi-scale attention module includes three three-dimensional convolutional layers C1, C2, and C3 arranged in parallel, followed by a three-dimensional convolutional layer C4 and a spatial spectrum attention module arranged in series. After C0, C1, C2, C3, C4, and C5, a normalization layer and a modified linear unit activation function layer are added.

[0055] In this embodiment, the input to the first 3D convolutional layer C0 is the preprocessed hyperspectral image X of the crop. C0 is a convolutional layer with a kernel size of 3 and a stride of 2. The inputs to the three parallel 3D convolutional layers C1, C2, and C3 of the first multi-scale attention module are all the output feature maps of C0. The input to the 3D convolutional layer C4 of the first multi-scale attention module is the merged feature of the output features of C1, C2, and C3. C4 is a convolutional layer with a kernel size of 3 and a stride of 1, used to fuse the multi-scale output feature maps of C1, C2, and C3. The input to the spatial-spectral attention module of the first multi-scale attention module is the output feature map of C4. (The last sentence appears to be a separate, unrelated statement: "Pesticide residue detection convolutional layer...") The input to the first residual module of the pesticide residue detection convolutional neural network is the output feature map of C0, which is then combined with the output features of the first spatial spectral attention module. The input to the second 3D convolutional layer C5 of the pesticide residue detection convolutional neural network is the output feature map of the first residual module. C5 is a convolutional layer with a kernel size of 3 and a stride of 1. Normalization layers and modified linear unit activation function layers are added after C0 and C5. The input to the second multi-scale attention module of the pesticide residue detection convolutional neural network is the output feature map of C5. The input to the second residual module of the pesticide residue detection convolutional neural network is the output feature map of C5, which is then combined with the output features of the second multi-scale attention module. The input to the fully connected module of the pesticide residue detection convolutional neural network is the output feature map of the second residual module.

[0056] The multi-scale attention module in this embodiment includes three parallel 3D convolutional layers C1, C2, and C3, followed by a 3D convolutional layer C4 and a spatial-spectral attention module connected in series. C1 is a convolutional layer with a kernel size of 3 and a stride of 1; C2 is a convolutional layer with a kernel size of 5 and a stride of 1; C3 is a convolutional layer with a kernel size of 7 and a stride of 1; C4 is a convolutional layer with a kernel size of 1 and a stride of 1. The spatial-spectral attention module is used to obtain the channel attention map CA(F) and the spatial attention map SA(F) from the feature map F output by the 3D convolutional layer C4 through channel-dimensional attention and spatial-dimensional attention, respectively. The channel attention map CA(F) and the spatial attention map SA(F) are then subjected to matrix multiplication and joint operation to obtain the final output feature F1 after correction and joint operation by the spatial-spectral attention module.

[0057] The residual module in this embodiment is used to fuse the input features of the multi-scale attention module and the output features of the spatial spectrum attention module at the same scale by using a convolutional kernel of size 1 and a normalization layer.

[0058] The fully connected module in this embodiment includes one unfolded layer and three fully connected layers arranged in series. After the first two fully connected layers, a Dropout layer is set. The third fully connected layer is equipped with a Softmax classification function to obtain pesticide residue detection results.

[0059] The modified linear unit activation function layer in this embodiment is a piecewise linear function used to compare the input data x with the value 0 and output the maximum value, that is, to change all negative values ​​to 0, while keeping positive values ​​unchanged; the Softmax function layer is used to achieve information matching.

[0060] In one implementation, the convolutional neural network for pesticide residue detection in crops is a pre-trained convolutional neural network for pesticide residue detection; see [link / reference]. Figure 3 The training process includes the following steps:

[0061] Step 1: Preparation of tea samples at different concentrations; picking tea leaves and spraying them with pesticides to obtain tea samples at different concentrations.

[0062] (1) Prepare pesticide solutions using distilled water in different proportions:

[0063] Different concentrations of pesticides were evenly sprayed onto the surface of tea leaves, and the tea samples were left to air dry naturally under experimental conditions for 24 hours before data collection. The pesticide used in this invention is bifenthrin.

[0064] Step 2: Acquisition and preprocessing of hyperspectral images of tea leaves; acquire hyperspectral images of tea leaves at different concentrations and perform preprocessing operations.

[0065] (1) Spread the same weight (10±0.5g) of tea leaves evenly on the platform of the hyperspectral image acquisition device.

[0066] (2) Obtain raw hyperspectral images of tea leaves at different pesticide concentrations using a hyperspectral image acquisition device. The hyperspectral image acquisition device mainly includes an imaging lens (HSIA-OL23), a hyperspectral imager (GaiaField-V10E), a light source (200W), a whiteboard (150×150), a mobile platform, and a computer loaded with hyperspectral data acquisition software (SpecView). The hyperspectral imaging device acquires wavelengths in the range of 420–1000 nm.

[0067] (3) Black and white correction is performed on the original hyperspectral images of crops at different pesticide concentrations. The mathematical formula is as follows:

[0068]

[0069] Where R1 represents the corrected hyperspectral image, R represents the original hyperspectral image, and W and B represent the whiteboard image and blackboard image, respectively;

[0070] (4) Perform multiplicative scattering correction (MSC) on the corrected hyperspectral image to reduce the noise in the extracted spectral data and obtain the preprocessed hyperspectral image of the crop.

[0071] Step 3: Obtaining the training and test sets;

[0072] The preprocessed hyperspectral images of crops are divided into training and test sets according to a certain ratio, and the training and test sets do not overlap. Since hyperspectral imaging systems collect a large amount of spectral data, there is a certain noise effect between each spectral band, and there is linear correlation between the data, which will affect the performance of pesticide residue identification models. Therefore, it is necessary to reduce the dimensionality of the original spectral data and remove redundant noise information. Currently, most non-destructive identification of common crops based on hyperspectral imaging systems uses a single algorithm, such as Unconsistent Variable Elimination (UVE), Continuous Projection Algorithm (SPA), or Competitive Adaptive Reweighted Sampling (CARS), to extract features and build an identification model. However, single algorithms lack stability when extracting features. Therefore, this invention adopts a secondary dimensionality reduction method combining CARS and SPA to further eliminate redundant information and improve the stability of the algorithm.

[0073] (1) The preprocessed crop hyperspectral images are randomly divided into training and test sets, with a ratio of 3:1.

[0074] (2) Competitive adaptive reweighted sampling (CARS) is performed on the crop hyperspectral image data training set to extract feature spectral bands.

[0075] (3) The extracted feature spectral bands are subjected to secondary dimensionality reduction using the continuous projection algorithm (SPA) to further eliminate redundant information in the data and obtain the crop hyperspectral image to be trained.

[0076] Step 4: Training the convolutional neural network for pesticide residue detection in crops;

[0077] Based on a 3D convolutional neural network (CNN) model, a crop pesticide residue detection model combining a 3D CNN and a random forest classifier is established, and crop samples with training data are input into the model for training. CNNs, as an effective tool for feature extraction in deep learning, are widely used in computer vision. Therefore, this invention extracts deep-level features from crop hyperspectral images by constructing a CNN model. However, due to the limited amount of input data, 3D CNNs are prone to overfitting. Therefore, in the testing phase, a random forest model is used to replace the classifier in the 3D CNN, and different decision trees are collected to reduce the model's variance, thereby enhancing the generalization ability and anti-overfitting ability of the crop pesticide residue detection model.

[0078] (1) Establish a three-dimensional convolutional neural network (CNN) model to mine deep features of the input hyperspectral image.

[0079] The structure of the constructed 3D CNN model is as follows: Figure 2 As shown, it mainly consists of two 3D convolutional layers C0 and C5, two multi-scale attention modules, two residual modules, and one fully connected module, with information matching achieved by the Softmax function. Furthermore, a Corrected Linear Unit (ReLU) activation function is used after each convolutional layer, the mathematical expression of which is as follows:

[0080]

[0081] ReLU is a piecewise linear function that compares the input data x with the value 0 and outputs the maximum value, that is, it turns all negative values ​​into 0, while keeping positive values ​​unchanged.

[0082] (2) Input the hyperspectral image of the crop to be trained into the established three-dimensional CNN model, and use the gradient descent algorithm with an adaptive learning rate (Adam) and a suitable number of iterations to fully train the one-dimensional convolutional neural network model. In this invention, the number of training iterations is set to 200 and the learning rate is set to 0.001.

[0083] In this embodiment, the tea sample to be tested is input into the trained crop pesticide residue detection model to obtain the crop pesticide residue detection results.

[0084] (1) Replace the third fully connected layer with the Softmax classification function in the fully connected module of the trained 3D CNN model with a random forest classifier. After feature extraction, the RF classifier is used for classification, which is the CNN-RF model proposed in this invention, to alleviate the overfitting problem of the model.

[0085] (2) The hyperspectral images of crops are obtained by dimensionality reduction of the test set of crops. The obtained hyperspectral images of crops are then input into the CNN-RF model to detect pesticide residues in crops and obtain the pesticide residue detection results.

[0086] Compared with existing technologies, this invention achieves low-cost and high-efficiency detection of pesticide residues in tea. This invention combines hyperspectral imaging technology and deep learning methods, and has the advantages of being non-destructive, automated and efficient.

[0087] This invention is not only applicable to agricultural crops (tea), but can also be used for pesticide residue detection in other leafy crops, making it widely applicable.

[0088] It should be understood that the above description of the preferred embodiments is quite detailed, but it should not be considered as a limitation on the scope of protection of this invention. Those skilled in the art, under the guidance of this invention, can make substitutions or modifications without departing from the scope of protection of the claims of this invention, and all such substitutions or modifications fall within the scope of protection of this invention. The scope of protection of this invention should be determined by the appended claims.

Claims

1. A method for detecting pesticide residues in crops based on convolutional neural networks, characterized in that, Includes the following steps: Step 1: Acquire hyperspectral images of crop samples and perform data preprocessing; Step 2: Input the preprocessed hyperspectral image into the pesticide residue detection convolutional neural network for pesticide residue detection; The pesticide residue detection convolutional neural network consists of two three-dimensional convolutional layers C0 and C5, two multi-scale attention modules, two residual modules, and a fully connected module. The multi-scale attention module includes three three-dimensional convolutional layers C1, C2, and C3 arranged in parallel, followed by a three-dimensional convolutional layer C4 and a spatial spectrum attention module arranged in series. After C0, C1, C2, C3, C4, and C5, a normalization layer and a modified linear unit activation function layer are added; the input of C0 is the preprocessed hyperspectral image X of the crop, and the inputs of C1, C2, and C3 are the output feature maps of C0; the input of C4 is the combined feature of the output features of C1, C2, and C3. The input to the first residual module is the output feature map of C0, which is combined with the output feature of the first spatial spectrum attention module and then input into C5; the output feature map of C5 is input into the second multi-scale attention module and the second residual module respectively, and the output features are combined and then input into the output feature map of the second residual module. The spatial spectral attention module of the convolutional neural network for pesticide residue detection includes channel-dimensional attention and spatial-dimensional attention. The mathematical formula for channel-dimensional attention CA(F) is as follows: ; Where F is the input feature matrix, and SN represents the shared network. AvgPool and MaxPool These represent global average pooling and global max pooling, respectively, where W0 and W1 both represent weights. and These represent the sigmoid and modified linear unit activation functions, respectively. and These represent the channel descriptors generated by average pooling and max pooling, respectively. The mathematical formula for spatial attention SA(F) is as follows: ; in, The kernel size represents the convolution kernel size. 3D convolution operation, and These represent two different spatial feature descriptors generated by global average pooling and global max pooling, respectively. The channel-dimensional attention CA(F) and spatial-dimensional attention SA(F) are respectively superimposed on the input feature map of the spatial-spectral attention module using matrix multiplication to obtain the refined channel-dimensional output feature map. and spatial dimension output feature map ; Output feature map of the channel dimension and spatial dimension output feature map Next, a residual module is set up to connect the channel- and spatial attention-corrected high-level features with the input feature residuals and perform a concatenation operation to finally obtain the jointly corrected output feature F1. The process can be mathematically represented as follows: ; Where F represents the input features of the spatial spectral attention module; The pesticide residue detection convolutional neural network replaces the third fully connected layer with a Softmax classification function in the fully connected module with a random forest classifier, and the classification is performed by the random forest classifier.

2. The method for detecting pesticide residues in crops based on convolutional neural networks according to claim 1, characterized in that: In step 1, black and white correction is performed on the acquired hyperspectral image, and the mathematical formula is as follows: , Where R1 represents the corrected hyperspectral image, R represents the original hyperspectral image, and W and B represent the whiteboard image and blackboard image, respectively; Multiplicative scattering correction is performed on the corrected hyperspectral image R1 to reduce the noise in the extracted spectral data, resulting in a preprocessed hyperspectral image of the crop.

3. The method for detecting pesticide residues in crops based on convolutional neural networks according to any one of claims 1-2, characterized in that: In step 2, the pesticide residue detection convolutional neural network is a trained pesticide residue detection convolutional neural network; Its training process includes the following steps: Step 2.1: Obtain several crop samples at different concentrations; Step 2.2: Acquire hyperspectral images of crops at different concentrations and perform preprocessing operations; Step 2.3: Divide the preprocessed hyperspectral images of crops into training and test sets according to a certain ratio; Step 2.4: Train the convolutional neural network for pesticide residue detection using crop samples in the training set; Step 2.5: Combine the trained pesticide residue detection convolutional neural network with a random forest classifier, and use the combined classification model to detect pesticide residues in crop samples in the test set.

4. The method for detecting pesticide residues in crops based on convolutional neural networks according to claim 3, characterized in that: In step 2.1, pesticide solutions were prepared using distilled water in different proportions; pesticides of different concentrations were evenly sprayed onto the surface of crops, and crop samples were placed under experimental conditions to air dry for a preset time before data collection.

5. The method for detecting pesticide residues in crops based on convolutional neural networks according to claim 3, characterized in that: In step 2.2, crop samples of equal weight are evenly spread on the platform of the hyperspectral image acquisition device; the hyperspectral image acquisition device is used to acquire original hyperspectral images of crop samples at different pesticide concentrations; the acquired original hyperspectral images of crop samples at different pesticide concentrations are then subjected to black and white correction, the mathematical formula of which is as follows: , Where R1 represents the corrected hyperspectral image, R represents the original hyperspectral image, and W and B represent the whiteboard image and blackboard image, respectively; Multiplicative scattering correction is performed on the corrected hyperspectral image R1 to reduce the noise in the extracted spectral data, resulting in a preprocessed hyperspectral image of the crop.

6. The method for detecting pesticide residues in crops based on convolutional neural networks according to claim 3, characterized in that: In step 2.3, competitive adaptive reweighted sampling is performed on the crop hyperspectral image data training set to extract feature spectral bands; the extracted feature spectral bands are then subjected to secondary dimensionality reduction using a continuous projection algorithm to further eliminate redundant data information, thereby obtaining the crop hyperspectral image to be trained.

7. The method for detecting pesticide residues in crops based on convolutional neural networks according to claim 3, characterized in that: In step 2.4, the pesticide residue detection convolutional neural network is fully trained using an adaptive learning rate gradient descent algorithm and a preset number of iterations.

8. A crop pesticide residue detection system based on convolutional neural networks, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the crop pesticide residue detection method based on a convolutional neural network as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for detecting pesticide residue concentration of vegetables based on hyperspectral imaging

    CN108872091A

  • Hami melon pesticide residue identification method based on convolutional neural network

    CN113406030A