Professional Documents
Culture Documents
DOI: 10.13930/j.cnki.cjea.200375
基于卷积神经网络的玉米病害小样本识别研究*
杨明欣, 张耀光, 刘 涛 **
(河北科技大学经济管理学院 石家庄 050018)
摘 要: 农作物病害治理对于农作物的产量和品质有着非常重要的影响。本文针对玉米病害人工识别困难、
识别过程耗费大量的人力成本和病害数据样本小且分布不均的问题, 提出了一种改进的迁移学习神经网络
(Neural Network)的病害识别方法。首先, 采用旋转、翻转等方法对样本图像集进行数据增强; 其次, 通过迁移
的 MobileNetV2 模型在玉米病害图像数据集上训练, 利用 Focal Loss 函数改进神经网络的损失函数; 最后, 通
过 Softmax 分类方法实现玉米病害图像识别。另外通过试验对比 AlexNet、GooleNet、Vgg16、RestNet34、
MobileNetV2 和迁移的 MobileNetV2 这 6 种模型的训练集准确率、验证集准确率、权重、参数数量和运行时
间。结果显示, 6 种模型验证集的准确率分别为 93.88%、95.48%、91.69%、97.67%、96.21%和 97.23%, 迁移
的 MobileNetV2 的准确率最高, 且权重仅有 8.69 MB。进一步通过混淆矩阵对比了 MobileNetV2 和迁移的
MobileNetV2 两种模型, 迁移的 MobileNetV2 模型识别正确率提升 1.02%, 训练速度减少 6 350 s。本文提出迁
移的 MobileNetV2 模型对玉米病害小样本的识别效果最佳, 具备更好的收敛速度与识别能力, 同时能够降低
模型的运算量并大幅度缩短识别时间。
关键词: 玉米病害; 迁移学习; 小样本; 卷积神经网络; Focal Loss; 混淆矩阵
中图分类号: TP183 开放科学码(资源服务)标识码(OSID):
Abstract: Crop disease management influences yield and quality, yet identifying corn diseases is still difficult. High labor costs,
small number of sample, and uneven disease distributions contribute to the difficulty. We propose an improved Convolutional Neural
Network (CNN) model based on the transfer learning method for disease identification. The sample image set was enhanced by rota-
tion and roll-over, then the migrated MobileNetV2 model was used to train the image data set for corn diseases. The Focal Loss func-
tion was used to improve the neural network loss function, and the Softmax classification method was used for corn disease image
recognition. The training set accuracy, validation set accuracy, weight, run time, and the number of parameter in six models were
experimentally compared. The verification set accuracy rates were 93.88% (AlexNet), 95.48% (GoogleNet), 91.69% (Vgg16),
97.67% (RestNet34), 96.21% (MobileNetV2), and 97.23% (migrated MobileNetV2). The migrated MobileNetV2 was 97.23% accu-
* 河北省重点研发计划项目(19226417D)和河北省高等学校科学技术重点项目(ZD2019083)资助
** 通信作者: 刘涛, 主要研究方向为信息资源管理和大数据分析建模。E-mail: liutaolunwen@163.com
杨明欣, 主要从事信息管理、信息安全方面的研究。E-mail: ymxspj@163.com
收稿日期: 2020-05-20 接受日期: 2020-09-26
* This study was supported by the Key R&D Program of Hebei Province of China (19226417D) and the Key Science and Technology Project of
Higher School of Hebei Province of China (ZD2019083).
** Corresponding author, E-mail: liutaolunwen@163.com
Received May 20, 2020; accepted Sep. 26, 2020
http://www.ecoagri.ac.cn
第 12 期 杨明欣等: 基于卷积神经网络的玉米病害小样本识别研究 1925
rate and weighed 8.69 MB. Confounding the MobileNetV2 model improved the recognition accuracy by 1.02% and reduced the
training speed by 6 350 seconds compared to the unconfounded model. The migrated MobileNetV2 model had the best corn disease
recognition ability with a small sampling size; improved convergence speed, reduced model calculations, and greatly improved the
recognition time.
Keywords: Corn diseases and insect pests; Transfer learning; Small sample; Convolutional Neural Network; Focal Loss;
Confusion matrix
http://www.ecoagri.ac.cn
1926 中国生态农业学报(中英文) 2020 第 28 卷
图1 残差网络(a)和倒残差网络(b)结构图
Fig. 1 Structures of the residual network (a) and the inverted residual network (b)
http://www.ecoagri.ac.cn
第 12 期 杨明欣等: 基于卷积神经网络的玉米病害小样本识别研究 1927
http://www.ecoagri.ac.cn
1928 中国生态农业学报(中英文) 2020 第 28 卷
表2 数据增强后的玉米病害数据集
Table 2 Maize diseases dataset after data enhancement
表3 5 种玉米病害类型训练集准确率
Table 3 Train set accuracies of five diseases of maize
标签 0 准确率 标签 1 准确率 标签 2 准确率 标签 3 准确率 标签 4 准确率 总训练集的准确率
训练集
Label 0 accuracy Label 1 accuracy Label 2 accuracy Label 3 accuracy Label 4 accuracy Total training set accuracy
Training set
(%) (%) (%) (%) (%) (%)
原始 Original 98.42 84.56 98.06 82.72 96.89 92.77
增强 Enhancement 99.38 89.19 97.62 85.71 99.39 94.62
标签 0-4 的意义见表 2。The meaning of the lable 0-4 is shown in the table 2.
http://www.ecoagri.ac.cn
第 12 期 杨明欣等: 基于卷积神经网络的玉米病害小样本识别研究 1929
表4 6 种模型进行玉米病害识别的测试结果
Table 4 Recognition results of maize diseases by six models
模型名称 训练集准确率 验证集准确率 权重大小 参数数量 运行时间
Model name Training set accuracy (%) Validation set accuracy (%) Weight size (MB) Number of parameters Run time (s)
AlexNet 95.24 93.88 55.67 14 591 685 2 830
GooleNet 96.38 95.48 39.39 10 318 655 10 400
Vgg16 95.05 91.69 158.17 41 460 549 51 800
RestNet34 96.17 97.67 81.31 21 287 237 12 550
MobileNetV2 94.86 96.21 8.69 2 230 277 9 050
Migrated MobileNetV2 94.62 97.23 8.69 2 230 277 2 700
http://www.ecoagri.ac.cn
1930 中国生态农业学报(中英文) 2020 第 28 卷
验证集的识别准确率稳定。由此可以说明, 对模型
进行训练时参数迁移的方法比参数初始化的效果
好。在 ImageNet 数据集上训练权重参数, 数据集种
类多, 因此迁移学习的方法泛化能力强。
4 结论
作物病虫害防治是农业生产的重要组成部分。
为了克服小样本玉米病害识别的困难, 本文引入迁
移学习方法, 提高了识别准确度。选取基于 Corn 的
玉米病害数据集作为研究对象, 进行了一系列试验
和探索, 得出以下结论:
1) Corn 数据集样本数据分布不均匀, 运用了旋
转、翻转、中心裁剪等方法进行数据增强处理, 得
图6 6 种模型训练集进行 50 次迭代的损失曲线
Fig. 6 Loss curves of the training set for 50 iterations of six models 到强化后的玉米病害数据集, 通过数据增强弱化背
景, 使得病害特征明显。
2)针对增强后数据集标签 0 的健康玉米和标签 1
的玉米灰斑病训练集样本过少的问题, 进行了翻转
扩容处理, 通过 Facal Loss 损失函数解决 5 种玉米病
害标签样本数量不均匀的问题, 训练集的准确率从
92.77%提升到 94.62%, 该方法能够有效提升玉米病
害训练集识别准确率。
3)采用 Pytorch 框架作为试验环境, 通过对 6 种
模型进行试验, 结果显示迁移的 MobileNetV2 方法
对玉米病害验证集的识别率高达 97.23%, 参数模型
仅有 8.69 MB, 样本训练时间仅有 2 700 s, 对于此
次采用的小样本玉米病害数据集迁移的
MobileNetV2 方法最有效, 具有权重小、准确率高、
鲁棒性强的特点, 能够避免过拟合的现象, 可以应
图7 6 种模型验证集进行 50 次迭代的损失曲线
Fig. 7 Loss curves of the validation set for 50 iterations of six models 用到小样本的玉米病害识别。
http://www.ecoagri.ac.cn
第 12 期 杨明欣等: 基于卷积神经网络的玉米病害小样本识别研究 1931
http://www.ecoagri.ac.cn