Handheld pesticide residue detector, pesticide residue detection method and system

By combining the Ghost pesticide residue detection model with a handheld pesticide residue detector, the high barrier to entry for hyperspectral technology in pesticide residue detection has been solved, enabling rapid and convenient pesticide residue detection and reducing the requirements for professional knowledge.

CN117470782BActive Publication Date: 2026-07-21WUHAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WUHAN UNIV
Filing Date
2023-08-14
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing hyperspectral technology is difficult and time-consuming to use in pesticide residue detection, while traditional methods require advanced equipment and expertise and have low detection efficiency.

Method used

A hybrid Ghost pesticide residue detection model is adopted, which combines two-dimensional and one-dimensional Ghost modules, attention fusion module and fully connected module to build a pesticide residue detection system. Hyperspectral images are acquired by a handheld pesticide residue detector and preprocessed and detected on the server.

Benefits of technology

It reduces the need for specialized knowledge, improves testing efficiency and accuracy, and enables rapid and convenient pesticide residue detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117470782B_ABST
    Figure CN117470782B_ABST
Patent Text Reader

Abstract

The application discloses a handheld pesticide residue detector, a pesticide residue detection method and a system, and solves the problems of high threshold and time-consuming and labor-consuming of pesticide residue detection. The application comprises the following steps: a handheld pesticide residue detector acquires a hyperspectral image of crops; a server pre-processes the hyperspectral image, detects pesticide residues based on a mixed Ghost model, and sends a pesticide residue detection result to the handheld pesticide residue detector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a handheld pesticide residue detector, a pesticide residue detection method and system. Background Technology

[0002] Pesticides are commonly used auxiliary agents in agricultural production, effectively controlling pests and diseases and increasing crop yields. However, during use, pesticide residues remain in agricultural products, posing potential health risks with long-term ingestion. Therefore, pesticide residue detection is of great significance, and with increasing public concern for health and the ecological environment, the requirements for pesticide residue detection are becoming increasingly stringent. Traditional pesticide residue detection methods mainly employ gas chromatography (GC), high-performance liquid chromatography (HPLC), and mass spectrometry (MS). While these methods are widely used and highly accurate, they often require destructive sample processing and suffer from drawbacks such as complex operation, long detection times, and high demands on equipment and expertise. Hyperspectral imaging, as a non-contact detection method, does not require destructive sample processing and offers advantages such as fast detection speed and high accuracy. However, current hyperspectral-based pesticide residue detection methods still require a high level of relevant background knowledge and have relatively low detection efficiency, limiting the application of hyperspectral technology in agricultural production. Summary of the Invention

[0003] This invention provides a handheld pesticide residue detector, a pesticide residue detection method and system, which solves the problems of high threshold and time-consuming and labor-intensive pesticide residue detection in the prior art.

[0004] Firstly, a pesticide residue detection method is provided, comprising: performing principal component analysis preprocessing on acquired hyperspectral images of crops to remove redundant information and obtain preprocessed hyperspectral images; inputting the preprocessed hyperspectral images into a hybrid Ghost pesticide residue detection model for pesticide residue detection, the hybrid Ghost pesticide residue detection model including a convolutional module C0, parallel connections for two-dimensional feature extraction branches and one-dimensional feature extraction branches to extract spatial characteristics and spectral features from the crop hyperspectral images respectively, an attention fusion module, and a fully connected module, wherein the preprocessed hyperspectral images are input into the convolutional module. The convolutional module C0 outputs feature map F1 and a one-dimensional vector F3 after matrix transformation of the output feature map, which are then input to the two-dimensional feature extraction branch and the one-dimensional feature extraction branch, respectively. The outputs F2 and F4 of the two-dimensional feature extraction branch are input to the attention fusion module. The attention fusion module converts the feature matrices of different feature extraction branches into one-dimensional feature vectors and performs a merging operation. It then uses a normalized attention mechanism to redistribute the feature weights. The output feature map F5 of the attention fusion module is input to the fully connected module. The fully connected module processes feature map F5 to obtain the pesticide residue detection result.

