Detection and identification of crop leaf diseases based on improved YOLOX-Nano
-
摘要:目的
实现精确迅速的农作物病害检测,减少人工诊断成本,降低病害带来的农作物产量和品质影响。
方法根据对农作物病害和病斑特征的分析,提出一种基于卷积注意力机制改进的YOLOX-Nano智能检测与识别模型,该模型采用CSPDarkNet作为主干网络,将卷积注意力模块CBAM引入到YOLOX-Nano网络结构的特征金字塔(Feature pyramid network,FPN)中,并在训练中引入Mixup数据增强方式,同时将分类的损失函数由二分类交叉熵损失函数(Binary cross entropy loss,BCE Loss)替换为焦点损失函数Focal Loss、回归损失函数由GIOU Loss替换为本文设计的CenterIOU Loss函数,采用迁移学习策略训练改进的YOLOX-Nano模型,以此提升农作物病害检测的精度。
结果改进后的YOLOX-Nano模型仅有0.98×106的参数量,在移动端测试单张图片检测时间约为0.187 s,平均识别精度达到99.56%。实践结果表明,其能快速有效地检测与识别苹果、玉米、葡萄、草莓、马铃薯和番茄等农作物的常见病害,且达到了精度与速度的平衡。
结论改进后的模型不仅对农作物叶片病害识别具有较高的精度和较快的检测速度,参数量和计算量较少,还易于部署在手机等移动端设备。该模型实现了在田间复杂环境对多种农作物病害精准定位与识别,对于指导早期农作物病害的防治具有十分重要的现实意义。
-
关键词:
- YOLOX-Nano网络 /
- 病害识别 /
- Focal Loss /
- 注意力机制 /
- 农作物病害
Abstract:ObjectiveTo identify crop diseases accurately and quickly, reduce the cost of artificial diagnosis, and reduce the impacts of crop diseases on crop yield and quality.
MethodBased on the analysis of the characteristics of crop diseases and spots, an improved YOLOX-Nano intelligent detection and recognition model based on convolution attention mechanism was proposed. The model employed CSPDarkNet as the backbone network, added convolutional attention module CBAM to the feature pyramid network (FPN) of the YOLOX-Nano network structure, and then introduced the mixup data enhancement method in the training. At the same time, the classification loss function was replaced by the binary cross entropy loss function (BCE Loss) with the focus loss function, the regression loss function of GIOU Loss was replaced by the CenterIOU Loss function designed in this paper, and a transfer learning strategy was also used to train the modified YOLOX-Nano model so as to improve the accuracy of crop disease detection.
ResultThe improved YOLOX-Nano model had parameters of 0.98×106, and the detection time of a single sheet was about 0.187 s at the mobile end, with a mean average precision of 99.56%. The practical results of introducing this method into mobile terminal deployment showed that it could quickly and effectively identify common diseases of crops such as apples, corns, grapes, strawberries, potatoes and tomatoes, and achieve the balance of accuracy and speed.
ConclusionThe improved model not only has higher accuracy and detection speed for crop leaf disease identification, but also has less parameters and calculation amount. The model was easy to be deployed on mobile devices such as mobile phones. In addition, the model achieves accurate positioning and identification of a variety of crop diseases in complex field environment, which is of great practical significance to guide the prevention and control of early crop diseases.
-
Keywords:
- YOLOX-Nano network /
- Disease identification /
- Focal Loss /
- Attention mechanism /
- Crop disease
-
-
图 1 PlantVillage部分数据集
1~4 依次为苹果黑星病、黑腐病、松锈病和健康叶;5~8依次为玉米灰斑病、锈病、健康叶和大斑病;9~12依次为葡萄黑腐病、轮斑病、褐斑病和健康叶;13~15依次为马铃薯早疫病、晚疫病和健康叶;16~17 依次为草莓叶焦病和健康叶;18~27 依次为番茄疮痂病、早疫病、晚疫病、叶霉病、斑枯病、红蜘蛛损伤、斑点病、黄叶曲叶病、花叶病毒病和健康叶;28为无叶片背景图
Figure 1. Partial dataset of PlantVillage
1−4 are apple scab, apple black rot, cedar apple rust and apple healthy leaves in turn; 5−8 are corn Cercospora zeaemaydis Tehon and Daniels, corn Puccinia polysora, corn healthy leaves and corn Curvularia leaf spot fungus; 9−12 are grape black rot, grape black measles, grape leaf blight fungus and grape healthy leaves in turn; 13−15 are potato early blight, potato late blight and potato healthy leaves in turn; 16−17 are strawberry leaf scorch and healthy leaves in turn; 18−27 are tomato bacterial spot bacteria, tomato early blight, tomato late blight water mold, tomato leaf mold, tomato septorial leaf spot, tomato spider mite damage, tomato target spot bacteria, tomato YLCV virus, tomato ToMV disease and tomato healthy leaves in turn; 28 is bladeless background image
图 9 Grad-CAM可视化添加CBAM前后玉米叶片特征提取的热力图
图片的颜色由黑到蓝再到黄直到红,依次表示网络对某区域特征关注逐渐增多
Figure 9. Grad-CAM visual characteristic extraction thermal diagram of corn leaf before and after adding CBAM
The color of the image changes from black to blue, then yellow to red, indicating that the network gradually pays more attention to the characteristics of a certain area
表 1 与主流轻量型网络性能对比
Table 1 Performance of the model versus mainstream lightweight network
模型
Model参数量(×106)
No. of parameters平均精确率/%
Mean average precision单张图片检测时间/s
Detection time of single imageYOLOX-Nano 0.92 97.97 0.176 ResNet-18 11.24 98.60 0.429 MobileNet-v2 3.40 97.33 0.189 YOLOv4-Tiny 6.06 97.42 0.382 YOLOX-Tiny 5.06 98.58 0.286 改进YOLOX-Nano
Improved YOLOX-Nano0.98 99.56 0.187 -
[1] 刘翱宇, 吴云志, 朱小宁, 等. 基于深度残差网络的玉米病害识别[J]. 江苏农业学报, 2021, 37(1): 67-74. doi: 10.3969/j.issn.1000-4440.2021.01.009 [2] SRDJAN S, MARKO A, ANDRAS A, et al. Deep neural networks based recognition of plant diseases by leaf image classification[J]. Computational Intelligence and Neuroscience, 2016(6): 3289801. doi: 10.1155/2016/3289801.
[3] ALBATTAH W, NAWAZ M, JAVED A, et al. A novel deep learning method for detection and classification of plant diseases[J]. Complex & Intelligent Systems, 2021, 8(2): 507-524.
[4] 刘洋, 冯全, 王书志. 基于轻量级CNN的植物病害识别方法及移动端应用[J]. 农业工程学报, 2019, 35(17): 194-204. doi: 10.11975/j.issn.1002-6819.2019.17.024 [5] SALEEM M H, POTGIETER J, ARIF K M. Plant disease classification: A comparative evaluation of convolutional neural networks and deep learning optimizers[J]. Plants (Basel, Switzerland), 2020, 9(10): 1319. doi: 10.3390/plants9101319.
[6] 孙俊, 谭文军, 毛罕平, 等. 基于改进卷积神经网络的多种植物叶片病害识别[J]. 农业工程学报, 2017, 33(19): 209-215. doi: 10.11975/j.issn.1002-6819.2017.19.027 [7] 李书琴, 陈聪, 朱彤, 等. 基于轻量级残差网络的植物叶片病害识别[J]. 农业机械学报, 2022, 53(3): 243-250. doi: 10.6041/j.issn.1000-1298.2022.03.025 [8] GE Z, LIU S T, WANG F, et al. YOLOX: Exceeding YOLO series in 2021[EB/OL]. arXiv: 2107.08430. 2021: https://arxiv.org/abs/2107.08430.
[9] WOO S, PARK J, LEE J Y, et al. CBAM: Convolutional block attention module[C]//European Conference on Computer Vision. Cham: Springer, 2018: 3-19.
[10] ZHANG H, CISSE M, DAUPHIN Y N, et al. Mixup: Beyond empirical risk minimization[EB/OL]. 2017: arXiv: 1710.09412. https://arxiv.org/abs/1710.09412.
[11] LIN T Y, GOYAL P, GIRSHICK R, et al. Focal loss for dense object detection[C]//2017 IEEE International Conference on Computer Vision (ICCV). Venice, Italy: IEEE, 2017: 2999-3007.
[12] WANG C Y, MARKLAO H Y, WU Y H, et al. CSPNet: A new backbone that can enhance leaming capablity of CNN[C]//2020 IEEE/CVF Conerence on Computer Vsion and Pattern Recognition Workshops(CVPRW). Seattle, WA, USA: IEEE, 2020: 1571-1580.
[13] LIN T, DOLLAR P, GIRSHICK R, et al. Feature pyramid networksifor object detection[C]//2017 IEEE Conference on Computer Vision and Pattern Recognition. Honolulu, HI, USA: IEEE, 2017: 936-944
[14] LlU S, QI L, QIN H F, et al. Path aggregation network for instance segmentation[C]//2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Salt Lake City, UT, USA: IEEE, 2018: 8759-8768.
[15] LIN T Y, MAIRE M, BELONGIE S, et al. Microsoft COCO: Common objects in context[C]//European Conference on Computer Vision. Cham: Springer, 2014: 740-755.
[16] EVERINGHAM M, ALIESLAMI S M, VAN GOOL L, et al. The pascal visual object classes challenge: A retrospective[J]. International Journal of Computer Vision, 2015, 111(1): 98-136. doi: 10.1007/s11263-014-0733-5
[17] SELVARAJU R R, COGSWELL M, DAS A, et al. Grad-CAM: Visual explanations from deep networks via gradient-based localization[J]. International Journal of Computer Vision, 2020, 128(2): 336-359.
[18] HE K M, ZHANG X Y, REN S Q, et al. Spatial pyramid pooling in deep convolutional networks for visual recognition[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2015, 37(9): 1904-1916. doi: 10.1109/TPAMI.2015.2389824
[19] 王立舒, 秦铭霞, 雷洁雅, 等. 基于改进YOLOv4-Nano的蓝莓成熟度识别方法[J]. 农业工程学报, 2021, 37(18): 170-178. [20] 赵志成, 罗泽, 王鹏彦, 等. 基于深度残差网络图像分类算法研究综述[J]. 计算机系统应用, 2020, 28(1): 14-21. doi: 10.15888/j.cnki.csa.007243 [21] 孙云云, 江朝晖, 董伟, 等. 基于卷积神经网络和小样本的茶树病害图像识别[J]. 江苏农业学报, 2019, 35(1): 48-55. doi: 10.3969/j.issn.1000-4440.2019.01.007 [22] 李晓振, 徐岩, 吴作宏, 等. 基于注意力神经网络的番茄叶部病害识别系统[J]. 江苏农业学报, 2020, 36(3): 561-568. doi: 10.3969/j.issn.1000-4440.2020.03.005 [23] 王艳玲, 张宏立, 刘庆飞, 等. 基于迁移学习的番茄叶片病害图像分类[J]中国农业大学学报, 2019, 24(6): 124-130. [24] 邱靖, 刘继荣, 曹志勇, 等. 基于卷积神经网络的水稻病害图像识别研究[J]. 云南农业大学学报(自然科学), 2019, 34(5): 884-888. -
期刊类型引用(10)
1. 王丽亚,陈哲. 基于多特征融合的番茄叶片病害智能诊断系统开发. 电子制作. 2025(05): 41-45 . 百度学术
2. 李文雪,孟洪兵,孙丽丽,韩璐宇. 融合多尺度注意力机制的棉花枯萎病识别算法研究. 现代农业装备. 2025(02): 86-92 . 百度学术
3. 樊江川,王源桥,苟文博,蔡双泽,郭新宇,赵春江. 基于实例分割技术的草莓叶龄及冠幅表型快速提取方法. 智慧农业(中英文). 2024(02): 95-106 . 百度学术
4. 李坤,刘婧,齐赫. 基于分层特征交叉注意力的小样本马铃薯病害叶片识别. 江苏农业科学. 2024(10): 210-216 . 百度学术
5. 冯玉涵,孙剑,张志芳. 基于层间特征蒸馏网络的作物叶片病害检测. 中国农机化学报. 2024(09): 271-277 . 百度学术
6. 李凤妹,龚青松,李奔奔,张敏,丁一,吕军. 基于改进YOLO v5s模型的水稻病虫害监测系统. 农业工程技术. 2024(20): 17-20 . 百度学术
7. 杨欢,王钧,李广,吴江琪,谈燕. 大田环境下青贮玉米枯叶病检测模型. 软件导刊. 2024(09): 193-199 . 百度学术
8. 方晓捷,严李强,张福豪,高心雨. 基于深度学习的农作物图像识别的发展. 江苏农业科学. 2024(20): 18-24 . 百度学术
9. 麻剑钧,刘晓慈,金龙新,熊伟,易森林,封春芳,刘阳,夏先亮. 基于机器视觉的农作物病害识别研究进展. 湖南农业科学. 2023(09): 97-100 . 百度学术
10. 郭文娟,冯全. 基于类激活映射的可解释性方法在农作物检测识别中的发展现状与趋势. 智能化农业装备学报(中英文). 2023(04): 41-48 . 百度学术
其他类型引用(13)