CN-121998870-A - Two-dimensional code image fuzzy region restoration method based on deep learning
Abstract
The invention discloses a two-dimensional code image fuzzy region restoration method based on deep learning, which relates to the technical field of two-dimensional code image fuzzy region restoration and comprises the steps of obtaining a fuzzy two-dimensional code image, executing positioning pattern detection on the fuzzy two-dimensional code image to obtain a positioning pattern region, estimating a local fuzzy core based on the positioning pattern region, constructing a non-uniform fuzzy degradation model, inputting the fuzzy two-dimensional code image into a module-level semantic segmentation network to obtain a functional module semantic map, generating a semantic-function joint attention weight map according to the functional module semantic map and a preset decoding vulnerability weight map, inputting the fuzzy two-dimensional code image, the non-uniform fuzzy degradation model and the semantic-function joint attention weight map into a deep restoration network to obtain a preliminary restoration image, performing differentiable binarization on the preliminary restoration image, sending the preliminary restoration image into a differentiable decoder to obtain a decoding confidence feedback signal, and combining pixels according to the decoding confidence feedback signal.
Inventors
- LI TIANCHI
- LIU SHUPING
- ZHOU HONGGEN
- ZHOU ZHIZHEN
- PENG JIANBIAO
- Xiao Zide
Assignees
- 江西旭昇电子股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260126
Claims (8)
- 1. A two-dimensional code image fuzzy region restoration method based on deep learning is characterized by comprising the following steps: Acquiring a blurred two-dimensional code image, and executing positioning pattern detection on the blurred two-dimensional code image to obtain a positioning pattern area; estimating a local fuzzy core based on the positioning pattern region, and constructing a non-uniform fuzzy degradation model; Inputting the fuzzy two-dimensional code image into a module-level semantic segmentation network to obtain a functional module semantic graph; generating a semantic-functional joint attention weight graph according to the functional module semantic graph and a preset decoding vulnerability weight graph, and inputting a fuzzy two-dimensional code image, a non-uniform fuzzy degradation model and the semantic-functional joint attention weight graph into a deep restoration network to obtain a preliminary restoration image; performing differential binarization on the preliminary repair image and sending the preliminary repair image to a differential decoder to obtain a decoding confidence feedback signal; And optimizing a depth repair network according to the combination of the decoding confidence feedback signals and pixel fidelity and the structural edge keeping and functional area consistency constraint, and outputting a repair two-dimensional code image which is subjected to local self-adaptive threshold post-processing in an reasoning stage.
- 2. The method for repairing the blurred region of the two-dimensional code image based on the deep learning of claim 1, wherein the method for performing the positioning pattern detection on the blurred two-dimensional code image to obtain the positioning pattern region comprises the following specific steps of: inputting a fuzzy two-dimensional code image into a lightweight convolutional neural network, wherein the network comprises a three-stage convolutional layer and a two-stage maximum pooling layer, and extracting spatial features layer by layer; Sending the final-stage feature map into a feature pyramid module to generate three-scale feature representations; Sliding anchor frames with preset sizes on each scale feature map with fixed step length, and calculating normalized cross-correlation response values of each anchor frame region and the standard positioning pattern template; selecting three non-overlapping areas with highest cross-correlation response values from all scales as candidate positioning pattern areas; Performing coordinate regression fine adjustment on each candidate region, and outputting the center coordinates of the positioning pattern region And side length Wherein the subscripts The values are 1, 2 and 3, and correspond to the upper left, upper right and lower left corner positioning patterns respectively.
- 3. The two-dimensional code image fuzzy region restoration method based on deep learning of claim 2, wherein the method is characterized by estimating local fuzzy core based on the positioning pattern region and constructing a non-uniform fuzzy degradation model, and comprises the following specific steps: At the center of each positioning pattern area As an origin, the size is cut in the blurred two-dimensional code image as follows Is a local image block of (a) ; Will be Inputting local fuzzy core estimation sub-network, which is composed of four layers of convolution and global average pooling, outputting corresponding local point spread function The size is ; Defining arbitrary positions of an image Global fuzzy core at Three local kernels are weighted and fused through radial basis functions, and the expression is as follows: ; Wherein, the Is the first Individual positioning pattern pair position The calculation formula is as follows: ; Wherein, the Representing pixel location And the first Center of each positioning pattern Is used for the distance of euclidean distance, The method is used for controlling the influence range of the local fuzzy core for a preset spatial attenuation coefficient; Will be And performing discrete sampling on the whole image to form a three-dimensional tensor with the same size as the blurred two-dimensional code image, and taking the three-dimensional tensor as a non-uniform blurred degradation model.
- 4. The two-dimensional code image fuzzy region restoration method based on deep learning of claim 3, wherein the step of inputting the fuzzy two-dimensional code image into a module-level semantic segmentation network to obtain a functional module semantic graph comprises the following specific steps: Processing the fuzzy two-dimensional code image by adopting a semantic segmentation network of an encoder-decoder structure, wherein the encoder part comprises five-stage downsampling convolution blocks, and each stage comprises two convolution layers and a maximum pooling layer; the decoder part is connected with the feature map of the corresponding level of the fusion encoder through jumping, and gradually upsamples to restore the spatial resolution; The decoder outputs a four-channel probability map finally, and the four functional areas correspond to the positioning pattern, the time sequence pattern, the alignment pattern and the data module respectively; binarization is carried out on each channel by applying a threshold value of 0.5 to generate a four-channel functional module semantic graph Wherein 、 、 、 For the boolean mask, the location of the corresponding functional area is identified.
- 5. The method for repairing the fuzzy region of the two-dimensional code image based on the deep learning of claim 4, wherein the semantic-functional joint attention weight graph is generated according to the semantic graph of the functional module and a preset decoding vulnerability weight graph, and the method comprises the following specific steps: acquiring a preset decoding vulnerability weight graph The graph is obtained by offline statistical analysis, including: Manually introducing single-bit overturn errors into each module position of a standard two-dimensional code, recording the frequency of complete failure of a decoding flow, and forming a weight graph with the same size as a two-dimensional code image after normalization The weight values corresponding to the format information area, the version information area and the mask identification bits are obviously higher than those of the common data module area; constructing an initial attention diagram Order-making I.e. the critical functional area of all non-data modules is set to 1; Masking data module regions And decoding vulnerability weight map Multiplying element by element to obtain vulnerability modulation diagram ; Combined attention-seeking diagram ; For a pair of Normalizing by Softmax function to generate semantic-function joint attention weight graph The method is used for modulating the characteristic response intensity of each spatial position in the depth repair network.
- 6. The method for repairing the fuzzy region of the two-dimensional code image based on the deep learning of claim 5, wherein the method is characterized in that the preliminary repairing image is subjected to differential binarization and sent to a differential decoder to obtain a decoding confidence feedback signal, and comprises the following specific steps: For preliminary repair image Performing differentiable binarization operations to generate successive approximation binary images The pixel value is calculated by the following formula: ; Wherein, the Representing the location of the preliminary repair image The gray value at which the color is to be changed, Controlling the steepness of the Sigmoid function as a temperature parameter, thereby adjusting the sharpness of binarization; Will be Inputting a differential decoder which simulates a standard two-dimensional code decoding flow and sequentially executes synchronous code searching, format information extracting, mask type identifying and Reed-Solomon error correction decoding; Recording three decoding intermediate indexes including synchronous code matching score Format check boolean outcome Reed-Solomon error correction margin ; The three indexes are weighted and fused to form a decoding confidence feedback signal The calculation formula is as follows: ; Wherein, the 、 、 Is a preset positive real weight coefficient and is used for balancing the importance of different decoding stages.
- 7. The two-dimensional code image fuzzy region restoration method based on deep learning of claim 6, wherein the feedback signal is combined with pixel fidelity according to decoding confidence, and the structural edge is kept consistent with the functional region to constrain and optimize the deep restoration network, and the specific steps are as follows: Constructing a composite training loss function Comprises the following four items: the first term is pixel fidelity loss The L1 norm is adopted to measure the restored image And clear reference image Differences (i.e.) ; The second term is structural edge retention loss By Sobel operator Extracting image gradient, and calculating gradient difference between the repair image and the reference image, namely: ; the third term is the functional area consistency loss Using semantic-functional joint attention weighting graphs The errors are weighted, and the repair precision of the key area is emphasized, namely: ; the fourth term directs loss of decoding confidence Encouraging decoding confidence in a range format Exceeding a preset threshold The method comprises the following steps: ; the four losses are weighted and summed to obtain a total loss function: ; Wherein, the 、 、 、 Is a preset positive real number super parameter; Calculation by back propagation algorithm And (3) carrying out gradient on the parameters of the deep repair network, and updating the network weight by adopting an adaptive optimizer.
- 8. The method for repairing the fuzzy region of the two-dimensional code image based on the deep learning of claim 7, wherein the method for repairing the two-dimensional code image by outputting the locally adaptive threshold post-processing in the reasoning stage comprises the following specific steps: Repair image output to depth repair network In window size Sliding through the whole image; at the center of each window Calculating the mean value of pixels in the neighborhood And standard deviation of ; Setting local dynamic thresholds The method comprises the following steps: ; Wherein, the The method comprises the steps of setting a preset proportionality coefficient for controlling the offset of a threshold value relative to a local mean value; for repairing images Each pixel of (3) Judging if The output pixel value is 1, otherwise is 0; Generating a final repair two-dimensional code image 。
Description
Two-dimensional code image fuzzy region restoration method based on deep learning Technical Field The invention relates to the technical field of two-dimensional code image fuzzy region restoration, in particular to a two-dimensional code image fuzzy region restoration method based on deep learning. Background The two-dimensional code image blurring region restoration technology is a special image restoration technology which is used for restoring an original clear structure of a two-dimensional code image by an algorithm means and ensuring that a restored image can be successfully read by standard code scanning equipment aiming at the problem of local or whole blurring degradation of the two-dimensional code image caused by motion blurring, defocus blurring, compression artifacts, low resolution or severe shooting conditions. Therefore, how to improve the intelligentization level and the safety of the repair of the two-dimensional code image fuzzy region by using an advanced technical means becomes one of the problems to be solved currently. The existing image deblurring or repairing method based on deep learning aims at improving visual quality, most of optimization indexes are PSNR, SSIM or perception loss, when the method is used for processing a blurred two-dimensional code, although the image can be seen clearly, a repairing result cannot be correctly decoded by code scanning equipment due to module boundary blurring, black-and-white inversion or structural distortion, so that the functionality is invalid, and most blind deblurring methods assume that a blurring kernel is spatially unchanged in the whole image, but in actual shooting, the blurring degree of the two-dimensional code image has obvious differences in different areas due to handheld shake, focusing deviation or perspective distortion. The prior art lacks efficient modeling of non-uniform blur, resulting in post-repair positioning pattern defects or data module misplacement. Disclosure of Invention The present invention has been made in view of the above-described problems occurring in the prior art. Therefore, the invention provides a two-dimensional code image blurring region restoration method based on deep learning, which solves the problems that the existing image deblurring or restoration method based on deep learning aims at improving visual quality, optimization indexes are PSNR, SSIM or perception loss, and when the method processes a blurred two-dimensional code, although the image can be seen clearly, a restoration result cannot be correctly decoded by code scanning equipment due to blurring of a module boundary, black-white inversion or structural distortion, so that functionality is invalid. In order to solve the technical problems, the invention provides the following technical scheme: The invention provides a two-dimensional code image fuzzy region restoration method based on deep learning, which comprises the following steps: Acquiring a blurred two-dimensional code image, and executing positioning pattern detection on the blurred two-dimensional code image to obtain a positioning pattern area; estimating a local fuzzy core based on the positioning pattern region, and constructing a non-uniform fuzzy degradation model; Inputting the fuzzy two-dimensional code image into a module-level semantic segmentation network to obtain a functional module semantic graph; generating a semantic-functional joint attention weight graph according to the functional module semantic graph and a preset decoding vulnerability weight graph, and inputting a fuzzy two-dimensional code image, a non-uniform fuzzy degradation model and the semantic-functional joint attention weight graph into a deep restoration network to obtain a preliminary restoration image; performing differential binarization on the preliminary repair image and sending the preliminary repair image to a differential decoder to obtain a decoding confidence feedback signal; And optimizing a depth repair network according to the combination of the decoding confidence feedback signals and pixel fidelity and the structural edge keeping and functional area consistency constraint, and outputting a repair two-dimensional code image which is subjected to local self-adaptive threshold post-processing in an reasoning stage. The method for repairing the fuzzy region of the two-dimensional code image based on the deep learning is characterized by comprising the following specific steps of: inputting a fuzzy two-dimensional code image into a lightweight convolutional neural network, wherein the network comprises a three-stage convolutional layer and a two-stage maximum pooling layer, and extracting spatial features layer by layer; Sending the final-stage feature map into a feature pyramid module to generate three-scale feature representations; Sliding anchor frames with preset sizes on each scale feature map with fixed step length, and calculating normalized cross-correlation response values of