[0005] Secondly, a pesticide residue detection system is provided, comprising: a preprocessing module configured to perform principal component analysis preprocessing on acquired hyperspectral images of crops to remove redundant information and obtain preprocessed hyperspectral images; and a hybrid Ghost pesticide residue detection model, whose input is the preprocessed hyperspectral image and output is the pesticide residue detection result. The hybrid Ghost pesticide residue detection model includes a convolutional module C0, parallel connections to two-dimensional feature extraction branches and one-dimensional feature extraction branches for extracting spatial characteristics and spectral features from the crop hyperspectral image, an attention fusion module, and a fully connected module. The input is fed into the convolutional module C0. The output feature map F1 and the one-dimensional vector F3 after matrix transformation of the output feature map are input into the two-dimensional feature extraction branch and the one-dimensional feature extraction branch, respectively. The outputs F2 and F4 of the two-dimensional feature extraction branch are input into the attention fusion module. The attention fusion module converts the feature matrices of different feature extraction branches into one-dimensional feature vectors and performs a merging operation. It then uses a normalized attention mechanism to redistribute the feature weights. The output feature map F5 of the attention fusion module is input into the fully connected module. The fully connected module processes the feature map F5 to obtain the pesticide residue detection result.

[0006] In the first and / or second aspects described above, the two-dimensional feature extraction branch includes a two-dimensional Ghost module G1, a convolutional module C1, a two-dimensional Ghost module G2, and a convolutional module C2 connected in series. Two-dimensional Ghost modules G1 and G2 are connected in parallel with residual modules R1 and R2, respectively. The feature map F1 output by convolutional module C0 is input to two-dimensional Ghost module G1, and the output F2 of convolutional module C2 is input to the attention fusion module. The one-dimensional feature extraction branch includes a one-dimensional Ghost module G3, a convolutional module C3, a one-dimensional Ghost module G4, and a convolutional module C4 connected in series. One-dimensional Ghost modules G3 and G4 are connected in parallel with residual modules R1 and R2, respectively. The one-dimensional vector F3 obtained by matrix transformation of the feature map output by convolutional module C0 is input to one-dimensional Ghost module G3, and the output F4 of convolutional module C4 is input to the attention fusion module. The detection results are then output to a handheld pesticide residue detector.

[0007] Thirdly, a server is provided, comprising: a processor; a memory including one or more program modules; wherein the one or more program modules are stored in the memory and configured to be executed by the processor, the one or more program modules including instructions for implementing the pesticide residue detection method.

[0008] Fourthly, a storage medium is provided for storing non-transitory instructions that, when executed by a processor, enable the pesticide residue detection method described above.

[0009] Fifthly, a handheld pesticide residue detector is provided, comprising: a hyperspectral camera configured to acquire hyperspectral images of crops; a communication module configured to send the hyperspectral images of crops to the server and receive pesticide residue detection results from the server; and a display screen configured to display the pesticide residue detection results. Attached Figure Description

[0010] Figure 1 This is a flowchart of a pesticide residue detection method provided in an embodiment of the present invention.

[0011] Figure 2 This is a structural diagram of a mixed Ghost pesticide residue detection model provided in an embodiment of the present invention.

[0012] Figure 3 This is a block diagram of a handheld pesticide residue detector and server provided in an embodiment of the present invention. Detailed Implementation

[0013] Figure 1 A flowchart of a pesticide residue detection method is shown. Figure 1 As shown, the method includes: Step 1, obtaining hyperspectral images of crops; Step 2, performing principal component analysis preprocessing on the acquired hyperspectral images of crops to remove redundant information and obtain preprocessed hyperspectral images; Step 3, sending the preprocessed hyperspectral images to a pesticide detection module equipped with a hybrid Ghost pesticide residue detection model for pesticide residue detection. In one embodiment, hyperspectral images of crops are acquired using a handheld pesticide residue detector and uploaded to a server. The server processes the hyperspectral images of crops to obtain pesticide residue detection results and returns the detection results to the handheld pesticide residue detector.

[0014] (1) Building the Ghost module:

