Crop pest identification method, device, equipment and medium

By acquiring and processing visible light and infrared images of crop pests, and using the optimized CNN image recognition network, it solves the identification difficulties of traditional manual identification in all-weather and low-light conditions, and achieves accurate and efficient pest identification.

CN118658010APending Publication Date: 2024-09-17YUNNAN HANZHE TECHN CO LTD

Patent Information

Application Number
CN202411133803.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Traditional manual identification of pests has low accuracy and low efficiency. It is especially difficult to effectively identify crop pests under all-weather and low-light conditions.

Method used

By acquiring visible light and infrared images, registering and labeling them, and then inputting a preset image fusion model, the optimized CNN image recognition network is used for training to achieve accurate identification of crop pests all-weather and in low light.

Benefits of technology

It achieves accurate identification of crop pests under all-weather, low-light conditions, eliminates dependence on light conditions, improves identification efficiency and accuracy, and saves computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118658010A
    Figure CN118658010A
Patent Text Reader

Abstract

The invention discloses a crop pest recognition method, device and equipment and a medium. The method comprises the following steps: acquiring a visible light image and an infrared image of a to-be-processed crop pest; registering and marking the to-be-processed crop pest visible light image and the to-be-processed crop pest infrared image to obtain a processed crop pest visible light image and a processed crop pest infrared image; inputting the processed crop pest visible light image and the processed crop pest infrared image into a preset image fusion model to obtain a target fusion image; inputting the target fusion image into a to-be-trained CNN image recognition network for training to obtain a target CNN image recognition network; and inputting the to-be-identified crop pest image into the target CNN image identification network to obtain a classification result of pests in the to-be-identified crop pest image. The invention belongs to the field of pest recognition. According to the invention, all-weather and low-illumination crop pest identification and detection can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of pest identification, and in particular to a method, device, equipment and medium for identifying crop pests. Background Art

[0002] Crop pests cause a variety of damage to agricultural production, and their impacts may include reduced yields, reduced quality, and economic losses. Crop pests can directly damage crops by chewing, sucking, or digging. Leaf-feeding pests may chew leaves, affecting photosynthesis; borers and other borers may eat stems or fruits; damage caused by pests may cause crop growth to be stunted, ultimately leading to reduced yields. Crop pests can carry and spread pathogens such as viruses, bacteria, or fungi. Fruits infested by borers may develop scars, rot, or have odors, affecting sales and consumption; some pests may become a public health risk. Therefore, it is extremely important to control pests on field crops.

[0003] However, traditional manual pest identification has many limitations. For example, manual identification is subjective and has low accuracy. In addition, manual pest identification is labor-intensive and inefficient. Manual pest identification usually relies on visible light, which makes it difficult to monitor pests at night or in low-light environments. In view of this, the present application proposes a crop pest identification method that can achieve all-weather, low-light crop pest identification and detection. Summary of the invention

[0004] The embodiments of the present application solve the technical problem that pests cannot be identified in all-weather and low-light conditions in the prior art by providing a method, device, equipment and medium for identifying crop pests, thereby achieving the technical effect of being able to identify pests in all-weather and low-light conditions.

[0005] In a first aspect, the present application provides a method for identifying crop pests, the method comprising: Acquire a plurality of visible light images of crop pests to be treated and a plurality of infrared images of crop pests to be treated, wherein the visible light images of crop pests to be treated correspond to the infrared images of crop pests to be treated one by one, and the visible light images of crop pests to be treated and the corresponding infrared images of crop pests to be treated are taken at the same time, at the same place and at the same angle; Registering and marking a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, to obtain a plurality of visible light images of processed crop pests and a plurality of infrared images of processed crop pests, wherein the visible light images of processed crop pests correspond to the infrared images of processed crop pests one by one; Inputting a plurality of processed crop pest visible light images and a plurality of processed crop pest infrared images into a preset image fusion model to obtain a plurality of target fusion images, wherein the processed crop pest visible light images, the processed crop pest infrared images and the target fusion images correspond one to one; Input several target fusion images into the CNN image recognition network to be trained to obtain the target CNN image recognition network; The crop pest image to be identified is input into the target CNN image recognition network to obtain the classification result of the pests in the crop pest image to be identified.

