# An Improved YOLOv5s-Based Helmet Recognition Method for Electric Bikes
## 5 Experiment
### Evaluation Index and Ablation Experiment  
In this paper, the performance of the improved YOLOv5 target detection model is evaluated using several indicators, including precision, recall, mAP.5, mAP.95, and \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Algorithm** & **P** & **R** & **mAP.5** & **mAP.95** & **Parameters** \\ \hline YOLOv5s & 95 & 87.2 & 91.9 & 68.9 & 7,018,216 \\ \hline Convmix & 93.9 & 86.5 & 91.7 & 67.9 & 5,334,760 \\ \hline CSPCM & 94.9 & 86.8 & 91.7 & 68.3 & 5,949,672 \\ \hline CSPCM-DFC & 93.8 & 88.4 & 92.1 & 69.1 & 5,927,114 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Convmix, CSPCM, and DFC experimental results. \begin{table}
\begin{tabular}{c c} \hline \hline
**Configuration Name** & **Configuration Parameters** \\ \hline Operating System & Ubuntu 18.04.6 LTS \\ CPU & Intel Xeon(R) Silver 4210 CPU @ 2.20 GHz \(\times\) 40 \\ GPU & NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 \\ Memory & 125.6 GiB \\ Software & Anaconda3-5.3, Pycharm2021 \\ Deep Learning Framework & Pytorch 1.13.1 \\ GPU Acceleration Library & CUDA 11.6 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Experimental environment configuration table. parameters. These indicators provide insights into the model's effectiveness in detecting targets accurately. Precision measures the ratio of correctly identified positive samples to all identified positive samples. Recall represents the ratio of correctly identified positive samples to all actual positive samples. The formulas for these indicators are as follows:  
\[Precision=\frac{TP}{TP+FP} \tag{7}\]  
\[Recall=\frac{TP}{TP+FN} \tag{8}\]  
\[AP=\int_{0}^{1}p(r)dr \tag{9}\]  
\[map.5=\frac{1}{N}{\sum_{i=1}^{N}AP_{i}^{IoUt=0.5}} \tag{10}\]  
\[map.95=\frac{1}{N}{\sum_{i=1}^{N}AP_{i}^{IoUt=0.95}} \tag{11}\]  
In the equations, \(TP\) denotes the number of correctly classified positive samples, \(FP\) denotes the number of incorrectly classified positive samples, \(FN\) denotes the number of incorrectly classified negative samples, and \(N\) denotes the total number of categories. The \(AP\) (Average Precision) is calculated separately for each category and then averaged over all categories. \(p(r)\) denotes the \(AP\) under a given recall rate \(r\) and the \(AP\) of the ith category under IoU thresholds of 0.5 and 0.95. A series of ablation experiments were conducted on the validation and test sets to investigate the effects of different conditions on the model's performance. The results of these experiments are presented in Table 4, where H represents the small target detection layer, CD represents the CSPCM-DFC, CA represents the CARAFE upsampling module, and NWD represents the NWD loss function. Experiment A involved adding a small target detection layer to YOLOv5s. The experimental results showed significant improvements in indicators such as P, R, mAP.5, and mAP.95, but this occurred as the number of parameters increased. Experiment B replaced layers 8 and 23 of the original model with the CSPCM-DFC module. The results showed that although mAP.5 and mAP.95 did not improve significantly, the number of parameters decreased by 1,091,102, reducing the complexity of the model without affecting performance. Experiment C utilized the CARAFE module as a replacement for the original Nearest Upsample module. The results indicated an increase of 0.8 in mAP.5, 0.3 in mAP.95, and a slight increase in the number of parameters, indicating an improvement in the performance of the model.