Please wait a minute...
Journal of ZheJiang University (Engineering Science)  2024, Vol. 58 Issue (1): 71-77    DOI: 10.3785/j.issn.1008-973X.2024.01.008
    
Lightweight object detection scheme for garbage classification scenario
Jiansong CHEN(),Yijun CAI*()
School of Opto-electronic and Communication Engineering, Xiamen University of Technology, Xiamen 361024, China
Download: HTML     PDF(1542KB) HTML
Export: BibTeX | EndNote (RIS)      

Abstract  

A lightweight Yolov5 garbage detection solution was proposed aiming at the issue of poor real-time performance in garbage detection classification on edge devices. The Stem module was introduced to enhance the model’s ability to extract features from input images. The C3 module of the backbone was improved to increase feature extraction capabilities. Depthwise separable convolution was used to replace the 3×3 downsampling convolutions in the network, achieving model lightweighting. The K-means++ algorithm was employed to recompute anchor box values for objects, enabling the model to better predict target box sizes during training. Experimental research and comparisons show that the improved model achieves a 0.8% increase in mAP_0.5 and a 3% increase in mAP_0.5:0.95, while reducing model parameters by 77.9% and improving inference speed by 21.9% compared with the Yolov5s model, significantly enhancing the detection performance of the model.



Key wordsgarbage classification      Yolov5      depthwise separable convolution      K-means++ algorithm      Stem module     
Received: 17 January 2023      Published: 07 November 2023
CLC:  TP 391  
Fund:  国家自然科学基金青年资助项目(62005232);福建省自然科学基金面上项目(2020J01294)
Corresponding Authors: Yijun CAI     E-mail: 1425633559@qq.com;yijuncai@foxmail.com
Cite this article:

Jiansong CHEN,Yijun CAI. Lightweight object detection scheme for garbage classification scenario. Journal of ZheJiang University (Engineering Science), 2024, 58(1): 71-77.

URL:

https://www.zjujournals.com/eng/10.3785/j.issn.1008-973X.2024.01.008     OR     https://www.zjujournals.com/eng/Y2024/V58/I1/71


面向垃圾分类场景的轻量化目标检测方案

针对边缘端进行垃圾检测分类实时性差的问题,提出轻量化的Yolov5垃圾检测解决方案. 引入Stem模块,增强模型对输入图像的特征提取能力. 将backbone的C3模块进行改进,提高特征提取能力. 使用深度可分离卷积替换网络中的3×3降采样卷积,实现模型轻量化. 使用K-means++算法重新计算物体的锚框值,使模型在训练过程中能够更好地预测目标框的大小. 通过实验研究对比可知,改进模型相比于Yolov5s模型,mAP_0.5提升了0.8%,mAP_0.5:0.95提升了3%,模型参数量减少到原来的77.9%,推理速度提升了21.9%,极大地提高了模型的检测性能.


