# A Real-Time Fabric Defect Detection Method Based on Improved YOLOv8
## 4 Experimental Results and Analysis
### Comparison Experiment
#### 4.5.2 Comparative Analysis of Different Algorithms  
This paper evaluates the effectiveness of the proposed method in fabric defect detection by comparing it with mainstream models such as Faster R-CNN [12], Cascade R-CNN [26], TPH-YOLOv5 [27], YOLOv5, and YOLOv8 [28] on the TILDA dataset. To ensure a fair \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Name** & **All\_Time** & **Mean\_Time** & **FPS** & **FLOPs** & **Params** \\ \hline C3 & 4.64141 & 0.00232 & 430.9031312336256 & 4.832G & 295,680 \\ ELAN & 6.09753 & 0.00305 & 328.00192876805573 & 8.053G & 492,288 \\ C2f & 5.76367 & 0.00288 & 347.0011744981227 & 7.516G & 459,520 \\ RG-C2f & 4.15235 & 0.00208 & 481.6544469393704 & 3.565G & 217,920 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparative experimental results of different modules. Figure 8: Comparison chart of detection results of TILDA dataset. comparison of inference speed, FPS (Frames Per Second) is measured after a warm-up phase of 200 iterations, followed by 1000 inference iterations to obtain an average inference time per image. The comparison results are shown in Table 3.  
From the table, the proposed model demonstrates significant advantages in fabric defect detection compared with several mainstream models while retaining the lightweight characteristics of the YOLO series of networks. The mAP value of Faster RCNN is only 0.71, which is due to the large difference between its initial anchor frame and the real frame in the dataset, and its performance declines, particularly in detecting fabric defects with extreme aspect ratios. Furthermore, due to Faster R-CNN being a two-stage detection network, its detection speed is restricted to 25 FPS, which fails to meet the real-time detection requirements. Although YOLOv5 achieves a faster detection speed of 118 FPS, its accuracy is relatively low, with a mAP of 0.686. YOLOv8, as the mainstream network of the YOLO series, achieves a mAP of 0.756 and a detection speed of 103.5 FPS, outperforming YOLOv5 and Faster R-CNN in both accuracy and speed. Therefore, the model in this paper is improved based on YOLOv8, which is slightly lower than YOLOv5 in detection speed but still better than most methods and achieves a good balance between accuracy and speed, which can meet the actual detection needs. To further evaluate the model's performance and robustness on a large-scale fabric defect dataset, this paper also introduces the Tianchi fabric defect dataset for extended experiments, and the experimental results are shown in Table 4.  
As can be seen from the table, the performance of all the models on the Tianchi dataset is degraded compared to the results on the TILDA dataset. This is due to the fact that the Tianchi dataset is more complex and diverse, with as many as 20 types of defects and significant differences in shapes, which leads to a significant increase in the difficulty of accurate recognition and thus poses a greater challenge to each model. Specifically, the mAP value of YOLOv8 is similar to that of Cascade RCNN, reaching 0.427, but the detection speed of Cascade RCNN is only 35.1 FPS, which is much lower than the requirement of real-time detection. In contrast, YOLOv8 has a detection speed of 103.5 FPS while maintaining a high mAP, but it is still not optimal. The improved algorithm proposed in this paper is based on YOLOv8, which is optimized and still shows excellent performance on the Tianchi dataset. The model in this \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Models** & **P** & **R** & **mAP** & **FPS** \\ \hline Faster RCNN & 0.485 & 0.35 & 0.355 & 25.0 \\ Cascade RCNN & 0.52 & 0.433 & 0.421 & 35.1 \\ TPH-YOLOv5 & 0.511 & 0.42 & 0.378 & 108.5 \\ YOLOv5 & 0.49 & 0.38 & 0.325 & 118.0 \\ YOLOv8 & 0.516 & 0.416 & 0.427 & 103.5 \\ ours & 0.534 & 0.459 & 0.442 & 110.2 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Comparative experimental results of different models.