[0006] Furthermore, before obtaining a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, the method includes: According to the preset image clarity, the preset pest image ratio and the preset pest stacking scenario, several photographed visible light images of crop pests and several photographed infrared images of crop pests are screened to obtain several visible light images of crop pests to be processed and several infrared images of crop pests to be processed. The photographed visible light images of crop pests correspond one to one to the photographed infrared images of crop pests.

[0007] Furthermore, a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed are marked, including: The crop pests and / or image background in the visible light image of the crop pests to be processed and the infrared image of the crop pests to be processed are marked.

[0008] Furthermore, several target fusion images are input into the CNN image recognition network to be trained for training, including: The plurality of target fusion images are divided into a training target fusion image, a test target fusion image and a verification target fusion image according to a preset distribution ratio; Input several training target fusion images into the CNN image recognition network to be trained to train the CNN image recognition network to be trained.

[0009] Furthermore, a preset image fusion model is constructed, and the method includes: Delete the second TRM module in the DATFuse model and add a multi-head self-attention layer to the DATFuse model to optimize the DATFuse model, and use the optimized DATFuse model as the preset image fusion model; Further, the optimized DATFuse model is trained based on a plurality of processed crop pest visible light images and a plurality of processed crop pest infrared images, and the method further includes: The module expression of the shallow feature extraction stage of the DATFuse model is:

[0010] in, is the output of the TRM module, For processed crop pest infrared images, This is a visible light image of processed crop pests. () is the batch normalization function, () is the ReLU activation function; The extraction expression of the DARM module of the DATFuse model is:

[0011]

[0012]

[0013]

[0014]

[0015] in, is the output of the DARM module, is the output of the channel attention module, Represents the input of the DARM module, represents the output of the spatial attention module, () is the batch normalization function, () is the ReLU activation function, Sig() is the Sigmoid activation function, is the output of the channel attention block in the DARM module, is the output of the residual block in the DARM module, is the output of the spatial attention block in the DARM module; Dependencies are built based on the TRM module, and the expression is:

[0016]

[0017]

[0018] in, is the output of the TRM module, is the output of the multi-head self-attention layer of the first layer, is the output of the second multi-head self-attention layer, MSA is multi-head self-attention, MLP is multi-layer perceptron, LN represents layer normalization, It is the input of TRM module; Finally, a convolution module of the DATFuse model is used to reduce the dimension and obtain the fusion result:

[0019] is the input of the last convolution module, Tanh() represents the tanh activation function, Fusion of images for the target; Among them, determining the loss function also includes:

[0020]

[0021]

[0022]

[0023] Among them, L is the total loss function, is the pixel loss, is the gradient loss, is the structural similarity loss, λ and γ represent the weight factors controlling the contribution of each term; They are target fusion image, processed crop pest infrared image, and processed crop pest visible light image respectively. is the F-paradigm, is the second normal form of the matrix, ▽ represents the gradient operation; H and W represent the height and width of the image, SSIM is the structural similarity, is the weight factor.

[0024] Furthermore, a CNN image recognition network to be trained is constructed, including: Use ResNet18 as the initial CNN image recognition network to be trained; Based on 1x1 convolution kernel to reduce the number of channels of the input feature map of the initial CNN image recognition network to be trained; Feature extraction based on 3x3 convolution kernel; The number of channels is restored based on 1x1 convolution.