[0015] Due to the rich spatial-spectral information in hyperspectral images of crops, processing these images with hundreds of bands using traditional 3D convolutional kernels requires a large number of training parameters and superior hardware, which significantly limits the application of hyperspectral technology in pesticide detection. Therefore, this invention, based on the "Ghost" concept, constructs a Ghost convolutional module to replace traditional convolutional kernels, acquiring more spatial-spectral features with fewer training parameters and improving the training efficiency of pesticide residue detection models.

[0016] This invention uses two-dimensional Ghost modules and one-dimensional Ghost modules to replace the traditional three-dimensional convolution module, reducing training parameters and improving detection efficiency. Specifically, the Ghost module mainly decomposes the traditional three-dimensional convolution into three parts; here, we take the two-dimensional Ghost module as an example. First, the first part uses a regular two-dimensional convolution with a 1×1 kernel. The number of compressed channels is used to generate intermediate feature maps. H′ and W′ represent the height and width of the intermediate output data, respectively; k×k is the size of the 2D convolution kernel; and n′ represents the number of channels in the intermediate output feature map. Next, in the second part, a 3×3 kernel 2D convolution is used to perform a low-cost operation on each channel of Y′ to obtain g ghost output feature maps Y. G The third part combines Y′ and Y. G The final output feature map has the number of channels n = n′ + g; the mathematical formula is expressed as follows:

[0017] Y′=X*f′+b′

[0018]

[0019]

[0020] Cat[.] represents a union operation. The output feature map represents n channels, y′ i It is the intrinsic feature map of i-th in Y′, Φ i,j This indicates that the j-th linear operation is performed on the i-th intrinsic feature map to obtain the j-th ghost feature map; it is worth noting that y′ i It can have one or more ghost feature maps. Furthermore, the linear operation Φ has less computational cost than the original convolution.

[0021] (2) Construction of the attention fusion module

[0022] Traditional convolutional algorithms assign the same weights to different features by default, often ignoring the contribution of important features and thus affecting the high-precision detection of pesticide residues. Therefore, this invention constructs an attention fusion module based on an attention mechanism to reallocate feature weights, further refine the feature map, and achieve the acquisition of discriminative features. Furthermore, the traditional spatial-spectral attention mechanism contains redundant convolutional and unrolling layers, increasing the number of training parameters and causing low computational efficiency. Therefore, this invention directly uses a normalized attention mechanism to reallocate feature weights, achieving the same weight allocation function as the traditional spatial-spectral attention mechanism without redundant training parameters, and further reducing the computational complexity of the detection model.

[0023] In the attention fusion module of this invention, Reshape is first used to uniformly transform the feature matrices of different feature extraction branches into one-dimensional feature vectors, and then a merging operation is performed. Secondly, a normalized attention mechanism is used to redistribute feature weights, highlighting important features and suppressing unimportant features. The implementation process of the normalized attention mechanism is shown in the following formula table:

[0024]

[0025] Where M is the output feature map, sigmoid() represents the sigmoid function operation, and W γ =γ i / ∑ j=0 γ j Represents the obtained weight, μ p and σ p Let be the mean and standard deviation of the mini-batch p, respectively; γ and β represent the scale c and the transition factor, respectively; and β are trainable transformation parameters. in This represents the input features.

[0026] (3) Construction of a hybrid Ghost pesticide residue detection model

[0027] Traditional pesticide residue detection models often use a single three-dimensional convolutional feature extraction branch, lacking the ability to extract multi-dimensional features. This invention constructs two feature extraction branches based on a two-dimensional Ghost module and a one-dimensional Ghost module, respectively extracting the spatial characteristics and spectral features of crop hyperspectral images, increasing feature diversity and further improving detection efficiency.

[0028] like Figure 2 As shown, the hybrid Ghost pesticide residue detection model mainly consists of parallel connected two-dimensional and one-dimensional feature extraction branches, specifically including five convolutional modules, two two-dimensional Ghost attention modules, two one-dimensional Ghost attention modules, four residual modules, one attention fusion module, and one fully connected module.

