纺织学报 ›› 2026, Vol. 47 ›› Issue (04): 145-153.doi: 10.13475/j.fzxb.20250501101

• 纺织工程 • 上一篇    下一篇

基于改进YOLOv9s的轻量级蕾丝织物表面缺陷检测方法研究

都晓广1, 景军锋1(), 王永波2   

  1. 1 西安工程大学 电子信息学院, 陕西 西安 710048
    2 西安工程大学 纺织科学与工程学院, 陕西 西安 710048
  • 收稿日期:2025-05-12 修回日期:2025-11-27 出版日期:2026-04-15 发布日期:2026-06-24
  • 通讯作者: 景军锋(1978—),男,教授,博士。主要研究方向为机器视觉与图像处理。E-mail:413066458@qq.com
  • 作者简介:都晓广(2000—),男,硕士生。主要研究方向为蕾丝花边表面缺陷检测。
  • 基金资助:
    国家自然科学基金项目(62176204);陕西省秦创原“科学家+工程师”项目(2023KXJ-061);西安市科技局秦创原“科学家+工程师”队伍建设项目(23KGDW0017-2022)

Research on lightweight lace fabric surface defect detection method based on improved YOLOv9s

DU Xiaoguang1, JING Junfeng1(), WANG Yongbo2   

  1. 1 School of Electronics and Information, Xi'an Polytechnic University, Xi'an, Shaanxi 710048, China
    2 School of Textile Science and Engineering, Xi'an Polytechnic University, Xi'an, Shaanxi 710048, China
  • Received:2025-05-12 Revised:2025-11-27 Published:2026-04-15 Online:2026-06-24

摘要:

针对当前基于深度学习的蕾丝织物表面缺陷检测方法的参数量和计算量较大、难以部署在资源受限设备上进行实时检测的问题,提出一种基于改进YOLOv9s模型的蕾丝织物表面缺陷检测方法MosYOLO。首先,将改进型轻量级网络MobileNetv3-Small用作YOLOv9s的主干网络,减少模型的参数量和计算量,使得模型更加适合边缘设备;其次,在主干网络中的浅层阶段引入改进型高效通道注意力机制,提升模型对缺陷特征的关注能力,并抑制背景干扰;然后利用Focaler-IoU函数优化原始的边界框回归损失,缓解训练数据中简单与困难样本数量不均衡的问题;最后,采用焦点调制模块替代颈部网络中的空间金字塔池化模块,增强模型对缺陷细节信息的提取能力。实验结果表明:所提出方法的平均精度均值达到91.0%,参数量和计算量均降低了27.1%,检测速度达37.9帧/s,提高了13.8%。改进后方法的检测效果有所提升,且模型更加轻量,适合部署至边缘设备。

关键词: 蕾丝织物, 深度学习, 表面缺陷检测, 轻量级模型, 注意力机制

Abstract:

Objective To ensure the quality of lace products, it is of great significance to achieve accurate and efficient surface defect detection during the lace fabric production process. To further reduce the computational complexity of the lace fabric surface defect detection models based on deep learning and make them more suitable for embedded devices with low computing power, a lightweight detection method named MosYOLO is proposed by improving the YOLOv9s model.

Method The improved MobileNetv3-Small lightweight network was adopted as the backbone network of YOLOv9s model to reduce the number of parameters and the amount of calculation. The improved Efficient Channel Attention mechanism was introduced into the backbone network to enhance the model's ability to recognize defect features. Aiming at the imbalanced proportion between the difficult and easy samples in the training data, the Focaler-CIoU loss was introduced to replace the original CIoU loss. The Focal Modulation module was applied to the neck network to further enhance the model's ability to extract defect information.

