# A Fabric Defect Segmentation Model Based on Improved Swin-Unet with Gabor Filter
## 5 Conclusions  
In this paper, an efficient transformer-based fabric defect segmentation neural network with a Gabor filter preprocessing operation is proposed. Specifically, the proposed model solves the local optimal fitting problem of transformer models in fabric defect segmentation. The proposed method can be roughly divided into three stages. First, a Gabor filter is embedded in the front of the model, with the aim of eliminating the influence of complex surface textures in the fabric image. The U-shaped structure in the second stage of the network is designed to not be quite completely symmetrical; the lighter upsampling operation compared to downsampling leads to better performance of the model. Finally, multi-stage result fusion is used to obtain the location of defects with high accuracy. Additionally, we propose a new loss function which uses a combination of the weighted focal loss and Dice loss to improve the convergence speed and detection accuracy of the model. Extensive experiments were conducted to evaluate the effectiveness of our model on three datasets. The proposed method not only significantly solves the limitations of transformer-based models, it has excellent performance and potential applications in the industrial field.  
In future work, we plan to seek a more efficient method to speed up our model in order to use fewer resources. Due to the difficulty of collecting defect samples in industrial scenarios and the high cost of manual annotation, we intend to focus on detection problems in scenarios where there are only a small number of labeled defect samples and to further enhance detection capabilities in these scenarios.  
\begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Method** & **ACC** & **SE** & **PC** & **IoU** \\ \hline Swin-Unet+BCE-Dice & 0.9893 & 0.6060 & 0.5986 & 0.4754 \\ Swin-UNet+FDL & 0.9903 & 0.5572 & **0.6433** & 0.4657 \\ Our(1) & **0.9912** & 0.6908 & 0.6417 & 0.5448 \\ Our(2) & 0.9900 & **0.7446** & 0.6236 & **0.5493** \\ \hline \hline \end{tabular}
\end{table}
Table 3: Ablation experiment results for our method on the AITEX dataset.  
Figure 9: Evaluation index curves of different combinations. Swin-Unet refers to the original Swin-Unet using the BCE–Dice loss; Our(0) refers to our proposed model using the BCE-Dice loss; Our(1) represents the proposed model using FDL without the Gabor filter; Our(2) represents the proposed model trained with fixed parameters of the Gabor filter layer and FDL.  
**Author Contributions:** Conceptualization and methodology, H.X. and C.L.; software, H.X. and S.D.; validation, C.L., S.D. and L.R.; writing--original draft preparation, H.X. and S.D.; writing--review and editing, C.L., L.R. and G.C.; project administration, L.R.; funding acquisition, C.L., G.C. and B.H. All authors have read and agreed to the published version of the manuscript.  
**Funding:** This work was supported by the National Key R&D Program of China (No. 2020 YFB17I2401), the Natural Science Foundation of China (62006210, 62206252), the Key Project of Public Benefit in Henan Province of China (201300210500), the Key Scientific and Technology Project in Henan Province of China (221100210100), and the Chinese Scholarship Council (No. 202007045007).  
**Data Availability Statement:** Data sharing is not applicable to this paper, as only public datasets were used during the current study and no new datasets were generated.  
**Conflicts of Interest:** The authors declare no conflict of interest.