Please wait a minute...
Journal of ZheJiang University (Engineering Science)  2024, Vol. 58 Issue (12): 2438-2446    DOI: 10.3785/j.issn.1008-973X.2024.12.003
    
Improved YOLOv5s based target detection algorithm for tobacco stem material
Jiaming LV(),Feng ZHANG*(),Yabo LUO
School of Mechanical and Electronic Engineering, Wuhan University of Technology, Wuhan 430070, China
Download: HTML     PDF(1394KB) HTML
Export: BibTeX | EndNote (RIS)      

Abstract  

There are problems such as background interference, multiple and irregularly shaped targets, target overlap, and rapid falling speeds during the transportation of tobacco stems in the tobacco production line. A tobacco stem material target detection algorithm based on improved YOLOv5s was proposed. The backbone and head of the YOLOv5s network were optimized, significantly improving the detection accuracy and substantially reducing the model size. Firstly, the network’s backbone was optimized into the RepViT-m1 structure, enhancing the information extraction efficiency. Secondly, reparameterization techniques were used to better capture the target features, thus improving the detection precision. Dynamic Head, a target detection head based on the attention mechanism, was introduced to make the model be focused on the potential target area to further improve the detection accuracy. Experimental results on self-constructed tobacco stem dataset demonstrated the effectiveness of the improved YOLOv5s model. Compared with the original YOLOv5s model, the improved model achieved an mAP@0.50 of 96.1%, which was improved by 5.8 percentage points; and achieved an mAP@0.50:0.95 of 94.7%, which was improved by 5.7 percentage points. Furthermore, the model size was 12.1 MB, which was decreased by 12.3%. The results provide reliable and accurate support for real-time monitoring systems.



Key wordstarget detection      YOLOv5s      tobacco stem detection      RepViT      reparameterization      attention mechanism     
Received: 14 November 2023      Published: 25 November 2024
CLC:  TP 391.4  
Fund:  国家自然科学基金资助项目(51875430).
Corresponding Authors: Feng ZHANG     E-mail: 345815526@qq.com;zhangfengie@whut.edu.cn
Cite this article:

Jiaming LV,Feng ZHANG,Yabo LUO. Improved YOLOv5s based target detection algorithm for tobacco stem material. Journal of ZheJiang University (Engineering Science), 2024, 58(12): 2438-2446.

URL:

https://www.zjujournals.com/eng/10.3785/j.issn.1008-973X.2024.12.003     OR     https://www.zjujournals.com/eng/Y2024/V58/I12/2438


基于改进YOLOv5s的烟梗物料目标检测算法

在烟草生产线中烟梗输送下落过程中,存在背景信息干扰、目标数量多且形状不一、目标堆叠、下落速度过快等问题,传统图像处理算法难以解决. 提出基于改进YOLOv5s的烟梗物料目标检测算法. 对YOLOv5s网络的骨干和头部进行优化改进,显著提高检测精度,大幅缩小模型大小;将骨干网络优化为RepViT-m1结构,以提高信息提取的效率;采用重参数化技术,以更好地捕捉目标的特征,提高检测的精确性;引入基于注意力机制的目标检测头Dynamic Head,使模型更专注于潜在的目标区域,进一步提高检测精度. 实验结果表明:在自建的烟梗数据集上,相较于原YOLOv5s模型,改进YOLOv5s模型的mAP@0.50为96.1%,提高了5.8个百分点;mAP@0.50∶0.95为94.7%,提高了5.7个百分点;模型大小为12.1 MB,减少了12.3%. 模型可以为实时监控系统提供可靠且精确的支持.