Results In this study, a dataset was constructed using lace fabric images collected from real industrial sites, including four types of surface defects, namely jacquard holes, broken yarns, holes and edging. The image size was all 512 pixels × 512 pixels. This dataset was used to train and test the model. By introducing multiple evaluation indicators for a comprehensive assessment of the model performance, it was learnt from the experiments that the mean Average Precision of improved MosYOLO model reached 91.0%, and the F1 score reached 88.4%. Compared with the baseline YOLOv9s model, mean Average Prescision and F1 score increased by 1.5% and 1.3%, respectively. Moreover, both the number of parameters and the amount of calculation of the model decreased by 27.1%, and the detection speed reached 37.9 frames per second. From the visualization results, the detection effect of MosYOLO model was superior to that of YOLOv9s for lace fabric surface defect detection, and it showed stronger detection ability for small defect. Compared with the Faster R-CNN, SSD, YOLOv4-Tiny, MobileNetv2-SSDLite, YOLOv7-Tiny and YOLOv7 object detection models, MosYOLO model achieved a better balance among detection accuracy, parameter quantity, computational cost and detection speed. By optimizing and accelerating MosYOLO model using TensorRT framework, the detection speed of the model and its deployment performance on edge device have been greatly improved. The ablation experiment results of improved model showed that after replacing the backbone network of YOLOv9s with the improved MobileNetv3-Small, the number of parameters, computational cost and volume of the model were significantly reduced. After introducing the Efficient Channel Attention mechanism in the shallow network stage, the mean Average Precision was improved. When the Focaler-CIoU bounding box regression loss was adopted, the mean Average Precision of the model became better than that of the CIoU loss. After using the lightweight Focal Modulation module in the neck network, the computational complexity of the model was further reduced, and the mean Average Precision was improved, making the model more efficient and more suitable for deployment on edge device.

Conclusion A lightweight method MosYOLO based on improved YOLOv9s model is proposed for the detection of lace fabric surface defects. The MosYOLO method significantly reduces the number of parameters, computational cost and volume of the model while ensuring the detection accuracy. By replacing the backbone network of YOLOv9s model with the improved MobileNetv3-Small, the improved Efficient Channel Attention mechanism, Focaler-CIoU bounding box regression loss and Focal Modulation module are introduced. MosYOLO outperforms YOLOv9s and other mainstream object detection models in multiple indicators such as the mean Average Precision and detection speed. The MosYOLO method can be deployed in edge device, better meeting the demands of the lace fabric industrial production site and enhancing production efficiency and product quality.

Key words: lace fabric, deep learning, surface defect detection, lightweight model, attention mechanism

中图分类号: 

  • TP391.4

图1

MosYOLO网络结构 注:CBH为卷积-批量归一化-Hard-Swish模块;BN为批量归一化;CBS为卷积-批量归一化-SiLU模块;AConv为平均池化卷积。"

图2

改进型Bottleneck模块"

图3

改进型ECA机制的结构细节"

图4

蕾丝织物图像采集"

图5

整体检测流程"

表1

模型检测精度对比"

模型 精度/% 平均精度均
PmAP/%
贾卡漏 牙边 断纱 破洞
Faster R-CNN 76.2 97.8 84.0 66.0 81.0
SSD 59.0 9.6 37.1 42.6 37.1
YOLOv4-Tiny 33.6 89.4 24.2 14.5 40.4
MobileNetv2-SSDLite 59.4 90.7 93.9 81.7 81.4
YOLOv7-Tiny 49.0 68.3 62.2 39.0 54.6
YOLOv7 67.4 95.0 90.8 72.2 81.4
YOLOv9s 60.9 99.5 99.5 98.0 89.5
MosYOLO 66.4 99.5 99.5 98.5 91.0

表2

模型复杂度对比"

模型 参数量/
106
浮点运算
数/109
模型体
积/MB
F1分数
FS/%
Faster R-CNN 28.3 241.7 108.0 62.2
SSD 12.2 19.2 46.7 5.4
YOLOv4-Tiny 5.9 5.2 22.5 19.2
MobileNetv2-SSDLite 4.1 2.0 15.8 40.0
YOLOv7-Tiny 6.0 4.2 142.0 14.9
YOLOv7 36.5 33.0 23.1 43.0
YOLOv9s 9.6 38.7 19.4 87.1
MosYOLO 7.0 28.2 14.1 88.4

图6

2种模型缺陷检测效果对比"

图7

不同噪声程度的检测结果"

图8

不同光照强度的检测结果"

表3

模型检测速度对比"

模型 检测帧率/(帧·s-1) 推理时间/s
Faster R-CNN 10.2 0.098
SSD 18.3 0.055
YOLOv4-Tiny 31.4 0.032
MobileNetv2-SSDLite 17.2 0.058
YOLOv7-Tiny 27.3 0.037
YOLOv7 20.7 0.048
YOLOv9s 33.3 0.030
MosYOLO 37.9 0.026

表4

模型在边缘设备上的检测速度对比"

模型 检测帧率/(帧·s-1) 推理时间/s
Faster R-CNN 0.3 3.333
SSD 2.0 0.500
YOLOv4-Tiny 5.8 0.172
MobileNetv2-SSDLite 2.3 0.434
YOLOv7-Tiny 4.8 0.208
YOLOv7 1.4 0.714
YOLOv9s 3.4 0.298
本文方法 10.5 0.095

