目的 针对多种因素导致QR码严重受损难以识读的问题,提出一种高污损QR码图像检测与信息复原技术。方法 首先,引入跨尺度连接与注意力机制优化YOLO11n网络,对复杂背景下的高污损QR码进行快速、精准定位。其次,提出一个结构约束扩散模型对定位后的图像进行信息复原。与传统方法不同,本文所给出的模型将QR码的定位符、校正符和编码网格等结构信息作为修复过程中的先验约束,使得复原出的图像在结构上正确、规范,有效提升了解码成功率。结果 实验结果表明,本文给出的优化YOLO11n模型在自建高污损QR码数据集和公共MSQ数据集上,检测精度(mAP@0.5-0.95)分别达到了75.3%和77.1%。此外,结构约束扩散模型在处理污损面积超过40%的QR码时,其解码成功率达到54%。结论 本文所提出的模型能有效解决高污损QR码识读困难等问题。
Abstract
The work aims to propose a highly soiled QR code image detection and information restoration technology to solve the problem that QR codes are severely damaged and difficult to read due to multiple factors, even human factors. Firstly, a cross-scale connection and attention mechanism was introduced to optimize the YOLO11n network, enabling rapid and accurate location of highly soiled QR codes in complex backgrounds. Secondly, a structure-constrained diffusion model was presented to restore the information of the positioned image. Different from the traditional methods, the model presented in this paper took the structural information such as the positioning symbol, correction symbol and encoding grid of the QR code as the prior constraints in the restoration process, making the restored image structurally correct and standardized, and effectively improving the probability of being readable and decoded. The experimental results showed that the detection accuracy (mAP@0.5-0.95) of the optimized YOLO11n model presented in this paper on the self-built highly soiled QR code dataset and the public MSQ dataset reached 75.3% and 77.1%, respectively. Besides, when the structure-constrained diffusion model dealt with QR codes with a soiled area exceeding 40%, its decoding success rate reached 54%. The model proposed in this paper can effectively solve the restoration problem of highly soiled QR codes and the problem of correct reading.
关键词
QR码 /
YOLO11n /
扩散模型 /
注意力机制 /
图像复原
Key words
QR Code /
YOLO11n /
diffusion model /
attention mechanism /
image restoration
{{custom_sec.title}}
{{custom_sec.title}}
{{custom_sec.content}}
参考文献
[1] 燕雨薇, 余粟. 二维码技术及其应用综述[J]. 智能计算机与应用, 2019, 9(5): 194-197.
YAN Y W, YU S.A Review on Two-Dimensional Code Technology and Its Application[J]. Intelligent Computer and Applications, 2019, 9(5): 194-197.
[2] WANG S.Substation Personnel Safety Detection Network Based on YOLOv4[C]// 2021 IEEE 2nd International Conference on Big Data, Artificial Intelligence and Internet of Things Engineering (ICBAIE). Nanchang, China. IEEE, 2021: 877-881.
[3] 李建刚, 黄诗浩, 郑启强, 等. 批量高速二维码视觉检测识别系统[J]. 应用光学, 2021, 42(2): 276-282.
LI J G, HUANG S H, ZHENG Q Q, et al.Identification System for Batch of Two-Dimensional Code with High Speed Based on Machine Vision[J]. Journal of Applied Optics, 2021, 42(2): 276-282.
[4] 杨建华, 方园园, 赵轩. 基于改进维纳滤波算法的运动模糊二维码图像复原方法[J]. 激光杂志, 2024, 45(2): 91-94.
YANG J H, FANG Y Y, ZHAO X.Image Restoration Method of Motion Blur Two-Dimensional Code Based on Improved Wiener Filter Algorithm[J]. Laser Journal, 2024, 45(2): 91-94.
[5] 郭建民, 冯立杰. 复杂背景下的QR二维码解码研究[J]. 信息系统工程, 2015(11): 137-138.
GUO J M, FENG L J.Research on QR Code Decoding under Complex Background[J]. China CIO News, 2015(11): 137-138.
[6] 张传栋, 吴倩, 孙飒爽, 等. 基于机器视觉的复杂背景QR二维码有效分割方法研究[J]. 制造业自动化, 2016, 38(11): 21-24.
ZHANG C D, WU Q, SUN S S, et al.Segmentation of QR Code with Complex Background Based on Machine Vision[J]. Manufacturing Automation, 2016, 38(11): 21-24.
[7] VAN GENNIP Y, ATHAVALE P, GILLES J, et al.A Regularization Approach to Blind Deblurring and Denoising of QR Barcodes[J]. IEEE Transactions on Image Processing, 2015, 24(9): 2864-2873.
[8] 刘云, 邹复民, 蔡祈钦, 等. 改进YOLOv8n-Pose的形变QR码校正与识别[J]. 计算机系统应用, 2024, 33(12): 141-152.
LIU Y, ZOU F M, CAI Q Q, et al.Deformed QR Code Correction and Recognition Based on Improved YOLOv8n-Pose[J]. Computer Systems & Applications, 2024, 33(12): 141-152.
[9] JI Y P, ZHANG D, HE Y L, et al.Improved YOLO11 Algorithm for Insulator Defect Detection in Power Distribution Lines[J]. Electronics, 2025, 14(6): 1201.
[10] WANG B Z, XU J B, ZHANG J K, et al.Motion Deblur of QR Code Based on Generative Adversative Network[C]//Proceedings of the 2019 2nd International Conference on Algorithms, Computing and Artificial Intelligence. Sanya China. ACM, 2019: 166-170.
[11] ZHENG J H, ZHAO R L, LIN Z J, et al.EHFP-GAN: Edge-Enhanced Hierarchical Feature Pyramid Network for Damaged QR Code Reconstruction[J]. Mathematics, 2023, 11(20): 166-170.
[12] 赵水平. 二维码结构编码及生成技术探讨与实现[J]. 电脑知识与技术, 2017, 13(8): 259-261.
ZHAO S P.The Implementation and Discussion of 2-D Barcodes Generation Method[J]. Computer Knowledge and Technology, 2017, 13(8): 259-261.
[13] ZHANG L M, RAO A Y, AGRAWALA M.Adding Conditional Control to Text-to-Image Diffusion Models[C]// 2023 IEEE/CVF International Conference on Computer Vision (ICCV). Paris, France. IEEE, 2024: 3813-3824.
[14] DOHERTY J, GARDINER B, KERR E, et al.BiFPN-YOLO: One-Stage Object Detection Integrating Bi-Directional Feature Pyramid Networks[J]. Pattern Recognition, 2025, 160: 111209.
[15] WU Y R, ZHANG L L, LI H, et al.Feature Fusion Pyramid Network for End-to-End Scene Text Detection[J]. ACM Transactions on Asian and Low-Resource Language Information Processing, 2024, 23(11): 1-16.
[16] VASWANI A, SHAZEER N, PARMAR N, et al.Attention Is All You Need[C]// Advances in Neural Information Processing Systems (NeurIPS). 2017: 5998-6008.
[17] LI Y H, CHEN Y T, WANG N Y, et al.Scale-Aware Trident Networks for Object Detection[C]// 2019 IEEE/CVF International Conference on Computer Vision (ICCV). Seoul, Korea. IEEE, 2019: 6053-6062.
[18] ZHANG X, ZHOU X, LIN M, et al.ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices[C]// Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR). 2018: 6848-6856. DOI: 10.1109/CVPR.2018.00716.
[19] XU Y W, PAGNUCCO M, SONG Y.An Edge Guided Coarse-to-Fine Generative Network for Image Outpainting[J]. Neurocomputing, 2023, 541: 126254.
[20] ZHAO X B, LI X.Vaccine-YOLOv10: Real-Time QR Code Detection Model for Complex Light Condition[J]. Journal of Real-Time Image Processing, 2025, 22(2): 81.
[21] LIU G L, REDA F A, SHIH K J, et al.Image Inpainting for Irregular Holes Using Partial Convolutions[C]// Computer Vision-ECCV 2018. Cham: Springer, 2018: 89-105.
[22] WANG A, CHEN H, LIU L H, et al. YOLOv10: Real-Time End-to-End Object Detection[EB/OL].2024: arXiv: 2405.14458. https://arxiv.org/abs/2405.14458
[23] TIAN Y J, YE Q X, DOERMANN D. YOLOv12: Attention-Centric Real-Time Object Detectors[EB/OL].2025: arXiv: 2502.12524. https://arxiv.org/abs/2502.12524
[24] DONG Q L, CAO C J, FU Y W.Incremental Transformer Structure Enhanced Image Inpainting with Masking Positional Encoding[C]// 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). New Orleans, LA, USA. IEEE, 2022: 11348-11358.
[25] LI Z, ZHANG Y N, DU Y F, et al.STNet: Structure and Texture-Guided Network for Image Inpainting[J]. Pattern Recognition, 2024, 156: 110786.
基金
国家自然科学基金面上项目(61972042); 北京市基金-市教委联合项目(KZ202010015023); 北京印刷学院科研平台建设项目(KYCPT202509); 北京印刷学院信息与通信工程一级学科博士点培育项目(21090525004)