Lightweight Residual Networks for Diagnosis of Apple Leaf Diseases
-
摘要:
目的 解决卷积神经网络在复杂环境下识别率低、模型参数多等问题,为苹果叶病智能识别提供参考。 方法 本研究提出一种基于改进ResNet18的苹果叶病识别模型。首先,通过离线增强和在线增强两种方式解决数据不平衡和数据过拟合现象,增强模型的泛化能力;其次,引入缩放因子调整通道参数以减少网络参数量,并在下采样残差结构的恒等映射中用最大池化层代替1×1卷积完成下采样,去除图片中的冗余特征,增大模型的感受野;将ResNet18模型的第一层7×7卷积层替换为多尺度特征提取模块,提高模型对细小病斑的提取能力;最后,在特征提取网络中插入DenseBlock模块,加强模型对浅层有效特征的重用。 结果 改进后的ResNet18模型准确率为97.94%,比原模型高出0.88个百分点;模型大小为3.97 MB,比原模型减小90.77%。与ShuffleNetv2、MobileNetv3、EfficientNet等轻量化模型和Inceptionv2、DenseNet、ResNet等经典模型相比,该模型拥有更好的性能。 结论 改进后的模型在复杂环境下能够准确识别苹果叶病,并且具有较少的模型参数,方便移植到移动设备上,为苹果叶病的智能诊断提供参考。 -
关键词:
- ResNet18模型 /
- 多尺度特征提取 /
- 最大池化层 /
- DenseBlock模块
Abstract:Objective An improved diagnostic model on apple leaf diseases was developed applying the lightweight residual networks. Method Data imbalance and overfitting of the original ResNet18 model was reduced by offline and online enhancements on its generalization ability. A scaling factor was introduced to minimize the number of network parameters and maximize the pooling layer in the constant mapping of down-sampled residual structure instead of 1×1 convolution. Redundant features in pictures were eliminated, and sensory field of the model increased. The first 7×7 convolutional layer of ResNet18 was replaced with a multi-scale feature extraction module to enrich fine lesions extraction. Finally, the DenseBlock module was inserted in the network to fully utilize valid shallow features. Results The improved ResNet18 model achieved an accuracy of 97.94%, which was a 0.88 percentage increase, with a significant 90.77% reduction on the program size of 3.97 MB. It performed superbly in comparison to other light-weight models, such as ShuffleNetv2, MobileNetv3, and EfficientNet, or the classical models, such as Inceptionv2, DenseNet, and ResNet. Conclusion The improved ResNet18 model could accurately identify the apple leaf diseases under complex circumstances. With fewer parameters than the original program, it could be more easily installed in a variety of devices for the diagnosis. -
表 1 数据集样本数量
Table 1. Information on sample data set
类别名称
Class name复杂背景
Complex background简单背景
Simple background增强后 Augmented 总数
Total训练集 Training set 验证集 Test set 健康 Healthy 845 — 676 169 845 斑点落叶病 Alternaria boltch 271 145 667 165 832 褐斑病 Brown spot 33 379 659 165 824 灰斑病 Grey spot 163 176 543 135 678 花叶病 Mosaic 171 200 594 148 742 白粉病 Powdery mildew 872 — 698 174 872 黑星病 Scab 809 — 648 161 809 锈病 Rush 715 — 572 143 715 总数 Total 3879 900 5057 1260 6317 表 2 参数调整和残差改进的对比分析
Table 2. Comparative analysis on parameter adjustment and residual improvement
模型
Model模型大小
Model size/MB参数量
Parameters/M准确率
Accuracy/%ResNet 42.7 11.18 97.06 ResNet-α0.75 24.0 6.29 97.22 ResNet-α0.5 10.7 2.80 97.14 ResNet-α0.25 2.73 0.70 96.27 ResNet-α0.25+Max 2.73 0.70 96.98 “α0.75”的数字代表通道缩放因子取值;Max代表最大池化层改进的下采样残差模块;M是百万的缩写,表示为1×106。
Data on "α0.75" is channel scaling factor; Max represents down-sampling residual module of maximum pooling layer improvement; M represents 1×106.表 3 消融试验结果
Table 3. Results on ablation experiments
模型
Model精确度
P/%召回率
R/%F1分数
F1 score/%准确率
Accuracy/%参数量
Parameters/M模型大小
Model size/MBResnet18 97.12 97.01 97.06 97.06 11.18 42.7 Resnet18-α0.25 96.34 96.24 96.29 96.27 0.70 2.73 Resnet18-α0.25+Max 96.96 96.99 96.98 96.98 0.70 2.73 Resnet18-α0.25+Max+MFEM 97.57 97.55 97.56 97.54 0.71 2.75 Resnet18-α0.25+Max+MFEM+DenseBlock 98.00 97.91 97.95 97.94 1.01 3.94 表 4 不同模型对比
Table 4. Comparisons on models
模型
Model精确度
P/%召回率
R/%F1分数
F1 score/%准确率
Accuracy/%参数量
Parameters/M模型大小
Model size/MBShuffleNetv2 94.60 94.64 94.62 94.60 1.26 4.98 GhostNet 91.71 91.77 91.74 91.80 3.89 15.1 MobileNetv3 93.17 93.20 93.19 93.17 1.52 5.95 EfficientNet 95.55 95.42 95.48 95.30 4.02 15.6 ResNet18 97.12 97.01 97.06 97.06 11.18 42.7 AlexNet 88.69 88.74 88.71 88.65 14.60 55.6 DenseNet121 97.31 97.28 97.30 97.22 6.90 27.1 Inceptionv2 94.54 94.59 94.56 94.52 7.3 28.2 Our model 98.00 97.91 97.95 97.94 1.01 3.94 -
[1] 张秋菊. 苹果树病虫害智能识别系统设计与实现 [J]. 农业工程技术, 2022, 42(30):23−24.ZHANG Q J. Design and implementation of intelligent identification system for apple tree pests and diseases [J]. Agricultural Engineering Technology, 2022, 42(30): 23−24. (in Chinese) [2] KUMAR S, KUMAR R, GUPTA M. Analysis of apple plant leaf diseases detection and classification: A review[C]//2022 Seventh International Conference on Parallel, Distributed and Grid Computing (PDGC). November 25-27, 2022. Solan, Himachal Pradesh, India. IEEE, 2022: 361-365. [3] 王树桐, 王亚南, 曹克强. 近年我国重要苹果病害发生概况及研究进展 [J]. 植物保护, 2018, 44(5):13−25,50.WANG S T, WANG Y N, CAO K Q. Occurrence of and research progress in important apple diseases in China in recent years [J]. Plant Protection, 2018, 44(5): 13−25,50. (in Chinese) [4] 钟昌源, 胡泽林, 李淼, 等. 基于分组注意力模块的实时农作物病害叶片语义分割模型 [J]. 农业工程学报, 2021, 37(4):208−215.ZHONG C Y, HU Z L, LI M, et al. Real-time semantic segmentation model for crop disease leaves using group attention module [J]. Transactions of the Chinese Society of Agricultural Engineering, 2021, 37(4): 208−215. (in Chinese) [5] 翟肇裕, 曹益飞, 徐焕良, 等. 农作物病虫害识别关键技术研究综述 [J]. 农业机械学报, 2021, 52(7):1−18.ZHAI Z Y, CAO Y F, XU H L, et al. Review of key techniques for crop disease and pest detection [J]. Transactions of the Chinese Society for Agricultural Machinery, 2021, 52(7): 1−18. (in Chinese) [6] CHENG H H, DAI Y L, LIN Y, et al. Identifying tomato leaf diseases under real field conditions using convolutional neural networks and a chatbot [J]. Computers and Electronics in Agriculture, 2022, 202: 107365. doi: 10.1016/j.compag.2022.107365 [7] AI Y, SUN C, TIE J, et al. Research on recognition model of crop diseases and insect pests based on deep learning in harsh environments [J]. IEEE Access, 2020, 8: 171686−171693. doi: 10.1109/ACCESS.2020.3025325 [8] 谢圣桥, 宋健, 汤修映, 等. 基于迁移学习和残差网络的葡萄叶部病害识别 [J]. 农机化研究, 2023, 45(8):18−23,28.XIE S Q, SONG J, TANG X Y, et al. Identification of grape leaf diseases based on transfer learning and residual networks [J]. Journal of Agricultural Mechanization Research, 2023, 45(8): 18−23,28. (in Chinese) [9] 王彦翔, 张艳, 杨成娅, 等. 基于深度学习的农作物病害图像识别技术进展 [J]. 浙江农业学报, 2019, 31(4):669−676.WANG Y X, ZHANG Y, YANG C Y, et al. Advances in new nondestructive detection and identification techniques of crop diseases based on deep learning [J]. Acta Agriculturae Zhejiangensis, 2019, 31(4): 669−676. (in Chinese) [10] 鲍文霞, 吴刚, 胡根生, 等. 基于改进卷积神经网络的苹果叶部病害识别 [J]. 安徽大学学报(自然科学版), 2021, 45(1):53−59.BAO W X, WU G, HU G S, et al. Apple leaf disease recognition based on improved convolutional neural network [J]. Journal of Anhui University (Natural Science Edition), 2021, 45(1): 53−59. (in Chinese) [11] NADER A, KHAFAGY M H, HUSSIEN S A. Grape Leaves Diseases Classification using Ensemble Learning and Transfer Learning [J]. International Journal of Advanced Computer Science and Applications, 2022, 13(7): 563−571. [12] 宋晨勇, 白皓然, 孙伟浩, 等. 基于GoogLeNet改进模型的苹果叶病诊断系统设计 [J]. 中国农机化学报, 2021, 42(7):148−155.SONG C Y, BAI H R, SUN W H, et al. Design of apple leaf disease diagnosis system based on GoogLeNet improved model [J]. Journal of Chinese Agricultural Mechanization, 2021, 42(7): 148−155. (in Chinese) [13] GAO Y X, CAO Z Z, CAI W W, et al. Apple leaf disease identification in complex background based on BAM-net [J]. Agronomy, 2023, 13(5): 1240. doi: 10.3390/agronomy13051240 [14] 周宏威, 沈恒宇, 袁新佩, 等. 基于迁移学习的苹果树叶片病虫害识别方法研究 [J]. 中国农机化学报, 2021, 42(11):151−158.ZHOU H W, SHEN H Y, YUAN X P, et al. Research on identification method of apple leaf diseases based on transfer learning [J]. Journal of Chinese Agricultural Mechanization, 2021, 42(11): 151−158. (in Chinese) [15] 孙文杰, 牟少敏, 董萌萍, 等. 基于卷积循环神经网络的桃树叶部病害图像识别 [J]. 山东农业大学学报(自然科学版), 2020, 51(6):998−1003.SUN W J, MU S M, DONG M P, et al. Image recognition of peach leaf diseases based on convolutional recurrent neural network [J]. Journal of Shandong Agricultural University (Natural Science Edition), 2020, 51(6): 998−1003. (in Chinese) [16] 孙俊, 朱伟栋, 罗元秋, 等. 基于改进MobileNet-V2的田间农作物叶片病害识别 [J]. 农业工程学报, 2021, 37(22):161−169.SUN J, ZHU W D, LUO Y Q, et al. Recognizing the diseases of crop leaves in fields using improved Mobilenet-V2 [J]. Transactions of the Chinese Society of Agricultural Engineering, 2021, 37(22): 161−169. (in Chinese) [17] 彭红星, 何慧君, 高宗梅, 等. 基于改进ShuffleNetV2模型的荔枝病虫害识别方法 [J]. 农业机械学报, 2022, 53(12):290−300.PENG H X, HE H J, GAO Z M, et al. Litchi diseases and insect pests identification method based on improved ShuffleNetV2 [J]. Transactions of the Chinese Society for Agricultural Machinery, 2022, 53(12): 290−300. (in Chinese) [18] 杨祥, 段军明, 董明刚. 面向移动端的植物病害图像识别方法及其应用 [J]. 江苏农业科学, 2023, 51(4):191−197.YANG X, DUAN J M, DONG M G. Mobile-oriented plant disease image recognition method and its application [J]. Jiangsu Agricultural Sciences, 2023, 51(4): 191−197. (in Chinese) [19] LI Z B, YANG Y B, LI Y, et al. A Solanaceae disease recognition model based on SE-Inception [J]. Computers and Electronics in Agriculture, 2020, 178: 105792. doi: 10.1016/j.compag.2020.105792 [20] 周敏敏. 基于迁移学习的苹果叶面病害Android检测系统研究[D]. 杨凌: 西北农林科技大学, 2019.ZHOU M M. Apple foliage diseases recognition in android system with transfer learning-based[D]. Yangling: Northwest A & F University, 2019. (in Chinese) [21] 李大湘, 曾小通, 刘颖. 耦合全局与局部特征的苹果叶部病害识别模型 [J]. 农业工程学报, 2022, 38(16):207−214.LI D X, ZENG X T, LIU Y. Apple leaf disease identification model by coupling global and patch features [J]. Transactions of the Chinese Society of Agricultural Engineering, 2022, 38(16): 207−214. (in Chinese) [22] 张宁, 吴华瑞, 韩笑, 等. 基于多尺度和注意力机制的番茄病害识别方法 [J]. 浙江农业学报, 2021, 33(7):1329−1338.ZHANG N, WU H R, HAN X, et al. Tomato disease recognition scheme based on multi-scale and attention mechanism [J]. Acta Agriculturae Zhejiangensis, 2021, 33(7): 1329−1338. (in Chinese) [23] 王等准, 李飞, 严春雨, 等. 基于多尺度特征融合的轻量化苹果叶部病理识别 [J]. 激光与光电子学进展, 2023, 60(2):99−107.WANG D Z, LI F, YAN C Y, et al. Lightweight apple-leaf pathological recognition based on multiscale fusion [J]. Laser & Optoelectronics Progress, 2023, 60(2): 99−107. (in Chinese) [24] HUANG G, LIU Z, VAN DER MAATEN L, et al. Densely connected convolutional networks[C]//2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). July 21-26, 2017. Honolulu, HI. IEEE, 2017: 4700-4708. [25] HE K M, ZHANG X Y, REN S Q, et al. Deep residual learning for image recognition[C]//2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). June 27-30, 2016. Las Vegas, NV, USA. IEEE, 2016: 770-778. [26] HOWARD A G, ZHU M, CHEN B, et al. Mobilenets: Efficient convolutional neural networks for mobile vision applications[EB/OL]. 2017: arXiv: 1704.04861.https://arxiv.org/abs/1704.04861. [27] SZEGEDY C, VANHOUCKE V, IOFFE S, et al. Rethinking the inception architecture for computer vision[C]//2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). June 27-30, 2016. Las Vegas, NV, USA. IEEE, 2016: 2818-2826. [28] 韩旭, 赵春江, 吴华瑞, 等. 基于注意力机制及多尺度特征融合的番茄叶片缺素图像分类方法 [J]. 农业工程学报, 2021, 37(17):177−188.HAN X, ZHAO C J, WU H R, et al. Image classification method for tomato leaf deficient nutrient elements based on attention mechanism and multi-scale feature fusion [J]. Transactions of the Chinese Society of Agricultural Engineering, 2021, 37(17): 177−188. (in Chinese) [29] JIANG M L, FENG C G, FANG X S, et al. Rice disease identification method based on attention mechanism and deep dense network [J]. Electronics, 2023, 12(3): 508. doi: 10.3390/electronics12030508