[0025] In a second aspect, the present application provides a crop pest identification device, the device comprising: An acquisition module is used to acquire a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, wherein the visible light images of crop pests to be processed correspond to the infrared images of crop pests to be processed one by one, and the visible light images of crop pests to be processed and the corresponding infrared images of crop pests to be processed are taken at the same time, at the same place and at the same angle; A registration and marking module is used to register and mark a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, so as to obtain a plurality of visible light images of processed crop pests and a plurality of infrared images of processed crop pests, wherein the visible light images of processed crop pests correspond to the infrared images of processed crop pests one by one; A fusion module is used to input a plurality of processed crop pest visible light images and a plurality of processed crop pest infrared images into a preset image fusion model to obtain a plurality of target fusion images, wherein the processed crop pest visible light images, the processed crop pest infrared images and the target fusion images correspond to each other one by one; A training module is used to input a number of target fusion images into the CNN image recognition network to be trained to obtain a target CNN image recognition network; The classification module is used to input the crop pest image to be identified into the target CNN image recognition network to obtain the classification result of the pests in the crop pest image to be identified.

[0026] In a third aspect, the present application provides an electronic device, including: processor; a memory for storing processor-executable instructions; The processor is configured to execute to implement a crop pest identification method as provided in the first aspect.

[0027] In a fourth aspect, the present application provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to implement a crop pest identification method as provided in the first aspect.

[0028] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: The present application obtains several visible light images of crop pests to be processed and several infrared images of crop pests to be processed; aligns and marks several visible light images of crop pests to be processed and several infrared images of crop pests to be processed to obtain several visible light images of processed crop pests and several infrared images of processed crop pests; inputs several visible light images of processed crop pests and several infrared images of processed crop pests into a preset image fusion model to obtain several target fusion images; inputs several target fusion images into a CNN image recognition network to be trained to obtain a target CNN image recognition network; inputs the crop pest images to be identified into the target CNN image recognition network to obtain the classification results of the pests in the crop pest images to be identified. The present application can classify and identify the pests in the crop pest images to be identified more accurately based on the target CNN image recognition network. This application uses an optimized dual-attention Transformer module to fuse infrared and visible light pest images for image recognition, which can eliminate the dependence of existing image recognition models on lighting conditions to a certain extent and can adapt to daytime, nighttime and low-light conditions. The image fusion model optimized in this application contains a TRM structure with two multi-head self-attention layers, which can capture more contextual information within a single module and has a smaller number of parameters, saving computing resources. This application uses a bottleneck structure to optimize the residual module of the ResNet18 model, which can reduce the number of parameters of the model and improve the expressiveness of the model to achieve better pest recognition results. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0030] Figure 1 A schematic diagram of a method for identifying crop pests provided in this application; Figure 2 A schematic diagram of the structure of a crop pest identification device provided in this application; Figure 3 A schematic diagram of the structure of an electronic device provided in this application; Figure 4 A schematic diagram of the structure of an improved TRM module provided in this application. DETAILED DESCRIPTION

[0031] The embodiment of the present application solves the technical problem in the prior art that pests cannot be identified under all-weather and low-light conditions by providing a method for identifying crop pests.

[0032] The technical solution of the embodiment of the present application is to solve the above technical problems, and the overall idea is as follows: A method for identifying crop pests, the method comprising: obtaining a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, the visible light images of crop pests to be processed and the infrared images of crop pests to be processed corresponding to each other, the visible light images of crop pests to be processed and the corresponding infrared images of crop pests to be processed being taken at the same time, the same place and the same angle; registering and marking the plurality of visible light images of crop pests to be processed and the plurality of infrared images of crop pests to be processed, obtaining a plurality of visible light images of processed crop pests and a plurality of infrared images of processed crop pests, the processed The visible light images of crop pests correspond to the processed infrared images of crop pests one by one; a plurality of processed visible light images of crop pests and a plurality of processed infrared images of crop pests are input into a preset image fusion model to obtain a plurality of target fusion images, and the processed visible light images of crop pests, the processed infrared images of crop pests and the target fusion images correspond to each other one by one; a plurality of target fusion images are input into a CNN image recognition network to be trained to obtain a target CNN image recognition network; the crop pest images to be identified are input into the target CNN image recognition network to obtain the classification results of the pests in the crop pest images to be identified.

[0033] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0034] First of all, the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0035] This application provides Figure 1 A crop pest identification method shown includes steps S11-S15.