表5

消融实验设计"

实验
编号
模型 改进型
MobileNetv3-
Small
改进型
ECA
Focaler-
CIoU
Focal
Modulation
YOLOv9s × × × ×
YOLOv9s-iMS × × ×
YOLOv9s-iMS-iE × ×
YOLOv9s-iMS-iE-FC ×
MosYOLO

表6

消融实验结果"

实验
编号
图像尺寸/
像素
参数量/
106
浮点运算
数/109
模型体
积/MB
平均精度均值
PmAP/%
512×512 9.6 38.7 19.4 89.5
512×512 7.6 28.8 15.2 88.7
512×512 7.6 28.8 15.2 90.0
512×512 7.6 28.8 15.2 90.4
512×512 7.0 28.2 14.1 91.0
[1] LU B Y, XU D, HUANG B Q. Deep-learning-based anomaly detection for lace defect inspection employing videos in production line[J]. Advanced Engineering Informatics, 2022, 51: 101471.
doi: 10.1016/j.aei.2021.101471
[2] 张缓缓, 马金秀, 景军锋, 等. 基于改进的加权中值滤波与K-means聚类的织物缺陷检测[J]. 纺织学报, 2019, 40(12): 50-56.
doi: 10.13475/j.fzxb.20181200407
ZHANG Huanhuan, MA Jinxiu, JING Junfeng, et al. Fabric defect detection method based on improved fast weighted median filtering and K-means[J]. Journal of Textile Research, 2019, 40(12): 50-56.
doi: 10.13475/j.fzxb.20181200407
[3] ZHANG J Q, JING J F, LU P W, et al. Improved MobileNetV2-SSDLite for automatic fabric defect detection system based on cloud-edge computing[J]. Measurement, 2022, 201: 111665.
doi: 10.1016/j.measurement.2022.111665
[4] FANG H, LIN S, HU J W, et al. CPF-DETR: an end-to-end DETR model for detecting complex patterned fabric defects[J]. Fibers and Polymers, 2025, 26(1): 369-382.
doi: 10.1007/s12221-024-00809-9
[5] XU D, LU B Y, HUANG B Q. A multiscale convolutional registration network for defect inspection on periodic lace surfaces[J]. IEEE Transactions on Instrumentation and Measurement, 2022, 71: 5006009.
[6] LI X S, ZHU Y. A real-time and accurate convolutional neural network for fabric defect detection[J]. Complex & Intelligent Systems, 2024, 10(3): 3371-3387.
[7] 景军锋, 张君扬, 张缓缓, 等. 梯度空间下的丝饼表面缺陷检测[J]. 纺织学报, 2020, 41(2): 44-51.
JING Junfeng, ZHANG Junyang, ZHANG Huanhuan, et al. Defect detection on surface of draw texturing yarn packages in gradient space[J]. Journal of Textile Research, 2020, 41(2): 44-51.
doi: 10.1177/004051757104100108
[8] 郑兆伦, 鲁玉军. 基于奇异值分解的双算法织物缺陷检测[J]. 纺织学报, 2022, 43(11): 59-67.
doi: 10.13475/j.fzxb.20210310709
ZHENG Zhaolun, LU Yujun. Dual-algorithm for fabric defect detection based on singular value decomposition[J]. Journal of Textile Research, 2022, 43(11): 59-67.
doi: 10.13475/j.fzxb.20210310709
[9] HUANG Y Q, JING J F, WANG Z. Fabric defect segmentation method based on deep learning[J]. IEEE Transactions on Instrumentation and Measurement, 2021, 70: 5005715.
[10] MA S B, LIU Y N, ZHANG Y P. Fabric defect detection based on improved lightweight YOLOv8n[J]. Applied Sciences, 2024, 14(17): 1-15.
doi: 10.3390/app14010001
[11] XU X M, CHEN J X, ZHANG H D, et al. D4Net: de-deformation defect detection network for non-rigid products with large patterns[J]. Information Sciences, 2021, 547: 763-776.
doi: 10.1016/j.ins.2020.05.050
[12] KANG X J, LI J F. AYOLOv7-tiny: towards efficient defect detection in solid color circular weft fabric[J]. Textile Research Journal, 2024, 94(1/2): 225-245.
doi: 10.1177/00405175231205898
[13] BURRA L R, KARUNA A, TUMMA S, et al. MobileNetV2-based transfer learning model with edge computing for automatic fabric defect detection[J]. Journal of Scientific & Industrial Research, 2022, 82(1): 128-134.
[14] CHEN C, ZHOU Q H, XIAO L, et al. LWFDD-YOLO: a lightweight defect detection algorithm based on improved YOLOv8[J]. Textile Research Journal, 95(9/10): 1125-1142.
doi: 10.1177/00405175241285596
[15] WANG C Y, YEH I H, MARK LIAO H Y. YOLOv9: learning what you want to Learn using programmable gradient information[C]//Computer Vision - ECCV 2024. Cham: Springer, 2025: 1-21.
[16] HOWARD A, SANDLER M, CHEN B, et al.Searching for MobileNetV3[C]//2019 IEEE/CVF International Conference on Computer Vision (ICCV). New York: IEEE, 2019: 1314-1324.
[17] YANG Jianwei, LI Chunyuan, DAI Xiyang, et al. Focal modulation networks[J]. Advances in Neural Information Processing Systems, 2022, 35: 4203-4217.
[18] WANG Q L, WU B G, ZHU P F, et al. ECA-net:efficient channel attention for deep convolutional neural networks[C]//2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). New York: IEEE, 2020: 11531-11539.
[1] 李宇彤, 于施佳, 韩曙光. 基于多视图的三维人体重建[J]. 纺织学报, 2026, 47(04): 215-224.
[2] 冯峥嵘, 刘贝芬, 陈孟元. 基于多尺度特征融合的花卉类印花图案风格迁移模型[J]. 纺织学报, 2026, 47(02): 264-272.
[3] 吕泽彬, 李子印, 汪小东, 叶飞, 刘伟红. 基于三阶段残差动态聚焦网络的羽绒图像分类[J]. 纺织学报, 2026, 47(02): 73-83.
[4] 冯采伶, 于施佳, 韩曙光. 基于深度学习的服装关键点实时检测模型[J]. 纺织学报, 2026, 47(01): 196-206.
[5] 庹武, 刘琼洋, 李庆响, 陈谦, 范睿鸽, 李佩. 基于机器视觉与YOLO11n的女西裤尺寸自动测量[J]. 纺织学报, 2025, 46(12): 208-215.
[6] 周青青, 常硕, 毛志平, 吴伟. 人工智能在纺织印染行业中的应用研究进展[J]. 纺织学报, 2025, 46(12): 260-269.
[7] 余志才, 余晓娜, 丁笑君, 顾冰菲. 基于PointNet分类模型的织物三维悬垂模型匹配[J]. 纺织学报, 2025, 46(11): 111-117.
[8] 朱耀麟, 李政, 张强, 陈鑫, 陈锦妮, 张洪松. 基于近红外光谱和多特征网络的羊毛和羊绒定量检测[J]. 纺织学报, 2025, 46(09): 104-111.
[9] 张晓婷, 赵鹏宇, 潘如如, 高卫东. 基于深度特征融合的格子织物图像检索方法[J]. 纺织学报, 2025, 46(08): 89-95.
[10] 王青, 姜越夫, 赵恬恬, 赵世航, 刘甲怡. 基于深度学习的纱管位姿估计方法及抓取实验[J]. 纺织学报, 2025, 46(07): 217-226.
[11] 罗瑞奇, 常大顺, 胡新荣, 梁金星, 彭涛, 陈佳, 李丽. 基于改进外观流网络的跨体态虚拟试衣[J]. 纺织学报, 2025, 46(06): 203-211.
[12] 顾孟尚, 张宁, 潘如如, 高卫东. 结合频域卷积模块的机织物图像疵点目标检测[J]. 纺织学报, 2025, 46(05): 159-168.
[13] 白雨薇, 徐健, 朱耀麟, 丁展博, 刘晨雨. 基于改进YOLOv8的梳棉机棉网上棉结检测方法[J]. 纺织学报, 2025, 46(03): 56-63.
[14] 黄小源, 侯珏, 杨阳, 刘正. 基于改进深度学习模型的高精度服装样板自动生成[J]. 纺织学报, 2025, 46(02): 236-243.
[15] 蔡丽玲, 王梅, 邵一兵, 陈炜, 曹华卿, 季晓芬. 基于改进堆叠生成对抗网络的传统汉服智能定制推荐[J]. 纺织学报, 2024, 45(12): 180-188.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!