# An Improved YOLOv5 Algorithm for Drowning Detection in the Indoor Swimming Pool
## 4 Experiments
### Ablation Experiments  
To validate the efficacy of our enhancements, we conducted an ablation experiment on the object detection network based on YOLOv5s. The Neck network of YOLOv5s was augmented with CA, ICA, and BiFPN. The results of the ablation experiments on the self-made dataset are presented in Table 4. Specifically, it was observed that compared to the baseline network YOLOv5s, ICA yielded a 0.8% improvement in precision but a marginal decrease of 0.3% in _[EMAIL_ADDRESS]. Similarly, CA led to a 0.5% boost in precision with a slight reduction of 0.3% in _[EMAIL_ADDRESS]. These outcomes prove the effectiveness of the ICA improvement. Furthermore, ICA contributed to a 1.9% increase in parameters. The improved YOLOv5 demonstrated a noteworthy 1.3% enhancement in precision and a 0.2 ms increase in inference speed, albeit with a 3.6% increase in parameters. The change in _[EMAIL_ADDRESS]:0.95 was minimal. The improvements in detection accuracy are justified and worthwhile, considering the marginal decrease in _[EMAIL_ADDRESS] and the modest increase in inference speed. The optimal placement of improvements significantly influences model performance. To assess the impact of introducing the ICA and BiFPN in the backbone section on model performance, an identical ablation experiment was conducted using YOLOv5s. As depicted in Table 5, incorporating ICA and BiFPN in the backbone results in performance enhancements. Specifically, in comparison to the original YOLOv5s, ICA demonstrates a 0.7% improvement in precision with a 5.9% increase in parameters. The combination of ICA and BiFPN leads to a 1.0% improvement in precision, accompanied by an 8.1% increase in parameters. There is minimal change in _[EMAIL_ADDRESS]:0.95, but a marginal decrease of 0.3% is observed in _[EMAIL_ADDRESS]. This ablation experiment confirms that incorporating ICA and BiFPN in the Neck section achieves the highest precision improvement, outperforming their insertion in the backbone section. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Real Value** & **Predicted Value (Positive)** & **Predicted Value (Negative)** \\ \hline Positive & True Positive (_TP_) & False Positive (_FN_) \\ Negative & False Negative (_FP_) & True Negative (_TN_) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Sample classification. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Algorithm** & **Precision (\%)** & **Recall (\%)** & _[EMAIL_ADDRESS] (\%)_ & _[EMAIL_ADDRESS]:0.95 (\%)_ & **Parameters** \\ \hline YOLOv5 & 96.8 & 98.1 & 98.9 & 73.2 & 7,018,216 \\ improved YOLOv5 & 98.1 & 98.0 & 98.5 & 73.3 & 7,272,073 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Comparison of improved YOLOv5 algorithm and original YOLOv5 algorithm. To assess the accuracy of the improved YOLOv5, we employ the commonly utilized confusion matrix for evaluation, as illustrated in Figure 5 on the self-made dataset. The diagonal entries signify the probability of the model correctly detecting a specific class within the self-made dataset, aligning with its true label. The off-diagonal areas denote false or missed detections. The results indicate that the improved YOLOv5 exhibits an exceptionally low error detection rate, particularly excelling in the identification of drowning incidents, showcasing its value in the field of rescue operations. Figure 6 illustrates the box loss, which represents the deviation loss value between the true anchor boxes and the predicted anchor boxes. It also displays the convergence curve and precision curve during the training of the improved YOLOv5. The box loss convergence curve decreases gradually and smoothly, stabilizing around the 90 th epoch. The precision curve exhibits fluctuations from the 15 th to the 50 th epochs, stabilizing gradually thereafter, particularly beyond the 60 th epoch or so. This observation signifies the stability of the improved YOLOv5, highlighting its robustness and considerable applicability in tasks related to drowning detection.