journal article·2025-09-05Open access

CP-YOLOv8s algorithm for tiny and extreme-type fabric defect detection

Peiyao Guo, Yanping Liu, Ying Wu, Jianye Wang, Yi Li

Abstract

To overcome the hurdles in tiny and extreme aspect ratio defect identification in fabrics, along with the issues of high leakage and false detection rates, we proposed an improved YOLOv8 fabric defect detection algorithm CA-P2-YOLOv8s (CP-YOLOv8s). It mainly includes three strategies. First, the coordinate attention (CA) mechanism was integrated behind the Spatial Pyramid Pooling Fast SPPF) module, which can embed the location information into the attention of the channel to enhance the image features. Second, a P2 detection layer was added at the detection head to form a four-scale pyramid network, increasing detection accuracy of tiny defects. Finally, the Wise-ShapeIoU loss function was designed, Wise-IoU steers the model focus to the more run-of-the-mill, decent-quality anchor frames, and Shape-IoU ensures the model keeps its eye on the ball when it comes to the frame’s intrinsic shape and scale. By working in tandem, these loss functions guide the model, reducing the effects of subpar samples, and ultimately improving the network’s performance to generalize well across the board. Experiments on the AliCloud Tianchi public fabric defects dataset validated that the proposed CP-YOLOv8s algorithm’s precision, recall, and mean average precision (mAP) are 95.0%, 83.1%, and 89.5%, respectively. That represents a solid jump of 4.8%, 6.5%, and 5.1% over the baseline YOLOv8s model, all while trimming the model’s parameters by 4.2%. On the self-constructed silk fabric dataset, the algorithm outperformed other algorithms by achieving a precision of 92.8%, recall of 86.0%, and mAP of 91.4%, respectively. In addition, the detection speed is enough to keep up with the demands of real-time industrial inspection.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Industrial Vision Systems and Defect Detection · Image Processing Techniques and Applications · Image and Object Detection Techniques

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

School of Fashion Design & Engineering, Zhejiang Sci-Tech University, Hangzhou, China

Digital Intelligence Style and Creative Design Research Center, Key Research Center of Philosophyand Social Sciences, Zhejiang Province, Zhejiang Sci-Tech University, Hangzhou, China

Silk and Fashion Cultral Center of Zhejiang, Zhejiang Sci-Tech University, Hangzhou, China

Department of Fashion/Institute of Central and East Central European Economic and Trade Cooperation, Ningbo University, Ningbo, Zhejiang, China

Funding

Green and low-carbon technology and industrializationof modern logistics, Zhejiang Engineering Research Center · Zhejiang Sci-Tech University 2024 Outstanding Graduate Student Dissertation Cultivation Fund Project

References (27)

Show source-provided references
1. 10.1109/TIE.1930.89647610.1109/TIE.1930.896476 ↗
2. 10.1016/j.compind.2022.10362810.1016/j.compind.2022.103628 ↗
3. 10.1177/004051750605390610.1177/0040517506053906 ↗
4. 10.1109/TPAMI.2016.257703110.1109/TPAMI.2016.2577031 ↗
5. Cai Z Vasconcelos N. Cascade R-CNN: Delving into high quality object detection. In: 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition Salt Lake City UT USA 18–23 June 2018. IEEE 2018 pp. 6154-616210.1109/CVPR.2018.00644 ↗
6. Liu W Anguelov D Erhan D et al. SSD: Single shot multibox detector. In: Computer Vision – ECCV 2016 (eds. Leibe B Matas J Sebe N et al.). Cham: Springer 2016 pp. 21–37.10.1007/978-3-319-46448-0_2 ↗
7. Redmon J Divvala S Girshick R et al. You Only Look Once: Unified real-time object detection. In: 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Las Vegas NV USA 27–30 June 2016. IEEE 2016 pp. 779–788.10.1109/CVPR.2016.91 ↗
8. Jocher G Chaurasia A Qiu J. YOLO by Ultralytics. Available at: https://github.com/ultralytics/ultralytics (2023 accessed 27 July 2025).
9. Zhang M Yu W Qiu H et al. A fabric defect detection algorithm based on YOLOv8. In: 2023 International Conference on Image Processing Computer Vision and Machine Learning (ICICML) Chengdu China 3–5 November 2023. IEEE 2023 pp. 1040–1043.10.1109/ICICML60161.2023.10424868 ↗
10. Si Y, Gao J, Zhao X. Research on textile defect detection algorithm for deep learning. Research Square preprint 2024. DOI: 10.21203/rs.3.rs-4179693/v1.
11. Chen C, Zhou Q, Li S, et al. Fabric defect detection algorithm based on improved YOLOv8. Text Res J. Epub ahead of print 25 July 2024. DOI: 10.1177/00405175241261092.
12. 10.3390/info1508047610.3390/info15080476 ↗
13. 10.3390/app1417800010.3390/app14178000 ↗
14. Chen C Zhou Q Xiao L et al. LWFDD-YOLO: A lightweight defect detection algorithm based on improved YOLOv8. Text Res J. Epub ahead of print 24 October 2024. DOI: 10.1177/00405175241285596.10.1177/00405175241285596 ↗
15. Hou Q Zhou D Feng J. Coordinate attention for efficient mobile network design. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Nashville TN USA 20–25 June 2021. IEEE 2021 pp. 13713–13722.10.1109/CVPR46437.2021.01350 ↗
16. Jocher G. YOLOv5 by Ultralytics. Available at: https://github.com/ultralytics/yolov5 (2020 accessed 25 July 2025).
17. Wang C-Y, Bochkovskiy A, Liao H-YM. Yolov7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. arXiv preprint arXiv:2207.02696, 2020.
18. Li X, Wang W, Wu L, et al. Generalized focal loss: Learning qualified and distributed bounding boxes for dense object detection. Adv Neural Inf Process Syst 2020; 33: 21002–21012.
19. Zheng Z Wang P Liu W et al. Distance-IoU loss: Faster and better learning for bounding box regression. In Proceedings of the 34th AAAI Conference on Artificial Intelligence 2020 pp. 12993–13000.10.1609/aaai.v34i07.6999 ↗
20. Woo S Park J Lee J-Y et al. CBAM: Convolutional block attention module. In: Proceedings of the European Conference on Computer Vision (ECCV) 2018 pp. 3–19.10.1007/978-3-030-01234-2_1 ↗
21. 10.1109/TPAMI.2019.291337210.1109/TPAMI.2019.2913372 ↗
22. Tong Z, Chen Y, Xu Z, et al. Wise-IoU: Bounding box regression loss with dynamic focusing mechanism. arXiv preprint arXiv:230110051, 2023.
23. Zhang H, Zhang S. Shape-IoU: More accurate metric considering bounding box shape and scale. arXiv preprint arXiv:231217663, 2023.
24. Tianchi Smart Diagnosis of Cloth Flaw Dataset. Available at: https://tianchi.aliyun.com/dataset/79336 (2020 accessed 25 July 2025).
25. Yang L, Zhang R-Y, Li L, et al. SimAM: A simple, parameter-free attention module for convolutional neural networks. In: Marina M, Tong Z (eds.), Proceedings of the 38th International Conference on Machine Learning. PMLR, 2021, pp. 11863–11874.
26. 10.1016/j.eswa.2023.12135210.1016/j.eswa.2023.121352 ↗
27. Selvaraju RR Cogswell M Das A et al. Grad-CAM: Visual explanations from deep networks via gradient-based localization. In: 2017 IEEE International Conference on Computer Vision (ICCV) Venice Italy 22–29 October 2017. IEEE 2017 pp. 618–626.10.1109/ICCV.2017.74 ↗