Two-dimensional code image reconstruction method and system
Through deep learning methods and preset QR code image reconstruction deep learning networks, combined with encoding and decoding modules, it solves the problem of QR code image reconstruction with traditional methods in low signal-to-noise ratio and complex backgrounds, significantly improving the recognition rate and accuracy. rate, achieving effective application in real-life scenarios.
Patent Information
- Application Number
- CN202410785014.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-29
AI Technical Summary
It is difficult for existing technology to effectively process QR code images with low signal-to-noise ratio. Traditional methods have weak generalization and cannot successfully reconstruct QR code images in complex backgrounds. Moreover, the research work is too idealistic and difficult to apply in real scenarios.
Using the deep learning method, the deep learning network is reconstructed through the preset QR code image to reconstruct the QR code image to be reconstructed, using the encoding module, alternating reference feature fusion network module and decoding module, based on the spatial attention mechanism and self-attention learning, Multi-scale features are extracted and cross-attention fusion is performed, and the reference image with the highest similarity is selected for image reconstruction.
It significantly improves the recognition rate and accuracy of QR code images, can handle the reconstruction of QR code images in complex backgrounds, and improves its application capabilities in real-life scenarios.
Smart Images

Figure CN118862918A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for reconstructing a two-dimensional code image. Background Art
[0002] QR code is also called two-dimensional barcode. The most common form is QR (Quick Response) code. It is a very popular encoding method on mobile devices in recent years. It can store more information than traditional one-dimensional barcodes and can also represent more data types. QR code uses a certain set of black and white graphics distributed in a plane according to a certain pattern to record data symbol information. In the compilation of the code, it cleverly uses the concept of "0" and "1" bit streams that constitute the internal logic basis of the computer, and uses several geometric shapes corresponding to binary to represent text numerical information. It is automatically recognized by image input devices or photoelectric scanning devices to realize automatic information processing. QR code has the characteristics of large storage capacity, high confidentiality, high traceability, strong damage resistance, large backup, and low cost. These characteristics are particularly suitable for forms, security and confidentiality, tracking, certificates, inventory counting, data backup, etc.
[0003] With the widespread application of QR codes, the demand for QR code image reconstruction and restoration is gradually increasing. For QR code images with low signal-to-noise ratio, the image preprocessing process of the decoding library can no longer restore them to the level that can successfully locate and decode. Most of the QR code image reconstruction work based on traditional methods uses Wiener filtering, Otsu method, KL divergence and other methods, but they all require prior knowledge, mathematical modeling of image blur, adjustment of parameters based on the data model, and finally deblurring of the image through operations such as convolution. These traditional methods can often only solve linear motion blur or slight noise, are difficult to adjust parameters, have weak generalization, and test results are often only reflected on small sample data sets. In addition, existing work often only targets barcode images with a single blur type and simple background images, that is, the sample images to be processed only have one blur type that is easy to model, and the bottom of the barcode is a solid color background, and there is no interference from the background pattern on the barcode. The research problem is too idealistic, making it unknown whether the research work can be applied in real scenarios. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a method and system for reconstructing a two-dimensional code image based on the strong structural characteristics of the two-dimensional code. The present invention uses a deep learning method to reconstruct the two-dimensional code image to be reconstructed, effectively improving the recognition rate and recognition accuracy of the two-dimensional code image.
[0005] The present invention provides a method for reconstructing a two-dimensional code image, comprising: determining a two-dimensional code image to be reconstructed and a reference two-dimensional code image; reconstructing the two-dimensional code image based on a preset two-dimensional code image reconstruction deep learning network according to the two-dimensional code image to be reconstructed and the reference two-dimensional code image, to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
[0006] According to a method for reconstructing a two-dimensional code image provided by the present invention, the preset two-dimensional code image reconstruction deep learning network includes an encoding module, an alternating reference feature fusion network module and a decoding module; the encoding module is used to encode the two-dimensional code image to be reconstructed and the reference two-dimensional code image respectively, extract multi-scale features based on the spatial attention mechanism, and obtain the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features; the alternating reference feature fusion network module is used to perform self-attention and cross-attention fusion learning according to the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features to obtain features after feature fusion learning; the decoding module is used to decode the features after feature fusion learning to obtain the reconstructed two-dimensional code image.
[0007] According to a method for reconstructing a two-dimensional code image provided by the present invention, the determination of a two-dimensional code image to be reconstructed and a reference two-dimensional code image includes: acquiring the two-dimensional code image to be reconstructed; selecting a candidate reference image with the highest image similarity from a preset reference two-dimensional code library as the reference two-dimensional code image; the preset reference two-dimensional code library includes a plurality of the candidate reference images.
[0008] According to a method for reconstructing a two-dimensional code image provided by the present invention, the candidate reference image with the highest image similarity is selected from a preset reference two-dimensional code library as the reference two-dimensional code image, comprising: determining the Gabor features of the two-dimensional code image to be reconstructed and the Gabor features of all the candidate reference images in the preset reference two-dimensional code library; calculating the similarity between the Gabor features of the two-dimensional code image to be reconstructed and the Gabor features of each candidate reference image based on a structural similarity algorithm to obtain a plurality of image similarity data; and determining the highest image similarity data from the plurality of image similarity data to use the candidate reference image corresponding to the highest image similarity data as the reference two-dimensional code image.
[0009] According to a two-dimensional code image reconstruction method provided by the present invention, the encoding module is specifically used to: perform pre-activated convolution processing on the features of the input two-dimensional code image to obtain image features after pre-activated convolution processing; use an hourglass block in the residual branch to capture the features of the image features after pre-activated convolution processing to obtain multi-scale image features; use a convolution layer to perform convolution processing on the multi-scale image features to obtain convolved image features; add the features of the input two-dimensional code image to the processed features to obtain encoded multi-scale features; the processed features are the features obtained by multiplying the image features after pre-activated convolution processing and the image features after convolution.
[0010] According to a two-dimensional code image reconstruction method provided by the present invention, the alternating reference feature fusion network module is specifically used to: respectively allocate feature attention weights for the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features based on residual channel attention processing to obtain the features to be reconstructed after attention allocation and the reference features after attention allocation; the features to be reconstructed after attention allocation perform self-attention learning on their own features to obtain the features to be reconstructed after self-attention learning; the reference features after attention allocation perform self-attention learning on their own features to obtain the reference features after self-attention learning; the features to be reconstructed after attention allocation and the reference features after attention allocation perform cross-attention learning to obtain the features after feature fusion learning.
[0011] The present invention also provides a two-dimensional code image reconstruction system, comprising: an image determination module, used to determine the two-dimensional code image to be reconstructed and the reference two-dimensional code image; an image reconstruction module, used to reconstruct the two-dimensional code image based on the two-dimensional code image to be reconstructed and the reference two-dimensional code image, based on a preset two-dimensional code image reconstruction deep learning network to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a method for reconstructing a two-dimensional code image as described above is implemented.
[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for reconstructing a two-dimensional code image as described in any one of the above is implemented.
[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for reconstructing a two-dimensional code image.
[0015] The present invention provides a method and system for reconstructing a two-dimensional code image, the method comprising: determining a two-dimensional code image to be reconstructed and a reference two-dimensional code image; reconstructing the two-dimensional code image based on a preset two-dimensional code image reconstruction deep learning network according to the two-dimensional code image to be reconstructed and the reference two-dimensional code image, to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image. The present invention uses a deep learning method to reconstruct the two-dimensional code image to be reconstructed, effectively improving the recognition rate and recognition accuracy of the two-dimensional code image. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a flow chart of a method for reconstructing a two-dimensional code image provided by the present invention.
[0018] Figure 2 It is a schematic diagram of the principle of a two-dimensional code image reconstruction method provided by the present invention.
[0019] Figure 3 It is a schematic diagram of the principle of the encoding module provided by the present invention.
[0020] Figure 4 It is a schematic diagram of the principle of the non-local feature processing module based on the multi-head self-attention mechanism provided by the present invention.
[0021] Figure 5 It is a schematic diagram of the principle of the residual channel attention module provided by the present invention.
[0022] Figure 6 It is a structural schematic diagram of a two-dimensional code image reconstruction system provided by the present invention.
[0023] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] A barcode is a set of bar and space symbols that are coded and arranged according to certain rules. It is used to express a set of information composed of characters such as numbers, letters, and symbols. It plays an important role in data entry and data collection. It is one of the most widely used technologies at present and plays an important role in commercial activities, daily life, and industrial manufacturing. Barcodes can be divided into one-dimensional barcodes and two-dimensional codes according to the arrangement of their bar and space symbols. The application scenarios of traditional one-dimensional barcodes are relatively limited, while two-dimensional codes have broadened the application scenarios of barcodes in daily life and industrial production. Compared with one-dimensional barcodes, two-dimensional codes have larger information capacity, easier recognition, higher reliability, and stronger security. There are many types of two-dimensional code systems, and the most common ones are QR code, DM code, PDF417 code, Code49 code, etc. Among them, QR code is the most widely used two-dimensional code system at present, and it is the first barcode system that can express Chinese characters. Compared with one-dimensional barcodes and other two-dimensional codes, QR codes have large information capacity, strong expressibility, and high reliability. Therefore, they have been widely used since their development and further expanded the application scenarios of two-dimensional codes. Due to the widespread popularity of QR codes, two-dimensional codes are often used to refer to QR codes in production, life, and academic research.
[0026] Although QR codes have been widely used, there are still a series of problems that need to be solved for the collection and recognition of QR codes. The restoration and reconstruction of low signal-to-noise ratio QR code images is one of the problems. Affected by the shooting equipment and shooting environment, the QR code images collected by the equipment often require image processing to be successfully recognized. Motion blur, defocus blur, low light environment, etc. are all common reasons that affect the quality of QR code images. For these low signal-to-noise ratio QR code images, the image preprocessing process of the decoding library can no longer restore them to the level where they can be successfully located and decoded. Therefore, it is necessary to restore and reconstruct the low signal-to-noise ratio QR code images to improve the image quality and ultimately achieve the purpose of optimizing the positioning and decoding of the QR code images.
[0027] As the demand for QR code image reconstruction and restoration gradually increases, the QR code image reconstruction work based on traditional methods is a general image restoration work, which adjusts the existing network structure parameters or loss functions, has weak generalization and low practicality.
[0028] In view of the shortcomings of the prior art, the present invention innovatively proposes a deep learning-based QR code image reconstruction method based on the strong structural features of QR codes. The present invention aims to guide the input image to learn the structural features of QR codes for QR code image reconstruction with the help of a small sample size reference QR code library, and significantly improve the recognition rate and recognition accuracy of QR code image reconstruction.
[0029] Please refer to Figure 1 , Figure 1 A schematic flow chart of a method for reconstructing a two-dimensional code image provided by the present invention.
[0030] Please refer to Figure 2 , Figure 2 A schematic diagram of the principle of a method for reconstructing a two-dimensional code image provided by the present invention.
[0031] The present invention provides a method for reconstructing a two-dimensional code image, comprising: 101: determining a two-dimensional code image to be reconstructed and a reference two-dimensional code image.
[0032] As a preferred embodiment, determining the two-dimensional code image to be reconstructed and the reference two-dimensional code image includes: obtaining the two-dimensional code image to be reconstructed; selecting a candidate reference image with the highest image similarity as the reference two-dimensional code image from a preset reference two-dimensional code library; the preset reference two-dimensional code library includes several candidate reference images.
[0033] As a preferred embodiment, a candidate reference image with the highest image similarity is selected from a preset reference two-dimensional code library as a reference two-dimensional code image, including: determining the Gabor features of the two-dimensional code image to be reconstructed and the Gabor features of all candidate reference images in the preset reference two-dimensional code library; calculating the similarity between the Gabor features of the two-dimensional code image to be reconstructed and the Gabor features of each candidate reference image based on a structural similarity algorithm to obtain a plurality of image similarity data; determining the highest image similarity data from the plurality of image similarity data, so as to use the candidate reference image corresponding to the highest image similarity data as the reference two-dimensional code image.
[0034] In this embodiment, for an input fuzzy two-dimensional code image (a two-dimensional code image to be reconstructed), a reference two-dimensional code image corresponding to the input two-dimensional code image to be reconstructed is selected from a preset reference two-dimensional code library of a small sample size according to a selection strategy. The reference two-dimensional code library is composed of a small number of reference two-dimensional code images, which are used as candidate reference two-dimensional codes in the present invention to provide a selection for the reference two-dimensional code image selection of the input two-dimensional code image to be reconstructed. The reference two-dimensional code image refers to a black and white high-definition two-dimensional code image that does not contain interference information and can guide the reconstruction of the two-dimensional code image to be reconstructed.
[0035] This embodiment adopts a selection strategy based on Gabor features to obtain a reference QR code image to guide the input QR code image to be reconstructed to learn the structural features of the QR code. Gabor features are used to describe the image texture information features. The image similarity between the QR code image to be reconstructed and the candidate reference QR code image is measured by Gabor features, and the candidate reference QR code image with the highest image similarity is selected from the preset reference QR code library as the final reference QR code image.
[0036] Gabor transform is a short-time windowed Fourier transform whose window function is a Gaussian function. The two-dimensional Gabor kernel function can be regarded as the superposition of the sine function and the Gaussian function. The specific definition of the two-dimensional Gabor kernel function is as follows:
[0037] Among them, (x0, y0) is the center point of the Gaussian kernel, θ is the rotation angle of the Gaussian kernel, (σ x ,σ y ) is the scale of the Gaussian kernel in two orthogonal directions, and (u0,v0) is the frequency domain coordinate. (x-x0) r and (y-y0) r The specific calculation formula is as follows:
[0038] Gabor features mainly rely on Gabor kernels to window the signal in the frequency domain, so that the local frequency information of the signal can be described. In the field of two-dimensional image processing, it can describe the image texture features. In order to measure the similarity between the Gabor features of the candidate reference two-dimensional code image and the two-dimensional code image to be reconstructed, the structural similarity (Structural Similarity, SSIM) is used as an evaluation index of image similarity in this embodiment. SSIM is an evaluation index for evaluating image similarity, which can comprehensively reflect the similarity between image pairs in three dimensions of brightness, contrast and structure. The value range is [0, 1]. The larger the value, the higher the similarity of the image pair. The candidate reference two-dimensional code image with the highest similarity is selected as the final reference two-dimensional code image by SSIM.
[0039] 102: Reconstruct the two-dimensional code image based on the two-dimensional code image to be reconstructed and the reference two-dimensional code image based on a preset two-dimensional code image reconstruction deep learning network to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
[0040] As a preferred embodiment, the preset two-dimensional code image reconstruction deep learning network includes an encoding module, an alternating reference feature fusion network module and a decoding module; the encoding module is used to encode the two-dimensional code image to be reconstructed and the reference two-dimensional code image respectively, extract multi-scale features based on the spatial attention mechanism, and obtain the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features; the alternating reference feature fusion network module is used to perform self-attention and cross-attention fusion learning according to the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features to obtain features after feature fusion learning; the decoding module is used to decode the features after feature fusion learning to obtain the reconstructed two-dimensional code image.
[0041] As a preferred embodiment, the encoding module is specifically used to: perform pre-activated convolution processing on the features of the input two-dimensional code image to obtain the image features after the pre-activated convolution processing; use the hourglass block in the residual branch to capture the features of the image features after the pre-activated convolution processing to obtain multi-scale image features; use the convolution layer to perform convolution processing on the multi-scale image features to obtain the convolved image features; add the features of the input two-dimensional code image to the processed features to obtain the encoded multi-scale features; the processed features are the features obtained by multiplying the image features after the pre-activated convolution processing and the image features after the convolution.
[0042] Please refer to Figure 3 , Figure 3 A schematic diagram of the principle of the encoding module provided by the present invention.
[0043] In this embodiment, the two-dimensional code image to be reconstructed and the reference two-dimensional code image are respectively input into the decoding module to obtain the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features. Specifically, this embodiment adopts an encoding module that introduces a spatial attention mechanism to learn multi-scale features. The encoding module of spatial attention is divided into two parts: a feature branch and an attention branch. The encoded multi-scale features output by the encoding module are the result of adding the features of the input two-dimensional code image to the processed features. The processed features are the features of the image features after pre-activated convolution processing and the features after convolution. The attention branch part uses an hourglass block and a convolution module, which can capture and convolve the image features after the activation convolution processing, extract multi-scale image features, and obtain attention features. The hourglass block contains a convolution module composed of multiple convolution layers, batch normalization layers and activation functions connected in series, and there are two skip branches at the same time, which retain the attention features of the original level while extracting higher-level features. The feature branch part is selected as the pre-activated residual unit of PReLU, and the batch normalization layer is added to avoid the gradient zero in ReLU.
[0044] As a preferred embodiment, the alternating reference feature fusion network module is specifically used to: respectively allocate feature attention weights for the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features based on the residual channel attention processing, so as to obtain the features to be reconstructed after attention allocation and the reference features after attention allocation; the features to be reconstructed after attention allocation perform self-attention learning on their own features to obtain the features to be reconstructed after self-attention learning; the reference features after attention allocation perform self-attention learning on their own features to obtain the reference features after self-attention learning; cross-attention learning is performed between the features to be reconstructed after attention allocation and the reference features after attention allocation to obtain the features after feature fusion learning.
[0045] Please refer to Figure 4 , Figure 4 A schematic diagram of the principle of a non-local feature processing module based on a multi-head self-attention mechanism provided by the present invention.
[0046] Please refer to Figure 5 , Figure 5 Schematic diagram of the principle of the residual channel attention module provided by the present invention.
[0047] In this embodiment, after the two-dimensional code image to be reconstructed and the reference two-dimensional code image are respectively subjected to the multi-scale feature extraction by the encoding module, the alternating reference feature fusion network module is used to enable self-attention and cross-attention fusion learning based on the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features. Specifically, the alternating reference feature fusion network module includes a sub-network stack consisting of a residual channel attention module RCAB (Residual Channel Attention Block) and a non-local feature processing module MNLM (MSA-based Non-Local Module) based on a multi-head self-attention mechanism.
[0048] For the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features, the residual channel attention module combines the channel attention mechanism with the residual idea, obtains the processed features through convolution-activation function-convolution operations, and then the processed features are assigned channel attention weights, and finally added to the encoded multi-scale features to obtain the features to be reconstructed after attention allocation and the reference features after attention allocation. The non-local feature processing module based on the multi-head self-attention mechanism performs non-local attention modeling on the self-attention and cross-attention of the features to be reconstructed after attention allocation and the reference features after attention allocation, expands the receptive field to the global, captures wider feature information, and introduces multi-head self-attention to improve the performance of module feature learning.
[0049] Finally, the features after feature fusion learning are sent to the decoding module to obtain the reconstructed two-dimensional code image. The decoding module structure used in the present invention is similar to the encoding module.
[0050] The following is a description of a two-dimensional code image reconstruction system provided by the present invention. The two-dimensional code image reconstruction system described below and the two-dimensional code image reconstruction method described above can be referenced to each other.
[0051] Please refer to Figure 6 , Figure 6 A schematic structural diagram of a two-dimensional code image reconstruction system provided by the present invention.
[0052] The present invention also provides a two-dimensional code image reconstruction system, comprising: an image determination module 1, used to determine the two-dimensional code image to be reconstructed and the reference two-dimensional code image; an image reconstruction module 2, used to reconstruct the two-dimensional code image based on the two-dimensional code image to be reconstructed and the reference two-dimensional code image based on a preset two-dimensional code image reconstruction deep learning network to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
[0053] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702 and the memory 703 communicate with each other through the communication bus 704. The processor 701 may call the logic instructions in the memory 703 to execute a method for reconstructing a two-dimensional code image, the method comprising: determining a two-dimensional code image to be reconstructed and a reference two-dimensional code image; reconstructing the two-dimensional code image based on a preset two-dimensional code image reconstruction deep learning network according to the two-dimensional code image to be reconstructed and the reference two-dimensional code image, to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
[0054] In addition, the logic instructions in the above-mentioned memory 703 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0055] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the two-dimensional code image reconstruction method provided by the above-mentioned methods, and the method includes: determining the two-dimensional code image to be reconstructed and the reference two-dimensional code image; reconstructing the two-dimensional code image based on a preset two-dimensional code image reconstruction deep learning network according to the two-dimensional code image to be reconstructed and the reference two-dimensional code image to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
[0056] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the two-dimensional code image reconstruction method provided by the above-mentioned methods, the method comprising: determining the two-dimensional code image to be reconstructed and the reference two-dimensional code image; reconstructing the two-dimensional code image based on a preset two-dimensional code image reconstruction deep learning network according to the two-dimensional code image to be reconstructed and the reference two-dimensional code image to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
[0057] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0058] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0059] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for reconstructing a two-dimensional code image, characterized in that: include: Determine a to-be-reconstructed two-dimensional code image and a reference two-dimensional code image; According to the two-dimensional code image to be reconstructed and the reference two-dimensional code image, the two-dimensional code image is reconstructed based on a preset two-dimensional code image reconstruction deep learning network to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
2. The method for reconstructing a two-dimensional code image according to claim 1, characterized in that: The preset two-dimensional code image reconstruction deep learning network includes an encoding module, an alternating reference feature fusion network module and a decoding module; The encoding module is used to encode the two-dimensional code image to be reconstructed and the reference two-dimensional code image respectively, extract multi-scale features based on the spatial attention mechanism, and obtain the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features; the alternating reference feature fusion network module is used to perform self-attention and cross-attention fusion learning according to the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features, and obtain features after feature fusion learning; The decoding module is used to decode the features learned after the feature fusion to obtain the reconstructed two-dimensional code image.
3. The method for reconstructing a two-dimensional code image according to claim 1, characterized in that: The step of determining the to-be-reconstructed two-dimensional code image and the reference two-dimensional code image comprises: Acquire the two-dimensional code image to be reconstructed; A candidate reference image with the highest image similarity is selected from a preset reference two-dimensional code library as the reference two-dimensional code image; the preset reference two-dimensional code library includes a plurality of the candidate reference images.
4. The method for reconstructing a two-dimensional code image according to claim 3, characterized in that: The step of selecting a candidate reference image with the highest image similarity from a preset reference two-dimensional code library as the reference two-dimensional code image comprises: Determine the Gabor features of the to-be-reconstructed two-dimensional code image and the Gabor features of all the candidate reference images in the preset reference two-dimensional code library; Based on the structural similarity algorithm, respectively calculating the similarity between the Gabor features of the to-be-reconstructed two-dimensional code image and the Gabor features of each candidate reference image, and obtaining a plurality of image similarity data; The highest image similarity data is determined from the plurality of image similarity data, so that the candidate reference image corresponding to the highest image similarity data is used as the reference two-dimensional code image.
5. The method for reconstructing a two-dimensional code image according to claim 2, characterized in that: The encoding module is specifically used to: perform pre-activation convolution processing on the features of the input two-dimensional code image to obtain image features after the pre-activation convolution processing; In the residual branch, an hourglass block is used to capture the image features after the pre-activated convolution processing to obtain multi-scale image features; Using a convolution layer to perform convolution processing on the multi-scale image features to obtain convolved image features; The features of the input two-dimensional code image are added to the processed features to obtain encoded multi-scale features; the processed features are the features obtained by multiplying the image features after the pre-activated convolution processing and the image features after the convolution.
6. The method for reconstructing a two-dimensional code image according to claim 2, characterized in that: The alternating reference feature fusion network module is specifically used for: Performing feature attention weight allocation on the encoded multi-scale features to be reconstructed and the encoded reference multi-scale features based on residual channel attention processing to obtain features to be reconstructed after attention allocation and reference features after attention allocation; The feature to be reconstructed after the attention allocation performs self-attention learning on its own feature to obtain the feature to be reconstructed after self-attention learning; the reference feature after the attention allocation performs self-attention learning on its own feature to obtain the reference feature after self-attention learning; Cross-attention learning is performed between the features to be reconstructed after the attention allocation and the reference features after the attention allocation to obtain the features after the feature fusion learning.
7. A two-dimensional code image reconstruction system, characterized in that: include: An image determination module, used to determine the two-dimensional code image to be reconstructed and the reference two-dimensional code image; An image reconstruction module is used to reconstruct the two-dimensional code image according to the two-dimensional code image to be reconstructed and the reference two-dimensional code image based on a preset two-dimensional code image reconstruction deep learning network to obtain a reconstructed two-dimensional code image; the preset two-dimensional code image reconstruction deep learning network is used to guide the two-dimensional code image to be reconstructed to learn the structural features of the reference two-dimensional code image.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for reconstructing a two-dimensional code image as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for reconstructing a two-dimensional code image as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for reconstructing a two-dimensional code image as claimed in any one of claims 1 to 6 is implemented.