[0029] The first convolutional module C0 of the hybrid Ghost pesticide residue detection model takes a preprocessed hyperspectral image as input, with a kernel size of 1 and a stride of 1.

[0030] The input to the two-dimensional feature extraction branch is the feature map F1 output by the convolutional module C0, which includes two two-dimensional Ghost modules G1-G2, two convolutional modules C1-C2, and two residual modules R1-R2. In the two-dimensional feature extraction branch, the first two-dimensional Ghost module G1, the convolutional module C1, the second two-dimensional Ghost module G2, and the convolutional module C2 are connected in series. The residual modules R1 and R2 in the two-dimensional feature extraction branch are connected in parallel with the first two-dimensional Ghost module G1 and the second two-dimensional Ghost module G2, respectively. The convolutional modules C1 and C2 in the two-dimensional feature extraction branch each consist of one average pooling layer and one convolutional layer. The kernel sizes of the average pooling layer and the convolutional layer are 2 and 1, respectively, and the stride size is 1.

[0031] The input to the one-dimensional feature extraction branch is a one-dimensional vector F3 obtained by matrix transformation of the feature map output by the convolutional module C0. It contains two one-dimensional Ghost modules G3-G4, two convolutional modules C3-C4, and two residual modules R3-R4. In the one-dimensional feature extraction branch, the first one-dimensional Ghost module G3, the convolutional module C3, the second one-dimensional Ghost module G4, and the convolutional module C4 are connected in series. The residual modules R3 and R4 in the one-dimensional feature extraction branch are connected in parallel with the first one-dimensional Ghost module G3 and the second one-dimensional Ghost module G4, respectively. The convolutional modules C3 and C4 in the one-dimensional feature extraction branch are each composed of one average pooling layer and one convolutional layer. The kernel sizes of the average pooling layer and the convolutional layer are 2 and 1, respectively, and the stride size is 1.

[0032] The input to the attention fusion module is the output F2 of the two-dimensional feature extraction branch and the output F1 of the one-dimensional feature extraction branch.

[0033] The fully connected module consists of one unfolded layer and three fully connected layers. Its input is the output feature map F5 of the attention fusion module. After each convolution, a normalization layer and an activation layer are added sequentially. The first two fully connected layers in the fully connected module are followed by a Dropout layer, and the last fully connected layer is equipped with a Softmax function to obtain the pesticide residue detection results. The detection results of this invention are divided into two categories: presence of pesticide residue and absence of pesticide residue. The preprocessed hyperspectral sample of the crop to be detected is input into the trained hybrid Ghost pesticide residue detection model, and the pesticide residue with the highest predicted probability is taken as the final detection result, quickly assessing whether the crop is safe.

[0034] Figure 3 A system block diagram of a handheld pesticide residue detector is shown. The handheld pesticide residue detector acquires hyperspectral images of crops and receives pesticide residue detection results. Figure 3As shown, the handheld pesticide residue detector includes a central control module 1, a battery module 2, an image acquisition module 3, an image display module 4, and a wireless communication module 5. The battery module 2, image acquisition module 3, image display module 4, and wireless communication module 5 are connected to the central control module 1. The central control module 1 controls the handheld pesticide residue detector. The battery module 2 powers the handheld pesticide residue detector. The image acquisition module 3 acquires hyperspectral images of crops, which can be obtained using SpectraCam. TM A hyperspectral camera. The image display module (LCD screen) 4 displays the spectral data and three-band false-color images of the acquired hyperspectral images of the crop, and simultaneously displays the pesticide residue detection results received by the wireless communication module 5. The wireless communication module 5 can be a Bluetooth module, Wi-Fi module, Zigbee module, or 4G / 5G network. The wireless communication module 5 enables remote communication between the handheld pesticide residue detector and the server, transmitting data to the cloud server and receiving pesticide residue detection results returned by the cloud service.

