CN115620050A - Improved YOLOv5 aphid identification and counting method based on climate chamber environment - Google Patents

Improved YOLOv5 aphid identification and counting method based on climate chamber environment Download PDF

Info

Publication number
CN115620050A
CN115620050A CN202211213228.XA CN202211213228A CN115620050A CN 115620050 A CN115620050 A CN 115620050A CN 202211213228 A CN202211213228 A CN 202211213228A CN 115620050 A CN115620050 A CN 115620050A
Authority
CN
China
Prior art keywords
aphid
identification
yolov5
feature
attention
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
CN202211213228.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.)
Yangzhou University
Original Assignee
Yangzhou University
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 Yangzhou University filed Critical Yangzhou University
Priority to CN202211213228.XA priority Critical patent/CN115620050A/en
Publication of CN115620050A publication Critical patent/CN115620050A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • 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
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/68Food, e.g. fruit or vegetables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/07Target detection

Landscapes

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

Abstract

The invention discloses an improved YOLOv5 aphid identification and counting method based on a climatic chamber environment, which comprises the steps of extracting aphid space and channel characteristics and identifying small aphid targets; carrying out characteristic coding on aphids, and identifying the aphids with different aggregation degrees and illumination intensities; fusing aphid context information and identifying aphids under different aphid acquisition methods; training the model and comparing the training results; and testing the model and comparing the test results. A YOLOv5 model is used as a basic network, a CBAM attention mechanism and a Transformer module are introduced aiming at the influence of small aphid size, aggregation degree and illumination intensity, a BiFpn characteristic fusion mode is introduced aiming at the influence brought by aphid image resolution and shooting angles in different acquisition modes, and the overall accuracy of the model is further improved. The aphid number in the climate chamber can be accurately counted through the designed aphid identification counting model, and the healthy control of fruits and vegetables is facilitated.

Description

