浙江农业学报 ›› 2022, Vol. 34 ›› Issue (6): 1306-1315.DOI: 10.3969/j.issn.1004-1524.2022.06.21
收稿日期:
2021-07-03
出版日期:
2022-06-25
发布日期:
2022-06-30
通讯作者:
汪杭军
作者简介:
*汪杭军,E-mail: whj@zafu.edu.cn基金资助:
CHEN Daohuai1(), WANG Hangjun2,*(
)
Received:
2021-07-03
Online:
2022-06-25
Published:
2022-06-30
Contact:
WANG Hangjun
摘要:
为了提高林业害虫检测的准确性,提出一种基于YOLOv4的改进算法。首先,基于智能害虫捕捉装置拍摄的图像,制作害虫数据集,采用K-means算法对样本数据集的目标框进行聚类分析,基于DIoU-NMS算法实现对害虫的计数功能;然后,在模型的路径聚合网络(PANet)结构上增加特征融合和104×104层级特征检测图,以提升对小个体害虫的识别率;最后,根据模型检测效率和复杂度,调整模型中的尺度特征图组合,在保证检测准确度的基础上,提升检测效率,并精简模型。试验结果表明,改进的YOLOv4模型的平均识别精度比传统YOLOv4模型提高了1.6百分点,且对于小个体害虫的识别效果更好,模型复杂度和模型参数量分别减少了11.9%、33.2%,检测速度提升了11.1%,更适于应用部署。
中图分类号:
陈道怀, 汪杭军. 基于改进YOLOv4的林业害虫检测[J]. 浙江农业学报, 2022, 34(6): 1306-1315.
CHEN Daohuai, WANG Hangjun. Detection of forest pests based on improved YOLOv4[J]. Acta Agriculturae Zhejiangensis, 2022, 34(6): 1306-1315.
图1 害虫捕捉装置(左)及其拍摄到的图像(右) 1,黑光灯;2,摄像头;3,采样盘;4,LED灯。
Fig. 1 Image capture device (left) and captured image (right) 1, Black light lamp; 2, Camera; 3, Sampling disk; 4, LED light.
害虫种类 Pest species | 害虫尺寸 Pest size | 样本数量 Sample quantity | 害虫种类 Pest species | 害虫尺寸 Pest size | 样本数量 Sample quantity |
---|---|---|---|---|---|
美苔蛾Miltochrista miniata | 小Small | 1 060 | 斜矛丽金龟Callistethus plagiicollis | 中Medium | 1 057 |
黄土苔蛾Eilema nigripoda | 小Small | 1 067 | 铜绿丽金龟Anomala corpulenta Motschulsky | 大Big | 1 289 |
条纹小斑蛾Thyrassia penangae | 小Small | 1 057 | 毛黄鳃金龟Holotrichia trichophora | 大Big | 1 156 |
突背斑红蝽Physopelta gutta | 小Small | 1 189 | 茶斑蛾Eterusia aedea | 大Big | 1 081 |
八点灰灯蛾Creatonotos transiens | 中Medium | 1 060 | 蚱蜢Locusta migratoria | 大Big | 903 |
表1 图像数据集中的害虫样本信息
Table 1 Information of pest samples in image dataset
害虫种类 Pest species | 害虫尺寸 Pest size | 样本数量 Sample quantity | 害虫种类 Pest species | 害虫尺寸 Pest size | 样本数量 Sample quantity |
---|---|---|---|---|---|
美苔蛾Miltochrista miniata | 小Small | 1 060 | 斜矛丽金龟Callistethus plagiicollis | 中Medium | 1 057 |
黄土苔蛾Eilema nigripoda | 小Small | 1 067 | 铜绿丽金龟Anomala corpulenta Motschulsky | 大Big | 1 289 |
条纹小斑蛾Thyrassia penangae | 小Small | 1 057 | 毛黄鳃金龟Holotrichia trichophora | 大Big | 1 156 |
突背斑红蝽Physopelta gutta | 小Small | 1 189 | 茶斑蛾Eterusia aedea | 大Big | 1 081 |
八点灰灯蛾Creatonotos transiens | 中Medium | 1 060 | 蚱蜢Locusta migratoria | 大Big | 903 |
模型Model | 特征图Feature map |
---|---|
YOLOv4 | 13×13、26×26、52×52 |
Improved YOLOv4-1 | 13×13、26×26、52×52、104×104 |
Improved YOLOv4-2 | 26×26、52×52、104×104 |
Improved YOLOv4-3 | 52×52、104×104 |
Improved YOLOv4-4 | 104×104 |
表2 各模型结构对比
Table 2 Structure comparison of different models
模型Model | 特征图Feature map |
---|---|
YOLOv4 | 13×13、26×26、52×52 |
Improved YOLOv4-1 | 13×13、26×26、52×52、104×104 |
Improved YOLOv4-2 | 26×26、52×52、104×104 |
Improved YOLOv4-3 | 52×52、104×104 |
Improved YOLOv4-4 | 104×104 |
模型 Model | MAP/% | FPS | FLOPs/B | MP/MB |
---|---|---|---|---|
YOLOv3 | 91.9 | 41 | 65 | 240 |
YOLOv4 | 94.8 | 36 | 59 | 250 |
Improved YOLOv4-1 | 96.1 | 30 | 69 | 254 |
Improved YOLOv4-2 | 96.3 | 33 | 64 | 187 |
Improved YOLOv4-3 | 96.0 | 38 | 58 | 171 |
Improved YOLOv4-4 | 96.4 | 40 | 52 | 167 |
表3 各模型结果对比
Table 3 Comparison of performance of different models
模型 Model | MAP/% | FPS | FLOPs/B | MP/MB |
---|---|---|---|---|
YOLOv3 | 91.9 | 41 | 65 | 240 |
YOLOv4 | 94.8 | 36 | 59 | 250 |
Improved YOLOv4-1 | 96.1 | 30 | 69 | 254 |
Improved YOLOv4-2 | 96.3 | 33 | 64 | 187 |
Improved YOLOv4-3 | 96.0 | 38 | 58 | 171 |
Improved YOLOv4-4 | 96.4 | 40 | 52 | 167 |
编号 Number | 害虫尺寸 Pest size | YOLOv3/% | YOLOv4/ % | Improved YOLOv4-4/ % |
---|---|---|---|---|
1 | 小Small | 89.2 | 93.1 | 96.0 |
2 | 小Small | 91.4 | 91.7 | 94.9 |
3 | 小Small | 91.5 | 94.4 | 96.0 |
4 | 小Small | 92.8 | 93.0 | 94.4 |
5 | 中Medium | 97.1 | 98.3 | 98.0 |
6 | 中Medium | 96.1 | 97.7 | 96.9 |
7 | 大Big | 98.3 | 99.1 | 99.1 |
8 | 大Big | 97.0 | 96.9 | 97.7 |
9 | 大Big | 98.5 | 99.0 | 99.0 |
10 | 大Big | 95.8 | 98.9 | 97.5 |
11 | — | 62.5 | 80.9 | 90.9 |
MAP | — | 91.9 | 94.8 | 96.4 |
表4 各模型识别准确度对比
Table 4 Comparison of recognition accuracy of different models
编号 Number | 害虫尺寸 Pest size | YOLOv3/% | YOLOv4/ % | Improved YOLOv4-4/ % |
---|---|---|---|---|
1 | 小Small | 89.2 | 93.1 | 96.0 |
2 | 小Small | 91.4 | 91.7 | 94.9 |
3 | 小Small | 91.5 | 94.4 | 96.0 |
4 | 小Small | 92.8 | 93.0 | 94.4 |
5 | 中Medium | 97.1 | 98.3 | 98.0 |
6 | 中Medium | 96.1 | 97.7 | 96.9 |
7 | 大Big | 98.3 | 99.1 | 99.1 |
8 | 大Big | 97.0 | 96.9 | 97.7 |
9 | 大Big | 98.5 | 99.0 | 99.0 |
10 | 大Big | 95.8 | 98.9 | 97.5 |
11 | — | 62.5 | 80.9 | 90.9 |
MAP | — | 91.9 | 94.8 | 96.4 |
编号 Number | 害虫尺寸 Pest size | 实际个数 Actual number | YOLOv3 | YOLOv4 | Improved YOLOv4-4 |
---|---|---|---|---|---|
1 | 小Small | 4 | 1 | 2 | 3 |
2 | 小Small | 6 | 3 | 4 | 5 |
3 | 小Small | 6 | 3 | 4 | 4 |
4 | 小Small | 5 | 3 | 4 | 4 |
5 | 中Medium | 6 | 5 | 5 | 5 |
6 | 中Medium | 5 | 4 | 4 | 4 |
7 | 大Big | 5 | 4 | 5 | 5 |
8 | 大Big | 6 | 6 | 6 | 6 |
9 | 大Big | 6 | 5 | 6 | 6 |
10 | 大Big | 4 | 3 | 3 | 4 |
11 | — | 3 | 1 | 1 | 1 |
合计Total | — | 56 | 38 | 44 | 47 |
表5 各模型的计数效果对比
Table 5 Comparison of counting results of different models
编号 Number | 害虫尺寸 Pest size | 实际个数 Actual number | YOLOv3 | YOLOv4 | Improved YOLOv4-4 |
---|---|---|---|---|---|
1 | 小Small | 4 | 1 | 2 | 3 |
2 | 小Small | 6 | 3 | 4 | 5 |
3 | 小Small | 6 | 3 | 4 | 4 |
4 | 小Small | 5 | 3 | 4 | 4 |
5 | 中Medium | 6 | 5 | 5 | 5 |
6 | 中Medium | 5 | 4 | 4 | 4 |
7 | 大Big | 5 | 4 | 5 | 5 |
8 | 大Big | 6 | 6 | 6 | 6 |
9 | 大Big | 6 | 5 | 6 | 6 |
10 | 大Big | 4 | 3 | 3 | 4 |
11 | — | 3 | 1 | 1 | 1 |
合计Total | — | 56 | 38 | 44 | 47 |
[1] | 顾晓丽, 潘洁, 张衡, 等. 基于物联网架构的我国森林病虫害监测研究进展[J]. 世界林业研究, 2015, 28(2): 48-53. |
GU X L, PAN J, ZHANG H, et al. Review of forest diseases and pests monitoring research in China based on Internet of Things framework[J]. World Forestry Research, 2015, 28(2): 48-53. (in Chinese with English abstract) | |
[2] | 贾少鹏, 高红菊, 杭潇. 基于深度学习的农作物病虫害图像识别技术研究进展[J]. 农业机械学报, 2019, 50(S1): 313-317. |
JIA S P, GAO H J, HANG X. Research progress on image recognition technology of crop pests and diseases based on deep learning[J]. Transactions of the Chinese Society for Agricultural Machinery, 2019, 50(S1): 313-317. (in Chinese with English abstract) | |
[3] | 邱道尹, 张红涛, 刘新宇, 等. 基于机器视觉的大田害虫检测系统[J]. 农业机械学报, 2007, 38(1): 120-122. |
QIU D Y, ZHANG H T, LIU X Y, et al. Design of detection system for agriculture field pests based on machine vision[J]. Transactions of the Chinese Society for Agricultural Machinery, 2007, 38(1): 120-122. (in Chinese with English abstract) | |
[4] |
WEN C L, GUYER D. Image-based orchard insect automated identification and classification method[J]. Computers and Electronics in Agriculture, 2012, 89: 110-115.
DOI URL |
[5] |
LIU T, CHEN W, WU W, et al. Detection of aphids in wheat fields using a computer vision technique[J]. Biosystems Engineering, 2016, 141: 82-93.
DOI URL |
[6] | 朱莉, 罗靖, 徐胜勇, 等. 基于颜色特征的油菜害虫机器视觉诊断研究[J]. 农机化研究, 2016, 38(6): 55-58. |
ZHU L, LUO J, XU S Y, et al. Machine vision recognition of rapeseed pests based on color feature[J]. Journal of Agricultural Mechanization Research, 2016, 38(6): 55-58. (in Chinese with English abstract) | |
[7] | 李文勇, 李明, 陈梅香, 等. 基于机器视觉的作物多姿态害虫特征提取与分类方法[J]. 农业工程学报, 2014, 30(14): 154-162. |
LI W Y, LI M, CHEN M X, et al. Feature extraction and classification method of multi-pose pests using machine vision[J]. Transactions of the Chinese Society of Agricultural Engineering, 2014, 30(14): 154-162. (in Chinese with English abstract) | |
[8] | 张睿珂, 陈梅香, 李明, 等. 基于机器视觉的蛾类三维姿态中前翅间夹角计算方法[J]. 林业科学, 2017, 53(11): 120-130. |
ZHANG R K, CHEN M X, LI M, et al. Method of extracting forewings angle of 3D pose for the moth based on machine vision[J]. Scientia Silvae Sinicae, 2017, 53(11): 120-130. (in Chinese with English abstract) | |
[9] | 田冉, 陈梅香, 董大明, 等. 红外传感器与机器视觉融合的果树害虫识别及计数方法[J]. 农业工程学报, 2016, 32(20): 195-201. |
TIAN R, CHEN M X, DONG D M, et al. Identification and counting method of orchard pests based on fusion method of infrared sensor and machine vision[J]. Transactions of the Chinese Society of Agricultural Engineering, 2016, 32(20): 195-201. (in Chinese with English abstract) | |
[10] | 肖德琴, 张玉康, 范梅红, 等. 基于视觉感知的蔬菜害虫诱捕计数算法[J]. 农业机械学报, 2018, 49(3): 51-58. |
XIAO D Q, ZHANG Y K, FAN M H, et al. Vegetable pest counting algorithm based on visual perception[J]. Transactions of the Chinese Society for Agricultural Machinery, 2018, 49(3): 51-58. (in Chinese with English abstract) | |
[11] | 周焱, 刘文萍, 骆有庆, 等. 基于深度学习的小目标受灾树木检测方法[J]. 林业科学, 2021, 57(3): 98-107. |
ZHOU Y, LIU W P, LUO Y Q, et al. Small object detection for infected trees based on the deep learning method[J]. Scientia Silvae Sinicae, 2021, 57(3): 98-107. (in Chinese with English abstract) | |
[12] | 杨国国, 鲍一丹, 刘子毅. 基于图像显著性分析与卷积神经网络的茶园害虫定位与识别[J]. 农业工程学报, 2017, 33(6): 156-162. |
YANG G G, BAO Y D, LIU Z Y. Localization and recognition of pests in tea plantation based on image saliency analysis and convolutional neural network[J]. Transactions of the Chinese Society of Agricultural Engineering, 2017, 33(6): 156-162. (in Chinese with English abstract) | |
[13] | 武英洁, 房世波, Piotr Chudzik, 等. 基于Faster R-CNN的野外环境中蝗虫快速识别[J]. 气象与环境学报, 2020, 36(6): 137-143. |
WU Y J, FANG S B, CHUDZIK P, et al. Rapid identification of locust on fields based on Faster R-CNN[J]. Journal of Meteorology and Environment, 2020, 36(6): 137-143. (in Chinese) | |
[14] | 张博, 张苗辉, 陈运忠. 基于空间金字塔池化和深度卷积神经网络的作物害虫识别[J]. 农业工程学报, 2019, 35(19): 209-215. |
ZHANG B, ZHANG M H, CHEN Y Z. Crop pest identification based on spatial pyramid pooling and deep convolution neural network[J]. Transactions of the Chinese Society of Agricultural Engineering, 2019, 35(19): 209-215. (in Chinese with English abstract) | |
[15] | 李衡霞, 龙陈锋, 曾蒙, 等. 一种基于深度卷积神经网络的油菜虫害检测方法[J]. 湖南农业大学学报(自然科学版), 2019, 45(5): 560-564. |
LI H X, LONG C F, ZENG M, et al. A detecting method for the rape pests based on deep convolutional neural network[J]. Journal of Hunan Agricultural University (Natural Sciences), 2019, 45(5): 560-564. (in Chinese with English abstract) | |
[16] | 李想. 基于物联网的虫情监测系统[D]. 北京: 北京林业大学, 2019. |
LI X. The pest monitoring system based on the Internet of Things[D]. Beijing: Beijing Forestry University, 2019. (in Chinese with English abstract) | |
[17] | REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection[C]// 2016 IEEE Conference on Computer Vision and Pattern Recognition, June 27-30, 2016, Las Vegas, NV, USA: IEEE, 2016: 779-788. |
[18] | 王金鹏, 高凯, 姜洪喆,等. 基于改进的轻量化卷积神经网络火龙果检测方法(英)[J]. 农业工程学报, 2020, 36(20): 218-225. |
WANG J P, GAO K, JIANG H Z, et al. Method for detecting dragon fruit based on improved lightweight convolutional neural network[J]. Transactions of the Chinese Society of Agricultural Engineering, 2020, 36(20): 218-225.(in English) | |
[19] | 蔡舒平, 孙仲鸣, 刘慧, 等. 基于改进型YOLOv4的果园障碍物实时检测方法[J]. 农业工程学报, 2021, 37(2): 36-43. |
CAI S P, SUN Z M, LIU H, et al. Real-time detection methodology for obstacles in orchards using improved YOLOv4[J]. Transactions of the Chinese Society of Agricultural Engineering, 2021, 37(2): 36-43. (in Chinese with English abstract) | |
[20] | LIU 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, June 18-23, 2018, Salt Lake City, UT, USA: IEEE, 2018: 8759-8768. |
[21] | 鞠默然, 罗海波, 王仲博, 等. 改进的YOLO V3算法及其在小目标检测中的应用[J]. 光学学报, 2019, 39(7): 0715004. |
JU M R, LUO H B, WANG Z B, et al. Improved YOLO V3 algorithm and its application in small target detection[J]. Acta Optica Sinica, 2019, 39(7): 0715004. (in Chinese with English abstract) |
[1] | 张晴晴, 刘连忠, 宁井铭, 吴国栋, 江朝晖, 李孟杰, 李栋梁. 基于YOLOV3优化模型的复杂场景下茶树嫩芽识别[J]. 浙江农业学报, 2021, 33(9): 1740-1747. |
[2] | 鲍烈, 王曼韬, 刘江川, 文波, 明月. 基于卷积神经网络的小麦产量预估方法[J]. 浙江农业学报, 2020, 32(12): 2244-2252. |
[3] | 王彦翔, 张艳, 杨成娅, 孟庆龙, 尚静. 基于深度学习的农作物病害图像识别技术进展[J]. 浙江农业学报, 2019, 31(4): 669-676. |
[4] | 杨国亮, 许楠, 康乐乐, 龚曼, 洪志阳. 基于参数指数非线性残差神经网络的脐橙病变叶片识别[J]. 浙江农业学报, 2018, 30(6): 1073-1081. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||