[0036] Step S11, obtaining a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, wherein the visible light images of crop pests to be processed correspond to the infrared images of crop pests to be processed one by one, and the visible light images of crop pests to be processed and the corresponding infrared images of crop pests to be processed are taken at the same time, at the same place and at the same angle.

[0037] Step S12, registering and marking a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, to obtain a plurality of visible light images of processed crop pests and a plurality of infrared images of processed crop pests, wherein the visible light images of processed crop pests correspond to the infrared images of processed crop pests one by one.

[0038] Step S13, inputting a plurality of processed crop pest visible light images and a plurality of processed crop pest infrared images into a preset image fusion model to obtain a plurality of target fused images, wherein the processed crop pest visible light images, the processed crop pest infrared images and the target fused images correspond one to one.

[0039] Step S14, inputting a plurality of target fused images into the CNN image recognition network to be trained to obtain a target CNN image recognition network.

[0040] Step S15, inputting the crop pest image to be identified into the target CNN image recognition network to obtain the classification result of the pests in the crop pest image to be identified.

[0041] Regarding step S11, a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed are obtained. The visible light images of crop pests to be processed correspond to the infrared images of crop pests to be processed one by one. The visible light images of crop pests to be processed and the corresponding infrared images of crop pests to be processed are taken at the same time, the same place and the same angle.

[0042] The visible light image of crop pests to be processed refers to the image of crop pests within the electromagnetic wave frequency band visible to human eyes. The visible light image of crop pests to be processed is composed of the pest image and the background image.

[0043] The infrared image of crop pests to be processed refers to an image captured by an infrared sensor or an infrared camera, which displays information within the infrared spectrum. The infrared image of crop pests to be processed also includes pest images and background images.

[0044] In order to ensure that the visible light images of crop pests to be processed and the infrared images of crop pests to be processed can be directly applied to step S12, before obtaining a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, the following steps may be included: According to the preset image clarity, the preset pest image ratio and the preset pest stacking scenario, several photographed visible light images of crop pests and several photographed infrared images of crop pests are screened to obtain several visible light images of crop pests to be processed and several infrared images of crop pests to be processed. The photographed visible light images of crop pests correspond one to one to the photographed infrared images of crop pests.

[0045] It is understandable that in the captured visible light images of crop pests or several captured infrared images of crop pests, there may be pests that are too small to be accurately identified, or the pests are stacked in the images and cannot be accurately identified, or the pixels of the images are not clear and cannot be accurately identified.

[0046] Therefore, according to the preset image clarity, the preset pest image ratio and the preset pest stacking scenario, several captured visible light images of crop pests and several captured infrared images of crop pests can be screened, and the unrecognizable captured visible light images and captured infrared images of crop pests can be eliminated, and the recognizable captured visible light images and captured infrared images of crop pests can be used as the visible light images and infrared images of crop pests to be processed.

[0047] The preset image clarity can be determined according to actual conditions, for example, 5M. Images below 5M cannot be used. The preset pest image ratio can be determined according to actual conditions, for example, 20%. If the ratio of pest images in the image is less than 20% of the entire image, it cannot be used. The preset pest stacking scenario can also be determined according to actual conditions. For example, if there is pest stacking in the image, it cannot be used.

[0048] Each visible light image of the crop pests to be processed corresponds to an infrared image of the crop pests to be processed, and the visible light image of the crop pests to be processed and the corresponding infrared image of the crop pests to be processed are taken at the same time, the same place and the same angle.

[0049] Regarding step S12, several visible light images of crop pests to be processed and several infrared images of crop pests to be processed are registered and marked to obtain several visible light images of processed crop pests and several infrared images of processed crop pests, and the visible light images of processed crop pests correspond to the infrared images of processed crop pests one by one.

[0050] After obtaining a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, the plurality of visible light images of crop pests to be processed and the plurality of infrared images of crop pests to be processed may be registered and marked, specifically including: Registration: Before the fusion of infrared images and visible light images, registration can usually be performed. Registration refers to matching the pixels of two or more images so that the infrared image and the visible light image are spatially aligned for subsequent processing and analysis. Images obtained by different sensors may have position deviation, angle deviation or scale deviation. Registration can help eliminate the deviation and ensure accurate alignment of the images.