Improved YOLOv5 aphid identification and counting method based on climate chamber environment
Technical Field
The invention relates to the technical field of insect pest target identification, in particular to an improved YOLOv5 aphid identification and counting method based on a climate chamber environment.
Background
With the increase of global population, people have more and more demands on fruits and vegetables, and the fruits and vegetables are gradually popularized by adopting a cultivation mode of an artificial climate chamber. The insect pest problem is the key to influence the quality of the fruits and the vegetables, and seriously influences the quality and the yield of the fruits and the vegetables. Due to the migration of aphids, dense ramie is distributed on the back of leaves, or the aphids are coiled in young and tender new leaves and hidden in various positions of vegetable plants, and the aphids are high in aggregation and difficult to count, so that the insect pest investigation in a climate chamber is seriously influenced.
Traditional aphid discernment count relies on people's naked eye to judge, but because the intensive of insect pest, the work load is great in the implementation, easily produces the erroneous judgement. Some researches attempt to solve the problem of insect pest identification and counting by combining an intelligent method with an insect attracting plate, for example, although traditional machine learning algorithms such as SVM, BP neural network and decision tree can obtain a certain accuracy, a large amount of parameter adjustment and other preprocessing work are required, and the complex climate chamber aphid identification task is difficult to adapt. With the development and prevalence of deep learning, a target detection algorithm mainly based on YOLO is widely applied to the fields of medical treatment, transportation and industry, a simple YOLO model is called to easily cause missing detection and false detection of aphid identification, and in the specific scene of a climate chamber, how to design an aphid identification network with strong pertinence, high precision and good performance is a technical problem to be solved urgently.
Disclosure of Invention
This section is for the purpose of summarizing some aspects of embodiments of the invention and to briefly introduce some preferred embodiments. In this section, as well as in the abstract and title of the application, simplifications or omissions may be made to avoid obscuring the purpose of the section, the abstract and the title, and such simplifications or omissions are not intended to limit the scope of the invention.
The invention is provided in view of the problems of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment.
Therefore, the invention aims to provide an improved Yolov5 aphid identification and counting method based on a climate chamber environment.
In order to solve the technical problems, the invention provides the following technical scheme: extracting aphid space and channel characteristics, and identifying small aphid targets;
carrying out characteristic coding on aphids, and identifying the aphids with different aggregation degrees and illumination intensities;
fusing aphid context information and identifying aphids under different aphid acquisition methods;
training the model and comparing the training results;
and testing the model and comparing the test results.
As a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: introducing a CBAM attention mechanism, respectively compressing the space dimension and the channel dimension under the condition that the channel dimension and the space dimension are not changed by utilizing a channel attention module and a space attention module, identifying the aphid small target, and acquiring an aphid channel characteristic output F and an aphid space attention characteristic F s And outputting F' after thinning the aphid channel space characteristic.
As a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: aphid extraction features incorporating the CBAM attention mechanism include,
a C3 module in a YOLOv5 skeleton layer generates a feature map F with the size of H x W x C, and a multi-layer perceptron performs feature mapping by using 1 x C aphid information obtained by parallel calculation of maximum pooling and average pooling;
and respectively obtain the maximum pooling characteristic output G 1 And average pooling feature output G 2 The maximum pooled feature output G 1 And said average pooled feature output G 2 Generating channel attention feature F after weighting operation and sigmoid activation c So as to obtain said aphid pathway characteristic output F' and on the basis of this obtain said aphid spatial attention characteristic F s And outputting F' of the refined aphid channel spatial features.
As a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: acquiring aphid channel characteristic output F', wherein the formula is as follows:
Fc=σ{MLP[Maxpooling(F)]+MLP[Avgpooling(F)]}
Figure BDA0003872577570000021
wherein, sigma represents sigmoid activation,
Figure BDA0003872577570000022
the multiplication operation between matrixes is represented, maxpooling and Avgpooling respectively represent maximum pooling and average pooling, and MLP represents a multilayer perceptron;
on the basis of obtaining the aphid channel characteristic output F', extracting the characteristics spliced by the maximum pooling and the average pooling by using a convolution layer, and obtaining the aphid space attention characteristic F after sigmoid activation s And finishing the operation of the SAM, wherein the calculation formula is as follows:
F s =σ{conv[Maxpooling(F);Avgpooling(F)]}
wherein conv represents a convolution operation;
the refined aphid channel spatial feature output F' formula is as follows:
Figure BDA0003872577570000023
as a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: the characteristic coding of aphids comprises that,
adding a Transformer coding module in front of each detection head, wherein the Transformer coding module comprises a multi-head self-attention mechanism and a multi-layer perceptron, and the multi-head self-attention mechanism consists of multiple groups of attention;
by utilizing the multi-head self-attention mechanism and the multilayer perceptron, the convolutional neural network introduces proper context information for supplementation while paying attention to the aphid information, so that the aphid information loss under different aggregation degrees and different illumination intensities is reduced, and the extraction and expression of target global features are realized.
As a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: single attention mechanism Z n Updating and splicing the query value Q, the key value K and the weight value V containing the global feature information of different subspaces, then performing softmax linear regression, and combining the subset features of each attention mechanism through splicing to establish MSA, wherein the calculation formula is as follows:
Figure BDA0003872577570000031
MSA(Q,K,V)=Concat(Z 1 ,Z 2 ,...,Z n )W 0
wherein, W 0 Weight representing update parameter, QK T For calculating the association degree between the image set composed of the input image feature set T and other feature sets, d represents the input dimension, d k Representing an input dimensionDegree, to avoid overfitting of the model, n represents an index of the number of attention heads.
As a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: the aphid characteristic context information fusion method comprises the following steps,
aiming at the problems of different aphid image resolutions and identification scenes and lack of uniform information expression modes caused by aphid image acquisition methods in different climates, the aphid feature weight input distribution problem is realized in the process of rapid normalization fusion, and more aphid feature details are learned by combining bidirectional cross-scale connection by referring to the BiFpn feature fusion mode;
the method for acquiring the indoor aphid images in different climates comprises a direct aphid plant counting method and a yellow aphid trap counting method.
As a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: constructing a climatic indoor aphid recognition model based on YOLOv5, and improving the problem of few aphid data sets by adopting image enhancement;
the aphid image enhancement method is used for enhancing the data set in a mode of combining Mosaic and GridMask.
As a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: the GridMask is an image enhancement method for deleting information, and the calculation formula is as follows:
Figure BDA0003872577570000041
d=random(d min ,d max )
δ xy )=random(0,d-1)
where r represents the proportion of the retained area to the total area of the image, x, y represent the length and width of the deleted area, random represents the random sampling, and d represents the size of the deleted area.
As a preferable scheme of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment, the method comprises the following steps: comparing the actual recognition and counting effects of aphids in different scenes of the improved aphid recognition model and other YOLO series models through a test platform;
the counting function is obtained by counting the number of the recognized aphid anchor frames.
The invention has the beneficial effects that: aiming at the problem of aphid identification and counting in the climate chamber environment, the invention designs an aphid data acquisition method in the climate chamber environment; a YOLOv5 model is used as a basic network, a CBAM attention mechanism and a Transformer module are introduced aiming at the influence of small aphid size, aggregation degree and illumination intensity, a BiFpn characteristic fusion mode is introduced aiming at the influence brought by aphid image resolution and shooting angles in different acquisition modes, and the overall accuracy of the model is further improved. The aphid number in the climate chamber can be accurately counted through the designed aphid identification counting model, and the healthy control of fruits and vegetables is facilitated.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise. Wherein:
FIG. 1 is a flow chart of the improved YOLOv5 aphid identification and counting method based on the climate chamber environment.
Fig. 2 is a schematic structural diagram of the CBAM attention mechanism introduced by the improved YOLOv5 aphid identification and counting method in the climate chamber environment.
FIG. 3 is a schematic structural diagram of an introduced Transformer module based on the improved Yolov5 aphid identification and counting method in a climate chamber environment.
Fig. 4 is a schematic structural diagram of a BiFpn feature fusion module introduced by the improved YOLOv5 aphid identification and counting method in the climate chamber environment.
FIG. 5 is a schematic diagram of aphid image collection on a plant according to the present invention based on an improved Yolov5 aphid identification and counting method in a climatic chamber environment.
FIG. 6 is a schematic diagram of aphid image collection on an insect attracting plate based on the improved YOLOv5 aphid identification and counting method in a climate chamber environment.
Fig. 7 is a schematic diagram of enhancing a data set by combining Mosaic and GridMask according to the improved YOLOv5 aphid identification and counting method in a climate chamber environment.
Fig. 8 is a schematic structural diagram of an original YOLOv5 model.
FIG. 9 is a schematic structural diagram of an improved aphid recognition model based on an improved Yolov5 aphid recognition and counting method in a climatic chamber environment.
FIG. 10 is a schematic diagram of an aphid recognition model P-R curve based on an improved Yolov5 aphid recognition and counting method in a climatic chamber environment.
FIG. 11 is a comparison graph of aphid recognition and counting effects of the aphid recognition model and other networks of YOLO on plants based on the improved YOLOv5 aphid recognition and counting method in the climatic chamber environment.
FIG. 12 is a comparison graph of aphid identification and counting effects of an aphid identification model and other networks of YOLO on an insect attracting plate according to the improved method for identifying and counting YOLOv5 aphids in a climatic chamber environment.
FIG. 13 is a comparison graph of aphid identification and counting effects of the insect identification model and other networks of YOLO on low light conditions in the improved YOLOv5 aphid identification and counting method based on the climate chamber environment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways than those specifically described and will be readily apparent to those of ordinary skill in the art without departing from the spirit of the present invention, and therefore the present invention is not limited to the specific embodiments disclosed below.
Furthermore, reference herein to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one implementation of the invention. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments.
Furthermore, the present invention is described in detail with reference to the drawings, and for convenience of illustration, the cross-sectional views illustrating the device structures are not enlarged partially according to the general scale when describing the embodiments of the present invention, and the drawings are only exemplary, which should not limit the scope of the present invention. In addition, the three-dimensional dimensions of length, width and depth should be included in the actual fabrication.
Example 1
Referring to fig. 1 to 7, an improved YOLOv5 aphid identification and counting method based on a climate chamber environment comprises the following steps:
s1: and (4) extracting aphid space and channel characteristics and identifying small aphid targets. It should be noted that:
by introducing a CBAM (Channel Attention Module) Attention mechanism, a Channel Attention Module (CAM) and a Space Attention Module (SAM) are utilized to compress a space dimension and a Channel dimension respectively under the condition that the Channel dimension and the space dimension are not changed, the problems of false detection and missing detection caused by the small-scale object problem of aphid are solved, the information of the aphid is mainly concerned and studied, the small object of the aphid is identified, the Channel characteristic output F' of the aphid and the space Attention characteristic F of the aphid are obtained s And outputting F' after thinning the aphid channel space characteristic.
An aphid feature extraction process combining an attention mechanism is shown in fig. 2, aphid channel information is extracted through CAM, a feature map F is generated on a C3 module in a YOLOv5 skeleton layer, the size of the feature map F is H W C, a Multilayer Perceptron (MLP) performs feature mapping on 1W 1C aphid information obtained by performing maximum pooling and average pooling parallel calculation, and the aphid information is respectively subjected to feature mappingObtaining a maximum pooled feature output G 1 And average pooling feature output G 2 ,G 1 And G 2 Via weighting operations
Figure BDA0003872577570000061
And the channel attention feature F after sigmoid activation (σ) c And after multiplication and self-adaptive correction, the aphid channel characteristic output F' is generated by the characteristic diagram F generated by the C3 module, and the calculation formula is as follows:
Fc=σ{MLP[Maxpooling(F)]+MLP[Avgpooling(F)]}
Figure BDA0003872577570000062
wherein the content of the first and second substances,
Figure BDA0003872577570000063
representing the multiplication operation between matrixes, maxpolong and avgpolong represent maximum pooling and average pooling, respectively, and MLP represents the multi-layered perceptron.
On the basis of obtaining aphid channel characteristic output F', the features spliced by maximum pooling and average pooling are extracted by utilizing a convolution layer, and the aphid space attention feature F is obtained after sigmoid activation (sigma) s Completing the operation of SAM, wherein the calculation formula is as follows;
F s =σ{conv[Maxpooling(F);Avgpooling(F)]}
and finally, multiplying the obtained product with F 'for one time on the basis of the operations of the CAM and the SAM to obtain a refined aphid channel spatial characteristic output F', wherein the calculation formula is as follows.
Figure BDA0003872577570000071
S2: and (4) carrying out feature coding on aphids, and identifying the aphids under different aggregation degrees and illumination intensities. It should be noted that:
a Transformer coding module is added in front of each detection head, and a multi-head self-attention Mechanism (MSA) and a multi-layer perceptron (MLP) are fully utilized, so that a convolutional neural network introduces appropriate context information for supplementation while paying attention to aphid information, aphid information loss under different aggregation degrees and different illumination intensities is reduced, and extraction and expression of target global features are realized.
As shown in FIG. 3, the Transformer encoding module includes two main parts, namely a multi-headed self-attention Mechanism (MSA) and a multi-layered perceptron (MLP), where the MSA consists of multiple sets of attention.
Single attention mechanism Z n Updating and splicing the query value Q, the key value K and the weight value V containing the global feature information of different subspaces, then performing softmax linear regression, and constructing MSA by splicing and fusing the subset features of each attention mechanism (Concat), so that the influence of complex information of illumination and aggregation degree on aphid identification precision can be overcome, and the calculation formula is as follows:
Figure BDA0003872577570000072
MSA(Q,K,V)=Concat(Z 1 ,Z 2 ,...,Z n )W 0
where n denotes the index of the number of attention mechanism heads, W 0 Weight representing update parameter, QK T For calculating the association degree between the image set composed of the input image feature set T and other feature sets, d represents the input dimension, d k The input dimensions are represented to avoid overfitting of the model.
Finally, the MLP is used for carrying out nonlinear output on the features to enhance the expression of a self-attention mechanism, so that aphid context information is captured, and loss of global information is reduced, wherein the input is standardized by a standardization layer to accelerate the convergence speed of the model.
S3: and (4) fusing aphid context information and identifying aphids under different aphid collection methods. It should be noted that:
aiming at the problems of different aphid image resolutions and different identification scenes and lack of uniform information expression modes brought by the method for acquiring the aphid images in different climates, the problem of input and distribution of the aphid feature weight is realized in the process of rapid normalization fusion, and more aphid feature details are learned by combining bidirectional cross-scale connection with reference to the feature fusion mode of BiFpn.
As shown in fig. 4 (b), for aphid features with different resolution information on plants and insect attracting boards, biFpn adopts a fast normalization fusion method to assign different weights O to different feature inputs, and the calculation formula is as follows.
Figure BDA0003872577570000081
Wherein, I i Input feature matrix, W, representing the previous node i Is a weight parameter, w, corresponding thereto j Representing an input weight parameter of the node, selecting 0.0001 as the element, representing the weight obtained by fast normalization fusion of different characteristic inputs by O, and representing the node by the obtained j.
On the basis, more aphid feature details are learned by combining bidirectional cross-scale connection, and intermediate node feature output is performed
Figure BDA0003872577570000082
The calculation formula is as follows:
Figure BDA0003872577570000083
Figure BDA0003872577570000084
wherein the content of the first and second substances,
Figure BDA0003872577570000085
respectively corresponding to the outputs of the 1 st, 2 nd and 3 rd nodes,
Figure BDA0003872577570000086
representing the characteristic output of the second-layer intermediate layer, conv representing the convolution operation, w 1 、w 2 、w 3 Respectively representing feature weights from different layers.
The method for collecting the indoor aphid images in different climates comprises a direct aphid plant counting method and an aphid yellow trap counting method;
(1) Directly counting plant aphids;
at the initial aphid outbreak stage, the aphid aggregation degree is lower, and the aphids at all positions of the fruit and vegetable plants in the climatic chamber are directly shot by using a CCD camera by adopting a plant aphid direct counting method.
As shown in FIG. 5, the image of aphids on the plant is shown, and the images (a) and (b) show the light concentration and the medium concentration of the aphids, which are respectively collected in two shooting environments of strong light and weak light.
(2) Yellow aphid-attracting plate counting method
In the later aphid outbreak period, aphids are dense, a yellow insect attracting plate is arranged under a hot pepper plant, the plant is knocked to make the aphids fall on the insect attracting plate, and a CCD camera is used for collecting aphid images on the insect attracting plate.
The model of the CCD camera is FE5050CCD.
FIG. 6 shows images of aphids on a plate, the images (a), (b) and (c) respectively representing a light, medium and high concentration of aphids, collected under high light conditions of 30000lux or less, medium light intensity of 150001 lux or less and low light intensity of 5000lux or less.
S4: training the model and comparing the training results. It should be noted that:
the improved method is used for constructing the aphid recognition model in the climate chamber based on YOLOv5, the problem of few aphid data sets is solved through image enhancement, and the improved aphid recognition model is compared with other YOLO series models through a test platform according to related evaluation indexes.
The aphid image enhancement method is used for enhancing the data set in a mode of combining Mosaic and GridMask. GridMask is an image enhancement method for deleting information, and the calculation formula is as follows:
Figure BDA0003872577570000091
d=random(d min ,d max )
δ xy )=random(0,d-1)
where r represents the proportion of the retained area to the total area of the image, x, y represent the length and width of the deleted area, random represents the random sampling, and d represents the size of the deleted area.
The image is spliced through random zooming, cutting and distribution after the GridMask operation to complete Mosaic enhancement operation, so that the sample expansion is realized, 1000 climate chamber aphid image data sets are finally obtained, and the method comprises the following steps of: 1: the scale of 1 is divided into a training set, a validation set, and a test set.
FIG. 7 is a schematic diagram of an aphid image enhancement method using Mosaic in combination with GridMask.
S5: and testing the model and comparing the test results. It should be noted that:
comparing the actual recognition and counting effects of aphids in different scenes of the improved aphid recognition model and other YOLO series models through a test platform;
the counting function is obtained by counting the number of the recognized aphid anchor frames.
Example 2
This example is a second example of the present invention, which is different from the first example in that a verification test based on the improved YOLOv5 aphid identification and counting method in climatic chamber environment is provided, and the technical effects adopted in the method are verified and explained.
The YOLOv5 model is shown in figure 8, the aphid recognition model improved on the basis is shown in figure 9, and the interference of redundant information and redundant aphid recognition is reduced by introducing a CBAM attention mechanism behind the original YOLOv5 network backbone layer C3 module; by adding a Transformer module (denoted by TR in the figure) in front of each detection head, global information is better acquired, so that the problem of difficulty in identification and counting caused by strong light and aphid aggregation with different aggregation degrees is solved; the neck structure of BiFpn is adopted to replace the original PANet neck, and context information is fused to further improve aphid identification precision; the aphid recognition model under the climate chamber environment is obtained through the operation.
The test platform is under a Windows10 operating system, processor information: intel (R) Xeon (R) Silver 4116cpu @2.10ghz, graphics card information: NVIDIA Quadro P600, python version 3.8.10, using Pyorch 1.9.0 as the deep learning framework. The hyper-parameter design is as follows: initial learning rate 0.01, momentum 0.937, weight attenuation coefficient 0.0005, and iteration number 200 times.
Note that the evaluation index includes Precision (Precision, P), recall (Recall, R), and mean average Precision (map @ 0.5), and the calculation formula is as follows:
Figure BDA0003872577570000101
Figure BDA0003872577570000102
Figure BDA0003872577570000103
Figure BDA0003872577570000104
wherein, TP represents the number of predicting positive samples, FP represents the number of predicting negative samples, FN represents the number of predicting positive samples as negative samples, AP represents all precision averages obtained under all possible values of recall rate, map @0.5 represents that when the IOU threshold is 0.5, the AP (Q) value, i.e. the qth class, is averaged under all classes, and Q represents the number of classes.
(1) Carrying out comparison test;
under the same test environment, the performances of the improved aphid recognition model and other YOLO series algorithms are compared, and after 200 times of training, the test results of the model are shown in Table 1.
Table 1: and (5) comparing test results.
Model (model) P R mAP@50 Inference time/ms
Improved aphid recognition model 0.991 0.991 0.993 9.4
YOLOv5 0.857 0.895 0.873 7.5
YOLOv4 0.829 0.872 0.829 17.3
YOLOv3 0.815 0.833 0.762 12.9
FIG. 10 shows the P-R curve of the training results of the improved aphid recognition model and other YOLO series algorithms.
(2) Ablation test
In order to further improve the influence of the method on the model, the performance of the model is examined by ablation tests aiming at different improvement points, and the test results are shown in table 2.
Table 2: and (5) ablation test results.
Figure BDA0003872577570000105
Figure BDA0003872577570000111
As shown in FIGS. 11 to 13, the identification effects of different models on aphids on plants, on trap boards and under low light conditions are respectively shown, and (a), (b), (c) and (d) are respectively shown to correspond to improved models, yolov5 models, yolov4 models and Yolov3 models.
It should be noted that the above-mentioned embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, which should be covered by the claims of the present invention.

