1. Introduction
During textile production, defects such as thread breaks, pilling, hole, thread floats, and stains may occur due to machinery issues or operator errors, leading to poor product quality and adversely affecting the company’s production efficiency [
1]. The complex texture of fabric surfaces makes traditional fabric defect detection methods, which often rely on manual visual inspection, inefficient, subjective, and prone to visual fatigue. According to [
2], the accuracy of manual inspection is only around 70%, which is insufficient to meet the demands of large-scale production. Therefore, it is crucial to develop an automated, efficient, accurate, and cost-effective fabric defect detection system using computer vision and deep learning technologies. Traditional object detection algorithms rely on a combination of handcrafted features and classifiers, which require high-quality images, involve complex processing, and are highly sensitive to noise and interference, limiting their effectiveness in detecting fabric defects.
In recent years, deep learning-based object detection algorithms have rapidly developed in object detection due to their strong learning capabilities and robustness to scale variations. Based on the number of detection stages, deep learning-based object detection algorithms can be divided into two-stage detection algorithms, represented by Faster R-CNN [
3], and one-stage detection algorithms, represented by YOLO (You Only Look Once) [
4] and SSD (Single-Shot MultiBox Detector) [
5]. In research on two-stage fabric defect detection algorithms, Sun Xuan et al. [
6] improved the prediction boxes by using an enhanced K-means clustering method and replaced the backbone network of Faster R-CNN with an optimized ResNet50. This algorithm improved the accuracy of fabric defect detection but did not address the issue of computational complexity.
Compared to two-stage detection algorithms, single-stage algorithms do not require the generation of candidate regions, offering higher real-time performance. They have unique advantages in multi-scale detection and multi-task learning, and multi-scale detection can recognize objects at different scales, thereby improving detection accuracy, making them a current research hotspot in fabric defect detection. Xie HS et al. [
7] added the Fully Convolutional Squeeze and Excitation (FCSE) module to the traditional SSD and validated it on the TILDA and Xuelang datasets, resulting in improved detection accuracy. Faced with a complex textile texture background, Guo YB (Guo, Yongbin) et al. [
8] proposed a Convolutional Squeeze and Excitation (CSE) channel attention module and integrated it into the YOLOv5 backbone, enhancing defect detection and anti-interference capabilities. Fan et al. [
9] embedded a channel and spatial dual-attention mechanism (CBAM) into YOLOv5, effectively improving the feature allocation issues associated with a single-attention mechanism and enhancing model accuracy. However, the computational load of the model was not significantly reduced. Jing, J. F. (Jing, Junfeng) et al. [
10] applied the k-means algorithm for the dimensional clustering of target frames and added YOLO detection layers on feature maps of different sizes. The improved network model achieved an error detection rate of less than 5%. These methods generally suffer from high computational complexity and an imbalance between accuracy and detection speed, making them difficult to deploy on resource-constrained edge devices.
With the advent of lightweight networks, various scholars have combined them with YOLO models to propose new lightweight object detection algorithms. Kang, X. et al. [
11] addressed the issues of complex deep learning model construction and high network complexity by using the lightweight YOLOv5s model as a base. They integrated the Convolutional Block Attention Module (CBAM) and feature enhancement module into the backbone and neck, respectively, and modified the loss function to CIoU_Loss. Liu BB et al. [
12] integrated new convolutional operators into the Extended Efficient Layer Aggregation Network to optimize feature extraction, effectively capturing spatial features while reducing computation. The experiments demonstrated that this fabric defect detection model reduced model parameters and the computational load by 18.03% and 20.53%. Although the aforementioned researchers have made significant progress in lightweight YOLO network detection methods, the complex background texture and numerous small targets in fabric defects pose challenges. The feature extraction capabilities of these networks remain limited, indicating that there is still room for improvement in the model’s lightweight design.
To address the aforementioned issues, this study proposes an efficient and accurate lightweight YOLOv8n-based fabric defect detection algorithm, GSL-YOLOv8n, suitable for textile production lines. The algorithm includes the following improvements:
Ghost Network Integration: The Ghost network is used to enhance the standard convolution (Conv) modules and C2f in the YOLOv8n network, significantly reducing the model’s parameter count.
Semantic Information Extraction: To address the loss of semantic information between different features and the loss of small target features in the C2f module of YOLOv8, the parameter-free attention mechanism SimAM is embedded at the end of the backbone network.
Lightweight Detection Head: To further achieve model lightweighting, a lightweight detection head (LSCDH) is designed by combining the GroupNorm and shared convolution concepts.
The experimental results on fabric defect datasets demonstrate the effectiveness of the proposed algorithm. It successfully balances detection accuracy and speed while reducing model complexity, making it suitable for deployment on devices with limited computational resources.
The remaining sections of this paper are organized as follows: The second section elaborates on the YOLOv8 algorithm and the proposed improvements. The third section introduces the fabric dataset, experimental setup, and detailed experimental results. The final section presents the conclusions and future work outlook of this study.
4. Conclusions
Based on the multi-scale characteristics of fabric defects, the dataset was preprocessed to enhance the model’s generalization ability. Building on the YOLOv8 model, we applied the concept of Ghost convolutions to improve the YOLOv8 backbone network. Specifically, we replaced the standard convolutions (Conv) in YOLOv8 with GhostConv and modified the C2f module to C2fGhost. This approach maintained model accuracy while reducing its complexity. Additionally, we integrated the parameter-free attention mechanism SimAM at the end of the backbone network, which enhanced the model’s ability to integrate multi-scale information.
The YOLOv8 detection head was upgraded to the newly designed LSCDH, which utilized the concept of shared convolutions to merge and adjust channel numbers of features. This combination of low-level detail and high-level semantic information boosts the model’s feature extraction capabilities while ensuring its lightweight nature, making it suitable for deployment on mobile devices. Ablation experiments validated the effectiveness of each module in our proposed GSL-YOLOv8n algorithm. Compared to the YOLOv8n algorithm, the improved GSL-YOLOv8n model reduced model size, computational complexity, and parameter count by 66.7%, 58.0%, and 67.4%, respectively. This resulted in a lightweight model with enhanced small target defect feature extraction and anti-interference capabilities while maintaining detection speed, achieving an
[email protected] of 98.29%.
In the future, we plan to integrate this model into resource-constrained embedded devices, exploring the application of lightweight models for fabric defect detection in environments with limited computing resources.