关键词: 目标检测,  YOLOv5s,  烟梗检测,  RepViT,  重参数化,  注意力机制 
Fig.1 Structure diagram of YOLOv5s algorithm network
Fig.2 Introduction diagram of Dynamic Head
Fig.3 Process diagram of automatic labeling algorithm based on connected domain
Fig.4 Schematic diagram of on-site environment construction
Fig.5 Actual application scenario diagram
模型P/%R/%mAP@0.50/%mAP@0.50∶0.95/%M/MBGFLOPsFPS/帧
①YOLOv5s77.893.390.389.013.816.6212.77
②YOLOv5s+RepViT-m181.985.389.886.226.224144.93
③YOLOv5s+重参数化的RepViT-m180.390.491.586.511.419.9192.31
④YOLOv5s+Dynamic Head79.793.692.190.613.717.8185.19
⑤YOLOv5s+RepViT-m1+Dynamic Head84.196.495.894.314.221.8133.33
⑥本研究算法86.294.196.194.712.121.3178.57
Tab.1 Analysis of results of module ablation experiments
dP/%R/%mAP@0.50/%mAP@0.50∶0.95/%
288.391.993.790.7
484.585.692.389.5
686.294.196.194.7
887.492.995.991.6
Tab.2 Analysis of results of head depth ablation experiments
模型P/%R/%mAP@0.50/%mAP@0.50∶0.95/%M/MBGFLOPsFPS/帧
Faster R-CNN78.683.387.582.0108.0150.813.14
YOLOv3-tiny75.885.184.380.816.613.0163.93
YOLOv378.287.187.983.8117.9155.327.80
YOLOv7-tiny85.288.789.886.411.713.2123.46
YOLOv775.387.786.384.871.3105.225.58
YOLOx-s76.592.989.184.034.326.8101.73
YOLOv8s80.393.589.586.721.428.8112.36
YOLOv5s77.893.390.389.013.816.6212.77
本研究算法86.294.196.194.712.121.3178.57
Tab.3 Analysis of experimental results for comparing different object detection algorithms
Fig.6 Training and validation loss curve
Fig.7 Confusion matrix diagram of identification of tobacco steam length
Fig.8 Classification and recognition result diagram
Fig.9 Comparison of recognition effects before and after model improvement
[1]   高尊华, 鲍文华, 程红军, 等 梗丝结构对卷烟质量稳定性的影响[J]. 烟草科技, 2007, (2): 5- 7
GAO Zunhua, BAO Wenhua, CHENG Hongjun, et al Influence of cut stem structure on quality stability of cigarette[J]. Tobacco Science and Technology, 2007, (2): 5- 7
doi: 10.3969/j.issn.1002-0861.2007.02.001
[2]   崔云月, 管一弘, 孙娜, 等 BP神经网络在烟梗长短梗率检测中的应用[J]. 软件导刊, 2021, 20 (2): 63- 67
CUI Yunyue, GUAN Yihong, SUN Na, et al The application of BP neural network in the determination of the stalk length and stem rate[J]. Software Guide, 2021, 20 (2): 63- 67
doi: 10.11907/rjdk.202478
[3]   杨耀伟, 张月华, 崔廷, 等 基于机器视觉和深度学习的烟梗识别方法[J]. 计算机应用, 2022, 42 (Suppl.1): 118- 122
YANG Yaowei, ZHANG Yuehua, CUI Ting, et al Tobacco stem recognition method based on machine vision and deep learning[J]. Journal of Computer Applications, 2022, 42 (Suppl.1): 118- 122
[4]   肖雷雨, 王澍, 刘渊根, 等 基于深度学习技术的烟梗形态分类与识别[J]. 烟草科技, 2021, 54 (6): 65- 74
XIAO Leiyu, WANG Shu, LIU Yuangen, et al Classification and identification of tobacco stem morphology based on deep learning technology[J]. Tobacco Science and Technology, 2021, 54 (6): 65- 74
[5]   刘新宇, 郝同盟, 张红涛, 等 基于改进YOLOv3网络的烟梗识别定位方法[J]. 食品与机械, 2022, 38 (3): 103- 109
LIU Xinyu, HAO Tongmeng, ZHANG Hongtao, et al Cigarette stem identification and location method based on improved YOLOv3 network[J]. Food and Machinery, 2022, 38 (3): 103- 109
[6]   苗新法, 刘宝莲, 李晓琴, 等. 改进YOLOV5s的铁轨裂纹目标检测算法[EB/OL]. [2023-11-03]. http://kns.cnki.net/kcms/detail/11.2127.TP.20230825.1227.008.html.
[7]   崔丽群, 曹华维. 基于改进YOLOv5的遥感图像目标检测[EB/OL]. [2023-11-03]. https://doi.org/10.19678/j.issn.1000-3428.0067790.
[8]   金鑫, 庄建军, 徐子恒 轻量化YOLOv5s网络车底危险物识别算法[J]. 浙江大学学报: 工学版, 2023, 57 (8): 1516- 1526
JIN Xin, ZHUANG Jianjun, XU Ziheng Lightweight YOLOv5s network-based algorithm for identifying hazardous objects under vehicles[J]. Journal of Zhejiang University: Engineering Science, 2023, 57 (8): 1516- 1526
[9]   ZHANG Z H, ZUO Z Y, LI Z, et al Real-time wheat unsound kernel classification detection based on improved YOLOv5[J]. Journal of Advanced Computational Intelligence and Intelligent Informatics, 2023, 27 (3): 474- 480
doi: 10.20965/jaciii.2023.p0474
[10]   HONG W W, MA Z H, YE B L, et al Detection of green asparagus in complex environments based on the improved YOLOv5 algorithm[J]. Sensors, 2023, 23 (3): 1562
doi: 10.3390/s23031562
[11]   YUAN J X, ZHENG X Z, PENG L W, et al Identification method of typical defects in transmission lines based on YOLOv5 object detection algorithm[J]. Energy Reports, 2023, (9): 323- 332
[12]   ZHOU T, YANG J. An improved YOLOv5 algorithm for construction solid waste detection [C]// IEEE 3rd International Conference on Electronic Technology , Communication and Information . Changchun: IEEE, 2023: 473–477.
[13]   FU Z. Vision transformer: vit and its derivatives [EB/OL]. [2023-08-24]. https://arxiv.org/abs/2205.11239.
[14]   LI C H, ZHANG C N. CNN or vit? revisiting vision transformers through the lens of convolution [EB/OL]. [2023-11-03]. https://arxiv.org/abs/2309.05375.
[15]   WANG A, CHEN H, LIN Z J, et al. Repvit: revisiting mobile cnn from vit perspective [EB/OL]. [2023-11-03]. https://arxiv.org/abs/2307.09283.
[16]   DING X H, ZHANG X Y, MA N N, et al. Repvgg: making vgg-style convnets great again [C]// IEEE/CVF Conference on Computer Vision and Pattern Recognition . Nashville: IEEE, 2021: 13733–13742.
[1] Canlin LI,Xinyue WANG,Lizhuang MA,Zhiwen SHAO,Wenjiao ZHANG. Image cartoonization incorporating attention mechanism and structural line extraction[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(8): 1728-1737.
[2] Zhongliang LI,Qi CHEN,Lin SHI,Chao YANG,Xianming ZOU. Dynamic knowledge graph completion of temporal aware combination[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(8): 1738-1747.
[3] Shuhan WU,Dan WANG,Yuanfang CHEN,Ziyu JIA,Yueqi ZHANG,Meng XU. Attention-fused filter bank dual-view graph convolution motor imagery EEG classification[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(7): 1326-1335.
[4] Xianwei MA,Chaohui FAN,Weizhi NIE,Dong LI,Yiqun ZHU. Robust fault diagnosis method for failure sensors[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(7): 1488-1497.
[5] Jun YANG,Chen ZHANG. Semantic segmentation of 3D point cloud based on boundary point estimation and sparse convolution neural network[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(6): 1121-1132.
[6] Yuntang LI,Hengjie LI,Kun ZHANG,Binrui WANG,Shanyue GUAN,Yuan CHEN. Recognition of complex power lines based on novel encoder-decoder network[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(6): 1133-1141.
[7] Zhiwei XING,Shujie ZHU,Biao LI. Airline baggage feature perception based on improved graph convolutional neural network[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(5): 941-950.
[8] Yi LIU,Yidan CHEN,Lin GAO,Jiao HONG. Lightweight road extraction model based on multi-scale feature fusion[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(5): 951-959.
[9] Cuiting WEI,Weijian ZHAO,Bochao SUN,Yunyi LIU. Intelligent rebar inspection based on improved Mask R-CNN and stereo vision[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(5): 1009-1019.
[10] Hai HUAN,Yu SHENG,Chenxi GU. Global guidance multi-feature fusion network based on remote sensing image road extraction[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(4): 696-707.
[11] Huijuan ZHANG,Kunpeng LI,Miaoxin JI,Zhenjiang LIU,Jianjuan LIU,Chi ZHANG. UAV detection algorithm based on spatial correlation enhancement[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(3): 468-479.
[12] Mingjun SONG,Wen YAN,Yizhao DENG,Junran ZHANG,Haiyan TU. Light-weight algorithm for real-time robotic grasp detection[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(3): 599-610.
[13] Xinhua YAO,Tao YU,Senwen FENG,Zijian MA,Congcong LUAN,Hongyao SHEN. Recognition method of parts machining features based on graph neural network[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(2): 349-359.
[14] Yaolian SONG,Can WANG,Dayan LI,Xinyi LIU. UAV small target detection algorithm based on improved YOLOv5s[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(12): 2417-2426.
[15] Changzhen XIONG,Chuanxi GUO,Cong WANG. Target tracking algorithm based on dynamic position encoding and attention enhancement[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(12): 2427-2437.