浙江农业学报 ›› 2024, Vol. 36 ›› Issue (6): 1413-1424.DOI: 10.3969/j.issn.1004-1524.20230822
朱铭敏1(), 张国平1,*(
), 谭建军2, 孙玲姣2, 朱黎1,3, 焦洁2
收稿日期:
2023-07-03
出版日期:
2024-06-25
发布日期:
2024-07-02
作者简介:
朱铭敏(1999—),女,湖北宜昌人,硕士研究生,主要从事人工智能研究。E-mail:892359179@qq.com
通讯作者:
*张国平,E-mail: gpzhang@ccnu.edu.cn
基金资助:
ZHU Mingmin1(), ZHANG Guoping1,*(
), TAN Jianjun2, SUN Lingjiao2, ZHU Li1,3, JIAO Jie2
Received:
2023-07-03
Online:
2024-06-25
Published:
2024-07-02
摘要:
在茶园环境中快速精准识别茶叶嫩芽是实现智能化采茶的关键技术之一,但茶芽检测模型的复杂性导致模型参数量大、计算量大、模型尺寸大,限制了模型在采茶机器人嵌入式设备的部署。鉴于此,本文提出一种基于YOLOv5s的轻量级茶叶嫩芽终端检测模型。首先,使用轻量级网络GhostNet替换YOLOv5s中的Backbone网络,并重构Neck网络,降低模型的参数量、计算量和内存占用量,改进后的模型分别降低了47.64%、49.36%、45.51%。其次,通过引入协调注意力(coordinate attention, CA)机制,抑制图像背景信息,增强模型对茶叶嫩芽的特征提取能力。接着,在Neck网络引入多尺度特征融合(multi-scale context, MSC)模块,有效融合浅层图像特征和深层语义特征,帮助网络模型提取有效识别信息。最后,使用边界框回归损失函数EIOU替换CIOU,加快损失函数收敛速度,提高茶叶嫩芽边界框定位精度。试验结果表明,与原YOLOv5s模型相比,改进模型的参数量、计算量以及模型内存占用量分别降低了3 Mb、7.3 Gb和6.37 Mb,检测精度提升0.3%。通过模型转换将该模型移植到树莓派平台,经过环境部署和推理引擎加速,达到了轻量级模型在资源和算力有限的树莓派上对茶叶嫩芽检测的目的,在一定程度上提高了茶叶嫩芽的识别精确度,为茶叶嫩芽的智能化采摘提供了理论研究和技术支持。
中图分类号:
朱铭敏, 张国平, 谭建军, 孙玲姣, 朱黎, 焦洁. 基于YOLOv5s的轻量级茶叶嫩芽终端检测模型[J]. 浙江农业学报, 2024, 36(6): 1413-1424.
ZHU Mingmin, ZHANG Guoping, TAN Jianjun, SUN Lingjiao, ZHU Li, JIAO Jie. A lightweight tea buds terminal detection model based on YOLOv5s[J]. Acta Agriculturae Zhejiangensis, 2024, 36(6): 1413-1424.
图2 YOLOv5s结构图 Conv2d,二维卷积;BN,批归一化;SiLU,激活函数;CBS,卷积块;Bottleneck,瓶颈结构;C3,轻量化语义分割网络;SPPF,快速空间金字塔池化模块;Concat,张量拼接;Upsample,上采样,MaxPool,最大池化。
Fig.2 Structure diagram of YOLOv5s Conv2d, Two-dimensional convolution; BN, Batch normalization; SiLU, Activation function; CBS, Convolutional block; Bottleneck, Bottleneck structure; C3, Lightweight semantic segmentation network; SPPF, Fast spatial pyramid pooling module; Concat, Tensor splicing; Upsample, Upsampling; MaxPool, Maximum pooling.
图5 协调注意力(CA)机制的结构 Residual,残差模块;AvgPooling,平均池化;BatchNorm,批归一化;Sigmoid,激活函数;Re-weight,重加权模块。
Fig.5 Structure diagram of coordinate attention (CA) mechanism Residual, Residual module; AvgPooling, Average pooling; BatchNorm, Batch normalization; Sigmaid, Activation function; Re weight, Reweighting module.
图7 改进后的YOLOv5s网络的结构 Ghost CBS,Ghost卷积块;Ghost C3, Ghost轻量化语义分割网络;DWConv,深度可分离卷积;CA,注意力机制;MSC,多尺度特征融合模块;Ghost Bottleneck, 幻象瓶颈层。
Fig.7 Structure diagram of the improved YOLOv5s network Ghost CBS, Ghost convolutional block; Ghost C3, Ghost lightweight semantic segmentation network; DWConv, Depth separable convolution; CA, Attention mechanism; MSC, Multi-scale feature fusion module; Ghost Bottleneck, Ghost Bottleneck.
模型 Models | 参数量 Params/Mb | 计算量 FLOPs/Gb | 模型大小 Size/Mb | 精准率 P/% | 召回率 R/% | 平均精度 AP/% |
---|---|---|---|---|---|---|
MobileNetV3 | 3.54 | 7.0 | 7.5 | 62.2 | 64.0 | 65.2 |
ShuffleNetV2 | 3.68 | 7.8 | 7.6 | 66.3 | 66.5 | 68.4 |
GhostNet | 3.67 | 8.0 | 7.9 | 67.0 | 68.2 | 71.2 |
表1 不同轻量化模型对比
Table 1 Comparison of different lightweight models
模型 Models | 参数量 Params/Mb | 计算量 FLOPs/Gb | 模型大小 Size/Mb | 精准率 P/% | 召回率 R/% | 平均精度 AP/% |
---|---|---|---|---|---|---|
MobileNetV3 | 3.54 | 7.0 | 7.5 | 62.2 | 64.0 | 65.2 |
ShuffleNetV2 | 3.68 | 7.8 | 7.6 | 66.3 | 66.5 | 68.4 |
GhostNet | 3.67 | 8.0 | 7.9 | 67.0 | 68.2 | 71.2 |
模型 Models | 参数量 Params/Mb | 计算量 FLOPs/Gb | 模型大小 Size/Mb | 精准率 P/% | 召回率 R/% | 平均精度 AP/% |
---|---|---|---|---|---|---|
YOLOv5s | 7.01 | 15.8 | 14.50 | 68.8 | 67.5 | 72.7 |
A | 3.67 | 8.0 | 7.90 | 67.0 | 68.2 | 71.2 |
B | 3.74 | 8.1 | 8.00 | 67.5 | 68.4 | 72.0 |
C | 3.98 | 8.5 | 8.13 | 68.4 | 68.5 | 72.5 |
D | 4.01 | 8.5 | 8.13 | 68.5 | 68.8 | 73.0 |
表2 消融试验对比
Table 2 Comparison of ablation test results
模型 Models | 参数量 Params/Mb | 计算量 FLOPs/Gb | 模型大小 Size/Mb | 精准率 P/% | 召回率 R/% | 平均精度 AP/% |
---|---|---|---|---|---|---|
YOLOv5s | 7.01 | 15.8 | 14.50 | 68.8 | 67.5 | 72.7 |
A | 3.67 | 8.0 | 7.90 | 67.0 | 68.2 | 71.2 |
B | 3.74 | 8.1 | 8.00 | 67.5 | 68.4 | 72.0 |
C | 3.98 | 8.5 | 8.13 | 68.4 | 68.5 | 72.5 |
D | 4.01 | 8.5 | 8.13 | 68.5 | 68.8 | 73.0 |
模型 Models | 参数量 params/Mb | 计算量 FLOPs/Gb | 模型大小 size/Mb | 精准率 P/% | 召回率 R/% | 平均精度 AP/% | t/s |
---|---|---|---|---|---|---|---|
Faster R-CNN[ | — | — | — | 89.00 | 58.00 | 54.00 | — |
YOLOv3[ | — | — | — | 74.51 | 69.56 | 71.96 | — |
Compact-YOLO v4[ | — | — | 23.20 | 51.07 | 78.67 | 72.93 | 0.023 |
YOLOv5-Lite | 1.54 | 3.70 | 3.40 | 60.30 | 61.70 | 60.00 | 0.063 |
YOLOv5s | 7.01 | 15.8 | 14.50 | 68.80 | 67.50 | 72.70 | 0.014 |
Ours | 4.01 | 8.50 | 8.13 | 68.50 | 68.80 | 73.00 | 0.016 |
表3 不同检测算法模型对比
Table 3 Comparison of different detection algorithm models
模型 Models | 参数量 params/Mb | 计算量 FLOPs/Gb | 模型大小 size/Mb | 精准率 P/% | 召回率 R/% | 平均精度 AP/% | t/s |
---|---|---|---|---|---|---|---|
Faster R-CNN[ | — | — | — | 89.00 | 58.00 | 54.00 | — |
YOLOv3[ | — | — | — | 74.51 | 69.56 | 71.96 | — |
Compact-YOLO v4[ | — | — | 23.20 | 51.07 | 78.67 | 72.93 | 0.023 |
YOLOv5-Lite | 1.54 | 3.70 | 3.40 | 60.30 | 61.70 | 60.00 | 0.063 |
YOLOv5s | 7.01 | 15.8 | 14.50 | 68.80 | 67.50 | 72.70 | 0.014 |
Ours | 4.01 | 8.50 | 8.13 | 68.50 | 68.80 | 73.00 | 0.016 |
模型 Models | t1 | t2 | t3 | t4 |
---|---|---|---|---|
YOLOv5s | 0.014 | 0.155 | 16.572 | 0.892 |
Ours | 0.016 | 0.145 | 9.157 | 0.723 |
表4 模型检测耗时
Table 4 Detection time of different models s
模型 Models | t1 | t2 | t3 | t4 |
---|---|---|---|---|
YOLOv5s | 0.014 | 0.155 | 16.572 | 0.892 |
Ours | 0.016 | 0.145 | 9.157 | 0.723 |
[1] | 刘顺星, 张慧坚, 刘晓青. 中国茶产业国际竞争力的比较分析与提升对策[J/OL]. 中国食物与营养, 2023: 1-8. |
LIU S X, ZHANG H J, LIU X Q. Comparative analysis and promotion countermeasures of international competitiveness of Chinese tea industry[J/OL]. Food and Nutrition in China, 2023: 1-8. (in Chinese with English abstract) | |
[2] | SHAO P D, WU M H, WANG X W, et al. Research on the tea bud recognition based on improved k-means algorithm[J]. MATEC Web of Conferences, 2018, 232: 03050. |
[3] | 刘自强, 周铁军, 傅冬和, 等. 基于颜色和形状的鲜茶叶图像特征提取及在茶树品种识别中的应用[J]. 江苏农业科学, 2021, 49(12): 168-172. |
LIU Z Q, ZHOU T J, FU D H, et al. Color and shape based feature extraction of fresh tea image and its application in tea tree variety recognition[J], Jiangsu Agricultural Sciences, 2021, 49(12): 168-172. (in Chinese with English abstract) | |
[4] | 吴雪梅, 张富贵, 吕敬堂. 基于图像颜色信息的茶叶嫩叶识别方法研究[J]. 茶叶科学, 2013, 33(6): 584-589. |
WU X M, ZHANG F G, LV J T. Research on recognition of tea tender leaf based on image color information[J]. Journal of Tea Science, 2013, 33(6): 584-589. (in Chinese with English abstract) | |
[5] | OTSU N. A threshold selection method from gray-level histograms[J]. IEEE Transactions on Systems, Man, and Cybernetics, 1979, 9(1): 62-66. |
[6] | 王子钰, 赵怡巍, 刘振宇. 基于SSD算法的茶叶嫩芽检测研究[J]. 微处理机, 2020, 41(4): 42-48. |
WANG Z Y, ZHAO Y W, LIU Z Y. Research on tea buds detection based on SSD algorithmon[J]. Microprocessors, 2020, 41(4): 42-48. (in Chinese with English abstract) | |
[7] | GAO M, SHI M, LI C. Research and implementation of image recognition of tea based on deep learning[C]// ACIS International Winter Conference on Software Engineering, Artificial Intelligence, Networking and Parallel/Distributed Computing (SNPD-Winter), January 28-30, 2021. Ho Chi Minh City, Vietnam. IEEE, 2021: 63-68. |
[8] | FUKUSHIMA K. Neural network model for a mechanism of patten recognition unaffected by shift in position - Neocognitron[J]. IEICE Technical Report, 1989, 62(10): 658-665. (in Chinese with English abstract) |
[9] | FUKUSHIMA K. Neocognitron: a self-organizing neural network model for a mechanism of pattern recognition unaffected by shift in position[J]. Biological Cybernetics, 1980, 36(4): 193-202. |
[10] | XU W K, ZHAO L G, LI J, et al. Detection and classification of tea buds based on deep learning[J]. Computers and Electronics in Agriculture, 2022, 192: 106547. |
[11] | GONG T, WANG Z L. A tea tip detection method suitable for tea pickers based on YOLOv4 network[C]// International Symposium on Robotics & Intelligent Manufacturing Technology (ISRIMT). September 24-26, 2021. Changzhou, China. IEEE, 2021: 264-268. |
[12] | 尹川, 苏议辉, 潘勉, 等. 基于改进YOLOv5s的名优绿茶品质检测[J]. 农业工程学报, 2023, 39(8): 179-187. |
YIN C, SU Y H, PAN M, et al. Detection of the quality of famous green tea based on improved YOLOv5s[J]. Transactions of the Chinese Society of Agricultural Engineering, 2023, 39(8): 179-187. (in Chinese with English abstract) | |
[13] | GUI Z Y, CHEN J N, LI Y, et al. A lightweight tea bud detection model based on Yolov5[J]. Computers and Electronics in Agriculture, 2023, 205: 107636. |
[14] | 刘翀豪, 潘理虎, 杨帆, 等. 改进YOLOv5的轻量化口罩检测算法[J]. 计算机工程与应用, 2023, 59(7): 232-241. |
LIU C H, PAN L H, YANG F, et al. Improved YOLOv5 lightweight mask detection algorithm[J]. Computer Engineering and Applications, 2023, 59(7): 232-241. (in Chinese with English abstract) | |
[15] | Howard A, Ruoming Pang, Adam H, et al. Searching for MobileNetV3[C]// IEEE/CVF International Conference on Computer Vision (ICCV). October 27-November 2, 2019. Seoul, Korea (South). IEEE, 2019: 1314-1324. |
[16] | HAN K, WANG Y H, TIAN Q, et al. GhostNet: More Features From Cheap Operations[C]// IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 13-19, 2020. Seattle, WA, USA. IEEE, 2020: 1577-1586. |
[17] | WANG L, LI B, FU R G. Feature fusion and coordinate attention for small target detection[C]// International Conference on Intelligent Computing and Signal Processing (ICSP). April 15-17, 2022. Xi’an, China. IEEE, 2022: 629-633. |
[18] | ZHANG Z, DENG Z J, WU Z P, et al. An improved EIoU-Yolov5 algorithm for blood cell detection and counting[C]// International Conference on Pattern Recognition and Artificial Intelligence (PRAI). August 19-21, 2022. Chengdu, China. IEEE, 2022: 989-993. |
[19] | XUE J L, CHENG F, LI Y Q, et al. Detection of farmland obstacles based on an improved YOLOv5s algorithm by using CIoU and anchor box scale clustering[J]. Sensors, 2022, 22(5): 1790. |
[20] | ZHANG Y M, HSIEH J W, LEE C C, et al. SFPN: synthetic FPN for object detection[C]// IEEE International Conference on Image Processing (ICIP). October 16-19, 2022. Bordeaux, France. IEEE, 2022: 1316-1320. |
[21] | LIU S, QI L, QIN H F, et al. Path aggregation network for instance segmentation[C]// IEEE/CVF Conference on Computer Vision and Pattern Recognition. June 18-23, 2018. Salt Lake City, UT. IEEE, 2018: 8759-8768. |
[22] | CAO M L, FU H, ZHU J Y, et al. Lightweight tea bud recognition network integrating GhostNet and YOLOv5[J]. Mathematical Biosciences and Engineering, 2022, 19(12): 12897-12914. |
[23] | LU X, TAO M Y, FU X, et al. Lightweight network design based on ResNet structure for modulation recognition[C]// 2021 IEEE 94th Vehicular Technology Conference (VTC2021-Fall). September 27-30, 2021. Norman, OK, USA. IEEE, 2021: 1-5. |
[24] | 李晨, 张辉, 张邹铨, 等. 融合多尺度特征与全局上下文信息的X光违禁物品检测[J]. 中国图象图形学报, 2022, 27(10): 3043-3057. |
LI C, ZHANG H, ZHANG Z Q, et al. Integrated multi-scale features and global context in X-ray detection for prohibited items[J]. Journal of Image and Graphics, 2022, 27(10): 3043-3057. (in Chinese with English abstract) | |
[25] | GUO S Y, LI Z Y, GUO S W. Pulmonary nodule detection algorithm based on YOLOv3[C]// 2022 4th International Conference on Artificial Intelligence and Advanced Manufacturing (AIAM). October 7-9, 2022. Hamburg, Germany. IEEE, 2022: 677-679. |
[26] | HUA Y H, XIAO B G, LI J Y, et al. Design and implementation of face recognition system based on raspberry pie[C]// 2021 IEEE Intl Conf on Dependable, Autonomic and Secure Computing, Intl Conf on Pervasive Intelligence and Computing, Intl Conf on Cloud and Big Data Computing, Intl Conf on Cyber Science and Technology Congress (DASC/PiCom/CBDCom/CyberSciTech). October 25-28, 2021. AB, Canada. IEEE, 2021: 673-678. |
[27] | RAN H H, WEN S P, WANG S Q, et al. Memristor-based edge computing of ShuffleNetV2 for image classification[J]. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 2021, 40(8): 1701-1710. |
[28] | 朱红春, 李旭, 孟炀, 等. 基于Faster R-CNN网络的茶叶嫩芽检测[J]. 农业机械学报, 2022, 53(5): 217-224. |
ZHU H C, LI X, MENG Y, et al. Tea bud detection based on faster R-CNN network[J]. Transactions of the Chinese Society for Agricultural Machinery, 2022, 53(5): 217-224. (in Chinese with English abstract) | |
[29] | CHEN C L, LU J Z, ZHOU M C, et al. A YOLOv3-based computer vision system for identification of tea buds and the picking point[J]. Computers and Electronics in Agriculture, 2022, 198(1): 107116. |
[30] | 黄家才, 唐安, 陈光明, 等. 基于Compact-YOLO v4的茶叶嫩芽移动端识别方法[J]. 农业机械学报, 2023, 54(3): 282-290. |
HUANG J C, TANG A, CHEN G M, et al. Mobile recognition solution of tea buds based on compact-YOLO v4 algorithm[J]. Transactions of the Chinese Society for Agricultural Machinery, 2023, 54(3): 282-290. (in Chinese with English abstract) |
[1] | 李大华, 孔舒, 李栋, 于晓. 基于改进SSD模型的柑橘叶片病害轻量化检测模型[J]. 浙江农业学报, 2024, 36(3): 662-670. |
[2] | 李颀, 李煜哲. 弱光条件下猪舍清洗目标检测[J]. 浙江农业学报, 2023, 35(9): 2240-2249. |
[3] | 李荣鹏, 买买提·沙吾提, 盛艳芳, 何旭刚. 基于CA-MobileNet-V2的核桃病害识别与应用[J]. 浙江农业学报, 2023, 35(12): 2977-2987. |
[4] | 王英允, 龙燕, 杨智优, 黄铝文. 基于改进U-Net网络的苹果叶部病害语义分割方法[J]. 浙江农业学报, 2023, 35(11): 2731-2741. |
[5] | 周品志, 裴悦琨, 魏冉, 张永飞, 谷宇. 基于YOLOV4模型的果园樱桃实时检测研究[J]. 浙江农业学报, 2022, 34(11): 2522-2532. |
[6] | 张宁, 吴华瑞, 韩笑, 缪祎晟. 基于多尺度和注意力机制的番茄病害识别方法[J]. 浙江农业学报, 2021, 33(7): 1329-1338. |
阅读次数 | ||||||||||||||||||||||||||||||||||||||||||||||||||
全文 376
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||
摘要 147
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||