[0035] This invention also provides an embodiment of a pesticide residue detection system, which includes a preprocessing module 6, a pesticide detection module 7, a data storage module 8, and an output module. The preprocessing module 6 is configured to perform dimensionality reduction processing on the acquired hyperspectral images of crops using principal component analysis (PCA) to improve the detection efficiency of the pesticide residue detection model. The dimensionality reduction is automatically selected based on the contribution of the principal components. The pesticide detection module 7 is configured to perform pesticide residue detection from the preprocessed hyperspectral images using a hybrid Ghost pesticide residue detection model. The hybrid Ghost pesticide residue detection model has been described in detail previously. The hybrid Ghost pesticide residue detection model achieves low-cost and high-efficiency output of pesticide residue detection results with fewer parameters and lower computational complexity. The data storage module 8 is configured to store the preprocessed hyperspectral images of crops and the pesticide residue detection results for later retrieval and use. The output module is configured to output the pesticide residue detection results, for example, by returning the detection results to a handheld pesticide residue detector.

[0036] The server can be a cloud server or a physical server. The server includes a processor and memory. The memory stores non-transitory instructions (e.g., one or more program modules). The processor executes the non-transitory instructions, which, when run by the processor, can perform steps 2 and / or 3 in the pesticide residue detection method described above. The memory and processor can be interconnected via a bus system and / or other forms of connection.

[0037] For example, a processor can be a central processing unit (CPU), a graphics processing unit (GPU), or other form of processing unit with data processing and / or program execution capabilities. For instance, a CPU can be based on x86 or ARM architectures. A processor can be a general-purpose processor or a dedicated processor, and it can control other components in the server to perform desired functions.

[0038] For example, the memory can be volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), compact optical disc read-only memory (CD-ROM), USB storage, flash memory, etc. One or more program modules can be stored on the memory, and the processor can run one or more program modules to implement various functions of the server.

[0039] In one embodiment, a storage medium is also provided for storing non-transitory instructions that, when executed by a server processor, can implement one or more steps of the pesticide residue detection method described above. That is, when the pesticide residue detection method and system provided in this application are implemented in software and sold or used as independent products, they can be stored in a storage medium. For further details regarding the storage medium, please refer to the corresponding description of the server's memory above; it will not be repeated here.

[0040] In summary, this invention first acquires hyperspectral images of crops using a handheld pesticide residue detector and uploads them to a cloud server. Secondly, since hyperspectral images contain hundreds of spectral bands, offering rich spectral and spatial information, they also contain a significant amount of redundant information. Therefore, a preprocessing module is set up on the cloud server to preprocess the hyperspectral images of crops, reducing redundant information and improving model detection efficiency. Furthermore, traditional convolutional neural networks, due to their large number of training parameters and computational complexity, often cannot quickly and accurately detect pesticide residues, greatly limiting the application of hyperspectral technology in pesticide detection. Therefore, this invention incorporates a hybrid Ghost pesticide residue detection model into the pesticide detection module, acquiring pesticide detection results of crops at low cost and high efficiency, and generating a technical report which is then returned to the handheld pesticide residue detector. This invention reduces the user's requirement for professional background knowledge and further improves work efficiency by utilizing a more convenient and accurate pesticide detection method.

Claims

1. A method for detecting pesticide residues, characterized in that, include: Principal component analysis was performed on the acquired hyperspectral images of crops to remove redundant information and obtain the preprocessed hyperspectral images. The preprocessed hyperspectral image is fed into the hybrid Ghost pesticide residue detection model for pesticide residue detection. The hybrid Ghost pesticide residue detection model includes a convolutional module C0, two-dimensional feature extraction branches and one-dimensional feature extraction branches that extract spatial characteristics and spectral features from crop hyperspectral images in parallel connection, an attention fusion module and a fully connected module. The preprocessed hyperspectral image is input into the convolutional module C0. The output feature map F1 of the convolutional module C0 and the one-dimensional vector F3 after matrix transformation of the output feature map are input into the two-dimensional feature extraction branch and the one-dimensional feature extraction branch, respectively. The output F2 of the two-dimensional feature extraction branch and the output F4 of the one-dimensional feature extraction branch are input into the attention fusion module. The attention fusion module converts the feature matrices of different feature extraction branches into one-dimensional feature vectors and performs a merging operation. It also uses a normalized attention mechanism to redistribute the feature weights. The output feature map F5 of the attention fusion module is input into the fully connected module. The fully connected module processes the feature map F5 to obtain the pesticide residue detection result. The two-dimensional feature extraction branch includes a two-dimensional Ghost module G1, a convolution module C1, a two-dimensional Ghost module G2, and a convolution module C2 connected in series. Two-dimensional Ghost modules G1 and G2 are respectively connected in parallel with residual modules R1 and R2. The feature map F1 output by convolution module C0 is input to two-dimensional Ghost module G1, and the output F2 of convolution module C2 is input to the attention fusion module. The one-dimensional feature extraction branch includes a one-dimensional Ghost module G3, a convolution module C3, a one-dimensional Ghost module G4, and a convolution module C4 connected in series. The one-dimensional Ghost modules G3 and G4 are respectively connected in parallel with residual modules R3 and R4. The one-dimensional vector F3 after matrix transformation of the feature map output by the convolution module C0 is input into the one-dimensional Ghost module G3. The output F4 of the convolution module C4 is input into the attention fusion module.

