# SAFP-YOLO: Enhanced Object Detection Speed Using Spatial Attention-Based Filter Pruning
## 4 Experimental Results
### Discussion  
In this section, the validation of the proposed method is presented. Figures 9 and 10 show the results of applying the conventional filter-pruning techniques (i.e., magnitude pruning [51] and random pruning [52]) to the pig dataset and vehicle dataset. Magnitude pruning involved determining the importance of filters based on their L2-norm values and then performing filter pruning. On the other hand, random pruning simply involves randomly selecting filters for pruning. As shown in Figures 9 and 10, the application of filter pruning increased the inference speed and reduced the model size of the baseline model. However, the conventional filter-pruning technique, by using L2-norm [51] or randomly removing filters [52], led to substantial accuracy degradation, regardless of the dataset. On the other hand, the proposed SAFP could provide an accuracy of 81.2% (vs. 87.9% baseline YOLOv7) for the pig dataset and 75.7% (vs. 81.8% baseline YOLOv7) for the vehicle dataset, even with 87.5% pruning. That is, with acceptable accuracy, SAFP could increase the inference speed (by a factor of five) and reduce the model size (by a factor of three) of the baseline model, regardless of the dataset. Figure 11 illustrates the feature maps generated by the convolution filters pruned through both the method proposed in this study and the conventional filter-pruning techniques [51; 52]. As depicted in the figure, the feature maps produced by the convolution filters pruned using the proposed method were observed to either not represent or minimally represent the features of the objects that should be detected, indicating that filters likely to be unimportant in object detection were pruned. Conversely, the feature maps representing the convolution filters pruned through the conventional filter-pruning techniques were found to have also eliminated filters that accurately represent the features of the objects that need to be detected. Thus, even filters that were likely to be important in object detection were pruned. Consequently, it was confirmed that by selectively pruning filters that do not adequately represent the features of the objects through the proposed method, a reduction in accuracy can be minimized. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **Method** & \begin{tabular}{c} **Accuracy \(\uparrow\)** \\ **(AP\({}_{0.5}\) \%)** \\ \end{tabular} & \begin{tabular}{c} **Speed \(\uparrow\)** \\ **(FPS)** \\ \end{tabular} & \begin{tabular}{c} **No. of Model** \\ **Parameters \(\downarrow\) (M)** \\ \end{tabular} \\ \hline \multirow{7}{*}{YOLOv4} & \multirow{2}{*}{\
\begin{tabular}{c} Baseline YOLOv4 \\ \end{tabular} } & \multirow{2}{*}{78.1} & \multirow{2}{*}{3.9} & \multirow{2}{*}{52.5} \\ \cline{3-3} \cline{5-5}  & & 50\% Pruning & 77.4 & 6.0 & 36.7 \\ \cline{3-5}  & & 75\% Pruning & 74.3 & 12.0 & 25.7 \\ \cline{3-5}  & & 87.5\% Pruning & 72.1 & 20.9 & 15.7 \\ \cline{2-5}  & & 50\% Pruning & 77.5 & 6.0 & 36.7 \\ \cline{3-5}  & & 75\% Pruning & 74.4 & 12.0 & 25.7 \\ \cline{3-5}  & & 87.5\% Pruning & 72.6 & 20.9 & 15.7 \\ \hline \multirow{7}{*}{YOLOv7} & \multirow{2}{*}{
\begin{tabular}{c} Baseline YOLOv7 \\ \end{tabular} } & \multirow{2}{*}{81.8} & \multirow{2}{*}{3.8} & \multirow{2}{*}{36.7} \\ \cline{3-5}  & & 50\% Pruning & 80.7 & 5.8 & 25.8 \\ \cline{3-5}  & & 75\% Pruning & 78.2 & 11.5 & 16.3 \\ \cline{3-5}  & & 87.5\% Pruning & 75.4 & 20.0 & 10.2 \\ \cline{3-5}  & & 50\% Pruning & 80.8 & 5.8 & 25.8 \\ \cline{3-5}  & & 75\% Pruning & 78.7 & 11.5 & 16.3 \\ \cline{3-5}  & & 87.5\% Pruning & 75.7 & 20.0 & 10.2 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Comparison of the proposed method with YOLOv4 and YOLOv7 for the vehicle dataset on a TX-2. Figure 9: Accuracy–speed comparison of the filter-pruning techniques with YOLOv4 and YOLOv7 (**a**,**c**) shows the results on the pig dataset and (**b**,**d**) shows the results on the vehicle dataset.