# Improved Lightweight YOLOv4 Foreign Object Detection Method for Conveyor Belts Combined with CBAM
## 4 Experiments
### Analysis of Experimental Results  
In order to verify the performance of this model, we used the YOLOv4 algorithm and this improved algorithm to train foreign object data sets, and the comparison results of the accuracy and loss rate are shown in Figure 8. Figure 8a,b shows the YOLOv4 algorithm on the left and the improved algorithm in this paper on the right. From Figure 8a, it can be seen that the accuracy of the YOLOv4 algorithm increased to 0.8 only at one-fifth of the training process, and the final training accuracy was stabilized at about 0.92; while the accuracy of the improved algorithm in this paper rapidly increased at the beginning of training, and the accuracy was maintained at about 0.98, it indicates that the algorithm in this paper not only converged quickly but also had high detection accuracy. From Figure 8b, it can be seen that the false detection rate of this algorithm was much lower than that of the YOLOv4 algorithm after the training and detection of two types of foreign objects, bolts, and gangue, indicating that this algorithm was more capable of feature extraction and higher detection accuracy than the YOLOv4 algorithm in the face of complex environments. \begin{table}
\begin{tabular}{c c} \hline \hline
**Configuration Name** & **Version Parameters** \\ \hline Operating System & ubuntu 18.04 LTS \\ GPU & NVIDIA GeForce GTX 3060 Ti \\ CPU & Intel Core i7-8700632.0 GHz \(\times\) 6 CPUs \\ Anaconda & 3 \\ CUDA & 10.1.105 \\ Python & 3.8 \\ Pytorch & 1.1.0 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Computer software and hardware configuration. A series of ablation experiments were designed to test the improvement measures in this paper. Firstly, the original YOLOv4 network was used as the standard model and was tested by the Kmeans++ clustering method, adding the CBAM attention module and Ghost module, respectively. Finally, the three improvement strategies were added to the YOLOv4 model at the same time. The experiments performed all used the same dataset and were in the same environment, with all parameters kept consistent. The results are shown in Table 3.  
From Table 3, we can see that the detection accuracy improved by 0.92% through by the Kmeans++ clustering method to obtain the suitable size and anchor frame for foreign object targets; the Ghostnet-CBAM-YOLOv4 network model was designed, and the backbone network of YOLOv4 was replaced by the Ghost module and transformed into a lightweight  
Figure 8: Comparison of experimental results between the proposed algorithm and YOLOv4 algorithm. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{\begin{tabular}{c} **Baseline** \\ **Models** \\ \end{tabular} } & \multicolumn{4}{c}{**Improvement Strategies**} & \multirow{2}{*}{\begin{tabular}{c} **MAP** \\ **(\%)** \\ \end{tabular} } & \multirow{2}{*}{\
\begin{tabular}{c} **Frequency** \\ **(Frame-S\({}^{-1}\))** \\ \end{tabular} } & \multirow{2}{*}{
\begin{tabular}{c} **Weights File Size** \\ **(MB)** \\ \end{tabular} } \\ \cline{3-4} \cline{6-7}  & & & & & & 92.97\% & 38.5 & 244 \\ YOLOv4 & \(\surd\) & - & - & 95.74\% & 48.3 & 44.3 \\ YOLOv4 & \(\surd\) & \(\surd\) & - & 97.94\% & 46.5 & 45.9 \\ YOLOv4 & & \(\surd\) & \(\surd\) & 98.19\% & 31.5 & 246 \\ YOLOv4 & \(\surd\) & \(\surd\) & \(\surd\) & 98.86\% & 49.2 & 42.8 \\ YOLOv4 & \(\surd\) & \(\surd\) & \(\surd\) & 99.13\% & 53.4 & 35.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Ablation experimental results. network. The detection speed increased by 2.77%. The detection speed increased by 9.8 fps. Additionally, the weight file was 44.3 MB. The CBAM attention module was added to enhance the feature extraction ability of the target in the complex environment under the mine, and the detection accuracy increased by 3.89%. We introduced a deep separable convolution instead of the 3 \(\times\) 3 ordinary convolution in the model; the detection accuracy was improved by 0.17%, and the detection speed was improved by 4.2 fps.