[0051] Marking: Marking the crop pests and / or image background in the visible light image of the crop pests to be treated and the infrared image of the crop pests to be treated.

[0052] If the purpose is to improve the processing efficiency, only the crop pests in the visible light image of the crop pests to be processed and the infrared image of the crop pests to be processed can be marked. If the purpose is to improve the processing accuracy, the crop pests and the image background in the visible light image of the crop pests to be processed and the infrared image of the crop pests to be processed can also be marked together.

[0053] Regarding step S13, a number of processed crop pest visible light images and a number of processed crop pest infrared images are input into a preset image fusion model to obtain a number of target fusion images, and the processed crop pest visible light images, the processed crop pest infrared images and the target fusion images correspond one to one.

[0054] Furthermore, the visible light image of the processed crop pests and the infrared image of the processed crop pests obtained in the present application are both paired, and a corresponding target fusion image can be obtained from a pair of visible light images of the processed crop pests and the infrared image of the processed crop pests.

[0055] The preset image fusion model of the present application can be an infrared and visible light image fusion model of a dual attention Transformer.

[0056] Construct a preset image fusion model, the method includes (you can refer to Figure 4 , Figure 4 The improved TRM module is shown in the figure below: The second TRM module in the DATFuse model is deleted, and a multi-head self-attention layer is added to the DATFuse model to optimize the DATFuse model, and the optimized DATFuse model is used as the preset image fusion model.

[0057] It can be understood that after obtaining the preset image fusion model, it can be used to fuse images. In order to further improve the accuracy of the fused image, the optimized DATFuse model can also be trained based on a number of processed crop pest visible light images and a number of processed crop pest infrared images. The method also includes: The module expression of the shallow feature extraction stage of the DATFuse model is:

[0058] in, is the output of the TRM module, For processed crop pest infrared images, This is a visible light image of processed crop pests. () is the batch normalization function, () is the ReLU activation function.

[0059] The extraction expression of the DARM module of the DATFuse model is:

[0060]

[0061]

[0062]

[0063]

[0064] in, is the output of the DARM module, is the output of the channel attention module, Represents the input of the DARM module, represents the output of the spatial attention module, () is the batch normalization function, () is the ReLU activation function, Sig() is the Sigmoid activation function, is the output of the channel attention block in the DARM module, is the output of the residual block in the DARM module, is the output of the spatial attention block in the DARM module.

[0065] Dependencies are built based on the TRM module, and the expression is:

[0066]

[0067]

[0068] in, is the output of the TRM module, is the output of the multi-head self-attention layer of the first layer, is the output of the second multi-head self-attention layer, MSA is multi-head self-attention, MLP is multi-layer perceptron, LN represents layer normalization, It is the input of the TRM module.

[0069] Finally, a convolution module of the DATFuse model is used to reduce the dimension and obtain the fusion result:

[0070] is the input of the last convolution module, Tanh() represents the tanh activation function, Fusion of images for the target; Among them, determining the loss function also includes:

[0071]

[0072]

[0073]

[0074] Among them, L is the total loss function, is the pixel loss, is the gradient loss, is the structural similarity loss, λ and γ represent the weight factors controlling the contribution of each term; They are target fusion image, processed crop pest infrared image, and processed crop pest visible light image respectively. is the F-paradigm, is the second normal form of the matrix, ▽ represents the gradient operation; H and W represent the height and width of the image, SSIM is the structural similarity, is the weight factor.

[0075] It can be understood that in the present application, a number of processed crop pest visible light images and a number of processed crop pest infrared images can be allocated according to a preset allocation ratio, and used for training, testing and verification respectively.

[0076] For example, there are 100 pairs of processed crop pest visible light images and processed crop pest infrared images, and the preset allocation ratio is 7:1:2. Then there are 70 pairs of images used to train the optimized DATFuse model, 10 pairs for testing, and 20 pairs for verification.

[0077] Regarding step S14, a plurality of target fused images are input into the CNN image recognition network to be trained to obtain a target CNN image recognition network.

[0078] After obtaining a plurality of target fusion images, the plurality of target fusion images are input into the to-be-trained CNN image recognition network for training, including: dividing the plurality of target fusion images into training target fusion images, testing target fusion images and verification target fusion images in a preset distribution ratio; and inputting the plurality of training target fusion images into the to-be-trained CNN image recognition network to train the to-be-trained CNN image recognition network.

[0079] The preset number allocation ratio can be determined according to actual conditions, and can be specifically 7:1:2. The training target fusion image is input into the CNN image recognition network to be trained, so as to train the CNN image recognition network to be trained.

[0080] CNN image recognition network refers to convolutional neural network, which is an artificial neural network structure used to process and analyze images. CNN image recognition network mainly includes: Convolutional Layer: The convolutional layer is the core component of CNN, which extracts features from the input image by sliding convolution kernels (also called filters) on the input image. Each convolution kernel produces a feature map that contains feature information at different locations in the image.

[0081] Pooling Layer: The pooling layer is used to reduce the size of the feature map, reduce the amount of computation, and increase the model's robustness to translation and scaling.

[0082] Fully Connected Layer: The fully connected layer converts the feature maps extracted by the convolution and pooling layers into a vector with the number of output categories, which is usually used for the final classification or regression task.

[0083] Specifically, ResNet18 can be used as the initial CNN image recognition network to be trained; a 1x1 convolution kernel is used to reduce the number of channels of the input feature map of the initial CNN image recognition network to be trained; a 3x3 convolution kernel is used for feature extraction; and a 1x1 convolution is used to restore the number of channels.

[0084] Regarding step S15, the crop pest image to be identified is input into the target CNN image recognition network to obtain the classification result of the pests in the crop pest image to be identified.

[0085] The target CNN image recognition network is obtained, and the crop pest image to be identified can be input into the target CNN image recognition network. The target CNN image recognition network classifies and identifies the pests in the crop pest image to be identified, and obtains the classification of the pests in the crop pest image to be identified.

[0086] In summary, the present application obtains several visible light images of crop pests to be processed and several infrared images of crop pests to be processed; aligns and marks several visible light images of crop pests to be processed and several infrared images of crop pests to be processed to obtain several visible light images of processed crop pests and several infrared images of processed crop pests; inputs several visible light images of processed crop pests and several infrared images of processed crop pests into a preset image fusion model to obtain several target fusion images; inputs several target fusion images into a CNN image recognition network to be trained to obtain a target CNN image recognition network; inputs the crop pest images to be identified into the target CNN image recognition network to obtain the classification results of the pests in the crop pest images to be identified. Based on the target CNN image recognition network, the present application can more accurately classify and identify the pests in the crop pest images to be identified. This application uses an optimized dual-attention Transformer module to fuse infrared and visible light pest images for image recognition, which can eliminate the dependence of existing image recognition models on lighting conditions to a certain extent and can adapt to daytime, nighttime and low-light conditions. The image fusion model optimized in this application contains a TRM structure with two multi-head self-attention layers, which can capture more contextual information within a single module and has a smaller number of parameters, saving computing resources. This application uses a bottleneck structure to optimize the residual module of the ResNet18 model, which can reduce the number of parameters of the model and improve the expressiveness of the model to achieve better pest recognition results.

[0087] Based on the same inventive concept, the present application provides Figure 2 A crop pest identification device is shown, the device comprising: An acquisition module 21 is used to acquire a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, wherein the visible light images of crop pests to be processed correspond to the infrared images of crop pests to be processed one by one, and the visible light images of crop pests to be processed and the corresponding infrared images of crop pests to be processed are taken at the same time, at the same place and at the same angle; A registration and marking module 22 is used to register and mark a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, so as to obtain a plurality of visible light images of processed crop pests and a plurality of infrared images of processed crop pests, wherein the visible light images of processed crop pests correspond to the infrared images of processed crop pests one by one; A fusion module 23 is used to input a plurality of processed crop pest visible light images and a plurality of processed crop pest infrared images into a preset image fusion model to obtain a plurality of target fusion images, wherein the processed crop pest visible light images, the processed crop pest infrared images and the target fusion images correspond to each other one by one; A training module 24 is used to input a plurality of target fusion images into a CNN image recognition network to be trained to obtain a target CNN image recognition network; The classification module 25 is used to input the crop pest image to be identified into the target CNN image recognition network to obtain the classification result of the pests in the crop pest image to be identified.

[0088] Based on the same inventive concept, the present application also provides Figure 3 An electronic device as shown includes: Processor 31; A memory 32 for storing instructions executable by the processor 31; The processor 31 is configured to execute to implement a crop pest identification method as provided above.

[0089] Based on the same inventive concept, the present application also provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by the processor 31 of the electronic device, the electronic device can implement a crop pest identification method as provided above.

[0090] Since the electronic device introduced in this embodiment is an electronic device used to implement the information processing method in the embodiment of the present application, based on the information processing method introduced in the embodiment of the present application, a person skilled in the art can understand the specific implementation of the electronic device of the present embodiment and its various variations, so how the electronic device implements the method in the embodiment of the present application is not described in detail here. As long as a person skilled in the art implements the electronic device used by the information processing method in the embodiment of the present application, it belongs to the scope of protection of this application.

[0091] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0092] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0093] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0094] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0095] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0096] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for identifying crop pests, It is characterized in that The method comprises: Acquire a plurality of visible light images of crop pests to be treated and a plurality of infrared images of crop pests to be treated, wherein the visible light images of crop pests to be treated correspond to the infrared images of crop pests to be treated one by one, and the visible light images of crop pests to be treated and the corresponding infrared images of crop pests to be treated are taken at the same time, at the same place and at the same angle; Registering and marking a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, to obtain a plurality of visible light images of processed crop pests and a plurality of infrared images of processed crop pests, wherein the visible light images of processed crop pests correspond to the infrared images of processed crop pests one by one; Inputting a plurality of processed crop pest visible light images and a plurality of processed crop pest infrared images into a preset image fusion model to obtain a plurality of target fusion images, wherein the processed crop pest visible light images, the processed crop pest infrared images and the target fusion images correspond one to one; Input several target fusion images into the CNN image recognition network to be trained to obtain the target CNN image recognition network; The crop pest image to be identified is input into the target CNN image recognition network to obtain the classification result of the pests in the crop pest image to be identified.

