A Lightweight Barcode Detection Algorithm Based on Deep Learning
Abstract
:1. Introduction
- This paper proposes a high-speed and accurate barcode recognition algorithm based on a lightweight barcode detection model. The model achieves real-time barcode detection with a small number of parameters, low computational complexity, high accuracy, and rapid inference capabilities.
- While focusing on minimizing both parameter count and computational complexity of the model, this paper also enhances the model’s ability to dynamically adjust contextual feature relationships. To achieve this, we introduce a linear attention mechanism and efficient convolutional operations into the network structure, thereby improving the feature extraction capabilities of the feature fusion convolutional blocks and pooling layers, as well as the operational efficiency of the convolutional modules. Furthermore, we reconstruct the detection head and adjust the model’s loss function to enhance the convergence speed and training quality of the model.
- The effectiveness of the proposed algorithm and model is verified in this paper. Comparative experimental results demonstrate that our model outperforms other models in terms of detection accuracy, model size, and detection speed.
2. Related Work
3. Method
3.1. The Framework of Barcode Recognition Algorithm
3.2. EfficientViT Block and Multi-Scale Linear Attention
3.3. Efficient Multi-Scale Feature Fusion Network
3.4. Lightweight Detection Head
4. Experiments
4.1. Preparation of the Dataset and Configuration of the Experimental Environment
4.2. Evaluation Metrics for Model Performance
4.3. Ablation Experiment
4.4. Model Comparison Experiment
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Yan, L.Y.; Tan, G.W.H.; Loh, X.M.; Hew, J.J.; Ooi, K.B. QR code and mobile payment: The disruptive forces in retail. J. Retail. Consum. Serv. 2021, 58, 102300. [Google Scholar] [CrossRef]
- De Luna, I.R.; Liébana-Cabanillas, F.; Sánchez-Fernández, J.; Muñoz-Leiva, F. Mobile payment is not all the same: The adoption of mobile payment systems depending on the technology applied. Technol. Forecast. Soc. Change 2019, 146, 931–944. [Google Scholar] [CrossRef]
- Elaskari, S.; Imran, M.; Elaskri, A.; Almasoudi, A. Using barcode to track student attendance and assets in higher education institutions. Procedia Comput. Sci. 2021, 184, 226–233. [Google Scholar] [CrossRef]
- Tan, L.; Lu, Y.; Yan, X.; Liu, L.; Zhou, X. XOR-ed visual secret sharing scheme with robust and meaningful shadows based on QR codes. Multimed. Tools Appl. 2020, 79, 5719–5741. [Google Scholar] [CrossRef]
- Nuhi, A.; Memeti, A.; Imeri, F.; Cico, B. Smart attendance system using qr code. In Proceedings of the 2020 9th Mediterranean Conference on Embedded Computing (MECO), Budva, Montenegro, 8–11 June 2020; pp. 1–4. [Google Scholar]
- Küng, K.; Aeschbacher, K.; Rütsche, A.; Goette, J.; Zürcher, S.; Schmidli, J.; Schwendimann, R. Effect of barcode technology on medication preparation safety: A quasi-experimental study. Int. J. Qual. Health Care 2021, 33, mzab043. [Google Scholar] [CrossRef] [PubMed]
- Ang, J.L.F.; Lee, W.K.; Ooi, B.Y.; Ooi, T.W.M. Location Sensing using QR codes via 2D camera for Automated Guided Vehicles. In Proceedings of the 2020 IEEE Sensors Applications Symposium (SAS), Kuala Lumpur, Malaysia, 9–11 March 2020; pp. 1–6. [Google Scholar]
- Ohbuchi, E.; Hanaizumi, H.; Hock, L.A. Barcode readers using the camera device in mobile phones. In Proceedings of the 2004 International Conference on Cyberworlds, Tokyo, Japan, 18–20 November 2004; pp. 260–265. [Google Scholar]
- Wachenfeld, S.; Terlunen, S.; Jiang, X. Robust recognition of 1-d barcodes using camera phones. In Proceedings of the 2008 19th International Conference on Pattern Recognition, Tampa, FL, USA, 8–11 December 2008; pp. 1–4. [Google Scholar]
- Katona, M.; Nyúl, L.G. Efficient 1D and 2D barcode detection using mathematical morphology. In Proceedings of the Mathematical Morphology and Its Applications to Signal and Image Processing: 11th International Symposium, ISMM 2013, Uppsala, Sweden, 27–29 May 2013; pp. 464–475. [Google Scholar]
- Aceto, G.; Ciuonzo, D.; Montieri, A.; Pescapé, A. Mobile encrypted traffic classification using deep learning: Experimental evaluation, lessons learned, and challenges. IEEE Trans. Netw. Serv. Manag. 2019, 16, 445–458. [Google Scholar] [CrossRef]
- Li, J.; Sun, A.; Han, J.; Li, C. A survey on deep learning for named entity recognition. IEEE Trans. Knowl. Data Eng. 2022, 34, 50–70. [Google Scholar] [CrossRef]
- Chen, J.; Wen, Y.; Nanehkaran, Y.A.; Zhang, D.; Zeb, A. Multiscale attention networks for pavement defect detection. IEEE Trans. Instrum. Meas. 2023, 72, 2522012. [Google Scholar] [CrossRef]
- Liu, M.; Jiang, J.; Zhu, C.; Yin, X.C. Vlpd: Context-aware pedestrian detection via vision-language semantic self-supervision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June2023; pp. 6662–6671. [Google Scholar]
- Hansen, D.K.; Nasrollahi, K.; Rasmussen, C.B. Real-time barcode detection and classification using deep learning. In International Joint Conference on Computational Intelligence; SCITEPRESS Digital Library: Lisbon, Portugal, 2017; pp. 321–327. [Google Scholar]
- Tian, Y.; Che, Z.; Zhai, G.; Gao, Z. BAN, a barcode accurate detection network. In Proceedings of the 2018 IEEE Visual Communications and Image Processing (VCIP), Taichung, Taiwan, 9–12 December 2018; pp. 1–5. [Google Scholar]
- Jia, J.; Zhai, G.; Zhang, J. EMBDN: An efficient multiclass barcode detection network for complicated environments. IEEE Internet Things J. 2019, 6, 9919–9933. [Google Scholar] [CrossRef]
- Zhang, J.; Min, X.; Jia, J. Fine localization and distortion resistant detection of multi-class barcode in complex environments. Multimed. Tools Appl. 2020, 80, 16153–16172. [Google Scholar] [CrossRef]
- Xu, X.; Xue, Z.; Zhao, Y. Research on an algorithm of express parcel sorting based on deeper learning and multi-information recognition. Sensors 2022, 22, 6705. [Google Scholar] [CrossRef] [PubMed]
- Cai, H.; Li, J.; Hu, M. Efficientvit: Lightweight multi-scale attention for high-resolution dense prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 4–6 October 2023; pp. 17256–17267. [Google Scholar]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention is all you need. arXiv 2017, arXiv:1706.03762. [Google Scholar]
- Han, K.; Wang, Y.; Tian, Q. Ghostnet: More features from cheap operations. In Proceedings of the IEEE/CVF conference on computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 14–19 June 2020; pp. 1577–1586. [Google Scholar]
- Wang, C.Y.; Yeh, I.H.; Liao, H.Y.M. Yolov9: Learning what you want to learn using programmable gradient information. arXiv 2024, arXiv:2402.13616. [Google Scholar]
- Zhang, H.; Zhang, S. Focaler-IoU: More Focused Intersection over Union Loss. arXiv 2024, arXiv:2401.10525. [Google Scholar]
- Li, X.; Wang, W.; Wu, L. Generalized focal loss: Learning qualified and distributed bounding boxes for dense object detection. Adv. Neural Inf. Process. Syst. 2020, 33, 21002–21012. [Google Scholar]
- Bolya, D.; Foley, S.; Hays, J. Tide: A general toolbox for identifying object detection errors. In Proceedings of the Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, 23–28 August 2020; pp. 558–573. [Google Scholar]
- Zheng, Z.; Wang, P.; Liu, W.; Li, J.; Ye, R.; Ren, D. Distance-IoU loss: Faster and better learning for bounding box regression. In Proceedings of the AAAI Conference on Artificial Intelligence 2020, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 12993–13000. [Google Scholar]
- Zhang, Y.F.; Ren, W.; Zhang, Z. Focal and efficient IOU loss for accurate bounding box regression. arXiv 2021, arXiv:2101.08158. [Google Scholar] [CrossRef]
- Gevorgyan, Z. SIoU loss: More powerful learning for bounding box regression. arXiv 2022, arXiv:2205.12740. [Google Scholar]
- Wang, C.Y.; Bochkovskiy, A.; Liao, H.Y.M. YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Vancouver, BC, Canada, 18–22 June 2023; pp. 7464–7475. [Google Scholar]
- Wang, A.; Chen, H.; Liu, L.; Chen, K.; Lin, Z.; Han, J.; Ding, G. Yolov10: Real-time end-to-end object detection. arXiv 2024, arXiv:2405.14458. [Google Scholar]
- Zhao, Y.; Lv, W.; Xu, S.; Wei, J.; Wang, G.; Dang, Q.; Liu, Y.; Chen, J. DETRs beat YOLOs on real-time object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 16–22 June 2024; pp. 16965–16974. [Google Scholar]
Parameter | Configuration |
---|---|
Programming language | Python |
Deep learning framework | Pytorch1.8.1 |
CPU | Intel (R) Xeon Gold 6248R |
GPU | NVDIA RTX A6000 |
CUDA | 11.8 |
Batch size | 16 |
Initial learning rate | 0.01 |
Epoch | 200 |
SGD momentum | 0.937 |
Weight decay | 0.0005 |
Methods | Params (M) | FLOPs (G) | Recall (%) | mAP50:95 (%) | |||
---|---|---|---|---|---|---|---|
Backbone-im * | C2f-Ghost | ADown | Head-im * | ||||
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 | |||
✓ | 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 |
Improvement (%) | (−74.2%) | (−79.6%) | (+1.8%) | (+1.9%) |
Methods | Recall (%) | mAP50:95 (%) | |
---|---|---|---|
CIoU | 93.5 | 74.6 | |
IoU | EIoU | 92.2 | 73.4 |
SIoU | 91.7 | 73.2 | |
EIoU | 92.7 (+0.5) | 73.9 (+0.5) | |
Focaler-IoU | SIoU | 94.2 (+2.5) | 73.6 (+0.4) |
CIoU(Ours) | 94.5 (+1.0) | 75.3 (+0.7) |
Methods | |||||
---|---|---|---|---|---|
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 | |
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) | |
CIoU(Ours) | 0.53 (−0.26) | 0.53 (−0.36) | 1.28 (−0.15) | 0.89 (−0.32) |
Methods | Params (M) | FLOPs (G) | Recall (%) | mAP50:95 (%) | FPS |
---|---|---|---|---|---|
Baseline | 11.1 | 28.4 | 92.7 | 73.4 | 210 |
YOLOv5s | 7.02 | 15.8 | 91.6 | 67.8 | 196 |
YOLOv7-tiny | 6.01 | 13.0 | 91.8 | 66.7 | 208 |
RT-DETR-R50 | 41.9 | 125.6 | 90.0 | 72.8 | 85 |
YOLOv9s | 9.6 | 38.7 | 92.4 | 71.3 | 122 |
YOLOv10s | 7.22 | 21.4 | 92.1 | 70.8 | 244 |
Ours | 2.86 | 5.8 | 94.5 | 75.3 | 230 |
Methods | Decoding Success Rate (%) | Number of Missed Tests |
---|---|---|
Baseline | 93.7 | 48 |
YOLOv5s | 92.3 | 58 |
YOLOv7-tiny | 93.4 | 50 |
YOLOv9s | 93.2 | 52 |
YOLOv10s | 92.8 | 55 |
RT-DETR | 91.4 | 65 |
Ours | 95.5 | 34 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Chen, J.; Dai, N.; Hu, X.; Yuan, Y. A Lightweight Barcode Detection Algorithm Based on Deep Learning. Appl. Sci. 2024, 14, 10417. https://doi.org/10.3390/app142210417
Chen J, Dai N, Hu X, Yuan Y. A Lightweight Barcode Detection Algorithm Based on Deep Learning. Applied Sciences. 2024; 14(22):10417. https://doi.org/10.3390/app142210417
Chicago/Turabian StyleChen, Jingchao, Ning Dai, Xudong Hu, and Yanhong Yuan. 2024. "A Lightweight Barcode Detection Algorithm Based on Deep Learning" Applied Sciences 14, no. 22: 10417. https://doi.org/10.3390/app142210417
APA StyleChen, J., Dai, N., Hu, X., & Yuan, Y. (2024). A Lightweight Barcode Detection Algorithm Based on Deep Learning. Applied Sciences, 14(22), 10417. https://doi.org/10.3390/app142210417