Claims (10)

1. An improved YOLOv5 aphid identification and counting method based on a climatic chamber environment is characterized in that: comprises the steps of (a) preparing a mixture of a plurality of raw materials,
extracting aphid space and channel characteristics, and identifying small aphid targets;
carrying out characteristic coding on aphids, and identifying the aphids with different aggregation degrees and illumination intensities;
fusing aphid context information and identifying aphids under different aphid acquisition methods;
training the model and comparing the training results;
and testing the model and comparing the test results.
2. The improved YOLOv5 aphid identification and enumeration method according to claim 1, based on climatic chamber environments, wherein: introducing a CBAM attention mechanism, compressing the space dimension and the channel dimension by using a channel attention module and a space attention module under the condition that the channel dimension and the space dimension are not changed respectively, identifying the small aphid targets, and acquiring an aphid channel characteristic output F, an aphid space attention characteristic F s And outputting F' through the refined aphid channel spatial characteristics.
3. The improved YOLOv5 aphid identification and counting method in a climatic-based environment according to claim 2, wherein: aphid extraction features incorporating the CBAM attention mechanism include,
a C3 module in a YOLOv5 skeleton layer generates a feature map F with the size of H x W x C, and a multi-layer perceptron performs feature mapping by using 1 x C aphid information obtained by parallel calculation of maximum pooling and average pooling;
and respectively obtain the maximum pooling characteristic output G 1 And average pooling characteristic output G 2 Said maximum pooling characteristic output G 1 And said average pooled feature output G 2 Generating channel attention feature F after weighting operation and sigmoid activation c So as to obtain said aphid pathway characteristic output F, and on the basis of said aphid pathway characteristic output F, obtaining said aphid spatial attention characteristic F s And outputting F' of the refined aphid channel spatial features.
4. The improved YOLOv5 aphid identification and counting method in a climatic-based room environment according to claim 3, wherein: obtaining aphid channel characteristic output F, wherein the formula is as follows:
Fc=σ{MLP[Maxpooling(F)]+MLP[Avgpooling(F)]}
Figure FDA0003872577560000011
wherein, sigma represents sigmoid activation,
Figure FDA0003872577560000012
the method comprises the following steps of (1) representing multiplication operation among matrixes, wherein Maxpooling and Avgpooling represent maximum pooling and average pooling respectively, and MLP represents a multilayer perceptron;
on the basis of obtaining the aphid channel characteristic output F', extracting the aphid channel splicing characteristics spliced by the maximum pooling and the average pooling by using a convolution layer, and obtaining the aphid space attention characteristic F after sigmoid activation s And finishing the operation of the SAM, wherein the calculation formula is as follows:
F s =σ{conv[Maxpooling(F);Avgpooling(F)]}
wherein conv represents a convolution operation;
the refined aphid channel spatial feature output F' formula is as follows:
Figure FDA0003872577560000021
5. the improved YOLOv5 aphid identification and counting method in a climatic-based room environment according to claim 1, wherein: the characteristic coding of aphids comprises that,
adding a Transformer coding module in front of each detection head, wherein the Transformer coding module comprises a multi-head self-attention mechanism and a multi-layer perceptron, and the multi-head self-attention mechanism consists of multiple groups of attention;
by utilizing the multi-head self-attention mechanism and the multilayer perceptron, the convolutional neural network introduces proper context information for supplementation while paying attention to the aphid information, so that the aphid information loss under different aggregation degrees and different illumination intensities is reduced, and the extraction and expression of target global features are realized.
6. The improved YOLOv5 aphid identification and counting method in a climatic-based room environment according to claim 5, wherein: single attention mechanism Z n Updating and splicing the query value Q, the key value K and the weight value V containing the global feature information of different subspaces, then performing softmax linear regression, and combining the subset features of each attention mechanism through splicing to establish MSA, wherein the calculation formula is as follows:
Figure FDA0003872577560000022
MSA(Q,K,V)=Concat(Z 1 ,Z 2 ,...,Z n )W 0
wherein, W 0 Weight representing update parameter, QK T For calculating the association degree between the image set composed of the input image feature set T and other feature sets, d represents the input dimension, d k The input dimensions are represented to avoid overfitting of the model, and n represents the index of the number of attention mechanism heads.
7. The improved YOLOv5 aphid identification and enumeration method according to claim 1, based on climatic chamber environments, wherein: the aphid characteristic context information fusion method comprises the following steps,
aiming at the problems that aphid image resolution and identification scenes are different and a unified information expression mode is lacked due to different indoor aphid image acquisition methods in different climates, the problem of input and distribution of aphid feature weights is realized in the process of rapid normalization fusion, and more aphid feature details are learned by integrating bidirectional cross-scale connection by referring to a BiFpn feature fusion mode;
the method for acquiring the indoor aphid images in different climates comprises a direct aphid plant counting method and a yellow aphid trap counting method.
8. The improved YOLOv5 aphid identification and enumeration method according to claim 1, based on climatic chamber environments, wherein: constructing a climate indoor aphid recognition model based on YOLOv5, and improving the problem of less aphid data sets by adopting image enhancement;
the aphid image enhancement method is used for enhancing the data set in a mode of combining Mosaic and GridMask.
9. The improved YOLOv5 aphid identification and counting method in a climatic-based room environment according to claim 7, wherein: the GridMask is an image enhancement method for deleting information, and the calculation formula is as follows:
Figure FDA0003872577560000031
d=random(d min ,d max )
δ xy )=random(0,d-1)
where r represents the proportion of the retained area to the total area of the image, x, y represent the length and width of the deleted area, random represents random sampling, and d represents the size of the deleted area.
10. The improved YOLOv5 aphid identification and counting method in a climatic-based room environment according to claim 1, wherein: comparing the actual recognition and counting effects of aphids in different scenes of the improved aphid recognition model and other YOLO series models through a test platform;
the counting function is obtained by counting the number of the recognized aphid anchor frames.
CN202211213228.XA 2022-09-29 2022-09-29 Improved YOLOv5 aphid identification and counting method based on climate chamber environment Pending CN115620050A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211213228.XA CN115620050A (en) 2022-09-29 2022-09-29 Improved YOLOv5 aphid identification and counting method based on climate chamber environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211213228.XA CN115620050A (en) 2022-09-29 2022-09-29 Improved YOLOv5 aphid identification and counting method based on climate chamber environment