2. A method for identifying crop pests as claimed in claim 1, It is characterized in that Before obtaining a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, the method includes: According to the preset image clarity, the preset pest image ratio and the preset pest stacking scenario, several photographed visible light images of crop pests and several photographed infrared images of crop pests are screened to obtain several visible light images of crop pests to be processed and several infrared images of crop pests to be processed. The photographed visible light images of crop pests correspond one to one to the photographed infrared images of crop pests.

3. A method for identifying crop pests as claimed in claim 1, It is characterized in that Mark several visible light images of crop pests to be processed and several infrared images of crop pests to be processed, including: The crop pests and / or image background in the visible light image of the crop pests to be processed and the infrared image of the crop pests to be processed are marked.

4. A method for identifying crop pests as claimed in claim 1, It is characterized in that The step of inputting a plurality of target fusion images into the CNN image recognition network to be trained for training includes: The plurality of target fusion images are divided into a training target fusion image, a test target fusion image and a verification target fusion image according to a preset distribution ratio; Input a plurality of training target fusion images into the CNN image recognition network to be trained to train the CNN image recognition network to be trained.

5. A method for identifying crop pests as claimed in claim 1, It is characterized in that Construct a preset image fusion model, the method includes: The second TRM module in the DATFuse model is deleted, and a multi-head self-attention layer is added to the DATFuse model to optimize the DATFuse model, and the optimized DATFuse model is used as the preset image fusion model.

