Intelligent pesticide residue detection method and device driven by infrared imaging
By combining infrared imaging and convolutional neural network models, efficient and accurate pesticide residue detection has been achieved, solving the problems of low detection efficiency and low accuracy in existing technologies, and reducing the harm of pesticide residues to human health and the ecological environment.
Patent Information
- Application Number
- CN202511677596.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-02-27
AI Technical Summary
Existing pesticide residue detection methods are inefficient and have low accuracy, failing to effectively reduce the harm to human health and the ecological environment caused by food containing pesticide residues.
An intelligent pesticide residue detection method driven by infrared imaging is proposed. After acquiring infrared images of target crops and converting them to grayscale, a convolutional neural network model is used to detect pesticide residues. The model includes processing of input layer, convolutional layer, pooling layer, fully connected layer and output layer to identify hot spot areas, color distribution and texture morphology of pesticide residue sites and output pesticide residue information.
It improves the efficiency and accuracy of pesticide residue detection, enabling efficient and accurate detection of pesticide residues and reducing harm to human health and the ecological environment.
Smart Images

Figure CN121577672A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of pesticide residue detection, and particularly relates to an infrared imaging driven pesticide residue intelligent detection method and device. BACKGROUND
[0002] Pesticides are prone to be left on the surface of crops, and long-term intake of food containing pesticide residues can cause harm to human health and the ecological environment.
[0003] Therefore, accurately and efficiently detecting pesticide residues can reduce the harm caused by food containing pesticide residues to human health and the ecological environment. However, the existing pesticide residue detection scheme has the problems of low efficiency and low detection accuracy. SUMMARY
[0004] The present application provides an infrared imaging driven pesticide residue intelligent detection method and device, which can directly detect the target crop through a pesticide residue detection model to determine the pesticide residue information of the target crop, and the above process is efficient and accurate, so that the pesticide residues can be detected efficiently and accurately, thereby reducing the harm caused by food containing pesticide residues to human health and the ecological environment.
[0005] In order to achieve the above purpose, the present application adopts the following technical scheme: In a first aspect, the present application provides an infrared imaging driven pesticide residue intelligent detection method, comprising: acquiring a target crop detection image; wherein the target crop detection image is an infrared image showing the pesticide residue detection part of the target crop; the pesticide residue detection part is the front of the leaf, the back of the leaf, the fruit skin or the stem joint. According to the target crop detection image, a target crop detection grayscale image is determined. Based on the target crop detection grayscale image and the pesticide residue detection model, the pesticide residue information of the pesticide residue detection part of the target crop is determined; the pesticide residue detection model is constructed based on a convolutional neural network model.
[0006] In an implementation manner of the first aspect, the pesticide residue information of the pesticide residue detection part of the target crop is determined, comprising: inputting the target crop detection grayscale image into the pesticide residue detection model, and the pesticide residue detection model analyzes the hot spot area, color distribution, texture morphology and edge change of the pesticide residue detection part of the target crop shown by the detection grayscale image to output the pesticide residue information of the pesticide residue detection part of the target crop; the pesticide residue information includes whether the pesticide residue detection part has pesticide residues, the type of pesticide residues and the pollution degree of pesticide residues.
[0007] In an implementation form of the first aspect, the pesticide residue detection model comprises, in sequence, an input layer, a first convolutional layer, a first pooling layer, a second convolutional layer, a second pooling layer, a first fully connected layer, a Dropout layer, a second fully connected layer, and an output layer, which are electrically connected.
[0008] In an implementation form of the first aspect, the pesticide residue detection model analyzes the hot spot area, color distribution, texture morphology, and edge change of the pesticide residue detection part on the target crop shown by the to-be-detected gray image, to output pesticide residue information of the pesticide residue detection part on the target crop, including: Step 1, the to-be-detected gray image enters the pesticide residue detection model through the input layer of the pesticide residue detection model; Step 2, the first convolutional layer, the first pooling layer, the second convolutional layer, and the second pooling layer of the pesticide residue detection model perform feature extraction on the hot spot area, color distribution, texture morphology, and edge change of the pesticide residue detection part on the target crop shown by the to-be-detected gray image, to obtain a feature vector of the to-be-detected gray image; Step 3, the first fully connected layer, the Dropout layer, and the second fully connected layer of the pesticide residue detection model classify the feature vector of the to-be-detected gray image, to obtain pesticide residue information of the pesticide residue detection part on the target crop; Step 4, the output layer of the pesticide residue detection model outputs the pesticide residue information of the pesticide residue detection part on the target crop.
[0009] In an implementation form of the first aspect, the method further comprises training the pesticide residue detection model, and the training process of the pesticide residue detection model is as follows. A convolutional neural network model is constructed. A training image dataset for training the convolutional neural network model is obtained; the training image dataset includes a plurality of pesticide residue images; each pesticide residue infrared image in the plurality of pesticide residue images is labeled with crop species, crop growth stage, pesticide type, and pollution degree. The convolutional neural network model is trained using the training image dataset to obtain the pesticide residue detection model.
[0010] In an implementation form of the first aspect, the to-be-detected gray image of the target crop is determined, including: The to-be-detected image of the target crop is subjected to piecewise linear gray scale transformation to obtain the to-be-detected gray image of the target crop; the piecewise linear gray scale transformation satisfies the following formula: wherein, represents the original gray scale of a pixel in the to-be-detected image, represents the transformed gray scale of the pixel in the to-be-detected image, represents a first original gray scale threshold value, represents a second original gray scale threshold value, represents a first transformed gray scale threshold value, represents a second transformed gray scale threshold value.
[0011] In a second aspect, the present application provides an intelligent pesticide residue detection device driven by infrared imaging, which is used to implement the method of the first aspect, and includes a to-be-detected image acquisition module, a gray scale image determination module, and a pesticide residue detection module. The to-be-detected image acquisition module is configured to acquire a to-be-detected image of a target crop; wherein the to-be-detected image is an infrared image showing a pesticide residue to-be-detected part of the target crop; the pesticide residue to-be-detected part is a leaf front surface, a leaf back surface, a fruit skin, or a stem joint. The gray scale image determination module is configured to determine a to-be-detected gray scale image of the target crop according to the to-be-detected image of the target crop. The pesticide residue detection module is configured to determine pesticide residue information of the pesticide residue to-be-detected part of the target crop based on the to-be-detected gray scale image of the target crop and a pesticide residue detection model; the pesticide residue detection model is constructed based on a convolutional neural network model.
[0012] In a third aspect, the present application provides an electronic device, including a processor and a memory coupled to the processor; the memory is configured to store computer instructions, when the electronic device is running, the processor executes the computer instructions stored in the memory, so that the electronic device executes the method in the first aspect or any of the implementation manners thereof.
[0013] In a fourth aspect, the present application provides a computer readable storage medium, including computer program instructions, when the computer program instructions are executed by a computer, the computer executes the method in the first aspect or any of the implementation manners thereof.
[0014] In a fifth aspect, the present application provides a computer program product, including computer program instructions, when the computer program instructions are executed on a computer, the computer executes the method in the first aspect or any of the implementation manners thereof.
[0015] The technical effects of the second aspect to the fifth aspect and the possible implementation manners thereof can refer to the description of the technical effects of the first aspect and the possible implementation manners thereof, which will not be repeated here.
[0016] Compared with the prior art, the present application has the following beneficial effects.
[0017] The method provided by the present application comprises the following steps: performing gray scale conversion on a to-be-detected image of a pesticide residue detection position of a target crop to obtain a to-be-detected gray scale image of the target crop; and detecting the to-be-detected gray scale image of the target crop by using a pesticide residue detection model constructed based on a convolutional neural network model to obtain pesticide residue information of the pesticide residue detection position of the target crop. In the above process, the gray scale conversion operation can highlight the hot spot, edge texture or gray scale jump of the to-be-detected image, and on this basis, the pesticide residue detection model has high detection efficiency and high accuracy for the to-be-detected gray scale image, can efficiently and accurately detect the pesticide residue, and thus reduces the harm of food containing pesticide residues to human health and the ecological environment. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 FIG. 1 is a schematic diagram of an infrared imaging driven pesticide residue intelligent detection method provided by an embodiment of the present application; Figure 2 FIG. 2 is a schematic diagram of a pesticide residue detection model hierarchical structure provided by an embodiment of the present application; Figure 3 FIG. 3 is a structural schematic diagram of an infrared imaging driven pesticide residue intelligent detection device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0019] In the specification and claims of the present application, the terms "first" and "second" are used to distinguish different objects, rather than to describe a specific order of the objects.
[0020] In the embodiments of the present application, "and / or" represents the relationship between the objects, for example, A and / or B can represent the following three cases: A exists alone, B exists alone, and A and B exist together.
[0021] In the embodiments of the present application, the words "exemplary" or "for example" are used to represent an example, illustration or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. On the contrary, the words "exemplary" or "for example" are used to present the relevant concept in a specific manner.
[0022] In the description of the present application, unless otherwise specified, "multiple" means two or more. For example, multiple pesticide residue images refer to two or more pesticide residue infrared images.
[0023] The method and device provided by the embodiments of the present application relate to food safety and can be used for detecting pesticide residues on crops. Specifically, a pesticide residue detection model constructed based on a convolutional neural network model is used to detect an infrared image of a target crop to obtain pesticide residue information of a pesticide residue detection part on the target crop.
[0024] To solve the problem of low efficiency and low detection accuracy of the existing pesticide residue detection scheme in the background art, the embodiments of the present application provide an infrared imaging driven pesticide residue intelligent detection method and device, which can directly detect a target crop through a pesticide residue detection model to determine pesticide residue information of a pesticide residue detection part on the target crop. The above process is of high efficiency and high accuracy, and thus the pesticide residue can be detected efficiently and accurately, thereby reducing the harm of food containing pesticide residues to human health and the ecological environment.
[0025] Exemplarily, the infrared imaging driven pesticide residue intelligent detection method provided by the embodiments of the present application can be executed by an electronic device with processing function, for example, a computer, a server, etc. Taking the computer as an example, the hardware part of the computer can include a processor, a memory, a network interface, a user interface, a communication bus, etc.
[0026] The processor is configured to control the electronic device to perform related processing and calculation tasks, for example, acquiring a target crop image, determining a target crop gray-scale image, determining pesticide residue information of a pesticide residue detection part on the target crop, etc. The processor can include a central processing unit (CPU) or other processors, and can be single-core or multi-core, for example, the processor can include multiple CPUs.
[0027] The memory is configured to store computer instructions and related data, for example, storing a target crop image, a target crop gray-scale image, a pesticide residue detection model, and pesticide residue information, etc. The memory can be a random access memory (RAM), a read only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, or an optical storage, a magnetic disk storage medium or other magnetic storage device, or any other medium capable of storing program codes or data accessible by a computer. Optionally, the memory can be integrated in the processor, and the memory can also be independent of the processor.
[0028] The network interface is used for communication between the computer and other devices or communication networks, and can be a transceiver with transceiving function. Optionally, the network interface can include a standard wired interface, a wireless interface (such as a WI-FI interface, a Bluetooth interface, a 5G interface), etc.
[0029] The communication bus is used to realize the connection and communication between different components, for example, the above-mentioned processor, memory, network interface and user interface can be interconnected through the communication bus.
[0030] The user interface can include a display screen, an input unit (such as a keyboard), and optionally, the user interface can also include a standard wired interface, a wireless interface.
[0031] Those skilled in the art can understand that the above computer can also include more or fewer components, or combine certain components, or different component arrangements, which are not limited in the embodiments of the present application.
[0032] As shown in the above-mentioned computer, the network interface is used for communication between the computer and other devices or communication networks, and can be a transceiver with transceiving function. Optionally, the network interface can include a standard wired interface, a wireless interface (such as a WI-FI interface, a Bluetooth interface, a 5G interface), etc. Figure 1 As shown in the above-mentioned computer, the network interface is used for communication between the computer and other devices or communication networks, and can be a transceiver with transceiving function. Optionally, the network interface can include a standard wired interface, a wireless interface (such as a WI-FI interface, a Bluetooth interface, a 5G interface), etc. S101, obtaining a target crop image to be detected; The target crop image to be detected is an infrared image showing the pesticide residue detection part of the target crop; the pesticide residue detection part is the front of the leaf, the back of the leaf, the fruit skin or the stem joint, etc. For example, for the target crop of leafy vegetables (such as spinach, rape, cabbage, etc.), the pesticide residue detection part should be the front / back of the leaf, and the leaf vein intersection area with more pesticide residues should be paid special attention to; for the target crop of fruits (such as apples, etc.), since the pesticide spraying is easy to form a fruit wax layer on the fruit skin, the pesticide residue detection part should be the fruit skin; for the target crop of grains, the pesticide residue detection part should be the ear and the surface of the grain; In one application scenario, the process of obtaining the above-mentioned target crop image to be detected is as follows: The target crop is imaged by infrared imaging in a natural state under multiple viewing angles and different distances to obtain multiple target crop images to be detected; in the process of collecting the above-mentioned image to be detected, the image collection focuses on the area where the pesticide residue deposition may occur on the surface of the crop, such as the front / back of the leaf, the fruit skin, the stem joint, etc. These areas are usually high-residue distribution areas after pesticide spraying, and their infrared reflectivity and thermal radiation response show specific differences. S102, determining a target crop gray image to be detected according to the target crop image to be detected; The specific processing process of S102 is as follows: A piecewise linear grayscale transformation is performed on the image of the target crop to be detected, resulting in a grayscale image of the target crop to be detected; the piecewise linear grayscale transformation satisfies the following formula. in, This represents the original gray level of the pixels in the image to be detected. This represents the transformed grayscale value of a pixel in the image to be detected. This represents the first original grayscale threshold. This represents the second original grayscale threshold. Indicates the grayscale threshold for the first transformation. Indicates the grayscale threshold for the second transformation; As can be seen from the above formula, the piecewise linear grayscale transformation can change the grayscale of a pixel from 0 to... Transform to 0- It can change the grayscale of pixels from - Transform to - It can change the grayscale of pixels from 255 to Transform to 255- Then 0≤ ≤ ≤255, 0≤ ≤ ≤255; It should be noted that, for the target crop image to be detected, the above piecewise linear grayscale transformation not only enhances the contrast performance of the pesticide residue area in the image to be detected, but also effectively reduces the interference of the background and normal tissue, laying the foundation for the subsequent pesticide residue detection model to determine the pesticide residue information of the pesticide residue detection site on the target crop. S103. Based on the grayscale image of the target crop to be detected and the pesticide residue detection model, determine the pesticide residue information of the parts of the target crop to be detected. The pesticide residue detection model is built based on a convolutional neural network model; specifically, such as Figure 2 As shown, the pesticide residue detection model consists of the following electrically connected layers in sequence: input layer, first convolutional layer, first pooling layer, second convolutional layer, second pooling layer, first fully connected layer, Dropout layer, second fully connected layer, and output layer. In one implementation, the method further includes training the pesticide residue detection model, and the training process of the pesticide residue detection model is as follows; (1) Construct a convolutional neural network model; Since the convolutional neural network model (CNN) adopted by the embodiments of the present application is a commonly used technical means in the technical field, the construction process of the convolutional neural network model will not be described further herein. (2) Obtain a training image data set for training the convolutional neural network model; The training image data set includes a plurality of pesticide residue images; each pesticide residue infrared image in the plurality of pesticide residue images is labeled with crop species, crop growth stage, pesticide type, and pollution degree; The following describes the acquisition process of the training image data set; 2.1 Collect pesticide residue infrared images of different types of pesticides polluting various crops at different growth stages using infrared imaging means; 2.2 Combine the collected pesticide residue infrared images to obtain the training image data set; It should be understood that the infrared images in the training image data set should cover key periods such as early, middle, and pre-harvest periods of various crops, to ensure that the model training has the ability to identify the patterns of pesticide residues at different growth periods; On this basis, a pesticide residue target standard database for feature vector classification also needs to be constructed; the following describes the construction process of the pesticide residue target standard database; 2.3 Preliminarily classify the collected pesticide residue infrared images according to pesticide type, pollution degree, and growth period; the classified images include: normal crop surface images (as "no pollution reference"); pesticide residue light pollution images (low dose / short interval spraying); pesticide residue moderate pollution images; pesticide residue heavy pollution images (high dose or long-term retention); In some embodiments, the pesticide types include common pesticide types such as organophosphorus, pyrethroid, carbamate, and neonicotinoid; the pollution degrees include no pollution, light pollution (not exceeding the limit --- maximum residue limit MRL), moderate pollution (1-2 times the maximum residue limit), and heavy pollution (more than 2 times the maximum residue limit); and the growth periods include early growth, middle growth, and pre-harvest; 2.4 Extract features from the preliminarily classified pesticide residue infrared images to obtain a target feature data set; The preliminarily classified pesticide residue infrared images are subjected to color channel separation, texture direction recognition, edge detection and segmentation, and hot spot region positioning processing, the features with discriminative significance in the pesticide residue infrared images are encoded, calculated, and summarized to form a high-dimensional feature vector set of each pesticide residue infrared image; the set is the high-dimensional feature vector of the image; In particular, considering that the pesticide molecules have specific reflection or absorption response in the infrared band, the absorption peak width, thermal spot center temperature difference value, thermal field distribution gradient and other high sensitivity parameters are extracted in the above feature extraction, which is specially aimed at the thermal spectrum abnormal area, so as to enhance the recognition ability of the pesticide residue detection model to low concentration pollution; The high-dimensional feature vector of each pesticide residue infrared image is classified and coded according to the pesticide type, pollution degree and crop type as a label, and is integrated into a unified data structure to form a target feature data set. It can be understood that the data set not only contains the infrared spectrum characteristics of common pesticides, but also accurately labels and classifies the key features of pesticide residues, ensuring that the pesticide residue detection model can identify different pesticide types as independent categories, thereby improving the accuracy and reliability of detection; 2.5 Split the target feature data set to obtain a plurality of target sub-data sets; Cross-classify the pesticide categories and crop categories in the target feature data set to generate a plurality of target sub-data sets; each target sub-data set includes a specific crop under the action of a specific pesticide at various pollution levels, ensuring that the pesticide residue detection model has sufficient recognition accuracy and generalization ability; 2.6 Use a plurality of target sub-data sets to construct a pesticide residue target standard database for feature vector classification; Integrate the above plurality of target sub-data sets according to a unified interface format to obtain a pesticide residue target standard database for feature vector classification; it can be understood that each feature vector in the above pesticide residue target standard database uniquely corresponds to a crop type, crop growth stage, pesticide type and pollution degree; It should be understood that the pesticide residue target standard database focuses on the unique reflection and absorption characteristics and typical spectral peak marker sites of pesticides in infrared images, ensuring that the pesticide residue detection model still maintains good recognition sensitivity and robustness when encountering multiple pesticide cross-contamination or low concentration residues; (3) Train the convolutional neural network model using the training image data set to obtain a pesticide residue detection model; The above training process will be described in detail below; First, the crop species, growth stage, pesticide type and pollution degree shown by the external image in the training image dataset are taken as label information; then, the infrared image is input into the model, low-level features (such as edges and basic textures) of the image are extracted through the first convolutional layer and the pooling layer, and then the mid-high level features (such as complex textures and hot spot area distribution) are further extracted through the second convolutional layer and the pooling layer; after the feature extraction is completed, the pooling output is flattened and input into the fully connected layer to realize global feature fusion, and a Dropout layer is introduced between the fully connected layers to prevent overfitting, thereby improving the generalization ability of the model; finally, through the second fully connected layer and the output layer, the classification result is output by using the Softmax function, and the categories include no pollution, light pollution, moderate pollution and heavy pollution; during the training process, the model generates a prediction result through forward propagation, and calculates a loss function (such as cross-entropy loss) combined with the real label, and then continuously optimizes the convolution kernel and weight parameters through back propagation and gradient descent, and after multiple iterations until the loss function converges, a pesticide residue detection model capable of stably identifying the pesticide residue condition is obtained. It should be understood that the pesticide residue detection model obtained after the above training process can capture the thermal radiation and energy distribution characteristics on the surface of agricultural products, use the temperature gradient and the absorption characteristics of the infrared wave band to reveal the pesticide residue signals that are difficult to identify by traditional visible light. Therefore, the embodiments of the present application combine the convolutional neural network (CNN) to perform deep feature extraction, pattern matching and classification judgment on the image, effectively overcoming the limitations of poor stability and weak adaptability of traditional manual feature extraction in complex backgrounds; by introducing a multi-layer neural structure and a large number of labeled samples for training, the model has self-learning and self-adaptive capabilities, and can still maintain stable and accurate recognition ability under multiple types of crops, multiple types of pesticides and multiple environmental variables, greatly improving the universality and reliability of the detection system. The specific processing process of S103 is given below. The target crop gray-scale image to be detected is input into the pesticide residue detection model, and the pesticide residue detection model analyzes the hot spot area, color distribution, texture morphology and edge change of the pesticide residue detection part on the target crop shown by the gray-scale image to be detected, to output the pesticide residue information of the pesticide residue detection part on the target crop. Optionally, the above pesticide residue information can include whether there is pesticide residue in the pesticide residue detection part, the type of the pesticide residue and the pollution degree of the pesticide, and can also include the type of the crop and the growth stage of the crop, and the specific content of the above pesticide residue information is not limited in the embodiments of the present application. Further, the pesticide residue detection model analyzes the hot spot area, color distribution, texture morphology and edge change of the pesticide residue detection part of the target crop shown by the to-be-detected gray image, to output the pesticide residue information of the pesticide residue detection part of the target crop, including the following steps: Step 1, the to-be-detected gray image enters the pesticide residue detection model through the input layer of the pesticide residue detection model; It can be understood that the to-be-detected gray image also inputs a 4-dimensional tensor when it enters the pesticide residue detection model; the specific content of the 4-dimensional tensor is as follows: Data shape: (Batch Size, Height, Width, Channels); Example: (32, 64, 64, 128); Meaning: Batch Size = 32: indicates that in order to improve the training efficiency, we input 32 images to the model at a time; Height = 64: the height of each image is 64 pixels; Width = 64: the width of each image is 64 pixels; Channels = 128: the number of channels (or depth) of each image is 128; for ordinary RGB images, it is 3 here; Step 2, the first convolutional layer, the first pooling layer, the second convolutional layer and the second pooling layer of the pesticide residue detection model extract features of the hot spot area, color distribution, texture morphology and edge change of the pesticide residue detection part of the target crop shown by the to-be-detected gray image, to obtain a feature vector of the to-be-detected gray image; Step 3, the first full connection layer, the Dropout layer and the second full connection layer of the pesticide residue detection model classify the feature vector of the to-be-detected gray image, to obtain the pesticide residue information of the pesticide residue detection part of the target crop; In the embodiment of the application, the first full connection layer, the Dropout layer and the second full connection layer of the pesticide residue detection model compare the feature vector of the to-be-detected gray image obtained in step 2 with the feature vectors in the pesticide residue target standard database obtained in the above 2.6 part, to obtain the pesticide residue information corresponding to the feature vector with the highest similarity to the feature vector of the to-be-detected gray image in the pesticide residue target standard database, as the pesticide residue information of the pesticide residue detection part of the target crop; Specifically, the high-dimensional feature map output by the convolution and pooling layer is unfolded into a feature vector and input to the first fully connected layer, the Dropout layer and the second fully connected layer of the model; the layer maps the image space features to a probability vector or a class output in a discrimination space through a weight matrix, and the output result of the second fully connected layer is processed by a Softmax or Sigmoid activation function, and the pesticide residue information of the pesticide residue detection part on the target crop is output. Step 4: The output layer of the pesticide residue detection model outputs the pesticide residue information of the pesticide residue detection part on the target crop. In an application scenario, the output of the pesticide residue detection model can be a probability distribution vector; the probability distribution vector is as follows: Data shape: (Batch Size, Num_Classes). Example (assuming there are 4 classes): (32, 4). Meaning: Batch Size = 32: corresponding to 32 input images, the model will give 32 prediction results; Num_Classes = 4: assuming that there are 4 classes to be identified: ['chlorpyrifos', 'carbendazim', 'acetamiprid', 'no pesticide']. Output example for one image: [0.1, 0.8, 0.05, 0.05]; the meaning of this vector is: the model predicts that the pesticide in the image to be detected has a 10% probability of being 'chlorpyrifos', an 80% probability of being 'carbendazim', a 5% probability of being 'acetamiprid', and a 5% probability of being 'no pesticide'; finally, we will select the class with the highest probability (i.e. 'carbendazim') as the prediction result of the model.
[0033] In summary, in the infrared imaging driven pesticide residue intelligent detection method provided by the embodiments of the present application, the detected image showing the pesticide residue detection part on the target crop is first converted to grayscale to obtain a detected grayscale image of the target crop, and then the pesticide residue detection model constructed based on the convolutional neural network model is used to detect the detected grayscale image of the target crop to obtain the pesticide residue information of the pesticide residue detection part on the target crop. In the above process, the grayscale conversion operation can highlight the hot spot, edge texture or grayscale jump of the detected image, and on this basis, the pesticide residue detection model has high detection efficiency and high accuracy for the detected grayscale image, can efficiently and accurately detect pesticide residues, and thus reduce the harm of food containing pesticide residues to human health and the ecological environment.
[0034] Correspondingly, the present application provides an infrared imaging driven pesticide residue intelligent detection device, which comprises Figure 3As shown, the device includes a to-be-detected image acquisition module 501, a grayscale image determination module 502, and a pesticide residue detection module 503. The to-be-detected image acquisition module 501 is configured to acquire a to-be-detected image of a target crop. The to-be-detected image is an infrared image showing a pesticide residue to-be-detected part of the target crop. The pesticide residue to-be-detected part is a leaf front surface, a leaf back surface, a fruit skin, or a stem joint. For example, the to-be-detected image acquisition module 501 is configured to implement S101 of the method. The grayscale image determination module 502 is configured to determine a to-be-detected grayscale image of the target crop based on the to-be-detected image of the target crop. For example, the grayscale image determination module 502 is configured to implement S102 of the method. The pesticide residue detection module 503 is configured to determine pesticide residue information of the pesticide residue to-be-detected part of the target crop based on the to-be-detected grayscale image of the target crop and a pesticide residue detection model. The pesticide residue detection model is constructed based on a convolutional neural network model. For example, the pesticide residue detection module 503 is configured to implement S103 of the method. The modules of the infrared imaging driven pesticide residue intelligent detection device described above can also be used to perform other steps in the method embodiments described above. All related content involved in the method embodiments described above can be cited in the function description of the corresponding functional modules, and will not be described here. The embodiments of the present application also provide an electronic device, which includes a processor and a memory coupled to the processor. The memory is configured to store computer instructions. When the electronic device is running, the processor executes the computer instructions stored in the memory to enable the electronic device to perform the method in the above embodiments. The processor can implement the to-be-detected image acquisition module 501, the grayscale image determination module 502, and the pesticide residue detection module 503. The memory can also be configured to store the to-be-detected image, the to-be-detected grayscale image, the pesticide residue detection model, and the pesticide residue information.
[0035] The embodiments of the present application also provide a computer readable storage medium, which includes a computer program. When the computer program is running on a computer, the computer program is configured to perform the method in the above embodiments.
[0036] The embodiments of the present application also provide a computer program product, which includes computer program instructions. When the computer program instructions are running on a computer, the computer program instructions are configured to perform the method in the above embodiments.
[0037] Each of the embodiments in the present specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments.
[0038] Finally, it should be noted that the above examples are only used to illustrate the technical solutions of the present application, and are not intended to limit the same; although the present application has been described in detail with reference to the foregoing examples, those of ordinary skill in the art should understand that the technical solutions recorded in the foregoing examples can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An infrared imaging-driven intelligent detection method for pesticide residues, characterized in that, include: Acquire a target crop image to be detected; wherein, the target crop image is an infrared image showing the area on the target crop where pesticide residues are to be detected; the area where pesticide residues are to be detected is the front or back of the leaf, the epidermis of the fruit, or the junction of the stem; Based on the image of the target crop to be detected, determine the grayscale image of the target crop to be detected; Based on the grayscale image of the target crop to be detected and the pesticide residue detection model, the pesticide residue information of the parts of the target crop to be detected is determined; the pesticide residue detection model is constructed based on a convolutional neural network model.
2. The method as described in claim 1, characterized in that, The process of determining pesticide residue information at the sites on the target crop to be tested includes: The grayscale image of the target crop to be detected is input into the pesticide residue detection model. The pesticide residue detection model analyzes the hot spot area, color distribution, texture morphology, and edge changes of the pesticide residue detection area on the target crop shown in the grayscale image to output pesticide residue information of the pesticide residue detection area on the target crop. The pesticide residue information includes whether there is pesticide residue in the pesticide residue detection area, the type of pesticide residue, and the degree of pesticide pollution.
3. The method as described in claim 2, characterized in that, The pesticide residue detection model comprises, in sequence, an electrically connected input layer, a first convolutional layer, a first pooling layer, a second convolutional layer, a second pooling layer, a first fully connected layer, a Dropout layer, a second fully connected layer, and an output layer.
4. The method as described in claim 3, characterized in that, The pesticide residue detection model analyzes the hot spot region, color distribution, texture morphology, and edge changes of the pesticide residue detection area on the target crop as shown in the grayscale image to be detected, in order to output pesticide residue information of the pesticide residue detection area on the target crop, including: Step 1: The grayscale image to be detected enters the pesticide residue detection model through the input layer of the pesticide residue detection model; Step 2: The first convolutional layer, the first pooling layer, the second convolutional layer, and the second pooling layer of the pesticide residue detection model extract features from the hot spot area, color distribution, texture morphology, and edge changes of the pesticide residue detection site on the target crop shown in the grayscale image to be detected, and obtain the feature vector of the grayscale image to be detected. Step 3: The first fully connected layer, Dropout layer and the second fully connected layer of the pesticide residue detection model classify the feature vector of the grayscale image to be detected, and obtain the pesticide residue information of the pesticide residue detection site on the target crop. Step 4: The output layer of the pesticide residue detection model outputs the pesticide residue information of the parts of the target crop to be detected.
5. The method as described in claim 1, characterized in that, The method also includes training the pesticide residue detection model, and the training process is as follows; Construct a convolutional neural network model; Obtain a training image dataset for training the convolutional neural network model; the training image dataset includes multiple pesticide residue images; each pesticide residue infrared image in the multiple pesticide residue images is labeled with the crop type, crop growth stage, pesticide type, and pollution level; the pesticide residue images are either unprocessed infrared images or grayscale processed infrared images. The convolutional neural network model is trained using the training image dataset to obtain the pesticide residue detection model.
6. The method as described in claim 1, characterized in that, The step of determining the grayscale image to be detected for the target crop includes: A piecewise linear grayscale transformation is performed on the image of the target crop to be detected, resulting in a grayscale image of the target crop to be detected; the piecewise linear grayscale transformation satisfies the following formula; in, This represents the original gray level of the pixels in the image to be detected. This represents the transformed grayscale value of a pixel in the image to be detected. This represents the first original grayscale threshold. This represents the second original grayscale threshold. Indicates the grayscale threshold for the first transformation. This represents the grayscale threshold for the second transformation.
7. An infrared imaging-driven intelligent pesticide residue detection device, used to implement the method described in any one of claims 1 to 6, characterized in that, It includes a module for acquiring the image to be detected, a module for determining the grayscale image, and a module for detecting pesticide residues; The image acquisition module is used to acquire an image of the target crop to be detected; wherein, the image to be detected is an infrared image showing the area of pesticide residue to be detected on the target crop; the area of pesticide residue to be detected is the front and back of the leaves, the epidermis of the fruit, or the junction of the stem; The grayscale image determination module is used to determine the grayscale image to be detected of the target crop based on the image to be detected of the target crop. The pesticide residue detection module is used to determine the pesticide residue information of the parts of the target crop to be detected based on the grayscale image of the target crop and the pesticide residue detection model; the pesticide residue detection model is constructed based on a convolutional neural network model.
8. An electronic device, characterized in that, The device includes a processor and a memory coupled to the processor; the memory is used to store computer instructions, which, when the electronic device is running, are executed by the processor to cause the electronic device to perform the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, It includes computer program instructions that, when executed by a computer, cause the computer to perform the method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, It includes computer program instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 6.