# Effective Strategies for Enhancing Real-Time Weapons Detection in Industry
## 4 Results
### First Phase  
#### 4.1.1 Models  
Most versions of YOLO come with models that exhibit varying precision and performance. Therefore, in this experiment, our aim is to identify the optimal model, considering both inference time and accuracy, for real-time object detection among the most suitable models within the selected YOLO versions. Specifically, we tested YOLOv5, including its small, medium, and large models. As for YOLOv7, we utilised the baseline (_YOLOv7_), _YOLOv7x_, _YOLOv7-w6_, and _YOLOv7-w6_ for this experiment. Finally, the _small_, _medium_, and _large_ models of YOLOv8 were experimented with. According to the results displayed in Figure 5, utilising the Disarm-Dataset for training yields superior average precision overall. Additionally, referring to Table 4, employing the _Disarm-Dataset_ for training surpasses the usage of other datasets by a significant margin (+16.1 AP50, +7 AP75, +24.3 AP, +19.2 F1), despite generating the highest number of false positives. Using either the _Gun-Dataset_ or _Disarm-Dataset_ for training yields positive results, as they contain the highest number of high-quality images. To enhance performance on smaller datasets, decreasing the batch size may be beneficial, as it can mitigate the occurrence of over-fitting. Moreover, the _usdataset_ is a very complex dataset due to the use of CCTV-style images. This dataset comprises a large number of weapons with a very small size, and it also includes occluded or blurred weapon appearances, making it challenging to learn the characteristics of these objects. By changing the cameras used for training and incorporating synthetic images, better learning of the weapon's features can be achieved. Upon closer examination, the models face considerable difficulty in identifying weapons in the first  
Figure 4: Test subset sample images. two videos due to the reduced size of the weapons and increased occlusion, compared to the third video. In general, the heightened complexity of the images makes detection more challenging. Focusing on the Disarm-Dataset, YOLOv8 exhibits superior accuracy and inference time compared to the models of YOLOv5 and YOLOv7, as evidenced by the results shown in Figure 6 and Table 5. Although YOLOv5 and YOLOv8 outperform YOLOv7, they exhibit lower consistency in the first three videos. Notably, the first two videos demonstrate inferior performances, in terms of accuracy, compared to the third, which has the least complexity. On the contrary, the larger the backbone, the better the outcomes, but there is also a decrease in frames per second with each subsequent backbone, except for YOLOv7, which yields results that are less consistent than those expected. Furthermore, these models \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Dataset** & **AP50** & **AP75** & **AP** & **F1** & **FP** \\ \hline Disarm-Dataset & 42.80 & 50.90 & 42.80 & 69.70 & 196 \\ Gun-Dataset & 60.60 & 34.50 & 29.20 & 52.80 & 163 \\ YouTube-GDD & 0.50 & 0.30 & 0.20 & 0.00 & 2 \\ usdataset\_v2 + synth & 0.70 & 0.70 & 0.60 & 0.40 & 0 \\ usdataset\_v2 & 0.00 & 0.00 & 0.00 & 0.00 & 0 \\ usdataset + synth & 0.00 & 0.00 & 0.00 & 0.00 & 0 \\ usdataset & 0.00 & 0.00 & 0.00 & 0.00 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Median results (YOLOv5 (s, m, l), YOLOv7 (base, v7x, w6, e6), and YOLOv8 (s, m, l)) grouped by dataset. The metrics used were Average Precision (AP), AP50, AP75, F1 score (F1), and False Positives (FP). These were calculated using an IoU of 0.7 and a confidence threshold of 0.5. Note that the results in red are the best and those in blue are the second best. Figure 5: Comparison between datasets according to AP\({}^{50-95}\). Note that the results shown are the average obtained by the models trained on these datasets (YOLOv5 (s, m, l), YOLOv7 (base, v7x, w6, e6), and YOLOv8 (s, m, l)). require the longest training time, as illustrated in Figure 7, while YOLOv8 demands the least time and delivers superior results. For the forthcoming experiments, we selected the small version of YOLOv8.