# A Lightweight Barcode Detection Algorithm Based on Deep Learning
## 4 Experiments
### Model Comparison Experiment  
To verify the balance between detection performance and model lightweighting achieved by the barcode detection model designed in this paper for barcode detection tasks in real-world scenarios, common models in the current object detection field are selected for comparison experiments. A total of four models, including those from the  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multicolumn{2}{c}{**Methods**} & \(\mathbf{E_{loc}}\downarrow\) & \(\mathbf{E_{Big}}\downarrow\) & \(\mathbf{E_{Mise}}\downarrow\) & \(\mathbf{E_{FP}}\downarrow\) \\ \hline \multirow{3}{*}{**IoU**} & CIoU & 0.79 & 0.89 & 1.43 & 1.21 \\  & EIoU & 0.41 & 1.10 & 1.53 & 1.75 \\  & SIoU & 0.51 & 1.29 & 1.87 & 1.79 \\ \hline \multirow{3}{*}{**Focaler-IoU**} & EIoU & 0.15 (\(-\)0.64) & 0.75 (\(-\)0.14) & 1.04 (\(-\)0.29) & 1.18 (\(-\)0.03) \\  & SIoU & 0.40 (\(-\)0.11) & 1.11 (\(-\)0.18) & 1.48 (\(-\)0.39) & 1.65 (\(-\)0.14) \\ \cline{1-1}  & CIoU(Ours) & 0.53 (\(-\)0.26) & 0.53 (\(-\)0.36) & 1.28 (\(-\)0.15) & 0.89 (\(-\)0.32) \\ \hline \hline \end{tabular}
\end{table}
Table 4: Comparison of prediction box vs. ground truth box errors for the improved model under different loss functions (using TIDE metrics).  
\begin{table}
\begin{tabular}{c c c c} \hline \hline \multicolumn{2}{c}{**Methods**} & \multicolumn{1}{c}{**Recall (\%)**} & \multicolumn{1}{c}{**mAP50:95 (\%)**} \\ \hline \multirow{3}{*}{**IoU**} & CIoU & 93.5 & 74.6 \\  & EIoU & 92.2 & 73.4 \\  & SIoU & 91.7 & 73.2 \\ \hline \multirow{3}{*}{**Focaler-IoU**} & EIoU & 92.7 (+0.5) & 73.9 (+0.5) \\  & SIoU & 94.2 (+2.5) & 73.6 (+0.4) \\ \cline{1-1}  & CIoU(Ours) & **94.5** (+1.0) & **75.3** (+0.7) \\ \hline \hline \end{tabular}
\end{table}
Table 3: Detection accuracy of the improved model under different loss functions.  
YOLO [30, 31] series and RT-DETR [32], are compared with the proposed model. The experimental results are shown in Table 5. According to Table 5, RT-DETR has the largest number of parameters and FLOPs, which are 41.9 M and 125.6 G, respectively, but its detection accuracy and speed are relatively poor. Within the YOLO series, the YOLOv7-tiny model has the smallest number of parameters and FLOPs, which are 6.01 M and 13.0 G, respectively, with a recall rate of 91.8% and an mAP50:95 of 66.7%. YOLOv10s has the fastest inference speed, with an FPS value of 244. Compared with other models, the improved model proposed in this paper has the smallest number of parameters and lowest computational cost while achieving the best detection accuracy and speed.  
To verify the detection accuracy of the model for barcodes in real-world scenarios, some barcode images are selected as samples to evaluate the detection results of different models. Figure 10 shows the comparison results of some models for barcode detection. As can be seen from the figure, Baseline, YOLOv5s, RT-DETR, YOLOv9s, and YOLOv10s exhibit varying degrees of missed detections, false detections, and repeated detections. YOLOv7-tiny has poor boundary determination for barcode bounding boxes. Compared with other models, the improved model, due to the incorporation of a linear attention mechanism, is able to extract more feature maps related to barcodes, leading to more accurate barcode recognition and reducing the probability of repeated detections.  
Furthermore, this paper randomly crops and stitches images in the test set, compiling a total of 300 barcode images as the total sample for a barcode recognition comparison experiment. The experimental results are shown in Table 6. According to Table 6, the proposed model achieves the highest barcode reading success rate of 95.5% among the images and has the lowest number of missed detections. Based on all experimental results, the proposed model demonstrates the best overall performance in barcode detection tasks and outperforms other models in real-world scenarios.