# A Lightweight Barcode Detection Algorithm Based on Deep Learning
## 4 Experiments
### Ablation Experiment  
The results of ablation experiments are shown in Table 2. The improvement methods proposed in this paper all contribute to reducing model size and improving detection accuracy. Specifically, when the model's backbone network employs the EfficientViT block, the model achieves good lightweight results, with a recall rate of 93.3%, mAP50:95 of 73.8%, 6.8 M parameters, and 17.4 G FLOPs. When the model uses the improved C2f module, it has 7.8 M parameters, 5.2 G FLOPs, a recall rate of 93%, and mAP50:95 of 73.5%. When the model adopts the ADown convolutional block in downsampling, it achieves the most significant improvement in detection accuracy, with a recall rate of 93.4% and mAP50:95 of 73.8%, which are 0.7% and 0.4% higher than the original model, respectively. When the model applies all the improvement strategies proposed in this paper, it demonstrates the best overall performance, with 2.86 M parameters, 5.8 G FLOPs, a recall rate of 94.5%, and mAP50:95 of 75.3%. The experimental results verify the effectiveness of the improvement methods proposed in this paper. Compared with the pre-improvement model, the improved model achieves better lightweight performance while enhancing detection accuracy, which is of great practical significance for deploying the model on resource-constrained platforms such as mobile devices and embedded systems. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Methods**} & \multicolumn{2}{c}{**Params**} & \multicolumn{2}{c}{**FLOPs**} & \multicolumn{2}{c}{**Recall**} & \multicolumn{1}{c}{**mAP50:95**} \\ \hline
**Backbone-im \({}^{*}\)** & **C2f-Ghost** & **ADown** & **Head-im \({}^{*}\)** & **(M)** & **(G)** & **(\%)** & **(\%)** \\ \hline  & & & & \(11.1\) & 28.4 & 92.7 & 73.4 \\  & & & & 6.8 & 17.4 & 93.3 & 73.8 \\  & & & & 7.8 & 19.0 & 93 & 73.5 \\  & & & & 9.33 & 21.3 & 93.4 & 73.8 \\  & & & & \(\bigvee\) & 10.06 & 27.8 & 92.9 & 73.6 \\  & & & & 5.2 & 13.6 & 94.2 & 73.9 \\  & & & & 4.66 & 12.9 & 94.3 & 74.6 \\  & & & & **2.86** & **5.8** & **94.5** & **75.3** \\ \hline  & & & & (\(-\)74.2\%) & (\(-\)79.6\%) & (+1.8\%) & (+1.9\%) \\ \hline \hline \end{tabular}  
\({}^{*}\) Backbone-im and Head-im represent the improved backbone and head, respectively.  
\end{table} 
Table 2: Ablation experiment results on barcode dataset. To intuitively understand the feature extraction and fusion processes of the model when processing input images, this paper analyzes the heatmaps outputted from various layers before and after model improvements, with the results illustrated in the figures. As shown in Figure 8, after partially improving the backbone and neck of the model, the heatmaps display clearer feature boundaries, more accurate feature localization, and stronger feature representation capabilities. This indicates that the improvement strategies proposed in this paper for the model's network structure enhance its feature extraction and fusion abilities. This paper also records the changes in detection accuracy curves during the training phase of the model before and after network improvements, as shown in Figure 9. Compared to the baseline model, the improved model exhibits higher accuracy in the medium-to-high confidence ranges, indicating a higher recall rate in scenarios close to real-world applications. Additionally, during the training phase, the improved model achieves higher mAP50:95 values, demonstrating better accuracy performance when the model training converges under the same conditions. The experiments show that the improvement strategies proposed in this paper contribute to enhancing the model's detection accuracy. Appropriate loss functions often improve a model's detection performance. To verify the effectiveness and rationality of the loss function selected in this paper for enhancing  
Figure 8: Heatmap outputs before and after model improvement. The top three are heatmaps generated by the baseline model, while the bottom three are heatmaps produced by the improved model.