# Enhanced YOLOv8 with BiFPN-SimAM for Precise Defect Detection in Miniature Capacitors
## 4 Experiments and Analysis of Results
### Comparative Experiment of Attention Module and Loss Function  
To ascertain the efficacy of various attention mechanisms and loss functions in augmenting the YOLOv8 algorithm for our dataset, this study meticulously crafted a suite of comparative experiments. These experiments meticulously integrated a variety of attention mechanisms and loss functions into the YOLOv8 framework to rigorously assess their capability to tackle practical challenges.  
Table 2 presents a comparative analysis of four distinct attention mechanisms: SE, CBAM, CA, and Simam. Furthermore, Table 3 focuses on six divergent loss functions: CIoU, DIoU, GIoU, SIoU, EIoU, and WIou [22]. Both tables evaluate their respective methods against three common metrics: parameters (M), frame rate (Fps), and mean average precision ([EMAIL_ADDRESS]).  
After evaluating the performance of various attention mechanisms, the Simam attention mechanism emerged as the superior choice, achieving an optimal mean average precision ([EMAIL_ADDRESS]) score of 0.903. However, it processed frames at a slightly reduced rate of 94 frames per second, indicating a trade-off between high accuracy and the system's real-time response. When it comes to selecting a loss function, the WIoU loss function stood out with a leading [EMAIL_ADDRESS] score of 0.886 while facilitating real-time processing capabilities at  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **IoU** & **Parameters/M** & **Fps** & **[EMAIL_ADDRESS] (\%)** \\ \hline \multirow{6}{*}{YOLOv8n} & CIoU & 3.01 & 96 & 86.3 \\  & DIoU & 3.01 & 101 & 85.8 \\ \cline{1-1}  & GIoU & 3.01 & 98 & 87.1 \\ \cline{1-1}  & SIoU & 3.01 & 103 & 87.0 \\ \cline{1-1}  & EIoU & 3.01 & 96 & 86.8 \\ \cline{1-1}  & WIoU & 3.01 & 99 & 88.6 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Comparison of results with different loss functions.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Attention** & **Parameters/M** & **Fps** & **[EMAIL_ADDRESS] (\%)** \\ \hline \multirow{6}{*}{YOLOv8n} & SE & 3.01 & 109 & 87.4 \\  & CBAM & 3.08 & 104 & 87.8 \\ \cline{1-1}  & CA & 3.04 & 101 & 89.1 \\ \cline{1-1}  & Simam & 3.01 & 94 & 90.3 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Comparison of results with different attention modules.  
99 frames per second. This balance suggests that WIoU is well-suited for real-time object detection systems, striking an effective balance between enhancing detection accuracy and maintaining processing speed.  
Taking into account both precision and computational efficiency, we chose to integrate the Simam attention mechanism and WIoU loss function into YOLOv8, a decision supported by our comprehensive ablation study. This combination not only enhanced the detection accuracy in our dataset but also met the stringent real-time performance requirements of industrial applications [37]. The ablation study further corroborated the efficacy of both the Simam attention mechanism and WIoU loss function in our specific dataset. Looking ahead, our future endeavors will focus on deploying these methodologies across broader and more heterogeneous datasets, aiming to confirm their scalability and effectiveness in a variety of real-world scenarios.