CN113744258A - Pepper disease identification method and device, electronic equipment and storage medium - Google Patents

Pepper disease identification method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113744258A
CN113744258A CN202111070315.XA CN202111070315A CN113744258A CN 113744258 A CN113744258 A CN 113744258A CN 202111070315 A CN202111070315 A CN 202111070315A CN 113744258 A CN113744258 A CN 113744258A
Authority
CN
China
Prior art keywords
image
disease
pepper
machine learning
learning model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111070315.XA
Other languages
Chinese (zh)
Inventor
宋敏
丁智欢
李明
孙雨佳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yunnan Chunxin Technology Co ltd
Guizhou Chunxin Technology Co ltd
Original Assignee
Yunnan Chunxin Technology Co ltd
Guizhou Chunxin Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yunnan Chunxin Technology Co ltd, Guizhou Chunxin Technology Co ltd filed Critical Yunnan Chunxin Technology Co ltd
Priority to CN202111070315.XA priority Critical patent/CN113744258A/en
Priority to CN202111370957.1A priority patent/CN113902735A/en
Publication of CN113744258A publication Critical patent/CN113744258A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30181Earth observation
    • G06T2207/30188Vegetation; Agriculture

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Quality & Reliability (AREA)
  • Medical Informatics (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a pepper disease identification method, a pepper disease identification device, electronic equipment and a storage medium, and belongs to the technical field of agricultural planting, wherein the pepper disease identification method comprises the following steps: acquiring an image to be detected, wherein the image to be detected comprises hot pepper; and inputting the image to be detected into a trained machine learning model to obtain an image with a disease mark, wherein the trained machine learning model is a model integrating a self-attention mechanism. The method replaces artificial subjective judgment with a trained machine learning model, saves manpower, is high in identification speed, and can exceed the artificial subjective judgment through continuous optimization and adjustment accuracy.

Description

Pepper disease identification method and device, electronic equipment and storage medium
Technical Field
The application belongs to the technical field of agricultural planting, and particularly relates to a pepper disease identification method and device, electronic equipment and a storage medium.
Background
Hot pepper, another name: horn pepper, long pepper, vegetable pepper, bell pepper, latin literature: capsicum annuum L is a perennial herb of Magnoliaceae, Solanaceae, Capsicum, or limited species.
At present, hot pepper disease identification depends on manual sampling investigation and identification and judgment are carried out according to expert experience, and a mature method is not popularized and applied to a hot pepper disease prediction technology. And the identification and judgment method has high labor intensity and long time consumption.
Disclosure of Invention
The application aims to provide a pepper disease identification method, a pepper disease identification device, electronic equipment and a storage medium so as to solve the problems of high labor intensity and long time consumption of pepper disease identification in the prior art.
According to a first aspect of embodiments of the present application, there is provided a method for identifying a pepper disease, which may include:
acquiring an image to be detected, wherein the image to be detected comprises hot pepper;
and inputting the image to be detected into a trained machine learning model to obtain an image with a disease mark, wherein the trained machine learning model is a model integrating a self-attention mechanism.
Further, the trained machine learning model comprises a feature extraction network;
inputting an image to be detected into a trained machine learning model to obtain an image with a disease mark, wherein the image comprises:
inputting an image to be detected into a feature extraction network to obtain a disease coordinate, a disease classification and a confidence coefficient;
and marking the image to be detected according to the disease coordinates, the disease classification and the confidence level to obtain an image with a disease mark.
Further, the trained machine learning model is obtained by training through the following method:
acquiring a plurality of pepper disease images;
carrying out augmentation processing on a plurality of pepper disease images to obtain a training image set;
disease marking is carried out on each image in the training image set to obtain a marked image set;
and training the machine learning model by using the labeled image set to obtain the trained machine learning model.
Further, a plurality of pepper disease images are subjected to augmentation processing to obtain a training image set, and the method comprises the following steps:
performing translation processing, cutting processing and rotation processing on each pepper disease image in the plurality of pepper disease images to obtain a plurality of augmented pictures;
and forming a training image set by the plurality of augmented pictures and the plurality of pepper disease images.
Further, the machine learning model includes: extracting a network and a loss function from the features;
training the machine learning model by utilizing the labeled image set to obtain a trained machine learning model, comprising the following steps of:
inputting the marked images in the marked image set into a feature extraction network to obtain a predicted feature map;
and training a loss function by using the predicted characteristic diagram and the labeled image to obtain a trained machine learning model.
Further, the feature extraction network includes: a plurality of convolutional layers and a residual module;
inputting the marked images in the marked image set into a feature extraction network to obtain a prediction feature map, wherein the prediction feature map comprises the following steps:
inputting the marked images in the marked image set into a plurality of convolution layers to obtain low-dimensional features;
inputting the low-dimensional features into a residual error module to obtain high-dimensional features;
and obtaining a prediction feature map based on the low-dimensional features and the high-dimensional features.
Further, the residual module comprises a convolutional layer and a self-attention module;
inputting the low-dimensional features into a residual error module to obtain high-dimensional features, wherein the high-dimensional features comprise:
inputting the low-dimensional features into the convolutional layer to obtain first residual extraction features;
inputting the first residual error extraction features into a self-attention module to obtain second residual error extraction features;
adding the first residual extraction features and the second residual extraction features, connecting the first residual extraction features and the second residual extraction features with a convolution, and carrying out information enrichment to obtain third residual extraction features;
and adding the first residual error extraction characteristic and the third residual error extraction characteristic to obtain a high-dimensional characteristic.
According to a second aspect of the embodiments of the present application, there is provided a pepper disease identification device, which may include:
the acquisition module is used for acquiring an image to be detected, wherein the image to be detected comprises hot pepper;
and the recognition module is used for inputting the image to be detected into the trained machine learning model to obtain the image with the disease mark, and the trained machine learning model is a model fused with a self-attention mechanism.
Further, the trained machine learning model comprises a feature extraction network;
an identification module comprising:
the characteristic extraction unit is used for inputting the image to be detected into the characteristic extraction network to obtain a disease coordinate, a disease classification and a confidence coefficient;
and the marking unit is used for marking the image to be detected according to the disease coordinates, the disease classification and the confidence level to obtain the image with the disease mark.
Further, the trained machine learning model is obtained by training through the following method:
acquiring a plurality of pepper disease images;
carrying out augmentation processing on a plurality of pepper disease images to obtain a training image set;
disease marking is carried out on each image in the training image set to obtain a marked image set;
and training the machine learning model by using the labeled image set to obtain the trained machine learning model.
Further, a plurality of pepper disease images are subjected to augmentation processing to obtain a training image set, and the method comprises the following steps:
performing translation processing, cutting processing and rotation processing on each pepper disease image in the plurality of pepper disease images to obtain a plurality of augmented pictures;
and forming a training image set by the plurality of augmented pictures and the plurality of pepper disease images.
Further, the machine learning model includes: extracting a network and a loss function from the features;
training the machine learning model by utilizing the labeled image set to obtain a trained machine learning model, comprising the following steps of:
inputting the marked images in the marked image set into a feature extraction network to obtain a predicted feature map;
and training a loss function by using the predicted characteristic diagram and the labeled image to obtain a trained machine learning model.
Further, the feature extraction network includes: a plurality of convolutional layers and a residual module;
inputting the marked images in the marked image set into a feature extraction network to obtain a prediction feature map, wherein the prediction feature map comprises the following steps:
inputting the marked images in the marked image set into a plurality of convolution layers to obtain low-dimensional features;
inputting the low-dimensional features into a residual error module to obtain high-dimensional features;
and obtaining a prediction feature map based on the low-dimensional features and the high-dimensional features.
Further, the residual module comprises a convolutional layer and a self-attention module;
inputting the low-dimensional features into a residual error module to obtain high-dimensional features, wherein the high-dimensional features comprise:
inputting the low-dimensional features into the convolutional layer to obtain first residual extraction features;
inputting the first residual error extraction features into a self-attention module to obtain second residual error extraction features;
adding the first residual extraction features and the second residual extraction features, connecting the first residual extraction features and the second residual extraction features with a convolution, and carrying out information enrichment to obtain third residual extraction features;
and adding the first residual error extraction characteristic and the third residual error extraction characteristic to obtain a high-dimensional characteristic.
According to a third aspect of embodiments of the present application, there is provided an electronic apparatus, which may include:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the aircraft flight envelope calculation method as shown in any embodiment of the first aspect.
According to a fourth aspect of embodiments of the present application, there is provided a storage medium, wherein instructions in the storage medium, when executed by a processor of an information processing apparatus or a server, cause the information processing apparatus or the server to implement the aircraft flight envelope calculation method as shown in any one of the embodiments of the first aspect.
The technical scheme of the application has the following beneficial technical effects:
according to the method, the image to be detected is obtained, the image to be detected comprises the hot pepper, and the image to be detected is input into the trained machine learning model, so that the image with the disease mark is obtained. The trained machine learning model is used for replacing manual subjective judgment, the labor is saved, the identification speed is high, and the accuracy rate can exceed the manual subjective judgment through continuous optimization and adjustment.
Drawings
FIG. 1 is a flowchart of a pepper disease identification method according to an exemplary embodiment of the present application;
FIG. 2 is a flowchart of a pepper disease identification method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a network structure for identifying pepper diseases according to an exemplary embodiment of the present application;
FIG. 4 is a schematic view of a convolutional layer structure in accordance with an exemplary embodiment of the present application;
FIG. 5 is a schematic diagram of a residual network block structure according to an exemplary embodiment of the present application;
FIG. 6 is a schematic diagram of a convolutional set structure in accordance with an exemplary embodiment of the present application;
FIG. 7 is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present application;
fig. 8 is a hardware configuration diagram of an electronic device according to an exemplary embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is further described in detail below with reference to the accompanying drawings in combination with the detailed description. It should be understood that the description is intended to be exemplary only, and is not intended to limit the scope of the present application. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present application.
In the drawings, a schematic diagram of a layer structure according to an embodiment of the application is shown. The figures are not drawn to scale, wherein certain details are exaggerated and possibly omitted for clarity. The shapes of various regions, layers, and relative sizes and positional relationships therebetween shown in the drawings are merely exemplary, and deviations may occur in practice due to manufacturing tolerances or technical limitations, and a person skilled in the art may additionally design regions/layers having different shapes, sizes, relative positions, as actually required.
It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it is noted that the terms "first", "second", and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In addition, the technical features mentioned in the different embodiments of the present application described below may be combined with each other as long as they do not conflict with each other.
At present, most of domestic methods for judging crop diseases and insect pests stay on the traditional field visual inspection, and judgment is carried out according to the appearance surface morphology of crops and the like, and the methods mostly depend on personal experience. Experts have abundant experience on pest identification, but often cannot arrive at the site in time, or large-scale area identification cannot be carried out due to limited human resources, so that misjudgment and missed judgment are easily caused. The traditional identification method has low identification rate and poor stability due to the problems of various diseases, small disease characteristics and the like. In view of the above, the present application provides a pepper disease prediction method.
The pepper disease prediction method provided by the embodiment of the present application is described in detail below with reference to the accompanying drawings by specific embodiments and application scenarios thereof.
As shown in fig. 1, in a first aspect of the embodiments of the present application, a method for identifying a pepper disease is provided, which may include:
s110: acquiring an image to be detected, wherein the image to be detected comprises hot pepper;
s120: and inputting the image to be detected into a trained machine learning model to obtain an image with a disease mark, wherein the trained machine learning model is a model integrating a self-attention mechanism.
According to the method, the image to be detected is obtained, the image to be detected comprises the hot pepper, and the image to be detected is input into a trained machine learning model, so that the image with the disease mark is obtained. The trained machine learning model is used for replacing manual subjective judgment, the labor is saved, the identification speed is high, and the accuracy rate can exceed the manual subjective judgment through continuous optimization and adjustment. Because a self-attention module mechanism is added in the residual error network, the extraction of important information in feature extraction is enhanced.
The following steps of the pepper disease prediction method are respectively explained:
firstly, step S110 is performed to obtain an image to be detected, wherein the image to be detected includes pepper.
In this step, the size of the image to be detected may be 416 × 416, or may be other suitable sizes, which is not limited herein.
Next, step S120 is performed, where the image to be detected is input into a trained machine learning model to obtain an image with a disease marker, and the trained machine learning model is a model fused with a self-attention mechanism.
In the step, the image to be detected is input into the trained machine learning model to determine the specific position of the pepper disease in the picture, and the image to be detected is input into the trained disease recognition network to locate and mark the specific position and type of the pepper disease. The trained machine learning model in the step comprises a feature extraction network, the image to be detected can generate output of three different feature graph sizes after being input into the feature extraction network, and the three outputs generate output of three different feature graph sizes after passing through a series of convolution networks and a splicing network. The output content is { x, y, w, h }, confidence, and the scores of the n categories. Wherein { x, y, w, h } is the center point coordinate and height and width of the mark, and confidence is the confidence score. And marking the disease picture through { x, y, w, h }, and selecting the score with the highest score according to the scores of the n categories, namely the disease category of the disease.
The machine learning model trained in the step is obtained by training through the following method:
1. collecting a plurality of main pepper disease images, expanding a data set by means of data preprocessing and the like, and dividing the expanded data set into a training set and a verification set.
2. And marking the pictures in the training set by using marking software, and marking the specific positions of the diseases.
3. And (3) building a convolutional neural network based on the yolo algorithm, adding a self-attention mechanism module into the convolutional neural network, constructing a pepper disease recognition model, and then training the model.
The method for constructing the pepper disease identification model comprises the following steps:
1. a network structure based on darknet53 was adopted as a feature extraction network for the model.
2. And respectively taking the last three layers of the feature extraction network as outputs, outputting the outputs to a splicing network, and splicing the outputs with another output.
3. And (3) extracting information from the output of the three splices in the step (2) through a convolution set, a 3x3 convolution layer and a 2x2 convolution respectively, and finally outputting results of three different feature quantities (13x13, 26x26 and 52x52) respectively when a full connection layer is connected.
The specific structure of the feature extraction network is as follows:
1. the first part is two convolutional layers with convolutional kernels all 3x3 in size and 32 and 64 in number, respectively.
2. The second part is a convolution kernel with the size of 1x1 and the number of 32 convolution layers and a convolution kernel with the size of 3x3 and the number of 64 convolution layers, and finally a residual error module added with a self-attention mechanism is connected. This part was repeated 1 time. Finally, a convolution kernel size of 3x3, a step size of 2, and a number of 128 convolution layers are concatenated.
3. The third part is a convolution kernel with the size of 1x1 and the number of 64 convolution layers and a convolution kernel with the size of 3x3 and the number of 128 convolution layers, and finally a residual error module added with a self-attention mechanism is connected. This part was repeated 2 times. Finally, a convolution kernel with the size of 3x3, the step size of 2 and the number of 256 convolution layers is connected.
4. The fourth part is a convolution kernel with the size of 1x1 and the number of 128 convolution layers and a convolution kernel with the size of 3x3 and the number of 256 convolution layers, and finally a residual error module added with a self-attention mechanism is connected. This part was repeated 8 times. Finally, a convolution kernel with the size of 3x3, the step size of 2 and the number of 512 convolution layers is connected.
5. The fifth part is a convolution kernel with the size of 1x1 and the number of 256 convolution layers and a convolution kernel with the size of 3x3 and the number of 512 convolution layers, and finally a residual error module added with a self-attention mechanism is connected. This part was repeated 8 times. Finally, a convolution kernel with the size of 3x3, the step size of 2 and the number of 1024 convolution layers is connected.
6. The second part is a convolution kernel with the size of 1x1 and the number of 512 convolution layers and a convolution kernel with the size of 3x3 and the number of 1024 convolution layers, and finally a residual error module added with a self-attention mechanism is connected. This part was repeated 4 times.
The residual module structure is as follows:
1. the input of the residual module is first input into the convolutional layer of 1x1 size and the convolutional layer of 3x3 size.
2. The output of step 1 is input into the self-attention module as input.
3. The outputs of the 1 and 2 steps are added and then connected with a 1x1 convolution for information enrichment.
4. The input of 1 and the output of 3 are added as the output of the whole residual network.
The loss function of the algorithm training is as follows:
1. the target confidence is lost. Target confidence may be understood as the probability of the presence of a target within a target rectangular box, the target confidence loss Lconf(o, c) a binary cross entropy loss is adopted, wherein oi is epsilon {0,1}, which indicates whether a real target exists in the predicted target bounding box i, 0 indicates that the real target does not exist, and 1 indicates that the real target exists. Ci represents the probability of Sigmod predicting whether an object exists within the target rectangular box i. The formula is as follows:
Lconf(o,c)=-∑(oiln(ci)+(1-oi)ln(1-ci));
ci=Sigmod(ci);
2. target class penalty Lcla(o, c) also used are binary cross-entropy losses, where oi,jE {0,1}, which indicates whether the jth class target really exists in the predicted target boundary box i, 0 indicates that the jth class target does not exist, 1 indicates that the jth class target exists, and c indicates that the jth class target existsijAnd (4) representing the Sigmoid probability of the j-th class target in the network prediction target boundary box i. The formula is as follows:
Figure BDA0003260197530000091
cij=Sigmod(cij);
3. loss of target location Lloc(l, g) the sum of squares of the difference between the actual bias value and the predicted bias value is adopted, wherein l represents the coordinate offset of the predicted rectangular frame, g represents the coordinate offset between the GTbox matched with the predicted rectangular frame and the default frame, { bx, by, bw, bh } is the parameter of the predicted target rectangular frame, { cx, cy, pw, ph } is the parameter of the default rectangular frame, { gx, gy, gw, gh } is the parameter of the actual target rectangular frame matched with the predicted rectangular frame, and the parameters are all mapped on the prediction feature map. The formula is as follows:
Figure BDA0003260197530000092
Figure BDA0003260197530000093
Figure BDA0003260197530000094
Figure BDA0003260197530000095
Figure BDA0003260197530000096
in some optional embodiments of the present application, the trained machine learning model comprises a feature extraction network;
inputting an image to be detected into a trained machine learning model to obtain an image with a disease mark, wherein the image comprises:
inputting an image to be detected into a feature extraction network to obtain a disease coordinate, a disease classification and a confidence coefficient;
and marking the image to be detected according to the disease coordinates, the disease classification and the confidence level to obtain an image with a disease mark.
In some optional embodiments of the present application, the trained machine learning model is obtained by training:
acquiring a plurality of pepper disease images;
carrying out augmentation processing on a plurality of pepper disease images to obtain a training image set;
disease marking is carried out on each image in the training image set to obtain a marked image set;
and training the machine learning model by using the labeled image set to obtain the trained machine learning model.
In some optional embodiments of the present application, the performing an augmentation process on a plurality of pepper disease images to obtain a training image set includes:
performing translation processing, cutting processing and rotation processing on each pepper disease image in the plurality of pepper disease images to obtain a plurality of augmented pictures;
and forming a training image set by the plurality of augmented pictures and the plurality of pepper disease images.
In some optional embodiments of the present application, the machine learning model comprises: extracting a network and a loss function from the features;
training the machine learning model by utilizing the labeled image set to obtain a trained machine learning model, comprising the following steps of:
inputting the marked images in the marked image set into a feature extraction network to obtain a predicted feature map;
and training a loss function by using the predicted characteristic diagram and the labeled image to obtain a trained machine learning model.
In some optional embodiments of the present application, the feature extraction network comprises: a plurality of convolutional layers and a residual module;
inputting the marked images in the marked image set into a feature extraction network to obtain a prediction feature map, wherein the prediction feature map comprises the following steps:
inputting the marked images in the marked image set into a plurality of convolution layers to obtain low-dimensional features;
inputting the low-dimensional features into a residual error module to obtain high-dimensional features;
and obtaining a prediction feature map based on the low-dimensional features and the high-dimensional features.
In some optional embodiments of the present application, the residual module comprises a convolutional layer and a self-attention module;
inputting the low-dimensional features into a residual error module to obtain high-dimensional features, wherein the high-dimensional features comprise:
inputting the low-dimensional features into the convolutional layer to obtain first residual extraction features;
inputting the first residual error extraction features into a self-attention module to obtain second residual error extraction features;
adding the first residual extraction features and the second residual extraction features, connecting the first residual extraction features and the second residual extraction features with a convolution, and carrying out information enrichment to obtain third residual extraction features;
and adding the first residual error extraction characteristic and the third residual error extraction characteristic to obtain a high-dimensional characteristic.
As shown in fig. 2, in an embodiment of the present application, a method for identifying pepper diseases by a self-attention mechanism is provided, which includes the following steps:
1. and (4) collecting and preprocessing training images. And collecting images of a plurality of disease categories as training data, and collecting all training image samples in the field in order to meet the requirement of actual disease identification. The focus of collecting images is focused on disease symptoms. And then, a plurality of new pictures are obtained through data preprocessing means such as translation, cutting, rotation and the like.
2. And marking the positions of the diseases in the images by using software.
3. A pepper disease identification network fused with a self-attention mechanism is constructed, and the network structure is shown in fig. 3. The Convolutional layer of the network is not a single Convolutional layer, but includes a batch normalization layer (BN) and a LeakyRelu activation function layer, as shown in fig. 4. The structure of the residual net block is shown in fig. 5, which uses the attention machine as part of the input to the residual block. The structure of the volume set (consistency set) is shown in fig. 6. The network has the following specific working flows:
the 3.1 network takes the entire 416x416 picture as input, and after passing through the two convolutional layers of the first part, the size of the obtained feature map is 64x208x 208.
3.2 after the convolution of the second part and the residual network, the feature map size is 128x104x 104. A self-attention module is added in the residual error network, so that the proportion of important modules in the extracted information can be effectively improved.
3.3 after the convolution of the third part and the residual network, the feature map size is 256x52x 52. The output of this block is not only the input of the convolution of the fourth part but also the input of the second splice layer of the subsequent network.
3.4 after the convolution and residual network of the fourth part, the feature map size is 512x26x 26. The output of this block is not only the input of the convolution of the fifth part but also the input of the first splice layer of the subsequent network.
3.5 after the last part of the convolution and residual network, the size of the output feature map is 1024x13x 13.
3.6 the output-input volume set of 3.5 steps is further characterized. The method has two branches, one branch is connected with a full connection layer after being convolved by a 3x3 convolution layer and a 1x1 convolution layer, and prediction of 13x13 scale is carried out; the other layer is subjected to 1x1 convolutional layer and upsampling layer, and becomes a characteristic map of 26x26, and the characteristic map is spliced with the output of the 3.4 step in the depth direction.
3.7 the flow of this step is similar to 3.6, one part makes the prediction of 26x26 scale, and the other part splices with the output of 3.3.
3.8 the last layer is connected with the full-link layer after being convolved by a convolution set, 3x3 convolution layer and 1x1 convolution, and the prediction of 52x52 scale is carried out.
3.9 training the network according to the set loss function.
4. And collecting an image to be detected.
5. And inputting the picture to be tested into the trained network, and marking the position and the name of the disease on the picture according to the { x, y, w, h } coordinates returned by the characteristic network and the predicted values of the n categories.
According to the method, the image to be detected is obtained, the image to be detected comprises the hot pepper, and the image to be detected is input into the trained machine learning model, so that the image with the disease mark is obtained. The trained machine learning model is used for replacing manual subjective judgment, the labor is saved, the identification speed is high, and the accuracy rate can exceed the manual subjective judgment through continuous optimization and adjustment. Because a self-attention module mechanism is added in the residual error network, the extraction of important information in feature extraction is enhanced.
In the pepper disease identification method provided by the embodiment of the present application, the execution main body may be a pepper disease identification device, or a control module of the pepper disease identification device for executing the pepper disease identification method. In the embodiment of the present application, a method for identifying pepper diseases by using a pepper disease identification device is taken as an example, and the device for identifying pepper diseases provided by the embodiment of the present application is described.
In a second aspect of embodiments of the present application, there is provided a pepper disease identification device, which may include:
the acquisition module is used for acquiring an image to be detected, wherein the image to be detected comprises hot pepper;
and the recognition module is used for inputting the image to be detected into the trained machine learning model to obtain the image with the disease mark.
The device of the embodiment obtains the image with the disease mark by obtaining the image to be detected, wherein the image to be detected comprises the hot pepper and inputting the image to be detected into the trained machine learning model. The trained machine learning model is used for replacing manual subjective judgment, the labor is saved, the identification speed is high, and the accuracy rate can exceed the manual subjective judgment through continuous optimization and adjustment. Because a self-attention module mechanism is added in the residual error network, the extraction of important information in feature extraction is enhanced.
The pepper disease identification device in the embodiment of the application can be a device, and can also be a component, an integrated circuit or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiments of the present application are not particularly limited.
The pepper disease identifying device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The pepper disease identification device provided by the embodiment of the application can realize each process realized by the method embodiments of fig. 1-5, and is not described herein again to avoid repetition.
Optionally, as shown in fig. 7, an electronic device 700 is further provided in this embodiment of the present application, and includes a processor 701, a memory 702, and a program or an instruction stored in the memory 702 and executable on the processor 701, where the program or the instruction is executed by the processor 701 to implement each process of the above pepper disease identification method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that the electronic device in the embodiment of the present application includes the mobile electronic device and the non-mobile electronic device described above.
Fig. 8 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 800 includes, but is not limited to: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, and a processor 810.
Those skilled in the art will appreciate that the electronic device 800 may further comprise a power source (e.g., a battery) for supplying power to the various components, and the power source may be logically connected to the processor 810 via a power management system, so as to manage charging, discharging, and power consumption management functions via the power management system. The electronic device structure shown in fig. 8 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
It should be understood that in the embodiment of the present application, the input Unit 804 may include a Graphics Processing Unit (GPU) 8041 and a microphone 8042, and the Graphics Processing Unit 8041 processes image data of a still picture or a video obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 806 may include a display panel 8061, and the display panel 8061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 807 includes a touch panel 8071 and other input devices 8072. A touch panel 8071, also referred to as a touch screen. The touch panel 8071 may include two portions of a touch detection device and a touch controller. Other input devices 8072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. The memory 809 may be used to store software programs as well as various data including, but not limited to, application programs and operating systems. The processor 810 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 810.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the above pepper disease identification method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and so on.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A pepper disease identification method is characterized by comprising the following steps:
acquiring an image to be detected, wherein the image to be detected comprises hot pepper;
and inputting the image to be detected into a trained machine learning model to obtain an image with a disease mark, wherein the trained machine learning model is a model integrating a self-attention mechanism.
2. The pepper disease identification method as claimed in claim 1, wherein the trained machine learning model comprises a feature extraction network;
inputting the image to be detected into a trained machine learning model to obtain an image with a disease mark, wherein the image comprises:
inputting the image to be detected into the feature extraction network to obtain a disease coordinate, a disease classification and a confidence coefficient;
marking the image to be detected according to the disease coordinates, the disease classification and the confidence level to obtain the image with the disease mark.
3. The method for identifying pepper diseases as claimed in claim 1, wherein the trained machine learning model is trained by the following method:
acquiring a plurality of pepper disease images;
performing augmentation processing on the plurality of pepper disease images to obtain a training image set;
disease marking is carried out on each image in the training image set to obtain a marked image set;
and training a machine learning model by using the labeled image set to obtain the trained machine learning model.
4. The method for identifying pepper diseases according to claim 3, wherein said amplifying the plurality of pepper disease images to obtain a training image set comprises:
performing translation processing, cutting processing and rotation processing on each pepper disease image in the plurality of pepper disease images to obtain a plurality of augmented pictures;
and combining the plurality of augmented pictures and the plurality of pepper disease images into the training image set.
5. The pepper disease identification method as claimed in claim 1, wherein the machine learning model comprises: extracting a network and a loss function from the features;
the training of the machine learning model by using the labeled image set to obtain the trained machine learning model comprises the following steps:
inputting the marked images in the marked image set into a feature extraction network to obtain a predicted feature map;
and training the loss function by using the prediction characteristic diagram and the labeled image to obtain the trained machine learning model.
6. The pepper disease identification method as claimed in claim 5, wherein the feature extraction network comprises: a plurality of convolutional layers and a residual module;
inputting the marked images in the marked image set into a feature extraction network to obtain a prediction feature map, wherein the method comprises the following steps:
inputting the marked images in the marked image set into the plurality of convolution layers to obtain low-dimensional features;
inputting the low-dimensional features into the residual error module to obtain high-dimensional features;
and obtaining a prediction feature map based on the low-dimensional features and the high-dimensional features.
7. The method for identifying pepper diseases as claimed in claim 6, wherein said residual module comprises a convolutional layer and a self-attention module;
inputting the low-dimensional features into the residual error module to obtain high-dimensional features, wherein the method comprises the following steps:
inputting the low-dimensional features into a convolutional layer to obtain first residual extraction features;
inputting the first residual error extraction features into a self-attention module to obtain second residual error extraction features;
adding the first residual extraction features and the second residual extraction features, connecting the first residual extraction features and the second residual extraction features with a convolution, and carrying out information enrichment to obtain third residual extraction features;
and adding the first residual extraction features and the third residual extraction features to obtain the high-dimensional features.
8. A hot pepper disease recognition device, characterized by comprising:
the acquisition module is used for acquiring an image to be detected, wherein the image to be detected comprises hot pepper;
and the recognition module is used for inputting the image to be detected into a trained machine learning model to obtain an image with a disease mark, wherein the trained machine learning model is a model fused with a self-attention mechanism.
9. An electronic device, comprising: a processor, a memory and a program or instructions stored on the memory and executable on the processor, the program or instructions when executed by the processor implementing the steps of the pepper disease identification method as claimed in any one of the claims 1-7.
10. A readable storage medium storing thereon a program or instructions which, when executed by a processor, carry out the steps of the pepper disease identification method as claimed in any one of the claims 1-7.
CN202111070315.XA 2021-09-13 2021-09-13 Pepper disease identification method and device, electronic equipment and storage medium Pending CN113744258A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111070315.XA CN113744258A (en) 2021-09-13 2021-09-13 Pepper disease identification method and device, electronic equipment and storage medium
CN202111370957.1A CN113902735A (en) 2021-09-13 2021-11-18 Crop disease identification method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111070315.XA CN113744258A (en) 2021-09-13 2021-09-13 Pepper disease identification method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113744258A true CN113744258A (en) 2021-12-03

Family

ID=78738519

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202111070315.XA Pending CN113744258A (en) 2021-09-13 2021-09-13 Pepper disease identification method and device, electronic equipment and storage medium
CN202111370957.1A Pending CN113902735A (en) 2021-09-13 2021-11-18 Crop disease identification method and device, electronic equipment and storage medium

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202111370957.1A Pending CN113902735A (en) 2021-09-13 2021-11-18 Crop disease identification method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (2) CN113744258A (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110502987A (en) * 2019-07-12 2019-11-26 山东农业大学 A kind of plant pest recognition methods and system based on deep learning
CN111080620B (en) * 2019-12-13 2024-03-19 中远海运科技股份有限公司 Road disease detection method based on deep learning
CN111274954B (en) * 2020-01-20 2022-03-15 河北工业大学 Embedded platform real-time falling detection method based on improved attitude estimation algorithm
CN111914914A (en) * 2020-07-21 2020-11-10 上海理想信息产业(集团)有限公司 Method, device, equipment and storage medium for identifying plant diseases and insect pests
CN112508014A (en) * 2020-12-04 2021-03-16 东南大学 Improved YOLOv3 target detection method based on attention mechanism
CN112699941B (en) * 2020-12-31 2023-02-14 浙江科技学院 Plant disease severity image classification method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113902735A (en) 2022-01-07

Similar Documents

Publication Publication Date Title
Liu et al. Early recognition of tomato gray leaf spot disease based on MobileNetv2-YOLOv3 model
WO2021227726A1 (en) Methods and apparatuses for training face detection and image detection neural networks, and device
CN111209970B (en) Video classification method, device, storage medium and server
WO2021147300A1 (en) Multi-source heterogeneous farmland big data yield prediction method and system, and apparatus
Iqbal et al. Coconut trees detection and segmentation in aerial imagery using mask region‐based convolution neural network
CN108197669B (en) Feature training method and device of convolutional neural network
CN110222718B (en) Image processing method and device
WO2021104125A1 (en) Abnormal egg identification method, device and system, storage medium, and electronic device
CN110796018A (en) Hand motion recognition method based on depth image and color image
CN114332680A (en) Image processing method, video searching method, image processing device, video searching device, computer equipment and storage medium
Zhang et al. Rapeseed stand count estimation at leaf development stages with UAV imagery and convolutional neural networks
CN115512005A (en) Data processing method and device
CN112561973A (en) Method and device for training image registration model and electronic equipment
Xia et al. Cloud/snow recognition of satellite cloud images based on multiscale fusion attention network
CN115775349A (en) False news detection method and device based on multi-mode fusion
CN116186326A (en) Video recommendation method, model training method, electronic device and storage medium
CN114140637B (en) Image classification method, storage medium and electronic device
CN111144407A (en) Target detection method, system, device and readable storage medium
CN112528978B (en) Face key point detection method and device, electronic equipment and storage medium
CN114168768A (en) Image retrieval method and related equipment
Rampi et al. Minnesota Land Cover Classification and Impervious Surface Area by Landsat and Lidar: 2013-14 Update
Lu et al. Citrus green fruit detection via improved feature network extraction
Zhang et al. A precise apple leaf diseases detection using BCTNet under unconstrained environments
Ke et al. Haze removal from a single remote sensing image based on a fully convolutional neural network
CN116543165A (en) Remote sensing image fruit tree segmentation method based on dual-channel composite depth network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20211203