6. A method for identifying crop pests as claimed in claim 5, It is characterized in that The optimized DATFuse model is trained based on a number of processed crop pest visible light images and a number of processed crop pest infrared images, and the method further includes: The module expression of the shallow feature extraction stage of the DATFuse model is: in, is the output of the TRM module, For processed crop pest infrared images, This is a visible light image of processed crop pests. () is the batch normalization function, () is the ReLU activation function; The extraction expression of the DARM module of the DATFuse model is: in, is the output of the DARM module, is the output of the channel attention module, Represents the input of the DARM module, represents the output of the spatial attention module, () is the batch normalization function, () is the ReLU activation function, Sig() is the Sigmoid activation function, is the output of the channel attention block in the DARM module, is the output of the residual block in the DARM module, is the output of the spatial attention block in the DARM module; The dependency relationship is constructed based on the TRM module, and the expression is: in, is the output of the TRM module, is the output of the multi-head self-attention layer of the first layer, is the output of the second multi-head self-attention layer, MSA is multi-head self-attention, MLP is multi-layer perceptron, LN represents layer normalization, is the input of the TRM module; Finally, a convolution module of the DATFuse model is used to reduce the dimension and obtain the fusion result: is the input of the last convolution module, Tanh() represents the tanh activation function, Fusion of images for the target; Among them, determining the loss function also includes: Among them, L is the total loss function, is the pixel loss, is the gradient loss, is the structural similarity loss, λ and γ represent the weight factors controlling the contribution of each term; They are target fusion image, processed crop pest infrared image, and processed crop pest visible light image respectively; is the F-paradigm, is the second normal form of the matrix, ▽ represents the gradient operation; H and W represent the height and width of the image, SSIM is the structural similarity, is the weight factor.

