CN115273072B - Apple leaf disease detection method based on improved Yolov5s model - Google Patents
Apple leaf disease detection method based on improved Yolov5s model Download PDFInfo
- Publication number
- CN115273072B CN115273072B CN202210663984.6A CN202210663984A CN115273072B CN 115273072 B CN115273072 B CN 115273072B CN 202210663984 A CN202210663984 A CN 202210663984A CN 115273072 B CN115273072 B CN 115273072B
- Authority
- CN
- China
- Prior art keywords
- model
- image
- yolov5s
- improved
- height
- 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.)
- Active
Links
- 201000010099 disease Diseases 0.000 title claims abstract description 65
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 title claims abstract description 65
- 238000001514 detection method Methods 0.000 title claims abstract description 54
- 241000219998 Philenoptera violacea Species 0.000 title claims abstract description 44
- 238000012549 training Methods 0.000 claims abstract description 18
- 241000220225 Malus Species 0.000 claims abstract description 10
- 238000012360 testing method Methods 0.000 claims abstract description 6
- 238000002372 labelling Methods 0.000 claims abstract description 5
- 238000003672 processing method Methods 0.000 claims abstract description 5
- 238000000034 method Methods 0.000 claims description 26
- 230000004913 activation Effects 0.000 claims description 14
- 230000006870 function Effects 0.000 claims description 11
- 238000011176 pooling Methods 0.000 claims description 11
- 238000010586 diagram Methods 0.000 claims description 10
- 238000012545 processing Methods 0.000 claims description 10
- JEIPFZHSYJVQDO-UHFFFAOYSA-N iron(III) oxide Inorganic materials O=[Fe]O[Fe]=O JEIPFZHSYJVQDO-UHFFFAOYSA-N 0.000 claims description 7
- 230000009467 reduction Effects 0.000 claims description 6
- 238000005259 measurement Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 claims description 4
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 claims description 3
- 238000001914 filtration Methods 0.000 claims description 3
- 238000010606 normalization Methods 0.000 claims description 3
- 238000007781 pre-processing Methods 0.000 claims description 3
- 238000011524 similarity measure Methods 0.000 claims description 3
- 230000009466 transformation Effects 0.000 claims description 3
- 238000013519 translation Methods 0.000 claims description 3
- 241000223602 Alternaria alternata Species 0.000 claims description 2
- 210000000988 bone and bone Anatomy 0.000 claims description 2
- 239000011435 rock Substances 0.000 claims 1
- 235000011430 Malus pumila Nutrition 0.000 description 7
- 235000015103 Malus silvestris Nutrition 0.000 description 7
- 241000223600 Alternaria Species 0.000 description 4
- 230000010339 dilation Effects 0.000 description 4
- 239000011159 matrix material Substances 0.000 description 4
- 235000013399 edible fruits Nutrition 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 241000196324 Embryophyta Species 0.000 description 2
- 244000141359 Malus pumila Species 0.000 description 2
- 235000021016 apples Nutrition 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000014759 maintenance of location Effects 0.000 description 2
- 235000016709 nutrition Nutrition 0.000 description 2
- 230000035764 nutrition Effects 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 241001251227 Pomacea Species 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 229910052500 inorganic mineral Inorganic materials 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000011707 mineral Substances 0.000 description 1
- 210000000056 organ Anatomy 0.000 description 1
- 230000029553 photosynthesis Effects 0.000 description 1
- 238000010672 photosynthesis Methods 0.000 description 1
- 230000007480 spreading Effects 0.000 description 1
- 229940088594 vitamin Drugs 0.000 description 1
- 229930003231 vitamin Natural products 0.000 description 1
- 235000013343 vitamin Nutrition 0.000 description 1
- 239000011782 vitamin Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/60—Type of objects
- G06V20/68—Food, e.g. fruit or vegetables
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/082—Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/30—Noise filtering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing 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/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N2021/8466—Investigation of vegetal material, e.g. leaves, plants, fruits
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Health & Medical Sciences (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Artificial Intelligence (AREA)
- Medical Informatics (AREA)
- Databases & Information Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- Immunology (AREA)
- Pathology (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 apple leaf disease detection method based on an improved Yolov5s model, which comprises the steps of firstly, obtaining images of different diseases of apple leaves, labeling, and constructing an initial data set; expanding a data set by adopting an image processing method, and dividing a training set and a testing set to obtain a final data set; introducing a Yolov5s model, improving, and training a data set by using the improved model to obtain a final apple leaf disease detection model; and detecting the image to be detected by using a final apple leaf disease detection model to obtain a detection result. According to the invention, through improving the Yolov5s model and introducing the Attentive GAN algorithm, the expression capability of the network learning characteristic is enhanced when the model is trained on the network, the accuracy and precision of the model are improved, and the accurate identification of apple leaf diseases can be realized under the rainy day condition.
Description
Technical Field
The invention belongs to the technical field of plant disease detection, and particularly relates to an apple leaf disease detection method based on an improved Yolov5s model.
Background
Apples are rich in minerals and vitamins, and are one of the most commonly eaten fruits. Apple leaf is the main organ for photosynthesis, plays an important role in making nutrition and delivering nutrition to fruits, so that apple leaf diseases are important factors for influencing the growth of apple trees. The apple leaf diseases are various, wherein the common diseases include alternaria leaf spot, brown spot, gray spot, mosaic disease and rust, the fruit retention is based on leaf retention, the apple leaf diseases are rapidly found and accurately identified and detected, different treatment measures are adopted for different diseases, the production loss can be reduced, and the yield and quality of apples are improved. Therefore, the method can accurately detect and identify the apple leaf diseases, and plays an important role in ensuring the growth of apple trees.
The target detection method based on deep learning is the most popular plant disease identification method nowadays. The task of object detection is to find the object of interest in the image and to annotate the name and location size of the object. The current mainstream target detection method has poor effect on detecting small targets such as apple leaf diseases, and has low identification precision, and under the condition of shooting on non-sunny days, the detection effect of apple leaf diseases is poor due to the interference of raindrops, and various leaf diseases can not be accurately identified, so that a detection method is needed to improve the detection precision of apple leaf diseases at present.
Disclosure of Invention
The invention aims to: aiming at the defects in the prior art, the invention aims to provide the apple leaf disease detection method based on the improved Yolov5s model, which not only improves the precision and accuracy of a network training model, but also can better detect the apple leaf disease under the rainy day condition.
The technical scheme is as follows: in order to achieve the above object, the present invention adopts the following technical scheme:
an apple leaf disease detection method based on an improved Yolov5s model comprises the following steps:
s1, obtaining images of different diseases of apple leaves, and labeling to construct an initial data set;
s2, expanding a data set by adopting an image processing method, and dividing a training set and a testing set to obtain a final data set;
s3, introducing and improving a Yolov5S model, and training a data set by using the improved model to obtain a final apple leaf disease detection model;
and S4, detecting an image to be detected by using a final apple leaf disease detection model to obtain a detection result.
Further, in step S1, common diseases of apple leaves include alternaria leaf spot, brown spot, gray spot, mosaic and rust, and different disease images are labeled.
Further, in step S2, affine transformation, filtering, translation and rotation are performed on the image, and the data set is expanded to increase the richness of the data set and prevent the model from being over fitted.
Further, in step S3, FEM is added on the basis of the feature pyramid of the jack structure of the Yolov5S model, and meanwhile, a CA attention mechanism module is added after the CSP structure in the jack structure of the Yolov5S model, so that the expression capability of the network learning feature is enhanced, and the average precision mean value of the network training model is improved.
Further, the FEM comprises two parts, namely a multi-branch convolution layer and an average pooling layer, wherein the multi-branch convolution layer comprises an expansion convolution layer, a BN layer and an activation layer, and different receptive fields are provided for an input feature map through an expansion convolution method; the average pooling layer fuses traffic information of each branch receptive field, and multi-scale precision detection is improved.
Further, the implementation process of the A attention mechanism module is as follows:
in order to acquire the attention on the width and the height of an image and encode accurate position information, firstly, carrying out global average pooling on the width and the height of an input feature map to obtain feature maps of the two directions; then splicing the feature graphs in the width direction and the height direction of the obtained global receptive field together, then sending the feature graphs into a convolution module with a shared convolution kernel of 1 multiplied by 1, reducing the dimension to the original C/r, and then sending the feature graph F subjected to batch normalization processing into a Sigmoid activation function to obtain a feature graph F; then the characteristic diagram F is convolved into 1X 1 according to the original height and width to obtain the same number of channels and the original F h And f w The attention weights of the feature graphs in the height and the width are respectively obtained through a Sigmoid activation function; and finally, multiplying and adding calculation on the original feature map to finally obtain the feature map with attention weights in the width and height directions.
Further, in step S5, preprocessing an image to be detected, judging whether the image is photographed on a sunny day or a rainy day, and if so, performing raindrop noise reduction processing on the image; if the shooting is performed on a sunny day, the network model is directly used for detection, and a final detection result is obtained.
Further, the process of judging whether the image is photographed on a sunny day is as follows:
s51: judging whether the image is photographed on a sunny day or not by a method of extracting texture features and performing feature matching according to the difference of the surface textures of the blades on the sunny day and the rainy day;
s52: inputting an image to be detected, carrying out gray level and binarization processing on the detected image, extracting feature points on the surface of the blade, vectorizing the extracted key points, and taking the extracted local features as an observation chart;
s53: and carrying out similarity measurement on the model layout and the observation diagram.
Further, a threshold is set when the similarity measure satisfies d (M ij ,R ij ) When the threshold is less than the threshold, the image to be detected can be judged to be shot on a sunny day, and the detection model is directly used for detecting diseases; if the judging condition is not met, shooting the image in rainy days, and carrying out noise reduction treatment on the image by adopting an active GAN algorithm.
The beneficial effects are that: compared with the prior art, the invention has the following advantages:
based on the original yolov5s model structure, the invention adds two innovative structures of the FEM module and the CA attention module, and the two structures can enlarge the receptive field of the feature map, improve the recognition precision of the multi-scale apple leaves, enhance the expression capability of the network learning features and improve the average precision mean value of the network training model. In addition, an innovative step of judging whether the image is photographed on a sunny day is added when the image is detected, and the detection precision of apple leaf diseases under the rainy day condition is improved by using the Attentive GAN algorithm to reduce noise when the image to be detected is photographed on a non-sunny day. According to the invention, through improving the Yolov5s model and introducing the Attentive GAN algorithm, the expression capability of the network learning characteristic is enhanced when the model is trained on the network, the accuracy and precision of the model are improved, and the accurate identification of apple leaf diseases can be realized under the rainy day condition.
Drawings
Fig. 1 is a flowchart of an apple leaf disease detection method based on an improved Yolov5s model in the present invention.
FIG. 2 is a graph of a modified Yolov5s model of the present invention;
FIG. 3 is a graph showing the results of detecting Alternaria pomacea disease by the method of the present invention;
FIG. 4 is a graph showing the detection result of brown spot disease of apple leaf by the method of the invention;
FIG. 5 is a graph showing the detection result of the apple leaf gray spot disease by the method of the invention;
FIG. 6 is a graph of the detection result of apple leaf mosaic disease by the method of the invention;
FIG. 7 is a graph showing the results of detecting rust disease of apple leaves by the method of the invention.
Detailed Description
The invention will be further illustrated by the following drawings and specific examples, which are carried out on the basis of the technical solutions of the invention, it being understood that these examples are only intended to illustrate the invention and are not intended to limit the scope of the invention.
As shown in FIG. 1, the invention discloses an apple leaf disease detection method based on an improved Yolov5S model, which comprises five steps of S1-S5:
s1, acquiring an apple leaf disease image, labeling, and constructing an initial data set;
the apple leaf disease image mainly comprises five common diseases of apple leaves: spot leaf fall, brown spot, gray spot, mosaic, rust, and labeling the image with a Make sense.
S2, performing data set expansion by using an image processing method to obtain a final data set;
the initial data set adopts an image processing method, including the existing affine transformation, filtering, translation and rotation methods, and the data set is expanded to increase the richness of the data set, prevent the model from being over-fitted and improve the generalization capability of the model. Dividing the data set into a training set and a testing set according to the proportion of 8:2 to obtain a final data set.
S3, introducing a Yolov5S model, improving a Neck structure and a Backbone structure of the model, and training by using the improved Yolov5S model to obtain a final apple leaf disease detection model.
S31, adding FEM (feature enhancement module) on the basis of a feature pyramid of a Neck structure of an original Yolov5S model, wherein the FEM comprises two parts:
the first part is a multi-branch convolutional layer, comprising three structures: an expanded convolution layer, a BN layer and a linear rectification (ReLU) activation layer, and different receptive fields are provided for an input feature map through an expanded convolution method; the second part is an average pooling layer, which fuses traffic information of each branch receptive field and improves multi-scale precision detection.
The multi-branch convolution layer provides the input characteristic diagram with the receptive fields with different sizes by a method of expansion convolution, and expansion convolutions in three divided structural layers all have kernels with the same size but different expansion speeds. Specifically, they all use 3×3 dilation convolution kernels, with three levels of dilation speed d of 1, 3, 5, respectively. The spreading convolution can spread the receptive field in an exponential ratio without losing resolution. Whereas in the convolution operation of the dilation convolution, the elements of the convolution kernel are spaced apart, the size of the space depends on the expansion rate, unlike in standard convolution operations where the elements of the convolution kernel are all adjacent. The convolution kernel is changed from 3×3 to 7×7, and the receptive field of the layer is 7×7. The receptive field formula of the dilation convolution is:
r i =1+(k-1)×d
r 2 =r 1 +(k-1)×d
r n Δr n-1 +(k-1)×d
where k and d represent the steps of the kernel-size and convolution, respectively.
And the average pooling layer fuses the receptive field information of each branch, and finally, the multi-scale precision prediction can be improved. The branch pooling layer is used for fusing information from different parallel branches, and avoids introducing additional parameters. During training, the representations of the different parallel branches are balanced using an averaging operation, enabling a single branch to perform reasoning during testing. The expression is as follows:
wherein y is i Representing the output of the branch pooling layer, a represents the number of parallel branches.
And S32, adding a CA attention mechanism module after the CSP structure in the back bone structure of the original Yolov5S model so as to enhance the expression capability of the network learning characteristics and improve the average precision mean value of the network training model.
The CA attention module implementation proceeds as follows.
In order to acquire the attention on the width and the height of an image and encode accurate position information, a CA module carries out global average pooling on the width and the height of an input feature map to obtain the feature map of the two directions, and the formula is as follows:
where W is the width of the input feature map, H is the height of the input feature map, x c Representing the input at the c-th channel, h represents the h height at the feature map, x c (h, i) represents an input at h height dividing width W into W bisecting ith bisection, x c (j, w) denotes dividing the height H into H bisectors at the j-th bisector at the width wAnd (5) inputting.
Then splicing the feature graphs in the width direction and the height direction of the obtained global receptive field together, then sending the feature graphs into a convolution module with a shared convolution kernel of 1 multiplied by 1, reducing the dimension to the original C/r, and then sending the feature graph F subjected to batch normalization processing into a Sigmoid activation function to obtain a feature graph F, wherein the formula is as follows:
wherein δ represents a Sigmoid activation function, and the formula of the activation function is as follows:
then the characteristic diagram F is convolved into 1X 1 according to the original height and width to obtain the same number of channels and the original F h And f w The attention weights of the feature map in height and width are obtained through a Sigmoid activation function respectively, and the formulas are as follows:
ω h =δ(f h (F h ))
ω w =δ(f w (F w ))
where δ is a Sigmoid activation function, F h And F w The components of the feature map F in the height and width directions, F h And f w The two components of the feature map F are respectively subjected to a 1×1 convolution.
Finally, the original feature map is multiplied to obtain the feature map with attention weight in the width and height directions, and the formula is as follows:
wherein x is c (m, n) is the original feature map,and->The height and width directions are feature maps with attention weights, respectively.
S4, training the data set by using the improved Yolov5S model to obtain a final apple leaf disease detection model;
the training data set and the test data set are transmitted into an improved Yolov5s model, and the following parameters are set: the input image size was set to 640 x 640, batch_size was set to 4, the training number epoch was set to 100, and then training of the model was performed. The invention verifies the performance of the improved Yolov5s model and the original Yolov5s model, and the experimental environment is as follows: CPU: intel (R) Core (TM) i5-7300HQ, 16g of memory, GTX1050 as a display card, 11.6 as a Cuda version, and Pytorch as a framework. The experimental results are as follows.
The mAP value of the improved yolov5s model is 95.8%, the mAP value of the original yolov5s is 89.7%, and the improvement is 6.1 percent; the improved yolov5s model has an accuracy value of 93.1%, the original yolov5s model has an accuracy value of 87.6%, and the accuracy value is improved by 5.5 percent; the recall rate of the improved yolov5s model is 94.1%, the recall rate of the original yolov5s model is 90.3%, 3.8% are improved, and comprehensive results show that the improved yolov5s model is superior to the original yolov5s model in a plurality of performance evaluation indexes.
S5, preprocessing an image to be detected, judging whether the image is shot in a sunny day or a rainy day, and if so, performing raindrop noise reduction processing on the image by using an active GAN algorithm; if the shooting is performed on a sunny day, the network model is directly used for detection, and a final detection result is obtained.
The process of judging whether the image is shot on a sunny day is as follows:
s51: according to the difference of the surface textures of the blades in sunny days and rainy days, whether the image is shot in sunny days or not can be judged by a method of extracting texture features and performing feature matching. Firstly, an apple leaf image shot in sunny days is read as matching data, gray processing and binarization processing are carried out on the matching data image, then, characteristic points of the leaf are extracted by adopting a SIFT algorithm, extracted key points are vectorized, and extracted local characteristics are used as a matching template. The template map key point vectorization matrix is as follows:
s52: then inputting an image to be detected, carrying out gray level and binarization processing on the detected image, extracting feature points on the surface of the blade by adopting a SIFT algorithm, vectorizing the extracted key points, and taking the extracted local features as an observation chart. The observation map keypoint vectorization matrix is as follows:
s53: and carrying out similarity measurement on the model layout and the observation diagram, wherein the measurement formula is as follows:
wherein m is ij Feature value r representing each key point in template vectorization matrix ij Representing the eigenvalues of each key point in the observation map vectorization matrix.
A threshold is set, when the similarity metric satisfies d (M ij ,R ij ) When the threshold is less than the threshold, the image to be detected can be judged to be shot on a sunny day, and the detection model is directly used for detecting diseases; if the judging condition is not met, shooting the image in rainy days, and carrying out noise reduction treatment on the image by adopting an active GAN algorithm.
The invention puts the preprocessed image into the apple leaf disease detection model, outputs the detection result, and the detection result diagrams are shown in figures 3-7, and are respectively the detection results of Alternaria alternata (Alternaria Boltch), brown Spot (brown Spot), gray Spot (grey Spot), mosaic disease (Mosaic disease) and Rust disease (Rust), so that the apple leaf disease detection model can accurately identify apple leaf diseases.
The detailed description is merely a preferred embodiment of the invention and is not intended to limit the scope of the invention, which is defined by the appended claims.
Claims (7)
1. An apple leaf disease detection method based on an improved Yolov5s model is characterized by comprising the following steps of: the method comprises the following steps:
s1, obtaining images of different diseases of apple leaves, and labeling to construct an initial data set;
s2, expanding a data set by adopting an image processing method, and dividing a training set and a testing set to obtain a final data set;
s3, introducing and improving a Yolov5S model, and training a data set by using the improved model to obtain a final apple leaf disease detection model;
based on a feature pyramid of a rock structure of the Yolov5s model, adding FEM, and simultaneously adding a CA attention module behind a CSP structure in a back bone structure of the Yolov5s model, so as to enhance the expression capability of the network learning features and improve the average precision mean value of the network training model; the CA attention module is realized as follows:
in order to acquire the attention on the width and the height of an image and encode accurate position information, the CA attention module carries out global average pooling on the width and the height of an input feature map to obtain the feature map of the two directions, and the formula is as follows:
wherein,,w is the width of the input feature map, H is the height of the input feature map, x c Representing the input at the c-th channel, h represents the h height at the feature map, x c (h, i) represents an input at h height dividing width W into W bisecting ith bisection, x c (j, w) represents an input at the j-th aliquot dividing the height H into H aliquots at the w-width;
then splicing the feature graphs in the width direction and the height direction of the obtained global receptive field together, then sending the feature graphs into a convolution module with a shared convolution kernel of 1 multiplied by 1, reducing the dimension to the original C/r, and then sending the feature graph F subjected to batch normalization processing into a Sigmoid activation function to obtain a feature graph F, wherein the formula is as follows:
wherein δ represents a Sigmoid activation function, and the formula of the activation function is as follows:
then the characteristic diagram F is convolved into 1X 1 according to the original height and width to obtain the same number of channels and the original F h And f w The attention weights omega of the feature graphs in height and width are obtained through a Sigmoid activation function h And omega w The formula is as follows:
ω h =δ(f h (F h ))
ω w =δ(f w (F w ))
wherein F is h And F w The components of the feature map F in the height and width directions, F h And f w Respectively a characteristic diagram of the two components of the characteristic diagram F after 1 multiplied by 1 convolution;
finally, the original feature map is multiplied to obtain the feature map with attention weight in the width and height directions, and the formula is as follows:
wherein x is c (m, n) is the original feature map,and->Feature maps with attention weights in the height and width directions, respectively;
and S4, detecting an image to be detected by using a final apple leaf disease detection model to obtain a detection result.
2. The apple leaf disease detection method based on an improved Yolov5s model of claim 1, wherein the method comprises the following steps: in the step S1, common diseases of apple leaves comprise Alternaria alternata, brown spot, gray spot, mosaic disease and rust, and different disease images are labeled.
3. The apple leaf disease detection method based on an improved Yolov5s model of claim 1, wherein the method comprises the following steps: in step S2, affine transformation, filtering, translation and rotation are performed on the image, and the data set is expanded to increase the richness of the data set and prevent the model from being fitted.
4. The apple leaf disease detection method based on an improved Yolov5s model of claim 1, wherein the method comprises the following steps: the FEM comprises two parts, namely a multi-branch convolution layer and an average pooling layer, wherein the multi-branch convolution layer comprises an expansion convolution layer, a BN layer and an activation layer, and different receptive fields are provided for an input feature map through an expansion convolution method; the average pooling layer fuses traffic information of each branch receptive field, and multi-scale precision detection is improved.
5. The apple leaf disease detection method based on an improved Yolov5s model of claim 1, wherein the method comprises the following steps: in step S5, preprocessing an image to be detected, judging whether the image is photographed in a sunny day or a rainy day, and if so, performing raindrop noise reduction on the image; if the shooting is performed on a sunny day, the network model is directly used for detection, and a final detection result is obtained.
6. The apple leaf disease detection method based on an improved Yolov5s model of claim 1, wherein the method comprises the following steps: the process of judging whether the image is shot on a sunny day is as follows:
s51: judging whether the image is photographed on a sunny day or not by a method of extracting texture features and performing feature matching according to the difference of the surface textures of the blades on the sunny day and the rainy day;
s52: inputting an image to be detected, carrying out gray level and binarization processing on the detected image, extracting feature points on the surface of the blade, vectorizing the extracted key points, and taking the extracted local features as an observation chart;
s53: and carrying out similarity measurement on the model layout and the observation diagram.
7. The apple leaf disease detection method based on an improved Yolov5s model of claim 6, wherein the method comprises the following steps: setting threshold, d (M ij ,R ij ) Representing a similarity measure, when the similarity measure satisfies d (M ij ,R ij ) When the threshold is less than the threshold, the image to be detected can be judged to be shot on a sunny day, and the detection model is directly used for detecting diseases; if the judging condition is not met, shooting the image in rainy days, and carrying out noise reduction treatment on the image by adopting an active GAN algorithm.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210663984.6A CN115273072B (en) | 2022-06-13 | 2022-06-13 | Apple leaf disease detection method based on improved Yolov5s model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210663984.6A CN115273072B (en) | 2022-06-13 | 2022-06-13 | Apple leaf disease detection method based on improved Yolov5s model |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115273072A CN115273072A (en) | 2022-11-01 |
CN115273072B true CN115273072B (en) | 2023-05-19 |
Family
ID=83760485
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210663984.6A Active CN115273072B (en) | 2022-06-13 | 2022-06-13 | Apple leaf disease detection method based on improved Yolov5s model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115273072B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117115640A (en) * | 2023-07-04 | 2023-11-24 | 北京市农林科学院 | Improved YOLOv 8-based pest and disease damage target detection method, device and equipment |
CN116883364A (en) * | 2023-07-17 | 2023-10-13 | 安徽大学 | Apple leaf disease identification method based on CNN and Transformer |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114005029A (en) * | 2021-10-20 | 2022-02-01 | 华南农业大学 | Improved yolov5 network-based fingered citron pest and disease identification method and system |
CN114372955A (en) * | 2021-12-02 | 2022-04-19 | 上海工程技术大学 | Casting defect X-ray diagram automatic identification method based on improved neural network |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114444653A (en) * | 2021-12-21 | 2022-05-06 | 武汉中海庭数据技术有限公司 | Method and system for evaluating influence of data augmentation on deep learning model performance |
-
2022
- 2022-06-13 CN CN202210663984.6A patent/CN115273072B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114005029A (en) * | 2021-10-20 | 2022-02-01 | 华南农业大学 | Improved yolov5 network-based fingered citron pest and disease identification method and system |
CN114372955A (en) * | 2021-12-02 | 2022-04-19 | 上海工程技术大学 | Casting defect X-ray diagram automatic identification method based on improved neural network |
Also Published As
Publication number | Publication date |
---|---|
CN115273072A (en) | 2022-11-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115273072B (en) | Apple leaf disease detection method based on improved Yolov5s model | |
Es-saady et al. | Automatic recognition of plant leaves diseases based on serial combination of two SVM classifiers | |
CN106228185B (en) | A kind of general image classifying and identifying system neural network based and method | |
CN109598306B (en) | Hyperspectral image classification method based on SRCM and convolutional neural network | |
CN108447057B (en) | SAR image change detection method based on significance and depth convolution network | |
CN111160396B (en) | Hyperspectral image classification method of graph convolution network based on multi-graph structure | |
CN111126361B (en) | SAR target identification method based on semi-supervised learning and feature constraint | |
Lin et al. | The pest and disease identification in the growth of sweet peppers using faster R-CNN and mask R-CNN | |
CN104751117A (en) | Lotus seedpod target image recognition method for picking robot | |
CN111639697B (en) | Hyperspectral image classification method based on non-repeated sampling and prototype network | |
Wang et al. | Segmentation of corn leaf disease based on fully convolution neural network | |
Mai et al. | Automatic lesion segmentation from rice leaf blast field images based on random forest | |
Chaturvedi et al. | Efficient Method for Tomato Leaf Disease Detection and Classification based on Hybrid Model of CNN and Extreme Learning Machine | |
CN117392157A (en) | Edge-aware protective cultivation straw coverage rate detection method | |
CN117475163A (en) | Crop disease severity detection method | |
Chen et al. | The building recognition and analysis of remote sensing image based on depth belief network | |
CN109558883B (en) | Blade feature extraction method and device | |
CN113298835B (en) | Fruit harvesting maturity weighted evaluation method | |
CN113469084B (en) | Hyperspectral image classification method based on contrast generation countermeasure network | |
CN113095384B (en) | Remote sensing image matching method based on linear segment context characteristics | |
Ramachandran et al. | Tiny Criss-Cross Network for segmenting paddy panicles using aerial images | |
CN114782455A (en) | Cotton row center line image extraction method for agricultural machine embedded equipment | |
Shakil et al. | Addressing agricultural challenges: An identification of best feature selection technique for dragon fruit disease recognition | |
CN111046861B (en) | Method for identifying infrared image, method for constructing identification model and application | |
CN111079850B (en) | Depth-space spectrum combined hyperspectral image classification method of band significance |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |