CN115719317A - Two-dimensional code deblurring method and device, electronic equipment and storage medium - Google Patents

Two-dimensional code deblurring method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115719317A
CN115719317A CN202211488393.6A CN202211488393A CN115719317A CN 115719317 A CN115719317 A CN 115719317A CN 202211488393 A CN202211488393 A CN 202211488393A CN 115719317 A CN115719317 A CN 115719317A
Authority
CN
China
Prior art keywords
dimensional code
layer
deblurring
picture
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211488393.6A
Other languages
Chinese (zh)
Inventor
孙科学
蒋志鹏
成谢锋
谷文成
崔国权
哈文嘉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University of Posts and Telecommunications
Original Assignee
Nanjing University of Posts and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University of Posts and Telecommunications filed Critical Nanjing University of Posts and Telecommunications
Priority to CN202211488393.6A priority Critical patent/CN115719317A/en
Publication of CN115719317A publication Critical patent/CN115719317A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

The invention discloses a two-dimension code deblurring method, a device, electronic equipment and a storage medium, wherein the method comprises the steps of obtaining a blurred two-dimension code picture; inputting the fuzzy two-dimensional code picture into a pre-constructed and trained two-dimensional code deblurring model to realize correction processing on the fuzzy two-dimensional code picture; the method for constructing and training the two-dimensional code deblurring model comprises the following steps: acquiring a two-dimensional code deblurring data set, wherein the data set comprises blurred image feature maps with different scales; inputting the fuzzy image characteristic diagrams of different scales into a pre-constructed generation network module of an FPN structure for pre-training to generate a pre-trained two-dimensional code deblurring model; the pre-trained two-dimensional code deblurring model is added into a pre-established double-scale discriminator for training to obtain a trained two-dimensional code deblurring model.

Description

Two-dimensional code deblurring method and device, electronic equipment and storage medium
Technical Field
The invention relates to a two-dimensional code deblurring method and device, electronic equipment and a storage medium, and belongs to the technical field of industrial Internet of things.
Background
Nowadays, two-dimensional code has widely been applied to industry thing networking field, and more mill, logistics management use two-dimensional code to store information, and the condition that appears fuzzy very easily because sweep factors such as sign indicating number equipment shake, relative motion between equipment and the object and imaging system degradation, this can lead to can't in time obtaining complete information on the two-dimensional code, influences the industrial production activity. This also makes the two-dimensional code deblurring research more and more interesting as a new research direction.
With the emergence of deep learning algorithms and special neural network processors, the deep learning technology is applied to various industries, and the image deblurring technology is also rapidly developed and greatly improved after the convolutional neural network is provided. Current deblurring algorithms can be roughly divided into two categories: blind deconvolution and non-blind deconvolution. The distinguishing core of the two categories of deblurring algorithms lies in whether a blur kernel of a blurred image is known or not, wherein blind deconvolution is used for restoring the blurred image into a clear image under the condition that the blur kernel and other information are not known; for non-blind deconvolution, it is relatively easy to provide the information of the blur kernel before deblurring, and then perform deconvolution of the image.
The antagonistic generation neural network (GAN) is a typical non-blind deconvolution algorithm, and has achieved unprecedented progress in the field of deblurring. The method combines the generation of the countermeasure network and the content loss function under the network use conditions of DeblurgAN and the like, directly removes image blur generated by motion, avoids the estimation problem of a blur kernel, directly generates a sharpened image end to end and obtains better effect. However, the layer of the DeblurGAN network designed based on GAN is deep, the operation of the model needs to occupy a large space, and the operation speed is about 1s, so that the real-time efficient deblurring task of the blurred two-dimensional code in real life cannot be well completed.
Disclosure of Invention
The invention aims to overcome the defects in the prior art, provides a two-dimensional code deblurring method, a device, electronic equipment and a storage medium, and solves the problem that a two-dimensional code image is blurred and cannot be detected due to factors such as jitter of code scanning equipment and relative motion between the equipment and an object.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a two-dimensional code deblurring method, including:
acquiring a fuzzy two-dimensional code picture;
inputting the fuzzy two-dimensional code picture into a pre-constructed and trained two-dimensional code deblurring model to realize correction processing on the fuzzy two-dimensional code picture;
the method for constructing and training the two-dimensional code deblurring model comprises the following steps:
acquiring a two-dimensional code deblurring data set, wherein the data set comprises blurred image feature maps with different scales;
inputting the fuzzy image characteristic diagrams of different scales into a pre-constructed generation network module of an FPN structure for pre-training to generate a pre-trained two-dimensional code deblurring model;
and adding the pre-trained two-dimensional code deblurring model into a pre-established double-scale discriminator for training to obtain a trained two-dimensional code deblurring model.
Further, the generating network module of the FPN structure comprises a multi-scale feature FPN framework and a lightweight MobileNet V3 backbone network, the lightweight MobileNet V3 backbone network comprises 16 layers, the first layer is provided with a convolution layer, the second layer to the twelfth layer are composed of bneck modules, the thirteenth layer is a convolution layer, the fourteenth layer is an average pooling layer, and the fifteenth layer and the sixteenth layer are composed of two 1x1 convolution cores.
Further, when inputting the blurred image feature maps with different scales into a pre-constructed generation network module of the FPN structure for pre-training, an L1 loss function is adopted:
L 1 (f(x),y)=∑|y-f(x)|
where x denotes the input blurred picture, f (x) denotes the deblurred picture, and y denotes the sharp picture corresponding to the blurred picture.
Further, the dual-scale discriminators are a local feature discriminator with the size of 70x70 and a global image discriminator with the size of 256x256 respectively, the two discriminators are identical in structure, each discriminator comprises 5 layers of convolution modules, the first layer of convolution module and the 5 th layer of convolution module are composed of zero fill function ZeroPad2d and convolution kernels with the size of 3x3, and normalization functions BatchNorm2d are added into the second layer convolution module and the fourth layer of convolution module.
Further, when the pre-trained two-dimensional code deblurring model is added into a pre-established dual-scale discriminator for training, the loss function in the training process comprises a pixel space loss function, a content loss function and a countermeasure loss function:
the pixel spatial loss function is:
Figure BDA0003963250290000031
wherein S represents a sharp picture, G (B) represents a deblurred picture by generating a network, W, H represents a picture dimension;
the penalty function is:
L adv
E S~Psharp(S) [(D(S)-E B~Pblurred(B) D(G(B))-1) 2 ]
+E B-Pblurred(B) [(D(G(B))-E S-Psharp(S) D(S)+1) 2 ]
the method comprises the steps that S represents a clear two-dimensional code picture corresponding to an input fuzzy two-dimensional code picture, B represents the input fuzzy two-dimensional code picture, D (G (B)) represents that a picture for generating network deblurring is input into a discriminator, S-Psharp (S) represents that the clear two-dimensional code picture is sampled in a concentrated mode, B-Pblurred (B) represents that the clear two-dimensional code picture is sampled in a concentrated mode, and E is an expected value;
the content loss function is:
Figure BDA0003963250290000041
wherein S represents a clear two-dimensional code picture corresponding to the input blurred two-dimensional code picture, B represents the input blurred two-dimensional code picture, W i,j 、H i,j Is the dimension of the feature map, represents the width and height of the feature map, and is the feature map of the jth convolution before the ith pooling layer;
the overall loss function is:
L=a×L P +b×L C +c×L adv
where parameter a is set to 0.006, parameter b is set to 0.5, and parameter c is set to 0.01.
In a second aspect, the present invention provides a two-dimensional code deblurring apparatus, including:
the image acquisition module is used for acquiring a fuzzy two-dimensional code image;
the deblurring module is used for inputting the blurred two-dimensional code picture into a pre-constructed and trained two-dimensional code deblurring model so as to realize correction processing on the blurred two-dimensional code picture;
wherein, including the construction and the training module of two-dimensional code deblurring model in the deblurring module, the construction and the training module of two-dimensional code deblurring model include:
the data set acquisition unit is used for acquiring a two-dimensional code deblurring data set, and the data set comprises blurred image feature maps with different scales;
the pre-training unit is used for inputting the fuzzy image characteristic diagrams with different scales into a pre-constructed generation network module of an FPN structure for pre-training to generate a pre-trained two-dimensional code deblurring model;
and the training unit is used for adding the pre-trained two-dimensional code deblurring model into a pre-established double-scale discriminator for training to obtain a trained two-dimensional code deblurring model.
Further, the generating network module of the FPN structure includes a multi-scale feature FPN framework and a lightweight MobileNetV3 backbone network, the lightweight MobileNetV3 backbone network has 16 layers, the first layer is provided with a convolutional layer, the second layer to the twelfth layer are formed by bneck modules, the thirteenth layer is a convolutional layer, the fourteenth layer is an average pooling layer, and the fifteenth layer and the sixteenth layer are formed by two 1 × 1 convolutional cores.
Further, the dual-scale discriminators are a local feature discriminator with the size of 70x70 and a global image discriminator with the size of 256x256 respectively, the two discriminators are identical in structure, each discriminator comprises 5 layers of convolution modules, the first layer of convolution module and the 5 th layer of convolution module are composed of zero fill function ZeroPad2d and convolution kernels with the size of 3x3, and normalization functions BatchNorm2d are added into the second layer convolution module and the fourth layer of convolution module.
In a third aspect, the present invention provides an electronic device comprising a processor and a storage medium;
the storage medium is used for storing instructions;
the processor is configured to operate in accordance with the instructions to perform the steps of the method according to any one of the preceding claims.
In a fourth aspect, the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of any one of the preceding claims.
Compared with the prior art, the invention has the following beneficial effects:
1. the invention provides a two-dimensional code deblurring method, a device, electronic equipment and a storage medium, wherein the two-dimensional code deblurring processing is completed by combining a generation network module of an FPN structure and a double-scale discriminator, a good detection effect is obtained on a data set, the running speed of a model is accelerated, and the correction capability of a blurred two-dimensional code is remarkably improved.
2. The invention provides a two-dimensional code deblurring method, a device, electronic equipment and a storage medium, which can greatly improve the performance of an algorithm by adopting a multi-scale feature FPN framework to select and combine input features with different scales, and can improve the processing capability of the algorithm on a blurred image by using a lightweight MobileNet V3 feature extraction network if applied to the deblurring algorithm, so that the algorithm has a better correction effect on the blurred image. In addition, the dual-scale discriminator with reference to the global features and the local features can well update and optimize the generated network parameters.
Drawings
Fig. 1 is a flowchart of a two-dimensional code deblurring method according to an embodiment of the present invention;
FIG. 2 is a network structure diagram of MobileNet-V3 according to an embodiment of the present invention;
FIG. 3 is a diagram of a generator network architecture provided by an embodiment of the present invention;
FIG. 4 is a diagram of a network structure of an arbiter provided by an embodiment of the present invention;
fig. 5 and 6 are exemplary diagrams of a two-dimensional code deblurring method according to an embodiment of the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.
Example 1
The embodiment introduces a method for deblurring a two-dimensional code, including:
acquiring a fuzzy two-dimensional code picture;
inputting the fuzzy two-dimensional code picture into a pre-constructed and trained two-dimensional code deblurring model to realize correction processing on the fuzzy two-dimensional code picture;
the method for constructing and training the two-dimensional code deblurring model comprises the following steps:
acquiring a two-dimensional code deblurring data set, wherein the data set comprises blurred image feature maps with different scales;
inputting the fuzzy image characteristic diagrams of different scales into a pre-constructed generation network module of an FPN structure for pre-training to generate a pre-trained two-dimensional code deblurring model;
and adding the pre-trained two-dimensional code deblurring model into a pre-established double-scale discriminator for training to obtain a trained two-dimensional code deblurring model.
The application process of the two-dimensional code deblurring method provided by the embodiment specifically relates to the following steps:
s1, acquiring a two-dimensional code deblurring data set;
s2, establishing a generating module of the FPN structure, inputting a two-dimension code deblurring data set, and pre-training the generating module of the FPN structure to obtain a pre-training model;
s3, establishing a double-scale discriminator, wherein the double-scale discriminator can carry out characteristic discrimination on the input deblurred picture and the clear picture corresponding to the deblurred picture to obtain information;
s4, loading a pre-training model to the FPN structure generation network module and adding a discriminator for training;
and S5, correcting the fuzzy two-dimensional code by using the two-dimensional code deblurring model.
Preferably, the S2 specifically includes the following steps:
s21, adopting a lightweight MobileNet V3 feature extraction network, wherein the network has 16 layers, and selecting fuzzy image feature maps with different scales from 5 layers (1,2,4,9, 12) to output to the next layer;
and S22, merging the feature graphs of different scales input by the feature extraction network of the previous layer by adopting a multi-scale feature FPN framework.
S23, adding global residual connection and then generating a clear picture;
and S24, pre-training the generation network module of the FPN structure to obtain a pre-training model.
Preferably, the dual-scale discriminator in S3 is designed as follows:
s31, the double-scale discriminator comprises a local feature discriminator with the size of 70x70 and a global image discriminator with the size of 256x 256;
s32, the discriminator comprises a 5-layer convolution module; the first layer convolution module and the 5 th layer convolution module are composed of zero filling functions zeroPad2d and convolution kernels with the size of 3x3, and normalization functions BatchNorm2d are added into the second layer convolution module and the fourth layer convolution module.
The contents designed in the above embodiments will be described below with reference to a preferred embodiment.
The invention provides a two-dimensional code deblurring method based on a countermeasure generation neural network (GAN), which combines a generation network module of an FPN structure with a dual-scale discriminator and is used for deblurring two-dimensional codes, and mainly solves the problem of undesirable blurring caused by the jitter of code scanning equipment and the relative motion between the equipment and an object. Compared with the existing method, the two-dimensional code deblurring method has good effects on visual effects and objective evaluation indexes.
The two-dimensional code deblurring method based on the countermeasure generation neural network (GAN) of the embodiment comprises the following steps: and establishing a generating network module and a double-scale discriminator of the FPN structure. The generator network structure of the feature pyramid structure (FPN) comprises a multi-scale feature FPN framework and a lightweight MobileNet V3 feature extraction network, wherein the feature extraction network comprises 16 layers, 5 layers (1,2,4,9, 12) are selected to select fuzzy image feature maps with different scales, the fuzzy image feature maps are used as feature maps with different scales of the multi-scale feature FPN framework to be combined, global residual errors are added to be connected, and then a clear picture is generated. The dual-scale discriminator is used for carrying out local feature discrimination on a 70x 70-size image and discriminating a 256x 256-size global image, so that two resistance losses are generated, and richer information is provided for a generator. The input of the network generation module is a two-dimensional code fuzzy picture, and the output is a deblurred picture.
Fig. 1 is an exemplary flowchart of a two-dimensional code deblurring method according to an embodiment of the present application. The two-dimensional code deblurring method comprises the following steps.
S1, acquiring a two-dimensional code deblurring data set.
The S1 specifically comprises a self-made two-dimensional code deblurring data set, and 1000 clear two-dimensional code images are selected to generate the data set containing a Gaussian blur kernel and a motion blur kernel. The generated fuzzy two-dimensional code picture is formed by combining fuzzy cores with different sizes and noise. Gaussian blur kernels of different sizes were randomly superimposed on our images. For the motion blur kernel, we fix the motion angle of the motion blur kernel to 30 degrees and randomly select the length in {10, 11, 12 }. We add gaussian noise, salt and pepper noise, and speckle noise in addition to these two kinds of blur. We generated 2000 blurred pictures, which included 1000 gaussian blurred images and 1000 motion blurred images. We also chose 100 clear pictures and make the test set as above. The clear pictures and the blurred pictures in the data set correspond one to one.
S2, establishing a generating module of the FPN structure to extract the fuzzy image characteristic diagrams of different scales, generating a clear picture through global residual connection, and pre-training the generating module to obtain a pre-training model.
The S2 specifically comprises the following steps:
and (3) establishing an FPN structure, wherein a network generation module of the FPN structure comprises a multi-scale feature FPN framework and a lightweight MobileNet V3 backbone network as shown in figure 2.
S21, as shown in FIG. 3, the lightweight MobileNet V3 backbone network has 16 layers, wherein the first layer is provided with a convolution layer, the second layer to the twelfth layer are composed of a bneck module, the thirteenth layer is a convolution layer, the fourteenth layer is an average pooling layer, and the last two layers are composed of two 1x1 convolution kernels. Table 1 shows the specific parameter settings for MobileNetV3, where SE represents whether the layer uses the channel attention mechanism. NL represents the type of activation function used for the layer, NBN represents the absence of the Batch Normalization operation, and s represents the number of stride steps of the stride of the layer's convolution kernel. MoblieNet V3 uses two non-linear activation functions HS (H-Swish) and RE (ReLU).
TABLE 1
Figure BDA0003963250290000091
Figure BDA0003963250290000101
The nonlinear activation function H-Swish is:
Figure BDA0003963250290000102
the nonlinear activation function ReLU is:
Figure BDA0003963250290000103
and performing feature extraction on the original picture through the lightweight MobileNet V3, and selecting 5 layers (1,2,4,9, 12) of the original picture to obtain 5 feature maps with different sizes and different detail information. As shown in fig. 2, firstly, 3x3 convolution is performed on a blurred picture 256x256x3 of an input network, and downsampling is performed to obtain a 128x128x16 feature map layer0, and then, the MobileNetV3 is extracted to extract 4 feature maps with different sizes: 64x64x16 (layer 1), 32x32x24 (layer 2), 16x16x48 (layer 3), 8x8x96 (layer 4).
S22, the generation network module of the FPN structure can rapidly deduce and deblur the two-dimensional code. Performing 1x1 convolution on the feature maps layer0, layer1, layer2, layer3 and layer4 to change the number of feature channels to be 128, performing 2 times of upsampling, fusing the upsampled feature maps with the feature map of the previous layer to respectively obtain feature maps map4, map3, map2 and map1, and performing 1x1 convolution on the feature map layer0 to change the number of feature channels to be 64 to obtain a feature map0; performing 3x3 convolution operation on map 4-map 1, changing the number of characteristic channels to 64, then performing up-sampling to 1/4 of the original input picture size and connecting the size to form a 64x64x256 tensor, performing characteristic fusion on the tensor through 3x3 convolution and changing the number of channels to 64, and then performing twice up-sampling and performing characteristic fusion on the tensor and the characteristic image B1 to obtain a characteristic image; the feature fused feature map is up-sampled twice again and subjected to a convolution operation with a convolution kernel size of 3x 3.
And S23, finally, introducing an input to output direct connection, and outputting the deblurred picture.
And S24, pre-training the generating network module of the FPN structure to obtain a pre-training model.
An L1 loss function is adopted in the pre-training process:
L 1 (f(x),y)=∑|y-f(x)|
where x denotes the input blurred picture, f (x) denotes the deblurred picture, and y denotes the sharp picture corresponding to the blurred picture. For a total of 1000 pre-training iterations, and save the best-result weight model file. In the first 500 iterations, the learning rate was set to 0.0001. The learning rate starts to decay after 500 times.
And S3, establishing a double-scale discriminator.
The S3 specifically comprises the following steps:
s31, as shown in FIG. 4, the dual-scale discriminators are a local feature discriminator with the size of 70x70 and a global image discriminator with the size of 256x256, respectively, the two discriminators have the same structure, and the sizes of the input images are set to be different.
And S32, the discriminator consists of 5 layers of convolution modules, wherein the first layer of convolution module and the 5 th layer of convolution module consist of zero fill functions zeroPad2d and convolution kernels with the size of 3x3, and normalization functions BatchNorm2d are added into the second layer of convolution module and the fourth layer of convolution module.
And S4, loading a pre-training model to the FPN structure generation network module and adding a discriminator for training.
The training process loss function includes a pixel space loss function, a content loss function, and a counter loss function:
the pixel spatial loss function is:
Figure BDA0003963250290000121
where S denotes a sharp picture, G (B) denotes a deblurred picture by generating a network, W, H denotes a picture dimension.
The penalty function is:
L adv
E S~Psharp(S) [(D(S)-E B~Pblurred(B) D(G(B))-1) 2 ]
+E B-Pblurred(B) [(D(G(B))-E S-Psharp(S) D(S)+1) 2 ]
wherein S represents a clear two-dimensional code picture corresponding to an input fuzzy two-dimensional code picture, B represents the input fuzzy two-dimensional code picture, D (G (B)) represents that a picture for generating network deblurring is input into a discriminator, S-Psharp (S) represents that the clear two-dimensional code picture is sampled in a concentrated manner, B-Pblurred (B) represents that the picture is sampled in a concentrated manner, and E is an expected value.
The content loss function is:
Figure BDA0003963250290000131
wherein S represents a clear two-dimensional code picture corresponding to the input blurred two-dimensional code picture, B represents the input blurred two-dimensional code picture, W i,j 、H i,j The dimension of the feature map indicates the width and height of the feature map, and is a feature map of the jth convolution before the ith pooling layer.
The overall loss function is:
L=a×L P +b×L C +c×L adv
where parameter a is set to 0.006, parameter b is set to 0.5, and parameter c is set to 0.01.
And loading a pre-training model and a dual-scale discriminator for training by using a generating network module of an FPN structure, wherein the picture input sizes are 70x70 and 256x256 respectively. Wherein, the 70x70 image adopts a random cutting method to judge the local features. And training 1000 times of iterations, storing the weight model with the best effect in each iteration, and setting the learning rate to be 0.0001.
And S5, the trained network can generate a clear two-dimensional code picture from the fuzzy two-dimensional code picture.
So far, the two-dimensional code deblurring method is completed from step 1 to step 5.
In general, the method comprises the steps of firstly establishing a network generation module of the FPN structure, selecting fuzzy image feature graphs of different scales, merging the fuzzy image feature graphs serving as feature graphs of different scales of a multi-scale feature FPN framework, adding global residual errors for connection, and then generating a clear picture. And pre-training a network generation module of the FPN structure. And establishing a dual-scale discriminator, inputting the deblurred picture and the clear picture corresponding to the deblurred picture, and updating and generating the network parameters by comparing loss functions.
The method provided by the invention compares standard performance indexes (PSNR and SSIM), operation speed and model size with other methods, and the result is shown in table 2;
TABLE 2
Figure BDA0003963250290000132
Figure BDA0003963250290000141
As can be seen from Table 2, the method provided by the patent is optimal in both PSNR and SSIM evaluation indexes, and is obviously superior to other methods in reasoning operation speed.
Please refer to fig. 5 and fig. 6, which show the deblurring effect of the present application on a portion of a two-dimensional code picture, fig. 5 is the two-dimensional code picture before deblurring, and fig. 6 is the two-dimensional code picture after applying the deblurring method of the present application.
The invention also provides reference for other related problems in the same field, can also provide reference for other related problems in the same field, can be used as a basis for expansion and expansion, and has very wide application prospect in other technical solutions related to the deblurring method.
Example 2
The embodiment provides a two-dimensional code deblurring device, including:
the image acquisition module is used for acquiring a fuzzy two-dimensional code image;
the deblurring module is used for inputting the blurred two-dimensional code picture into a pre-constructed and trained two-dimensional code deblurring model so as to realize correction processing on the blurred two-dimensional code picture;
wherein, including the construction and the training module of two-dimensional code deblurring model in the deblurring module, the construction and the training module of two-dimensional code deblurring model include:
the data set acquisition unit is used for acquiring a two-dimensional code deblurring data set, and the data set comprises blurred image feature maps with different scales;
the pre-training unit is used for inputting the fuzzy image characteristic diagrams with different scales into a pre-constructed generation network module of an FPN structure for pre-training to generate a pre-trained two-dimensional code deblurring model;
and the training unit is used for adding the pre-trained two-dimensional code deblurring model into a pre-established double-scale discriminator for training to obtain a trained two-dimensional code deblurring model.
Further, the generating network module of the FPN structure includes a multi-scale feature FPN framework and a lightweight MobileNetV3 backbone network, the lightweight MobileNetV3 backbone network has 16 layers, the first layer is provided with a convolutional layer, the second layer to the twelfth layer are formed by bneck modules, the thirteenth layer is a convolutional layer, the fourteenth layer is an average pooling layer, and the fifteenth layer and the sixteenth layer are formed by two 1 × 1 convolutional cores.
Further, the dual-scale discriminators are a local feature discriminator with the size of 70x70 and a global image discriminator with the size of 256x256 respectively, the two discriminators are identical in structure, each discriminator comprises 5 layers of convolution modules, the first layer of convolution module and the 5 th layer of convolution module are composed of zero fill function ZeroPad2d and convolution kernels with the size of 3x3, and normalization functions BatchNorm2d are added into the second layer convolution module and the fourth layer of convolution module.
Example 3
The embodiment provides an electronic device, comprising a processor and a storage medium;
the storage medium is used for storing instructions;
the processor is configured to operate in accordance with the instructions to perform the steps of the method according to any of embodiment 1.
Example 4
The present embodiment provides a computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the steps of the method of any of the embodiment 1.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A two-dimensional code deblurring method is characterized by comprising the following steps:
acquiring a fuzzy two-dimensional code picture;
inputting the fuzzy two-dimensional code picture into a pre-constructed and trained two-dimensional code deblurring model to realize correction processing on the fuzzy two-dimensional code picture;
the method for constructing and training the two-dimensional code deblurring model comprises the following steps:
acquiring a two-dimensional code deblurring data set, wherein the data set comprises blurred image feature maps with different scales;
inputting the fuzzy image characteristic diagrams of different scales into a pre-constructed generation network module of an FPN structure for pre-training to generate a pre-trained two-dimensional code deblurring model;
and adding the pre-trained two-dimensional code deblurring model into a pre-established double-scale discriminator for training to obtain a trained two-dimensional code deblurring model.
2. The two-dimensional code deblurring method according to claim 1, wherein the generating network module of the FPN structure comprises a multi-scale feature FPN framework and a lightweight MobileNet V3 backbone network, the lightweight MobileNet V3 backbone network has 16 layers, wherein the first layer is provided with a convolutional layer, the second layer to the twelfth layer are composed of a bneck module, the thirteenth layer is a convolutional layer, the fourteenth layer is an average pooling layer, and the fifteenth layer and the sixteenth layer are composed of two 1x1 convolution kernels.
3. The two-dimensional code deblurring method according to claim 1, characterized in that when inputting the blurred image feature maps of different scales into a pre-constructed generation network module of an FPN structure for pre-training, an L1 loss function is adopted:
L 1 (f(x),y)=∑|y-f(x)|
where x denotes the input blurred picture, f (x) denotes the deblurred picture, and y denotes the sharp picture corresponding to the blurred picture.
4. The method according to claim 1, wherein the two-dimensional classifiers are a local feature classifier with a size of 70x70 and a global image classifier with a size of 256x256, and the two classifiers have the same structure and comprise 5-layer convolution modules, wherein the first layer convolution module and the 5 th layer convolution module are composed of zero-padding functions ZeroPad2d and convolution kernels with sizes of 3x3, and normalization functions BatchNorm2d are added in the second-layer convolution module to the fourth-layer convolution module.
5. The two-dimensional code deblurring method according to claim 1, wherein when the pre-trained two-dimensional code deblurring model is added to a pre-established dual-scale discriminator for training, the loss function in the training process comprises a pixel space loss function, a content loss function and a counter loss function:
the pixel spatial loss function is:
Figure FDA0003963250280000021
wherein S represents a sharp picture, G (B) represents a deblurred picture by generating a network, W, H represents a picture dimension;
the penalty function is:
L adv =E S~Psharp(S) [(D(S)-E B~Pblurred(B) D(G(B))-1) 2 ]+E B-Pblurred(B) [(D(G(B))-E S-Psharp(S) D(S)+1) 2 ]
the method comprises the steps that S represents a clear two-dimensional code picture corresponding to an input fuzzy two-dimensional code picture, B represents the input fuzzy two-dimensional code picture, D (G (B)) represents that a picture for generating network deblurring is input into a discriminator, S-Psharp (S) represents that the clear two-dimensional code picture is sampled in a concentrated mode, B-Pblurred (B) represents that the clear two-dimensional code picture is sampled in a concentrated mode, and E is an expected value;
the content loss function is:
Figure FDA0003963250280000031
wherein S represents a clear two-dimensional code picture corresponding to the input fuzzy two-dimensional code picture, B represents the input fuzzy two-dimensional code picture, W i,j 、H i,j Is the dimension of the feature map, represents the width and the height of the feature map, and is the feature map of the jth convolution before the ith pooling layer;
the overall loss function is:
L=a×L P +b×L C +c×L adv
where parameter a is set to 0.006, parameter b is set to 0.5, and parameter c is set to 0.01.
6. The utility model provides a two-dimensional code deblurrs device which characterized in that includes:
the image acquisition module is used for acquiring a fuzzy two-dimensional code image;
the deblurring module is used for inputting the blurred two-dimensional code picture into a pre-constructed and trained two-dimensional code deblurring model so as to realize correction processing on the blurred two-dimensional code picture;
wherein, including the construction and the training module of two-dimensional code deblurring model in the deblurring module, the construction and the training module of two-dimensional code deblurring model include:
the data set acquisition unit is used for acquiring a two-dimensional code deblurring data set, and the data set comprises blurred image feature maps with different scales;
the pre-training unit is used for inputting the fuzzy image characteristic diagrams with different scales into a pre-constructed generation network module of an FPN structure for pre-training to generate a pre-trained two-dimensional code deblurring model;
and the training unit is used for adding the pre-trained two-dimensional code deblurring model into a pre-established double-scale discriminator for training to obtain a trained two-dimensional code deblurring model.
7. The two-dimensional code deblurring device according to claim 6, wherein the generating network module of the FPN structure comprises a multi-scale feature FPN framework and a lightweight MobileNet V3 backbone network, the lightweight MobileNet V3 backbone network has 16 layers, wherein the first layer is provided with a convolution layer, the second layer to the twelfth layer are composed of a bneck module, the thirteenth layer is a convolution layer, the fourteenth layer is an average pooling layer, and the fifteenth layer and the sixteenth layer are composed of two 1x1 convolution kernels.
8. The apparatus according to claim 6, wherein the two-dimensional classifiers are a local feature classifier with size 70x70 and a global image classifier with size 256x256, respectively, the two classifiers have the same structure, and the classifiers include 5-layer convolution modules, wherein the first-layer convolution module and the 5-layer convolution module are composed of zero-padding function ZeroPad2d and convolution kernel with size 3x3, and the normalization function BatchNorm2d is added to the second-layer to fourth-layer convolution modules.
9. An electronic device, characterized in that: comprising a processor and a storage medium;
the storage medium is to store instructions;
the processor is configured to operate in accordance with the instructions to perform the steps of the method according to any one of claims 1 to 5.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that: the program when executed by a processor implementing the steps of the method of any one of claims 1 to 5.
CN202211488393.6A 2022-11-25 2022-11-25 Two-dimensional code deblurring method and device, electronic equipment and storage medium Pending CN115719317A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211488393.6A CN115719317A (en) 2022-11-25 2022-11-25 Two-dimensional code deblurring method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211488393.6A CN115719317A (en) 2022-11-25 2022-11-25 Two-dimensional code deblurring method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115719317A true CN115719317A (en) 2023-02-28

Family

ID=85256381

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211488393.6A Pending CN115719317A (en) 2022-11-25 2022-11-25 Two-dimensional code deblurring method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115719317A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117556847A (en) * 2024-01-05 2024-02-13 深圳爱莫科技有限公司 Identification method of two-dimension code of cigarette end

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117556847A (en) * 2024-01-05 2024-02-13 深圳爱莫科技有限公司 Identification method of two-dimension code of cigarette end
CN117556847B (en) * 2024-01-05 2024-04-26 深圳爱莫科技有限公司 Identification method of two-dimension code of cigarette end

Similar Documents

Publication Publication Date Title
Nah et al. Deep multi-scale convolutional neural network for dynamic scene deblurring
Pan et al. Physics-based generative adversarial models for image restoration and beyond
Xue et al. Video enhancement with task-oriented flow
Zhang et al. Multi-scale single image dehazing using perceptual pyramid deep network
Jo et al. Deep video super-resolution network using dynamic upsampling filters without explicit motion compensation
Zhang et al. Residual dense network for image super-resolution
CN111275626B (en) Video deblurring method, device and equipment based on ambiguity
Yeh et al. Semantic image inpainting with deep generative models
CN108550118B (en) Motion blur image blur processing method, device, equipment and storage medium
CN110969589B (en) Dynamic scene blurred image blind restoration method based on multi-stream annotating countermeasure network
Sun et al. Lightweight image super-resolution via weighted multi-scale residual network
CN110782399A (en) Image deblurring method based on multitask CNN
Wang et al. Cycle-snspgan: Towards real-world image dehazing via cycle spectral normalized soft likelihood estimation patch gan
CN107133923B (en) Fuzzy image non-blind deblurring method based on adaptive gradient sparse model
CN111091503A (en) Image out-of-focus blur removing method based on deep learning
Ju et al. BDPK: Bayesian dehazing using prior knowledge
CN111462019A (en) Image deblurring method and system based on deep neural network parameter estimation
CN112164011A (en) Motion image deblurring method based on self-adaptive residual error and recursive cross attention
CN110443775B (en) Discrete wavelet transform domain multi-focus image fusion method based on convolutional neural network
Rivadeneira et al. Thermal image super-resolution challenge-pbvs 2021
Dong et al. Learning spatially variant linear representation models for joint filtering
Min et al. Blind deblurring via a novel recursive deep CNN improved by wavelet transform
Wang et al. Training very deep CNNs for general non-blind deconvolution
CN115719317A (en) Two-dimensional code deblurring method and device, electronic equipment and storage medium
CN115345791A (en) Infrared image deblurring algorithm based on attention mechanism residual error network model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination