《计算机应用》唯一官方网站 ›› 2025, Vol. 45 ›› Issue (2): 640-646.DOI: 10.11772/j.issn.1001-9081.2024010140
• 多媒体计算与计算机仿真 • 上一篇
收稿日期:
2024-02-06
修回日期:
2024-04-10
接受日期:
2024-04-11
发布日期:
2024-05-09
出版日期:
2025-02-10
通讯作者:
胡节
作者简介:
何秋润(2000—),男,四川内江人,硕士研究生,CCF会员,主要研究方向:深度学习、目标检测基金资助:
Qiurun HE1, Jie HU1,2(), Bo PENG1, Tianyuan LI2
Received:
2024-02-06
Revised:
2024-04-10
Accepted:
2024-04-11
Online:
2024-05-09
Published:
2025-02-10
Contact:
Jie HU
About author:
HE Qiurun, born in 2000, M. S. candidate. His research interests include deep learning, object detection.Supported by:
摘要:
针对纺织品疵点边缘特征弱以及极端长宽比导致检测困难的问题,提出基于YOLOv7的上下文信息多尺度特征融合织物疵点检测算法(CMFFD-YOLO)。首先,采用k均值聚类算法得到适应目标尺寸的更好锚框,并通过迁移学习引入主干权重;然后,重新设计主干网络,添加全局上下文信息(GC)模块,从而充分利用局部和全局上下文的信息增强小目标特征的提取能力;最后,设计一种基于多尺度特征融合网络的通道空间注意力渐近特征金字塔网络(CAFPN),采用渐近融合的方式使不同层次的语义信息联系更紧密,且在融合过程中能提取更多有用信息。在天池和ZJU-Leaper这2个纺织面料瑕疵数据集上的实验结果表明,所提算法的平均精度均值(mAP)分别达到了64.6%和61.7%,相较于原始YOLOv7分别提高了12.5和7.8个百分点,并且模型参数量比原始YOLOv7降低了5.013×106,具有更高的检测速度。可见,所提算法能满足企业织物疵点检测对检测精度和速度的需求。
中图分类号:
何秋润, 胡节, 彭博, 李天源. 基于上下文信息的多尺度特征融合织物疵点检测算法[J]. 计算机应用, 2025, 45(2): 640-646.
Qiurun HE, Jie HU, Bo PENG, Tianyuan LI. Fabric defect detection algorithm based on context information and multi-scale feature fusion[J]. Journal of Computer Applications, 2025, 45(2): 640-646.
数据集 | 疵点类别 | 全部 | |||||||
---|---|---|---|---|---|---|---|---|---|
破洞 | 污渍 | 三丝 | 花板跳 | 错纬 | 浆斑 | 跳花 | 磨痕 | ||
全部 | 957 | 1 206 | 3 219 | 450 | 594 | 1 230 | 1 191 | 1 149 | 9 996 |
训练 | 785 | 981 | 2 571 | 355 | 481 | 974 | 925 | 921 | 7 993 |
测试 | 172 | 225 | 648 | 95 | 113 | 256 | 266 | 228 | 2 003 |
表1 天池纺织面料疵点数据集的标签统计
Tab. 1 Label statistics of Tianchi textile fabric defect dataset
数据集 | 疵点类别 | 全部 | |||||||
---|---|---|---|---|---|---|---|---|---|
破洞 | 污渍 | 三丝 | 花板跳 | 错纬 | 浆斑 | 跳花 | 磨痕 | ||
全部 | 957 | 1 206 | 3 219 | 450 | 594 | 1 230 | 1 191 | 1 149 | 9 996 |
训练 | 785 | 981 | 2 571 | 355 | 481 | 974 | 925 | 921 | 7 993 |
测试 | 172 | 225 | 648 | 95 | 113 | 256 | 266 | 228 | 2 003 |
数据集 | 疵点类别 | 全部 | ||
---|---|---|---|---|
磨损 | 油渍 | 污渍 | ||
全部 | 912 | 992 | 532 | 2 436 |
训练 | 705 | 782 | 441 | 1 928 |
测试 | 207 | 210 | 91 | 508 |
表2 ZJU-Leaper纺织面料疵点数据集的标签统计
Tab. 2 Label statistics of ZJU-Leaper textile fabric defect dataset
数据集 | 疵点类别 | 全部 | ||
---|---|---|---|---|
磨损 | 油渍 | 污渍 | ||
全部 | 912 | 992 | 532 | 2 436 |
训练 | 705 | 782 | 441 | 1 928 |
测试 | 207 | 210 | 91 | 508 |
模型 | mAP | AP50 | AP75 | APs | APm | APl |
---|---|---|---|---|---|---|
YOLOv7 | 52.1 | 75.6 | 56.6 | 35.8 | 42.8 | 52.1 |
YOLOv7+k-means | 54.5 | 77.3 | 60.3 | 38.6 | 45.3 | 55.7 |
表3 聚类的有效性验证 ( %)
Tab. 3 Validation of clustering effectiveness
模型 | mAP | AP50 | AP75 | APs | APm | APl |
---|---|---|---|---|---|---|
YOLOv7 | 52.1 | 75.6 | 56.6 | 35.8 | 42.8 | 52.1 |
YOLOv7+k-means | 54.5 | 77.3 | 60.3 | 38.6 | 45.3 | 55.7 |
模型 | mAP | AP50 | AP75 | APs | APm | APl |
---|---|---|---|---|---|---|
YOLOv5 | 40.7 | 68.8 | 39.9 | 27.8 | 41.4 | 40.8 |
YOLOv5+W | 49.4 | 78.4 | 49.9 | 34.7 | 44.2 | 50.1 |
YOLOv7 | 31.9 | 58.7 | 28.9 | 17.6 | 22.6 | 33.2 |
YOLOv7+W | 54.5 | 77.3 | 60.3 | 38.6 | 45.3 | 55.7 |
表4 主干权重的有效性验证 ( %)
Tab. 4 Validation of backbone weight effectiveness
模型 | mAP | AP50 | AP75 | APs | APm | APl |
---|---|---|---|---|---|---|
YOLOv5 | 40.7 | 68.8 | 39.9 | 27.8 | 41.4 | 40.8 |
YOLOv5+W | 49.4 | 78.4 | 49.9 | 34.7 | 44.2 | 50.1 |
YOLOv7 | 31.9 | 58.7 | 28.9 | 17.6 | 22.6 | 33.2 |
YOLOv7+W | 54.5 | 77.3 | 60.3 | 38.6 | 45.3 | 55.7 |
模型 | mAP/% | AP50/% | AP75/% | 参数量/106 |
---|---|---|---|---|
YOLOv7_change | 54.5 | 77.3 | 60.3 | 36.541 |
YOLOv7_change+GC | 61.5 | 83.9 | 69.2 | 37.728 |
表5 GC网络的有效性验证
Tab. 5 Validation of GC network effectiveness
模型 | mAP/% | AP50/% | AP75/% | 参数量/106 |
---|---|---|---|---|
YOLOv7_change | 54.5 | 77.3 | 60.3 | 36.541 |
YOLOv7_change+GC | 61.5 | 83.9 | 69.2 | 37.728 |
模型 | mAP/% | AP50/% | AP75/% | 参数量/106 |
---|---|---|---|---|
YOLOv7_change | 54.5 | 77.3 | 60.3 | 36.541 |
YOLOv7_change+AFPN | 63.9 | 84.3 | 71.6 | 30.322 |
YOLOv7_change+CAFPN | 64.1 | 84.7 | 71.7 | 30.333 |
表6 CAFPN的有效性验证
Tab. 6 Validation of CAFPN effectiveness
模型 | mAP/% | AP50/% | AP75/% | 参数量/106 |
---|---|---|---|---|
YOLOv7_change | 54.5 | 77.3 | 60.3 | 36.541 |
YOLOv7_change+AFPN | 63.9 | 84.3 | 71.6 | 30.322 |
YOLOv7_change+CAFPN | 64.1 | 84.7 | 71.7 | 30.333 |
模型 | mAP/% | AP50/% | AP75/% | APs/% | APm/% | APl/% | 参数量/106 |
---|---|---|---|---|---|---|---|
YOLOv5_l | 49.4 | 78.4 | 49.9 | 34.7 | 44.2 | 50.1 | 46.149 |
YOLOv5_x | 51.4 | 78.5 | 54.3 | 38.0 | 47.8 | 51.8 | 86.265 |
YOLOX_l | 38.2 | 63.2 | 39.7 | 32.3 | 55.9 | 39.4 | 54.153 |
YOLOv7_l | 52.1 | 75.6 | 56.6 | 35.8 | 42.8 | 52.1 | 36.541 |
RTMDet_l | 50.2 | 79.9 | 52.4 | 14.5 | 33.4 | 56.6 | 52.256 |
Faster R-CNN | 50.2 | 68.1 | 54.4 | 45.7 | 60.6 | 42.9 | 41.453 |
SE-YOLOv5 | 51.6 | 78.7 | 53.5 | 36.2 | 45.1 | 50.9 | 46.217 |
FD-YOLOv5 | 53.4 | 77.6 | 55.3 | 36.6 | 44.7 | 53.2 | 45.763 |
CA-YOLOv7 | 60.5 | 79.3 | 68.1 | 38.7 | 47.2 | 58.9 | 31.475 |
CMFFD-YOLO | 64.6 | 84.9 | 71.5 | 40.2 | 47.8 | 66.4 | 31.528 |
表7 天池纺织疵点数据集上的性能比较
Tab. 7 Performance comparison on Tianchi textile defect dataset
模型 | mAP/% | AP50/% | AP75/% | APs/% | APm/% | APl/% | 参数量/106 |
---|---|---|---|---|---|---|---|
YOLOv5_l | 49.4 | 78.4 | 49.9 | 34.7 | 44.2 | 50.1 | 46.149 |
YOLOv5_x | 51.4 | 78.5 | 54.3 | 38.0 | 47.8 | 51.8 | 86.265 |
YOLOX_l | 38.2 | 63.2 | 39.7 | 32.3 | 55.9 | 39.4 | 54.153 |
YOLOv7_l | 52.1 | 75.6 | 56.6 | 35.8 | 42.8 | 52.1 | 36.541 |
RTMDet_l | 50.2 | 79.9 | 52.4 | 14.5 | 33.4 | 56.6 | 52.256 |
Faster R-CNN | 50.2 | 68.1 | 54.4 | 45.7 | 60.6 | 42.9 | 41.453 |
SE-YOLOv5 | 51.6 | 78.7 | 53.5 | 36.2 | 45.1 | 50.9 | 46.217 |
FD-YOLOv5 | 53.4 | 77.6 | 55.3 | 36.6 | 44.7 | 53.2 | 45.763 |
CA-YOLOv7 | 60.5 | 79.3 | 68.1 | 38.7 | 47.2 | 58.9 | 31.475 |
CMFFD-YOLO | 64.6 | 84.9 | 71.5 | 40.2 | 47.8 | 66.4 | 31.528 |
模型 | mAP/% | AP50/% | AP75/% | APs/% | APm/% | APl/% | 参数量/106 |
---|---|---|---|---|---|---|---|
YOLOv5_l | 58.2 | 89.9 | 60.9 | 19.2 | 48.8 | 68.1 | 46.149 |
YOLOv5_x | 58.7 | 89.7 | 64.0 | 25.2 | 46.8 | 68.5 | 86.265 |
YOLOX_l | 45.9 | 81.5 | 43.0 | 13.7 | 34.3 | 55.2 | 54.153 |
YOLOv7_l | 53.9 | 87.8 | 56.6 | 24.1 | 46.5 | 64.1 | 36.541 |
RTMDet_l | 60.1 | 90.9 | 63.6 | 23.6 | 48.6 | 69.5 | 52.256 |
CA-YOLOv7 | 59.2 | 88.5 | 56.3 | 24.9 | 50.6 | 66.4 | 31.475 |
CMFFD-YOLO | 61.7 | 91.0 | 64.8 | 26.4 | 51.9 | 69.7 | 31.528 |
表8 ZJU-Leaper纺织疵点数据集上的性能比较
Tab. 8 Performance comparison on ZJU-Leaper textile defect dataset
模型 | mAP/% | AP50/% | AP75/% | APs/% | APm/% | APl/% | 参数量/106 |
---|---|---|---|---|---|---|---|
YOLOv5_l | 58.2 | 89.9 | 60.9 | 19.2 | 48.8 | 68.1 | 46.149 |
YOLOv5_x | 58.7 | 89.7 | 64.0 | 25.2 | 46.8 | 68.5 | 86.265 |
YOLOX_l | 45.9 | 81.5 | 43.0 | 13.7 | 34.3 | 55.2 | 54.153 |
YOLOv7_l | 53.9 | 87.8 | 56.6 | 24.1 | 46.5 | 64.1 | 36.541 |
RTMDet_l | 60.1 | 90.9 | 63.6 | 23.6 | 48.6 | 69.5 | 52.256 |
CA-YOLOv7 | 59.2 | 88.5 | 56.3 | 24.9 | 50.6 | 66.4 | 31.475 |
CMFFD-YOLO | 61.7 | 91.0 | 64.8 | 26.4 | 51.9 | 69.7 | 31.528 |
模型 | mAP/% | AP50/% | AP75/% | 参数量/106 |
---|---|---|---|---|
YOLOv7 | 52.1 | 75.6 | 56.6 | 36.541 |
YOLOv7+k-means | 54.5 | 77.3 | 60.3 | 36.541 |
YOLOv7+k-means+GC | 61.5 | 83.9 | 69.2 | 37.728 |
YOLOv7+k-means+CAFPN | 64.1 | 84.7 | 71.7 | 30.333 |
YOLOv7+All | 64.6 | 84.9 | 71.5 | 31.528 |
表9 本文算法在天池数据集上的模块消融实验结果
Tab. 9 Module ablation experiment results of proposed algorithm on Tianchi dataset
模型 | mAP/% | AP50/% | AP75/% | 参数量/106 |
---|---|---|---|---|
YOLOv7 | 52.1 | 75.6 | 56.6 | 36.541 |
YOLOv7+k-means | 54.5 | 77.3 | 60.3 | 36.541 |
YOLOv7+k-means+GC | 61.5 | 83.9 | 69.2 | 37.728 |
YOLOv7+k-means+CAFPN | 64.1 | 84.7 | 71.7 | 30.333 |
YOLOv7+All | 64.6 | 84.9 | 71.5 | 31.528 |
1 | KÖHLER M, EISENBACH M, GROSS H M. Few-shot object detection: a comprehensive survey[J]. IEEE Transactions on Neural Networks and Learning Systems, 2024, 35(9): 11958-11978. |
2 | KANG X, LI J. AYOLOv7-tiny: towards efficient defect detection in solid color circular weft fabric[J]. Textile Research Journal, 2024, 94(1/2): 225-245. |
3 | WOO S, PARK J, LEE J Y, et al. CBAM: convolutional block attention module[C]// Proceedings of the 2018 European Conference on Computer Vision, LNCS 11211. Cham: Springer, 2018: 3-19. |
4 | HU J, SHEN L, SUN G. Squeeze-and-excitation network[C]// Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2018: 7132-7141. |
5 | GUO Y, KANG X, LI J, et al. Automatic fabric defect detection method using AC-YOLOv5[J]. Electronics, 2023, 12(13): No.2950. |
6 | 许胜宝,郑飂默,袁德成. 基于改进级联R-CNN的面料疵点检测方法[J]. 现代纺织技术, 2022, 30(2):48-56. |
XU S B, ZHENG L M, YUAN D C. A method for fabric defect detection based on improved cascade R-CNN[J]. Advanced Textile Technology, 2022, 30(2):48-56. | |
7 | HE Y, ZHANG H D, HUANG X Y, et al. Fabric defect detection based on improved Faster RCNN[J]. International Journal of Artificial Intelligence and Applications, 2021, 12(4): 23-32. |
8 | LI F, XIAO K, HU Z, et al. Fabric defect detection algorithm based on improved YOLOv5[J]. The Visual Computer, 2024, 40(4): 2309-2324. |
9 | ZENG N, WU P, WANG Z, et al. A small-sized object detection oriented multi-scale feature fusion approach with application to defect detection[J]. IEEE Transactions on Instrumentation and Measurement, 2022, 71: No.3507014. |
10 | LIN T Y, DOLLÁR P, GIRSHICK R, et al. Feature pyramid networks for object detection[C]// Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2017: 936-944. |
11 | FU X, YUAN Z, YU T, et al. DA-FPN: deformable convolution and feature alignment for object detection[J]. Electronics, 2023, 12(6): No.1354. |
12 | 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. |
13 | AHMED M, SERAJ R, ISLAM S M S. The k-means algorithm: a comprehensive survey and performance evaluation[J]. Electronics, 2020, 9(8): No.1295. |
14 | LIU S, QI L, QIN H, et al. Path aggregation network for instance segmentation[C]// Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2018: 8759-8768. |
15 | YANG G, LEI J, ZHU Z, et al. AFPN: asymptotic feature pyramid network for object detection[C]// Proceedings of the 2023 IEEE International Conference on Systems, Man, and Cybernetics. Piscataway: IEEE, 2023: 2184-2189. |
16 | LIU S, HUANG D, WANG Y. Learning spatial fusion for single-shot object detection[EB/OL]. [2024-03-29].. |
17 | ZHANG C, FENG S, WANG X, et al. ZJU-Leaper: a benchmark dataset for fabric defect detection and a comparative study[J]. IEEE Transactions on Artificial Intelligence, 2020, 1(3): 219-232. |
18 | SELVARAJU R R, COGSWELL M, DAS A, et al. Grad-CAM: visual explanations from deep networks via gradient-based localization[C]// Proceedings of the 2017 IEEE International Conference on Computer Vision. Piscataway: IEEE, 2017: 618-626. |
19 | JIN R, NIU Q. Automatic fabric defect detection based on an improved YOLOv5[J]. Mathematical Problems in Engineering, 2021, 2021: No.7321394. |
20 | GE Z, LIU S, WANG F, et al. YOLOX: exceeding YOLO series in 2021[EB/OL]. [2024-03-29].. |
21 | LYU C, ZHANG W, HUANG H, et al. RTMDet: an empirical study of designing real-time object detectors[EB/OL]. [2024-03-29].. |
22 | HOU W, WEN S, LI P, et al. Surface defect detection of fabric based on improved Faster R-CNN[C]// Proceedings of the 2023 IEEE International Conference on Sensors, Electronics and Computer Engineering. Piscataway: IEEE, 2023: 600-604. |
23 | ZHENG L, WANG X, WANG Q, et al. A fabric defect detection method based on improved YOLOv5[C]// Proceedings of the 7th International Conference on Computer and Communications. Piscataway: IEEE, 2021: 620-624. |
24 | 毋涛,崔青,殷强,等. 基于改进YOLOv7的织物疵点检测算法[J]. 纺织高校基础科学学报, 2023, 36(4):29-36. |
WU T, CUI Q, YIN Q, et al. Weaving fabric defect detection algorithm based on improved YOLOv7[J]. Basic Sciences Journal of Textile Universities, 2023, 36(4):29-36. |
[1] | 马汉达, 吴亚东. 多域时空层次图神经网络的空气质量预测[J]. 《计算机应用》唯一官方网站, 2025, 45(2): 444-452. |
[2] | 张众维, 王俊, 刘树东, 王志恒. 多尺度特征融合与加权框融合的遥感图像目标检测[J]. 《计算机应用》唯一官方网站, 2025, 45(2): 633-639. |
[3] | 李瑞, 李贯峰, 胡德洲, 高文馨. 融合路径与子图特征的知识图谱多跳推理模型[J]. 《计算机应用》唯一官方网站, 2025, 45(1): 32-39. |
[4] | 刘赏, 周煜炜, 代娆, 董林芳, 刘猛. 融合注意力和上下文信息的遥感图像小目标检测算法[J]. 《计算机应用》唯一官方网站, 2025, 45(1): 292-300. |
[5] | 宋鹏程, 郭立君, 张荣. 利用局部-全局时间依赖的弱监督视频异常检测[J]. 《计算机应用》唯一官方网站, 2025, 45(1): 240-246. |
[6] | 潘烨新, 杨哲. 基于多级特征双向融合的小目标检测优化模型[J]. 《计算机应用》唯一官方网站, 2024, 44(9): 2871-2877. |
[7] | 李烨恒, 罗光圣, 苏前敏. 基于改进YOLOv5的Logo检测算法[J]. 《计算机应用》唯一官方网站, 2024, 44(8): 2580-2587. |
[8] | 姬张建, 杜娜. 基于改进VariFocalNet的微小目标检测[J]. 《计算机应用》唯一官方网站, 2024, 44(7): 2200-2207. |
[9] | 龙伍丹, 彭博, 胡节, 申颖, 丁丹妮. 基于加强特征提取的道路病害检测算法[J]. 《计算机应用》唯一官方网站, 2024, 44(7): 2264-2270. |
[10] | 张勇进, 徐健, 张明星. 面向轻量化的改进YOLOv7棉杂检测算法[J]. 《计算机应用》唯一官方网站, 2024, 44(7): 2271-2278. |
[11] | 刘瑞华, 郝子赫, 邹洋杨. 基于多层级精细特征融合的步态识别算法[J]. 《计算机应用》唯一官方网站, 2024, 44(7): 2250-2257. |
[12] | 刘越, 刘芳, 武奥运, 柴秋月, 王天笑. 基于自注意力机制与图卷积的3D目标检测网络[J]. 《计算机应用》唯一官方网站, 2024, 44(6): 1972-1977. |
[13] | 黄梦源, 常侃, 凌铭阳, 韦新杰, 覃团发. 基于层间引导的低光照图像渐进增强算法[J]. 《计算机应用》唯一官方网站, 2024, 44(6): 1911-1919. |
[14] | 韩贵金, 张馨渊, 张文涛, 黄娅. 基于多特征融合的自监督图像配准算法[J]. 《计算机应用》唯一官方网站, 2024, 44(5): 1597-1604. |
[15] | 李鸿天, 史鑫昊, 潘卫国, 徐成, 徐冰心, 袁家政. 融合多尺度和注意力机制的小样本目标检测[J]. 《计算机应用》唯一官方网站, 2024, 44(5): 1437-1444. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||