Publications (1)

Publication Number Publication Date
CN115620050A true CN115620050A (en) 2023-01-17

Family

ID=84860464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211213228.XA Pending CN115620050A (en) 2022-09-29 2022-09-29 Improved YOLOv5 aphid identification and counting method based on climate chamber environment

Country Status (1)

Country Link
CN (1) CN115620050A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116342596A (en) * 2023-05-29 2023-06-27 云南电网有限责任公司 YOLOv5 improved substation equipment nut defect identification detection method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116342596A (en) * 2023-05-29 2023-06-27 云南电网有限责任公司 YOLOv5 improved substation equipment nut defect identification detection method
CN116342596B (en) * 2023-05-29 2023-11-28 云南电网有限责任公司 YOLOv5 improved substation equipment nut defect identification detection method

Similar Documents

Publication Publication Date Title
CN111553193B (en) Visual SLAM closed-loop detection method based on lightweight deep neural network
CN109508655A (en) The SAR target identification method of incomplete training set based on twin network
CN108509976A (en) The identification device and method of animal
CN109460708A (en) A kind of Forest fire image sample generating method based on generation confrontation network
CN108090447A (en) Hyperspectral image classification method and device under double branch's deep structures
CN110084151A (en) Video abnormal behaviour method of discrimination based on non-local network's deep learning
CN107092883A (en) Object identification method for tracing
CN111400536B (en) Low-cost tomato leaf disease identification method based on lightweight deep neural network
CN109410184A (en) Live streaming pornographic image detection method based on dense confrontation network semi-supervised learning
CN109977802A (en) Crops Classification recognition methods under strong background noise
CN114565826A (en) Agricultural pest and disease identification and diagnosis method, system and device
CN111666897A (en) Oplegnathus punctatus individual identification method based on convolutional neural network
CN110222592A (en) A kind of construction method of the timing behavioral value network model generated based on complementary timing behavior motion
CN114359695A (en) Insulator breakage identification method based on uncertainty estimation
CN115620050A (en) Improved YOLOv5 aphid identification and counting method based on climate chamber environment
CN110096976A (en) Human behavior micro-Doppler classification method based on sparse migration network
CN106845051A (en) A kind of near infrared no-wound blood sugar test wavelength Variable Selection method based on Combinatorial Optimization
Xiao et al. AMResNet: An automatic recognition model of bird sounds in real environment
CN113256733A (en) Camera spectral sensitivity reconstruction method based on confidence voting convolutional neural network
CN116994244A (en) Method for evaluating fruit yield of citrus tree based on Yolov8
CN112528726A (en) Aphis gossypii insect pest monitoring method and system based on spectral imaging and deep learning
CN115063653B (en) Method and system for measuring dominant color of built environment based on brain sensitive data of image
Fang et al. Application of genetic algorithm (GA) trained artificial neural network to identify tomatoes with physiological diseases
CN110321951A (en) A kind of VR simulated flight device evaluation of training method
CN114092844A (en) Multi-band image target detection method based on generation countermeasure 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