Crimson Publishers Publish With Us Reprints e-Books Video articles

Full Text

Trends in Textile Engineering & Fashion Technology

Multi-Attention Collocation of the Textile Defects Detection Method

Han Yan and Hongge Yao*

College of Computer Science & Engineering, Xi’an Technological University, China

*Corresponding author:Hongge Yao, College of Computer Science & Engineering, Xi’an Technological University, China

Submission: November 14, 2022; Published: November 22, 2022

DOI: 10.31031/TTEFT.2022.07.000666

ISSN 2578-0271
Volume 7 Issue4


The article is dedicated to a method of “multi-attention mechanism” collocation to improve the detection ability of neural networks for textile defects. The “multi-attention mechanism” that combines channel attention and spatial attention in neural networks is presented to improve the feature extraction ability of defects. The results indicate that this method has a high detection rate for difficult-to-detect samples such as small defects, uneven density defects, and easily confused defects, among which the detection rate of stains, weft defects, and holes can reach more than 75%, and the detection rate of edge, erase and weave can reach more than 90%.

Keywords:Textile defects detection; Attention mechanism; Multi-attention; Mechanism collocation; Neural networks


Textile defect detection is an important part of the production and quality management of the textile industry, the use of deep learning algorithms [1] instead of manual can achieve faster and more accurate detection of textile defects. The core of fabric defect detection is feature extraction. In this article, a multi-attention feature extraction method [2,3] is used to improve the feature extraction ability of textile defects, and to improve the efficiency of textile defect identification. The multi-attention module, as shown in Figure 1, includes channel attention and spatial attention. Channel attention can obtain “which feature map is the key point”, while spatial attention can obtain “which part is the key point in the feature map” [4]. This article combined both “attentions” to enhance the representational capacity of the network for defects.

Figure 1:Multi-attention cooperation feature extraction.

Experimental section

To add a “multi-attention mechanism” in the neural network, the following two groups of experiments were designed. The first group of experiments is a channel and spatial attention collocation; the second group of experiments is stage selection.

Channel attention matches spatial attention: The attention mechanism is usually added to the feature extraction part of the neural network [5], which can enhance the defect feature information and suppress the non-defect information. Because the sequence combination of the collocation of space and channel attention and the cooperation with convolution operation has a certain influence on the recognition results, this article designs the following comparative experiments on the sequence of channel and space collocation according to the textile defect recognition rate. The experimental results are shown in Figure 2, in which, the abscissa A-G represents the collocation plans: A: without attention mechanism; B: convolution-channel attention-convolution-spatial attention; C: convolution-spatial attention-convolution-channel attention; D: convolution-channel attention-spatial attentionconvolution; E: convolution-spatial attention-channel attentionconvolution; F: convolution-spatial attention-channel attention; G: convolution-channel attention-spatial attention. The ordinate represents the accuracy (ACC), true positive rate (TPR), false positive rate (FPR), and precision (PPV).

Figure 2:Channel and spatial attention matching results.

In Figure 2, according to the matching sequence of convolutionchannel attention spatial attention, the ACC, PPV, and TPR indexes are the highest at 0.9091, 0.9249 and 0.9492, respectively, and FPR is lowest at 0.1667, so the matching of the convolution-channel attention spatial attention is the most ideal one [6]. This is because after extracting the fabric defect features by convolution, the global defect features should be highlighted first, which is helpful to find all the defects. Then the local defect features are highlighted, which can fully display each defect. The order of convolution-channel attention-spatial attention is exactly in this order to highlight the defective features. So, this order of collocation is ideal. The experiment also proves this.

Effectiveness of collocation: To verify the effectiveness of adding a “multi-attention mechanism” to the neural network system, the feature maps of the intermediate process of the “multiattention mechanism” were visualized. Figure 3 shows inputting an image and conducting channel attention, the refined feature map can be obtained. After carrying out spatial attention, the ultimate refined feature map can be obtained. It is known from the that the “multi-attention mechanism” can enhance features and suppress non-defects features.

Figure 3:Visualize feature maps with multi-attention.

Multi-category defects recognition effect: Multiple defects of different types existing in one fabric image were detected. In Figure 4, all four pictures contain multiple defects of many different types. Figure 4 shows that the recognition of tucked-in selvage and bruise holes is 0.90 and 0.99, respectively; The recognition of pricking holes and bruise holes is 0.79 and above 0.97, respectively; The recognition of missing picks and gout is 0.82 and 0.97, respectively; The recognition of bruise holes and stains is 0.94 and 0.75, respectively. This indicates that this method can effectively detect multi-type defect positions and defect types, accurately extracting all types of defect features and recognizing defect types.

Figure 4:Detection results of multi-type defects.


Aiming at the characteristics of textile defects, a method of fusing a multi-attention is proposed to detect them. Experiments showed that the method in this article had strong detection ability for textile defects, which was manifested as strong detection ability for difficult detection, especially for confusing defects, and clear classification. It meets the requirements of practical application.


  1. Lecun Y, Bengio Y, Hinton G (2015) Deep learning. Nature 521(7553): 436-444.
  2. He K, Gkioxari G, Dollar P, Girshick R (2017) Mask R-CNN. IEEE Transactions on Pattern Analysis & Machine Intelligence (99): 1.
  3. Ren S, He K, Girshick R, Sun J (2015) Faster R-CNN: towards real-time object detection with region proposal networks.
  4. Woo S, Park J, Lee JY, Kweon IS (2018) Cbam: Convolutional block attention module. Proceedings of the European Conference on Computer Vision (ECCV), pp. 3-19.
  5. Fei W, Jiang M, Chen Q, Yang S, Li C, et al. (2017) Residual attention network for image classification.
  6. Yao H, Na Q, Zhu S, Lin M, Yu J (2022) Fabric defect detection with an attention mechanism based on hard sample training. Textile Research Journal 92(9-10): 1429-1443.

© 2022 Hongge Yao. This is an open access article distributed under the terms of the Creative Commons Attribution License , which permits unrestricted use, distribution, and build upon your work non-commercially.