关键词: 垃圾分类,  Yolov5,  深度可分离卷积,  K-means++算法,  Stem模块 
Fig.1 Improvement tree graph of Yolov5 algorithm
Fig.2 Structure diagram of improved Yolov5 model
Fig.3 Structural diagram of Stem module
Fig.4 Structural diagram of depthwise separable convolution module
Fig.5 Structural diagram of C3 improved module
训练参数 参数值 训练参数 参数值
动量 0.937 循环学习率 0.1
权重衰减率 0.0005 预热学习轮次 3
批量大小 32 预热学习动量 0.8
迭代次数 100 预热初始学习率 0.1
初始学习率 0.01
Tab.1 
Fig.6 Performance comparison between Yolov5s model and improved model
模型 P R mAP@0.5 mAP@0.5:0.95 Np/106 t/ms
Yolov5s 0.834 0.792 0.861 0.529 7.026307 135.9
Yolov5s+K-means++ 0.855 0.836 0.883 0.555 7.026307 135.9
改进模型 0.859 0.777 0.849 0.532 5.421475 106.1
改进模型+K-means++ 0.897 0.811 0.869 0.559 5.421475 106.1
Tab.2 Comparison of experimental results between Yolov5s model and improved model
Fig.7 Comparison of detection results between Yolov5s and improved model
[1]   GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation [C]// Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. Columbus: IEEE, 2014: 580-587.
[2]   HE K M, ZHANG X, REN S, et al Spatial pyramid pooling in deep convolutional networks for visual recognition[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2015, 37 (9): 1904- 1916
doi: 10.1109/TPAMI.2015.2389824
[3]   GIRSHICK R. Fast R-CNN [C]// 2015 IEEE International Conference on Computer Vision. Santiago: IEEE, 2015: 1440-1448.
[4]   REN S, HE K, GIRSHICK R, et al Faster R-CNN: towards real time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 39 (6): 1137- 1149
doi: 10.1109/TPAMI.2016.2577031
[5]   REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection [C]// 2015 IEEE Conference on Computer Vision and Pattern Recognition. Las Vegas: IEEE, 2015: 6517-6525.
[6]   LIU W, ANGUELOV D, ERHAN D, et al. SSD: single shot multi-box detector [C]// 14th European Conference on Computer Vision. [S. l. ]: Springer, 2016: 21-37.
[7]   李小波, 李阳贵, 郭宁, 等 融合注意力机制的Yolov5口罩检测算法[J]. 图学学报, 2023, 44 (1): 16- 25
LI Xiaobo, LI Yanggui, GUO ning, et al Yolov5 mask detection algorithm integrating attention mechanism[J]. Journal of Graphics, 2023, 44 (1): 16- 25
[8]   代牮, 赵旭, 李连鹏, 等 基于改进Yolov5的复杂背景红外弱小目标检测算法[J]. 红外技术, 2022, 44 (5): 504- 512
DAI Xuan, ZHAO Xu, LI Lianpeng, et al Infrared dim small target detection algorithm based on improved Yolov5 in complex background[J]. Infrared Technology, 2022, 44 (5): 504- 512
[9]   李仁鹰, 钱慧芳, 郭佳豪, 等 基于M-Yolov4模型的轻量化目标检测算法[J]. 国外电子测量技术, 2022, 41 (4): 15- 21
LI Renying, QIAN Huifang, GUO Jiahao, et al Lightweight target detection algorithm based on M-Yolov4 model[J]. Foreign Electronic Measurement Technology, 2022, 41 (4): 15- 21
doi: 10.19652/j.cnki.femt.2103482
[10]   王晨, 袁庆霓, 白欢, 等 面向仓储货物的轻量化目标检测算法[J]. 激光与光电子学进展, 2022, 59 (24): 74- 80
WANG Chen, YUAN Qingni, BAI Huan, et al Lightweight object detection algorithm for warehousing goods[J]. Progress in Laser and Optoelectronics, 2022, 59 (24): 74- 80
[11]   秦伟伟, 宋泰年, 刘洁瑜 基于轻量化 Yolov3的遥感军事目标检测算法[J]. 计算机工程与应用, 2021, 57 (21): 263- 269
QIN Weiwei, SONG Tainian, LIU Jieyu Remote sensing military target detection algorithm based on lightweight Yolov3[J]. Computer Engineering and Application, 2021, 57 (21): 263- 269
doi: 10.3778/j.issn.1002-8331.2106-0026
[12]   王相友, 李晏兴, 杨振宇, 等 基于改进Yolov4模型的马铃薯中土块石块检测方法[J]. 农业机械学报, 2021, 52 (8): 241- 247
WANG Xiangyou, LI Yanxing, YANG Zhenyu, et al Detection method of soil and stone in potato based on improved Yolov4 model[J]. Journal of Agricultural Machinery, 2021, 52 (8): 241- 247
[13]   陈田, 黄家才, 张铎, 等 基于深度学习的移动机器人障碍物检测研究[J]. 南京工程学院学报: 自然科学版, 2022, 20 (2): 8- 12
CHEN Tian, HUANG Jiacai, ZHANG Duo, et al Research on obstacle detection of mobile robots based on deep learning[J]. Journal of Nanjing Institute of Engineering: Natural Science Edition, 2022, 20 (2): 8- 12
[14]   杨小冈, 高凡, 卢瑞涛, 等 基于改进Yolov5的轻量化航空目标检测方法[J]. 信息与控制, 2022, 51 (3): 361- 368
YANG Xiaogang, GAO Fan, LU Ruitao, et al A lightweight aerial target detection method based on improved Yolov5[J]. Information and Control, 2022, 51 (3): 361- 368
doi: 10.13976/j.cnki.xk.2021.1240
[15]   李志刚, 张娜. 一种轻量型Yolov5交通标志识别方法[J]. 电讯技术, 2022, 62(9): 1201-1206.
LI Zhigang, ZHANG Na. A lightweight Yolov5 traffic sign recognition method [J/OL]. Tel-Ecommunication Technology, 2022, 62(9): 1201-1206.
[16]   倪伟健, 秦会斌 GSDCPeleeNet: 基于PeleeNet的高效轻量化卷积神经网络[J]. 电子技术应用, 2021, 47 (3): 22- 26
NI Weijian, QIN Huibin GSDCPeleeNet: efficient lightweight convolutional neural network based on PeleeNet[J]. Electronic Technology Application, 2021, 47 (3): 22- 26
[17]   刘宇宸, 石刚, 崔青, 等 改进MobileNetv3-Yolov3交通标志牌检测算法[J]. 东北师大学报: 自然科学版, 2022, 54 (2): 53- 60
LIU Yuchen, SHI Gang, CUI Qing, et al Improved MobileNetv3-Yolov3 traffic sign detection algorithm[J]. Journal of Northeast Normal University: Natural Science Edition, 2022, 54 (2): 53- 60
[18]   王静, 白云 基于改进Yolov5s的车辆目标检测算法[J]. 信息与电脑(理论版), 2022, 34 (10): 80- 83
WANG Jing, BAI Yun Vehicle target detection algorithm based on improved Yolov5s[J]. Information and Computer (Theoretical Edition), 2022, 34 (10): 80- 83
[19]   罗安能, 万海斌, 司志巍, 等 基于改进Yolov5s的可回收垃圾的检测算法[J]. 激光与光电子学进展, 2023, 60 (10): 130- 137
LUO Anneng, WAN Haibin, SI Zhiwei, et al Detection algorithm of recyclable garbage based on improved Yolov5s[J]. Progress in Laser and Optoelectronics, 2023, 60 (10): 130- 137
[20]   闫彬, 樊攀, 王美茸, 等 基于改进Yolov5m的采摘机器人苹果采摘方式实时识别[J]. 农业机械学报, 2022, 53 (9): 28- 38
YAN Bin, FAN Pan, WANG Meirong, et al Real time recognition of apple picking method based on improved YoloV5m picking robot[J]. Journal of Agricultural Machinery, 2022, 53 (9): 28- 38
[21]   邢晋超, 潘广贞 改进Yolov5s的手语识别算法研究[J]. 计算机工程与应用, 2022, 58 (16): 194- 203
XING Jinchao, PAN Guangzhen Research on improved Yolov5s sign language recognition algorithm[J]. Computer Engineering and Application, 2022, 58 (16): 194- 203
[22]   龙赛, 宋晓凤, 张苏, 等 改进Yolov5s的航拍图像车辆检测研究[J]. 激光杂志, 2022, 43 (10): 22- 29
LONG Sai, SONG Xiaofeng, ZHANG Su, et al Research on improving Yolov5s aerial image vehicle detection[J]. Laser Magazine, 2022, 43 (10): 22- 29
doi: 10.14016/j.cnki.jgzz.2022.10.022
[23]   王晓雯, 梁博, 刘芳芳 基于注意力机制与加权盒函数的Yolov5的行人摔倒检测算法[J]. 山西大学学报: 自然科学版, 2023, 46 (2): 334- 341
WANG Xiaowen, LIANG Bo, LIU Fang-fang Yolov5 pedestrian fall detection algorithm based on attention mechanism and weighted box function[J]. Journal of Shanxi University: Natural Science Edition, 2023, 46 (2): 334- 341
[24]   王文胜, 李继旺, 吴波, 等 基于Yolov5交通标志识别的智能车设计[J]. 国外电子测量技术, 2021, 40 (10): 158- 164
WANG Wensheng, LI Jiwang, WU Bo, et al Intelligent vehicle design based on Yolov5 traffic sign recognition[J]. Foreign Electronic Measurement Technology, 2021, 40 (10): 158- 164
[1] Xin JIN,Jian-jun ZHUANG,Zi-heng XU. Lightweight YOLOv5s network-based algorithm for identifying hazardous objects under vehicles[J]. Journal of ZheJiang University (Engineering Science), 2023, 57(8): 1516-1526.
[2] Hao-jie FANG,Hong-zhao DONG,Shao-xuan LIN,Jian-yu LUO,Yong FANG. Driver fatigue state detection method based on multi-feature fusion[J]. Journal of ZheJiang University (Engineering Science), 2023, 57(7): 1287-1296.
[3] Qing-lu MA,Jia-ping LU,Xiao-yao TANG,Xue-feng DUAN. Improved YOLOv5s flame and smoke detection method in road tunnels[J]. Journal of ZheJiang University (Engineering Science), 2023, 57(4): 784-794.
[4] Yao ZENG,Fa-qin GAO. Surface defect detection algorithm of electronic components based on improved YOLOv5[J]. Journal of ZheJiang University (Engineering Science), 2023, 57(3): 455-465.
[5] Tian-le YUAN,Ju-long YUAN,Yong-jian ZHU,Han-chen ZHENG. Surface defect detection algorithm of thrust ball bearing based on improved YOLOv5[J]. Journal of ZheJiang University (Engineering Science), 2022, 56(12): 2349-2357.
[6] Yun-zuo ZHANG,Wei GUO,Zhao-quan CAI,Wen-bo LI. Remote sensing image target detection combining multi-scale and attention mechanism[J]. Journal of ZheJiang University (Engineering Science), 2022, 56(11): 2215-2223.
[7] Hong-zhao DONG,Hao-jie FANG,Nan ZHANG. Multi-scale object detection algorithm for recycled objects based on rotating block positioning[J]. Journal of ZheJiang University (Engineering Science), 2022, 56(1): 16-25.