7. A method for identifying crop pests as claimed in claim 1, It is characterized in that Build a CNN image recognition network to be trained, including: Use ResNet18 as the initial CNN image recognition network to be trained; Based on 1x1 convolution kernel to reduce the number of channels of the input feature map of the initial CNN image recognition network to be trained; Feature extraction based on 3x3 convolution kernel; The number of channels is restored based on 1x1 convolution.

8. A crop pest identification device, It is characterized in that The device comprises: An acquisition module is used to acquire a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, wherein the visible light images of crop pests to be processed correspond to the infrared images of crop pests to be processed one by one, and the visible light images of crop pests to be processed and the corresponding infrared images of crop pests to be processed are taken at the same time, at the same place and at the same angle; A registration and marking module is used to register and mark a plurality of visible light images of crop pests to be processed and a plurality of infrared images of crop pests to be processed, so as to obtain a plurality of visible light images of processed crop pests and a plurality of infrared images of processed crop pests, wherein the visible light images of processed crop pests correspond to the infrared images of processed crop pests one by one; A fusion module is used to input a plurality of processed crop pest visible light images and a plurality of processed crop pest infrared images into a preset image fusion model to obtain a plurality of target fusion images, wherein the processed crop pest visible light images, the processed crop pest infrared images and the target fusion images correspond to each other one by one; A training module is used to input a number of target fusion images into the CNN image recognition network to be trained to obtain a target CNN image recognition network; The classification module is used to input the crop pest image to be identified into the target CNN image recognition network to obtain the classification result of the pests in the crop pest image to be identified.

9. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute to implement a crop pest identification method as claimed in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to implement a crop pest identification method as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for early detecting crop pests based on multisensor information fusion

    CN102084794A

  • Crop disease and pest detection method and system based on multi-modal image, equipment and storage medium

    CN113569786A

  • Pest and disease identification method and system based on multi-model feature fusion

    CN114332621A

  • Disease and pest recognition and early warning method and system for tea planting

    CN117576564A

  • Knowledge graph-based plant disease and insect pest identification method, system and device, and storage medium

    CN117726920A

Cited By

  • Multi-modal method for detecting citrus pests based on near infrared spectrum and visible light image

    CN120544234A