《计算机应用》唯一官方网站 ›› 2024, Vol. 44 ›› Issue (7): 2271-2278.DOI: 10.11772/j.issn.1001-9081.2023070969
收稿日期:
2023-07-19
修回日期:
2023-09-22
接受日期:
2023-09-22
发布日期:
2023-10-26
出版日期:
2024-07-10
通讯作者:
徐健
作者简介:
张勇进(1998—),男,陕西西安人,硕士研究生,主要研究方向:人工智能、深度学习;基金资助:
Yongjin ZHANG, Jian XU(), Mingxing ZHANG
Received:
2023-07-19
Revised:
2023-09-22
Accepted:
2023-09-22
Online:
2023-10-26
Published:
2024-07-10
Contact:
Jian XU
About author:
ZHANG Yongjin, born in 1998, M. S. candidate. His research interests include artificial intelligence, deep learning.Supported by:
摘要:
针对棉纺厂原棉吞吐量大、检测时间长而常见卷积神经网络无法实现高实时检测的问题,提出基于轻量化改进的YOLOv7模型对原棉杂质的检测算法,旨在快速高效地对棉杂质进行检测。首先通过删减YOLOv7模型冗余的卷积层从而提高检测速度;其次在主干网络内添加FasterNet卷积降低模型的计算负担,减少特征图的冗余性,实现高实时检测;最后在颈部网络内运用CSP-RepFPN(Cross Stage Partial networks with Replicated Feature Pyramid Network)重构特征金字塔,增加特征信息流通,减少特征损失,提高检测精度。实验结果表明:在自建棉杂数据集上改进的YOLOv7模型在棉杂检测精度上达到了96.0%,检测时间比YOLOv7减少了37.5%;在公开DWC(Drinking Waste Classification)数据集上整体精度达到82.5%,检测时间仅为29.8 ms。改进的YOLOv7模型能够为原棉杂质的实时检测和识别分类提供一种轻量化的检测方法,大幅节约了时间成本。
中图分类号:
张勇进, 徐健, 张明星. 面向轻量化的改进YOLOv7棉杂检测算法[J]. 计算机应用, 2024, 44(7): 2271-2278.
Yongjin ZHANG, Jian XU, Mingxing ZHANG. Lightweight algorithm for impurity detection in raw cotton based on improved YOLOv7[J]. Journal of Computer Applications, 2024, 44(7): 2271-2278.
模型 | 网络层的层数 | 耗时/ms | 浮点运算量/GFLOPs | mAP/% | ||||
---|---|---|---|---|---|---|---|---|
3×3卷积层 | 1×1卷积层 | 池化层 | 连接层 | 采样层 | ||||
YOLOv7 | 44 | 36 | 7 | 15 | 2 | 29.1 | 105.2 | 95.9 |
Light-YOLOv7 | 22 | 14 | 5 | 9 | 1 | 23.3 | 106.8 | 92.2 |
表1 YOLOv7与Light-YOLOv7数据对比
Tab. 1 Data Comparison between YOLOv7 and Light-YOLOv7
模型 | 网络层的层数 | 耗时/ms | 浮点运算量/GFLOPs | mAP/% | ||||
---|---|---|---|---|---|---|---|---|
3×3卷积层 | 1×1卷积层 | 池化层 | 连接层 | 采样层 | ||||
YOLOv7 | 44 | 36 | 7 | 15 | 2 | 29.1 | 105.2 | 95.9 |
Light-YOLOv7 | 22 | 14 | 5 | 9 | 1 | 23.3 | 106.8 | 92.2 |
棉杂种类 | YOLOv7 | Light-YOLOv7-FNR | ||||
---|---|---|---|---|---|---|
精确率 | 召回率 | mAP | 精确率 | 召回率 | mAP | |
平均值 | 90.9 | 91.1 | 95.9 | 93.1 | 91.2 | 96.0 |
原棉秆 | 89.7 | 91.0 | 96.0 | 93.5 | 88.3 | 94.3 |
发丝 | 78.8 | 91.8 | 91.8 | 84.4 | 90.9 | 92.4 |
原棉叶 | 98.3 | 84.6 | 96.9 | 95.6 | 90.2 | 98.1 |
棉籽壳 | 97.0 | 97.0 | 99.0 | 98.9 | 95.4 | 99.3 |
表2 YOLOv7和Light-YOLOv7-FNR模型在原棉杂质数据集上的检测结果 ( %)
Tab. 2 Detection results of YOLOv7 and Light-YOLOv7-FNR on cotton dataset
棉杂种类 | YOLOv7 | Light-YOLOv7-FNR | ||||
---|---|---|---|---|---|---|
精确率 | 召回率 | mAP | 精确率 | 召回率 | mAP | |
平均值 | 90.9 | 91.1 | 95.9 | 93.1 | 91.2 | 96.0 |
原棉秆 | 89.7 | 91.0 | 96.0 | 93.5 | 88.3 | 94.3 |
发丝 | 78.8 | 91.8 | 91.8 | 84.4 | 90.9 | 92.4 |
原棉叶 | 98.3 | 84.6 | 96.9 | 95.6 | 90.2 | 98.1 |
棉籽壳 | 97.0 | 97.0 | 99.0 | 98.9 | 95.4 | 99.3 |
模型 | mAP | 耗时/ms | ||||
---|---|---|---|---|---|---|
棉秆 | 棉叶 | 头发 | 棉籽 | 平均 | ||
YOLOv7 | 96.0 | 96.9 | 91.8 | 99.0 | 95.9 | 29.10 |
Light-YOLOv7FN | 93.8 | 95.5 | 88.5 | 99.3 | 94.3 | 19.50 |
Light-YOLOv7R | 96.9 | 98.8 | 93.6 | 99.4 | 97.2 | 28.19 |
Light-YOLOv7FNR | 94.3 | 98.1 | 92.4 | 99.3 | 96.0 | 18.20 |
表3 不同改进模型在原棉杂质数据集上的检测性能 ( %)
Tab. 3 Detection performance of different improved models on raw cotton impurity dataset
模型 | mAP | 耗时/ms | ||||
---|---|---|---|---|---|---|
棉秆 | 棉叶 | 头发 | 棉籽 | 平均 | ||
YOLOv7 | 96.0 | 96.9 | 91.8 | 99.0 | 95.9 | 29.10 |
Light-YOLOv7FN | 93.8 | 95.5 | 88.5 | 99.3 | 94.3 | 19.50 |
Light-YOLOv7R | 96.9 | 98.8 | 93.6 | 99.4 | 97.2 | 28.19 |
Light-YOLOv7FNR | 94.3 | 98.1 | 92.4 | 99.3 | 96.0 | 18.20 |
模型 | mAP/% | 耗时/ms |
---|---|---|
Light-YOLOv7FNR | 96.1 | 18.2 |
MNV3 | 89.8 | 262.0 |
Faster-RCNN | 94.9 | 140.0 |
YOLOv5 | 81.2 | 11.4 |
表4 不同模型对原棉杂质数据集的检测性能
Tab. 4 Detection performance of different models on raw cotton impurity dataset
模型 | mAP/% | 耗时/ms |
---|---|---|
Light-YOLOv7FNR | 96.1 | 18.2 |
MNV3 | 89.8 | 262.0 |
Faster-RCNN | 94.9 | 140.0 |
YOLOv5 | 81.2 | 11.4 |
模型 | mAP% | 耗时/ms |
---|---|---|
DETR+ResNet-50 | 80.9 | 115.2 |
WNV3 | 81.4 | 145.9 |
YOLOv7 | 81.8 | 36.4 |
Light-YOLOv7-FNR | 82.5 | 29.8 |
YOLOv5 | 72.9 | 20.5 |
Faster-RCNN | 83.4 | 211.2 |
表5 不同模型对DWC数据集的检测性能
Tab. 5 Detection performance of different models on DWC dataset
模型 | mAP% | 耗时/ms |
---|---|---|
DETR+ResNet-50 | 80.9 | 115.2 |
WNV3 | 81.4 | 145.9 |
YOLOv7 | 81.8 | 36.4 |
Light-YOLOv7-FNR | 82.5 | 29.8 |
YOLOv5 | 72.9 | 20.5 |
Faster-RCNN | 83.4 | 211.2 |
1 | 徐爱武.近十年我国棉花生产量与消费量分析及建议[J].棉花科学, 2022, 44(4): 61-64. |
XU A W. Analysis and suggestion of cotton production and consumption in China in recent ten years [J]. Journal of Cotton Sciences, 2022, 44(4): 61-64. | |
2 | 刘伟刚.加强棉花质量管控,助力棉花质量提升[J].中国棉花加工, 2022(4): 31-32. |
LIU W G. Strengthening cotton quality control to help improve cotton quality [J]. China Cotton Processing, 2022(4): 31-32. | |
3 | 陈佳,王燕,白玉兰.我国棉花产业现状和产出效率分析及对策[J].棉花科学, 2022, 44(5): 3-10. |
CHEN J, WANG Y, BAI Y L. Current situation and output efficiency analysis and countermeasures of Chinese cotton industry [J]. Cotton Sciences, 2022, 44(5): 3-10. | |
4 | 王雪颖,吕慧捷,周鸿淼,等.我国棉花产业链发展现状及展望[J].农业与技术, 2022, 42(14): 139-142. |
WANG X Y, LYU H J, ZHOU H M, et al. Current situation and outlook of cotton industry chain development in China [J]. Agriculture and Technology, 2022, 42(14): 139-142. | |
5 | MATCHANOV R D, YULDASHEV A T, KULDOSHEV D A. Analysis of the degree of impurity of raw cotton when using a U-shaped receiving chamber in a combined cotton harvester [J]. IOP Conference Series: Earth and Environmental Science, 2022, 1112: 012029. |
6 | LECUN Y, BOTTOU L, BENGIO Y, et al. Gradient-based learning applied to document recognition [J]. Proceedings of the IEEE, 1998, 86(11): 2278-2324. |
7 | GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation [C]// Proceedings of the 2014 IEEE Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2014: 580-587. |
8 | 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, 2016, 39(6): 1137-1149. |
9 | REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection [C]// Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2016: 779-788. |
10 | 谢团结,林贤伟,胡连信,等.基于改进YOLOv5算法的织物疵点检测系统[J].棉纺织技术, 2022, 50(11): 15-20. |
XIE T J, LIN X W, HU L X, et al. Fabric defect detection system based on improved YOLOv5 algorithm [J]. Cotton Textile Technology, 2022, 50(11): 15-20. | |
11 | ZHANG C, LI T, ZHANG W. The detection of impurity content in machine-picked seed cotton based on image processing and improved YOLOV4 [J]. Agronomy, 2022, 12(1): 66. |
12 | 徐健,胡道杰,刘秀平,等.基于改进型RFB-MobileNetV3的棉杂图像检测[J].纺织学报, 2023, 44(1): 179-187. |
XU J, HU D J, LIU X P, et al. Cotton impurity image detection based on improved RFB-MobileNetV3 [J]. Journal of Textile Research, 2023, 44(1): 179-187. | |
13 | MAJCHROWSKA S, MIKOLAJCZYK A, FERLIN M, et al. Waste detection in Pomerania: non-profit project for detecting waste in environment [EB/OL]. (2021-05-12) [2023-07-01]. . |
14 | WANG C-Y, BOCHKOVSKIY A, LIAO H-Y M. YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors [C]// Proceedings of the 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2023: 7464-7475. |
15 | JIANG K, XIE J, YAN R, et al. An attention mechanism improved YOLOv7 object detection algorithm for duck count estimation [J]. Agriculture, 2022, 12(10): 1659. |
16 | ZHAO H, ZHANG H, ZHAO Y.YOLOv7-sea: object detection of maritime UAV images based on improved YOLOv7 [C]// Proceedings of the 2023 IEEE/CVF Winter Conference on Applications of Computer Vision. Piscataway: IEEE, 2023: 233-238. |
17 | XIA Y, NGUYEN M, YAN W Q. A real-time kiwifruit detection based on improved YOLOv7 [C]// Proceedings of the 37th International Conference on Image and Vision Computing. Cham: Springe, 2023: 48-61. |
18 | ZHENG J, WU H, ZHANG H, et al. Insulator defect detection algorithm based on improved YOLOv7 [J]. Sensors, 2022, 22(22): 8801. |
19 | WANG R, LIANG F, MOU X, et al. Development of an improved YOLOv7-based model for detecting defects on strip steel surfaces [J]. Coatings, 2023, 13(3): 536. |
20 | CHEN J, KAO S, HE H, et al. Run, don’t walk: chasing higher FLOPS for faster neural networks [C]// Proceedings of the 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2023: 12021-12031. |
21 | WENG K, CHU X, XU X, et al. EfficientRep: an efficient RepVGG-style convnets with hardware-aware neural network design [EB/OL]. (2023-02-01) [2023-07-01]. . |
22 | WANG C-Y, LIAO H-Y M, WU Y-H, et al. CSPNet: a new backbone that can enhance learning capability of CNN [C]// Proceedings of the 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops. Piscataway: IEEE, 2020: 1571-1580. |
[1] | 龙伍丹, 彭博, 胡节, 申颖, 丁丹妮. 基于加强特征提取的道路病害检测算法[J]. 《计算机应用》唯一官方网站, 2024, 44(7): 2264-2270. |
[2] | 程小辉, 黄云天, 张瑞芳. 基于多尺度和加权坐标注意力的轻量化红外道路场景检测模型[J]. 《计算机应用》唯一官方网站, 2024, 44(6): 1927-1934. |
[3] | 宋霄罡, 张冬冬, 张鹏飞, 梁莉, 黑新宏. 面向复杂施工环境的实时目标检测算法[J]. 《计算机应用》唯一官方网站, 2024, 44(5): 1605-1612. |
[4] | 耿焕同, 刘振宇, 蒋骏, 范子辰, 李嘉兴. 基于改进YOLOv8的嵌入式道路裂缝检测算法[J]. 《计算机应用》唯一官方网站, 2024, 44(5): 1613-1618. |
[5] | 封筠, 毕健康, 霍一儒, 李家宽. 轻量化沥青路面裂缝图像分割网络PIPNet[J]. 《计算机应用》唯一官方网站, 2024, 44(5): 1520-1526. |
[6] | 黄子杰, 欧阳, 江德港, 郭彩玲, 李柏林. 面向牵引座焊缝表面质量检测的轻量型深度学习算法[J]. 《计算机应用》唯一官方网站, 2024, 44(3): 983-988. |
[7] | 张成涵宇, 林钰哲, 谭程珂, 王俊帆, 顾烨婷, 董哲康, 高明煜. 基于轻量化YOLOv5的新型菜品识别网络[J]. 《计算机应用》唯一官方网站, 2024, 44(2): 638-644. |
[8] | 陈姿芊, 牛科迪, 姚中原, 斯雪明. 适用于物联网的区块链轻量化技术综述[J]. 《计算机应用》唯一官方网站, 2024, 44(12): 3688-3698. |
[9] | 赵欣, 李鑫杰, 徐健, 刘步云, 毕祥. 基于卷积神经网络与Transformer并行的医学图像配准模型[J]. 《计算机应用》唯一官方网站, 2024, 44(12): 3915-3921. |
[10] | 王呈, 王炀, 荣英佼. 面向配电柜字符识别的YOLOv7-MSBP目标定位算法[J]. 《计算机应用》唯一官方网站, 2024, 44(10): 3191-3199. |
[11] | 王宏, 钱清, 王欢, 龙永. 融合大核注意力卷积的轻量化图像篡改定位算法[J]. 《计算机应用》唯一官方网站, 2023, 43(9): 2692-2699. |
[12] | 郝巨鸣, 杨景玉, 韩淑梅, 王阳萍. 引入Ghost模块和ECA的YOLOv4公路路面裂缝检测方法[J]. 《计算机应用》唯一官方网站, 2023, 43(4): 1284-1290. |
[13] | 张韵, 王淑营, 郑庆, 张海柱. 保持细节几何特征的三维网格模型轻量化算法[J]. 《计算机应用》唯一官方网站, 2023, 43(4): 1226-1232. |
[14] | 陈海燕, 贾明明, 赵文力, 王婵飞. 基于嵌入式Jetson TX2的高原鼠兔目标检测[J]. 《计算机应用》唯一官方网站, 2023, 43(1): 98-103. |
[15] | 郭克友, 李雪, 杨民. 基于轻量化YOLOv4的交通信息实时检测方法[J]. 《计算机应用》唯一官方网站, 2023, 43(1): 74-80. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||