2. The pesticide residue detection method according to claim 1, characterized in that, The test results are output to a handheld pesticide residue detector.

3. A pesticide residue detection system, characterized in that, include: The preprocessing module is configured to perform principal component analysis preprocessing on the acquired hyperspectral images of crops to remove redundant information and obtain preprocessed hyperspectral images. The hybrid Ghost pesticide residue detection model takes preprocessed hyperspectral images as input and outputs pesticide residue detection results. This model includes a convolutional module C0, parallel connections for two-dimensional and one-dimensional feature extraction branches to extract spatial and spectral features from crop hyperspectral images, an attention fusion module, and a fully connected module. The preprocessed hyperspectral image is input to the convolutional module C0. The output feature map F1 and the one-dimensional vector F3 obtained by matrix transformation of the output feature map are input to the two-dimensional and one-dimensional feature extraction branches, respectively. The outputs F2 and F4 of the two-dimensional and one-dimensional feature extraction branches are input to the attention fusion module. The attention fusion module converts the feature matrices from different feature extraction branches into one-dimensional feature vectors and merges them, then uses a normalized attention mechanism to redistribute feature weights. The output feature map F5 of the attention fusion module is input to the fully connected module, which processes the feature map F5 to obtain the pesticide residue detection results. The two-dimensional feature extraction branch includes a two-dimensional Ghost module G1, a convolution module C1, a two-dimensional Ghost module G2, and a convolution module C2 connected in series. Two-dimensional Ghost modules G1 and G2 are respectively connected in parallel with residual modules R1 and R2. The feature map F1 output by convolution module C0 is input to two-dimensional Ghost module G1, and the output F2 of convolution module C2 is input to the attention fusion module. The one-dimensional feature extraction branch includes a one-dimensional Ghost module G3, a convolution module C3, a one-dimensional Ghost module G4, and a convolution module C4 connected in series. The one-dimensional Ghost modules G3 and G4 are respectively connected in parallel with residual modules R3 and R4. The one-dimensional vector F3 after matrix transformation of the feature map output by the convolution module C0 is input into the one-dimensional Ghost module G3. The output F4 of the convolution module C4 is input into the attention fusion module.

4. The pesticide residue detection system according to claim 3, characterized in that, It also includes an output module that outputs the test results to a handheld pesticide residue detector.

5. A server, characterized in that, include: processor; Memory, including one or more program modules; The one or more program modules are stored in the memory and configured to be executed by the processor, and the one or more program modules include instructions for implementing the pesticide residue detection method according to any one of claims 1-2.

6. A storage medium for storing non-transitory instructions, characterized in that, When the non-temporary instructions are executed by the processor, the pesticide residue detection method according to any one of claims 1-2 can be implemented.

7. A handheld pesticide residue detector, characterized in that, include: A hyperspectral camera, configured to acquire hyperspectral images of crops; A communication module configured to send hyperspectral images of crops to the server of claim 5 and receive pesticide residue detection results from the server of claim 5. And a display screen configured to show pesticide residue test results.