# Fabric Defect Detection Based on Improved Lightweight YOLOv8n
## 3 Result and Discussion
### Comparison Experiments
#### 3.5.4 Comparison Experiment of Different Algorithms  
To validate the effectiveness of the proposed GSL-YOLOv8n algorithm compared to other classical algorithms, we use the YOLOv8n model as the baseline network model. The evaluation metrics include model size, GFLOPs, the number of model parameters, and [EMAIL_ADDRESS]. We selected the classical two-stage model Faster R-CNN, and the single-stage models SSD and YOLO for comparison with the proposed GSL-YOLOv8n algorithm on the enhanced dataset. The experimental results are shown in Table 7.  
From the comparison results of different algorithms shown in Table 7, it is evident that the proposed GSL-YOLOv8n algorithm offers advantages in both detection accuracy and speed over Faster R-CNN. For single-stage algorithms like SSD, which struggle with detecting small targets in fabric defects, the [EMAIL_ADDRESS] is the lowest, and both the model size and parameter count are relatively high. Among the different versions of the YOLO algorithm, YOLOv5s performs best in terms of [EMAIL_ADDRESS], but its large model size and parameter count make it less suitable for deployment on resource-constrained embedded devices. YOLOv6 demonstrates the best performance in terms of FPS. The proposed GSL-YOLOv8n algorithm excels in GFLOPs and parameter count, with a model size as low as 2.1 and an [EMAIL_ADDRESS] of 98.29, making it fully capable of meeting the demands for fast and accurate detection in industrial production. Table 8 presents the AP and [EMAIL_ADDRESS] detection results for six types of defects across eight different algorithms. It is evident that the SSD algorithm performs worse compared to other models in various metrics for fabric defect detection. The improved GSL-YOLOv8n model shows an increase in AP values for most defects, especially for small defect targets such as hole and loose threads. Additionally, the GSL-YOLOv8n model exhibits a significant improvement in AP values for elongated defects like Skips and loose threads. In a comparison of Precision-Recall curves, Figure 9 shows a steeper curve compared to Figure 9, indicating that the GSL-YOLOv8 model converges more quickly in detection tasks, achieving higher accuracy in the early stages of training. The Recall-Confidence curve in Figure 9 is smoother than that in Figure 9 and demonstrates better generalization \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Model** & **Model Size/MB** & **GFLOPs/G** & **Parameters** & **FPS/(Frame-s-1)** & **[EMAIL_ADDRESS]/\%** \\ \hline SSD & 100.3 & 62.7 & 26,285,486 & 184.12 & 88.21 \\ Faster R-CNN & 159.3 & 134.4 & 41,755,286 & 25.47 & 97.13 \\ YOLOv5n & 5.3 & 7.1 & 2,504,114 & 286.5 & 96.51 \\ YOLOv5s & 18.5 & 23.8 & 9,113,858 & 206.7 & 98.34 \\ YOLOv6 & 8.7 & 8.7 & 4,234,338 & 336.6 & 96.99 \\ YOLOv7-Tiny & 74.9 & 105.2 & 37,221,635 & 68.8 & 93.60 \\ YOLOv8n & 6.3 & 8.1 & 3,006,818 & 239.6 & 97.70 \\ GSL-YOLOv8n & 2.1 & 3.4 & 981,381 & 238.9 & 98.29 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Comparative experiments of different algorithms. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multirow{2}{*}{**Model**} & \multicolumn{5}{c}{**AP/\%**} & \multirow{2}{*}{**[EMAIL_ADDRESS]**\%**} \\ \cline{2-2} \cline{4-7}  & **Float** & **Skips** & **Pilling** & **Hole** & **Pulling Out Yarn** & **Stains** \\ \hline SSD & 83.82 & 92.84 & 97.73 & 95.00 & 82.69 & 77.18 & 88.21 \\ Faster R-CNN & 98.39 & 97.62 & 99.44 & 96.55 & 98.62 & 92.17 & 97.13 \\ YOLOv5n & 99.00 & 97.47 & 98.70 & 94.86 & 97.55 & 91.48 & 96.51 \\ YOLOv5s & 99.32 & 98.77 & 99.44 & 99.50 & 98.53 & 94.51 & 98.34 \\ YOLOv6 & 99.06 & 97.67 & 99.44 & 98.81 & 97.16 & 89.82 & 96.99 \\ YOLOv7-Tiny & 92.50 & 96.10 & 97.80 & 93.30 & 92.90 & 89.00 & 93.60 \\ YOLOv8n & 99.30 & 98.80 & 99.30 & 96.70 & 97.00 & 94.90 & 97.70 \\ GSL-YOLOv8n & 99.13 & 99.28 & 99.50 & 99.31 & 98.12 & 94.41 & 98.29 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Comparative experiments of AP values of different algorithms. in the low-confidence range.