Fold two-dimensional code recovery method, device and equipment and readable storage medium
Technical Field
The invention relates to the technical field of computer vision, in particular to a fold two-dimensional code recovery method, a fold two-dimensional code recovery device, fold two-dimensional code recovery equipment and a readable storage medium.
Background
With the rapid development of information technology, people are increasingly pressing on the rapid input and rapid processing of information. The two-dimensional code technology plays an indispensable role in the fast input and fast processing of information. However, as the application of the two-dimensional code becomes wider, the two-dimensional code used in the two-dimensional code image is distorted in wrinkles to different degrees due to the photographing angle, the wrinkles, the bending of the two-dimensional code image itself, or the attached matter.
At present, aiming at the problem of distortion of two-dimensional codes, most of the two-dimensional codes are researched for distortion correction algorithms, including methods such as space transformation and gray interpolation, and wrinkle recovery processing including image vertex positioning, perspective transformation and gray interpolation. Most of these algorithms require human search for recovery algorithms in different wrinkle cases. For example, in a case where a pair of sides of a two-dimensional code pattern is not distorted and the other pair of sides is distorted, a first corrected image is obtained by eliminating the influence of linear distortion caused by a photographing angle or the like, and then a second corrected image is obtained by performing wrinkle distortion correction on the first corrected image by a shortest curve interpolation method, and then two-dimensional QR code decoding recognition is performed on the basis of the first corrected image. Therefore, the existing recovery processing of the fold two-dimensional code can only be performed under the condition of specifying a fold, and the two-dimensional code under different fold conditions in a real application scene cannot be effectively recovered.
In summary, how to effectively solve the problems of recovery processing of the two-dimensional code with wrinkles and the like is a technical problem that needs to be solved urgently by those skilled in the art at present.
Disclosure of Invention
The invention aims to provide a wrinkle two-dimensional code recovery method, a wrinkle two-dimensional code recovery device and a readable storage medium, so that two-dimensional code pictures with different wrinkle conditions can be effectively recovered.
In order to solve the technical problems, the invention provides the following technical scheme:
a folded two-dimensional code recovery method comprises the following steps:
acquiring an identifiable original two-dimensional code picture, and performing wrinkling processing on the original two-dimensional code picture by using a distortion mapping map to obtain a wrinkled two-dimensional code picture;
taking the fold two-dimensional code picture as input data, and performing fold recovery training on a deep learning network by combining the original two-dimensional code picture to obtain a target deep learning network;
and acquiring a target wrinkle two-dimensional code picture, and performing wrinkle recovery processing on the target wrinkle two-dimensional code picture by using the target deep learning network to acquire a recognizable target two-dimensional code picture.
Preferably, after obtaining the wrinkled two-dimensional code picture, before taking the wrinkled two-dimensional code picture as input data, the method further includes:
and performing data enhancement processing on the folded two-dimensional code picture.
Preferably, after obtaining the wrinkled two-dimensional code picture, before taking the wrinkled two-dimensional code picture as input data, the method further includes:
and carrying out picture realistic processing on the folded two-dimensional code picture, wherein the picture realistic processing comprises at least one of random rotation, noise addition, size reduction and background addition.
Preferably, the acquiring of the recognizable original two-dimensional code picture includes:
and generating the original two-dimensional code picture by using two-dimensional code generation software.
Preferably, after obtaining the recognizable target two-dimensional code picture, the method further includes:
and carrying out two-dimensional code identification on the target two-dimensional code picture.
Preferably, the performing the crumpling process on the original two-dimensional code picture by using the warp map to obtain a crumpled two-dimensional code picture includes:
dividing the original two-dimensional code picture by using a grating method to obtain a plurality of grids with the same size;
randomly selecting seed points and offset vectors in each grid, and offsetting pixel points in the grids according to the folding coefficients and the bending coefficients by using the diffusion principle on the basis of the seed points to obtain a target offset equation;
obtaining a disturbance grid by using the target offset equation;
and combining the perturbation grid, applying the distortion mapping graph to the original two-dimensional code picture, and obtaining the fold two-dimensional code picture.
Preferably, the fold recovery processing is performed on the target fold two-dimensional code picture by using the target deep learning network, so as to obtain a recognizable target two-dimensional code picture, and the fold recovery processing includes:
performing a group of convolutions on the target fold two-dimensional code by using the target deep learning network to obtain a convolution result;
inputting the convolution result into a posing layer for scale transformation to obtain a scale transformation result;
and inputting the scale transformation result into a DenseNet network for wrinkle recovery processing to obtain the target two-dimensional code picture.
A wrinkle two-dimensional code recovery device comprises:
the data acquisition module is used for acquiring an identifiable original two-dimensional code picture and performing wrinkling processing on the original two-dimensional code picture by using a distortion mapping map to obtain a wrinkled two-dimensional code picture;
the network training module is used for taking the fold two-dimensional code picture as input data and carrying out fold recovery training on the deep learning network by combining the original two-dimensional code picture to obtain a target deep learning network;
and the wrinkle recovery module is used for obtaining a target wrinkle two-dimensional code picture, and performing wrinkle recovery processing on the target wrinkle two-dimensional code picture by using the target deep learning network to obtain a recognizable target two-dimensional code picture.
A wrinkle two-dimensional code recovery device comprising:
a memory for storing a computer program;
and the processor is used for realizing the steps of the wrinkle two-dimensional code recovery method when the computer program is executed.
A readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the above-described wrinkle two-dimensional code recovery method.
By applying the method provided by the embodiment of the invention, the recognizable original two-dimensional code picture is obtained, and the distortion mapping map is utilized to carry out the wrinkling processing on the original two-dimensional code picture so as to obtain the wrinkled two-dimensional code picture; taking the fold two-dimensional code picture as input data, and performing fold recovery training on the deep learning network by combining the original two-dimensional code picture to obtain a target deep learning network; and acquiring a target wrinkle two-dimensional code picture, and performing wrinkle recovery processing on the target wrinkle two-dimensional code picture by using a target deep learning network to acquire a recognizable target two-dimensional code picture.
The wrinkle conditions appearing in the two-dimensional code picture are various, and the effective recovery algorithm corresponding to each wrinkle condition is difficult to exhaust. And due to the learning capability of the deep learning network, the data processing process can be continuously optimized in the training process, and finally, the expected processing result can be output after the input data are processed. Based on the method, firstly, an identifiable original two-dimensional code picture is obtained, the original two-dimensional code picture is subjected to wrinkling processing by using the distortion mapping map, a wrinkled two-dimensional code picture is obtained, and the two-dimensional code picture is subjected to wrinkling processing by using the distortion mapping map, so that the wrinkled two-dimensional code picture is obtained. And then inputting the two-dimensional code picture of the fold into a deep learning network, and performing fold recovery training by combining the original two-dimensional code picture to obtain a target deep learning network capable of performing fold recovery on the two-dimensional code picture of the fold under different fold conditions. After the target wrinkle two-dimensional code picture is obtained, the target wrinkle two-dimensional code picture can be subjected to wrinkle recovery processing by using a target depth network, and a recognizable target two-dimensional code picture is obtained. Therefore, the effective recovery algorithm corresponding to each wrinkle condition is not required to be exhausted, only the recognizable original two-dimensional code picture needs to be wrinkled, the wrinkle two-dimensional code picture and the original two-dimensional code picture are used for training the deep learning network, and finally the target deep learning network obtained after training can be used for effectively recovering the two-dimensional code pictures with different wrinkle conditions.
Correspondingly, the embodiment of the invention also provides a wrinkle two-dimensional code recovery device, equipment and a readable storage medium corresponding to the wrinkle two-dimensional code recovery method, which have the technical effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart illustrating an implementation of a two-dimensional code recovery method for wrinkles according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a two-dimensional code recovery device for wrinkles in an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a two-dimensional code recovery device for wrinkles in an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a folded two-dimensional code recovery device in an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
referring to fig. 1, fig. 1 is a flowchart illustrating a method for recovering a two-dimensional code with wrinkles according to an embodiment of the present invention, where the method includes the following steps:
s101, obtaining an identifiable original two-dimensional code picture, and performing wrinkling processing on the original two-dimensional code picture by using the distortion mapping map to obtain a wrinkled two-dimensional code picture.
The two-dimension code can be shot through the image acquisition equipment to obtain the two-dimension code picture, and the two-dimension code picture is identified to obtain the original two-dimension code picture carried by the two-dimension code picture. Or acquiring the recognizable two-dimensional code picture from the network by using the web crawler. The method and the device consider that the unidentifiable two-dimensional code picture cannot be acquired due to the reasons of light, the pixel size of the image acquisition equipment, shake, angle and the like during shooting. And in the process of acquiring the original two-dimensional code picture by using the web crawler, the acquired picture needs to be screened.
Preferably, the recognizable original two-dimensional code picture can be generated by directly utilizing two-dimensional code generation software, so that a two-dimensional code shooting process and a two-dimensional code recognition process can be omitted. The two-dimensional code generation software can select common two-dimensional codes such as a forage two-dimensional code generator, a vector two-dimensional code, a joint diagram two-dimensional code and the like to generate, and only the two-dimensional code generation software can generate the recognizable original two-dimensional code picture, so that the encoding mode of the two-dimensional code generation software and the specification of the output two-dimensional code are not limited.
After the original two-dimensional code picture is obtained, the original two-dimensional code picture can be subjected to wrinkling processing by using the distortion mapping map, namely, wrinkles appearing on the two-dimensional code shot in the simulation reality application scene are simulated. Therefore, the two-dimensional code picture with folds can be obtained.
Wherein, the wrinkle processing process may include:
dividing an original two-dimensional code picture by using a grating method to obtain a plurality of grids with the same size;
randomly selecting seed points and offset vectors in each grid, and offsetting pixel points in the grid according to the folding coefficients and the bending coefficients by using the diffusion principle on the basis of the seed points to obtain a target offset equation;
thirdly, obtaining a disturbance grid by using a target offset equation;
and step four, combining the disturbance grid, applying the distortion mapping graph to the original two-dimensional code picture, and obtaining the fold two-dimensional code picture.
For convenience of description, the above four steps will be described in combination.
To make a foldThe obtained folded two-dimensional code picture can be more similar to the folded two-dimensional code picture under the real condition, a distortion mapping map can be applied to the original two-dimensional code picture by combining a disturbance network, and the folded two-dimensional code picture is finally obtained. The warp map may be specifically a warp map at a pixel level, which is established on the basis of the perturbation network by using linear interpolation. That is to say, the generation factor of the wrinkle in the two-dimensional code picture can be effectively simulated under the real scene based on the distortion mapping chart. In addition, the disturbance network may be a sampling format method, and the original two-dimensional code picture is divided to obtain a plurality of grids with the same size, where the grids may be regular patterns, such as n × n squares. Then, randomly selecting a seed point and an offset vector in each grid, and offsetting pixel points in the grid according to the folding coefficient and the bending coefficient by using the diffusion principle on the basis of the seed point to obtain a target offset equation. The diffusion principle is utilized to simulate wrinkles, and the wrinkles with different degrees are generated on pictures at different positions in the transmission process of force. Wherein the fold-back coefficient can be expressed as
![Figure BDA0001973722330000061](https://patentimages.storage.googleapis.com/30/6d/1c/502305ffe8a908/BDA0001973722330000061.png)
The bending modulus can be expressed as 1-d
αα is a parameter regulated, the parameter value can be randomly selected between 0.6-1 to promote data diversification, after a target offset equation of each network is obtained, a disturbance grid can be obtained, the disturbance grid is disturbed, and the disturbance can be transmitted to one grid of each target offset equation in the grid.
It should be noted that, in the embodiment of the present invention, the original two-dimensional code picture and the folded two-dimensional code picture obtained by performing folding processing on the original two-dimensional code picture do not refer to one picture, but refer to batch original two-dimensional code pictures and batch folded two-dimensional code pictures. In addition, an original two-dimensional code picture can be subjected to wrinkle processing to obtain different wrinkle two-dimensional code pictures. I.e. the corrugation process is a random process, not an oriented process.
S102, taking the fold two-dimensional code picture as input data, and performing fold recovery training on the deep learning network by combining the original two-dimensional code picture to obtain a target deep learning network.
After the two-dimensional code picture of the fold is obtained, the two-dimensional code of the fold can be used as input data, the two-dimensional code picture of the fold is subjected to fold recovery processing by using a deep learning network, the two-dimensional code picture which is recovered is obtained, at the moment, the two-dimensional code picture which is recovered is compared with the original two-dimensional code picture, whether the two-dimensional codes are consistent or not is judged by respectively identifying the two-dimensional codes in the original two-dimensional code picture and the two-dimensional codes in the two-dimensional code picture which are recovered in a specific comparison process, and a comparison result is fed back to. During the training process, the wrinkle recovery loss value of the network can be calculated by using the loss function after each round of training is finished. The loss function may be embodied as a mean square and error function representation of the calculated alignment results. In addition, the learning rate during training can be set to be 0.001, and when the change of the wrinkle recovery loss value is smaller than a specified value, the training is finished, and the target deep learning network is obtained.
Preferably, in order to enable the target deep learning network to recover the two-dimensional code pictures of various wrinkle situations, data enhancement processing may be performed on the wrinkle two-dimensional code pictures to enhance the diversity of input data. Specifically, after the wrinkled two-dimensional code picture is obtained, before the wrinkled two-dimensional code picture is used as input data, data enhancement processing is performed on the wrinkled two-dimensional code picture. The data enhancement processing includes, but is not limited to, performing data enhancement operations such as turning, clipping, contrast conversion and the like on the original two-dimensional code picture to improve network generalization.
Preferably, in order to make the wrinkled two-dimensional code picture more similar to the wrinkled two-dimensional code generated in the real application scene, after the wrinkled two-dimensional code picture is obtained, before the wrinkled two-dimensional code picture is used as input data, the wrinkled two-dimensional code picture may be subjected to picture realistic processing, where the picture realistic processing includes at least one of random rotation, noise addition, size reduction and background addition. The method comprises the steps of carrying out batch processing on a CPU through operations of random rotation, noise addition, size reduction, background addition and the like to obtain a group of complete data sets which are closer to real samples.
S103, obtaining a target wrinkle two-dimensional code picture, and performing wrinkle recovery processing on the target wrinkle two-dimensional code picture by using a target deep learning network to obtain a recognizable target two-dimensional code picture.
After the target deep learning network is obtained and the target wrinkle two-dimensional code picture is obtained, the target deep learning network can be used for performing wrinkle recovery processing on the target wrinkle two-dimensional code picture, and therefore the recognizable target two-dimensional code picture can be obtained.
The wrinkle recovery processing process may include:
performing a group of convolutions on a target wrinkle two-dimensional code by using a target deep learning network to obtain a convolution result;
inputting the convolution result into a posing layer for scale transformation to obtain a scale transformation result;
inputting the scale transformation result into a DenseNet to carry out fold recovery processing to obtain a target two-dimensional code picture; each basic block of the DenseNet network is subjected to down sampling once so as to fix the size of the target two-dimensional code picture.
For convenience of description, the above three steps will be described in combination.
The target deep learning Network may be a deep learning Network including a convolutional layer, a posing layer, and a densneet Network (dense convolutional Network). Firstly, performing a group of convolutions on a folded two-dimensional code picture to obtain a convolution result, and then accessing a posing layer to perform scale transformation on the convolution result, for example, reducing the scale by half to obtain a scale transformation result. And then, based on a DenseNet (each basic block (basic module) of the DenseNet is subjected to once down-sampling, the scale can be reduced by half by sampling each time, and three groups of basic block modules can be designed) to process the scale transformation result, and finally, a recognizable target two-dimensional code picture is obtained. In the whole recovery processing process, the picture or data size of each stage may be specifically, if the pixel size of the target folded two-dimensional code picture is 400 × 400; after the posing layer carries out scale transformation on the target fold two-dimensional code, the pixel size is 200 x 200; in addition, each of the basic modules in the DenseNet network may reduce the sampling scale to 100 × 100, 50 × 50, and 25 × 25 in sequence, that is, the final output two-dimensional code may be 25 × 25, that is, the final target two-dimensional code picture may be Level2 Level (25 × 25 pixels may represent all information). It should be noted that, the number of basic block modules may also be set to other values, such as 2 or 4, but the pixels of the target two-dimensional code that needs to be finally output can represent all information, that is, when the number of basic block modules is increased, the pixel size of the target two-dimensional code with folds may be fixed to a larger value, and when the number of basic block modules is decreased, the pixel size of the target two-dimensional code with folds may be fixed to a smaller value. The wrinkle recovery processing procedure performed by the deep learning network can be referred to, and is not described in detail herein.
After the recognizable target two-dimensional code picture is obtained, two-dimensional code recognition can be carried out on the target two-dimensional code picture. That is to say, by combining the two-dimensional code recognition technology, the two-dimensional code picture with wrinkles can be effectively recognized through the wrinkle two-dimensional code recovery method provided by the embodiment of the invention.
By applying the method provided by the embodiment of the invention, the recognizable original two-dimensional code picture is obtained, and the distortion mapping map is utilized to carry out the wrinkling processing on the original two-dimensional code picture so as to obtain the wrinkled two-dimensional code picture; taking the fold two-dimensional code picture as input data, and performing fold recovery training on the deep learning network by combining the original two-dimensional code picture to obtain a target deep learning network; and acquiring a target wrinkle two-dimensional code picture, and performing wrinkle recovery processing on the target wrinkle two-dimensional code picture by using a target deep learning network to acquire a recognizable target two-dimensional code picture.
The wrinkle conditions appearing in the two-dimensional code picture are various, and the effective recovery algorithm corresponding to each wrinkle condition is difficult to exhaust. And due to the learning capability of the deep learning network, the data processing process can be continuously optimized in the training process, and finally, the expected processing result can be output after the input data are processed. Based on the method, firstly, an identifiable original two-dimensional code picture is obtained, the original two-dimensional code picture is subjected to wrinkling processing by using the distortion mapping map, a wrinkled two-dimensional code picture is obtained, and the two-dimensional code picture is subjected to wrinkling processing by using the distortion mapping map, so that the wrinkled two-dimensional code picture is obtained. And then inputting the two-dimensional code picture of the fold into a deep learning network, and performing fold recovery training by combining the original two-dimensional code picture to obtain a target deep learning network capable of performing fold recovery on the two-dimensional code picture of the fold under different fold conditions. After the target wrinkle two-dimensional code picture is obtained, the target wrinkle two-dimensional code picture can be subjected to wrinkle recovery processing by using a target depth network, and a recognizable target two-dimensional code picture is obtained. Therefore, the effective recovery algorithm corresponding to each wrinkle condition is not required to be exhausted, only the recognizable original two-dimensional code picture needs to be wrinkled, the wrinkle two-dimensional code picture and the original two-dimensional code picture are used for training the deep learning network, and finally the target deep learning network obtained after training can be used for effectively recovering the two-dimensional code pictures with different wrinkle conditions.
Example two:
in order to facilitate better understanding of the method for recovering the two-dimensional code of the wrinkle provided by the embodiment of the present invention, a target convolutional network is taken as an example of a convolutional neural network, and the method for recovering the two-dimensional code of the wrinkle provided by the embodiment of the present invention is described in detail below.
The method may specifically comprise the steps of:
1. utilizing 10000 two-dimensional code pictures generated by computer graphics algorithm software to carry out folding and bending fitting on the folding condition of the real two-dimensional code;
2. carrying out data enhancement operations such as turning, cutting, contrast conversion and the like on the data obtained in the step 1 so as to improve the network generalization;
3. designing a deep convolutional neural network structure;
4. the designed convolutional neural network is trained with the processed data set. And the finally obtained convolution neural network result can be better applied to recovery of the folded two-dimensional code image in the real scene.
The method comprises the steps of constructing a data set, specifically, generating 10000 two-dimensional code pictures (the pixel size is 800 × 800) containing determination information by using two-dimensional code generation software; then, dividing the picture into 100 x 100 grids by using a grid method, randomly selecting seed points and offset vectors thereof, and then using a diffusion principle to fold other points in the grid according to a doubling factor
Bending modulus 1-d
αAnd obtaining an offset equation, and finally obtaining a disturbance grid capable of simulating the wrinkle condition of the real two-dimensional code. Establishing a pixel level distortion mapping map by combining the generated disturbance grid and utilizing linear interpolation, and finally applying the pixel level distortion mapping map to a two-dimensional code picture to obtain a simulated fold two-dimensional code picture; through operations of random rotation, noise addition, size reduction, background addition and the like, a group of complete data sets which are closer to real samples are obtained after batch processing on a CPU.
The network design is that the network can carry out operations such as size transformation, random cutting, data enhancement of contrast distortion and the like on the pictures input into the network, and the size of the pictures input into the network is fixed at 400 x 400; then, under the PyTorch deep learning framework, a set of convolutions is performed on the input data, and then the firing layer is accessed, and the scale is reduced by half. Then based on a DenseNet (each basic block of which is subjected to down sampling once), three groups of basic block modules can be designed, and finally the whole network output is fixed at nB 1 × 25; wherein nB represents a parameter indicating the size of batch processing, i.e., the number of pictures input into the network at a time during training, as well as Batchsize herein.
The training process comprises the following steps: preprocessing a picture data set and then reading the picture data set into a network according to a format of Batchsize 16; writing the modified model structure into a model file based on a PyTorch framework; the loss function can be represented by directly utilizing the mean square and error functions, and the training learning rate can be set to be 0.001; the training is repeated for 50 rounds on the training data set.
After the training is finished, the target deep learning network can be obtained. And then, inputting the folded two-dimensional code graph, outputting the graph which is the recovered graph, and using the output graph for two-dimensional code identification.
Example three:
corresponding to the above method embodiment, an embodiment of the present invention further provides a two-dimensional code recovery device for wrinkles, where the two-dimensional code recovery device for wrinkles described below and the two-dimensional code recovery method for wrinkles described above may be referred to in a corresponding manner.
Referring to fig. 2, the apparatus includes the following modules:
the data acquisition module 101 is configured to acquire an identifiable original two-dimensional code picture, and perform wrinkling processing on the original two-dimensional code picture by using the distortion mapping map to obtain a wrinkled two-dimensional code picture;
the network training module 102 is used for taking the fold two-dimensional code picture as input data and performing fold recovery training on the deep learning network by combining the original two-dimensional code picture to obtain a target deep learning network;
and the wrinkle recovery module 103 is configured to obtain a target wrinkle two-dimensional code picture, and perform wrinkle recovery processing on the target wrinkle two-dimensional code picture by using a target deep learning network to obtain a recognizable target two-dimensional code picture.
By applying the device provided by the embodiment of the invention, the recognizable original two-dimensional code picture is obtained, and the distortion mapping map is utilized to carry out the wrinkling processing on the original two-dimensional code picture so as to obtain the wrinkled two-dimensional code picture; taking the fold two-dimensional code picture as input data, and performing fold recovery training on the deep learning network by combining the original two-dimensional code picture to obtain a target deep learning network; and acquiring a target wrinkle two-dimensional code picture, and performing wrinkle recovery processing on the target wrinkle two-dimensional code picture by using a target deep learning network to acquire a recognizable target two-dimensional code picture.
The wrinkle conditions appearing in the two-dimensional code picture are various, and the effective recovery algorithm corresponding to each wrinkle condition is difficult to exhaust. And due to the learning capability of the deep learning network, the data processing process can be continuously optimized in the training process, and finally, the expected processing result can be output after the input data are processed. Based on the method, the device firstly obtains the recognizable original two-dimensional code picture, carries out wrinkling processing on the original two-dimensional code picture by using the distortion mapping map to obtain the wrinkled two-dimensional code picture, and carries out wrinkling processing on the two-dimensional code picture by using the distortion mapping map to obtain the wrinkled two-dimensional code picture. And then inputting the two-dimensional code picture of the fold into a deep learning network, and performing fold recovery training by combining the original two-dimensional code picture to obtain a target deep learning network capable of performing fold recovery on the two-dimensional code picture of the fold under different fold conditions. After the target wrinkle two-dimensional code picture is obtained, the target wrinkle two-dimensional code picture can be subjected to wrinkle recovery processing by using a target depth network, and a recognizable target two-dimensional code picture is obtained. Therefore, the effective recovery algorithm corresponding to each wrinkle condition is not required to be exhausted, only the recognizable original two-dimensional code picture needs to be wrinkled, the wrinkle two-dimensional code picture and the original two-dimensional code picture are used for training the deep learning network, and finally the target deep learning network obtained after training can be used for effectively recovering the two-dimensional code pictures with different wrinkle conditions.
In one embodiment of the present invention, the method further comprises:
and the data enhancement processing module is used for performing data enhancement processing on the wrinkle two-dimensional code picture before the wrinkle two-dimensional code picture is taken as input data after the wrinkle two-dimensional code picture is obtained.
In one embodiment of the present invention, the method further comprises:
and the photorealisation processing module is used for carrying out photorealisation processing on the wrinkled two-dimensional code picture after the wrinkled two-dimensional code picture is obtained and before the wrinkled two-dimensional code picture is taken as input data, and the photorealisation processing comprises at least one of random rotation, noise addition, size reduction and background addition.
In an embodiment of the present invention, the data obtaining module 101 is specifically configured to generate an original two-dimensional code picture by using two-dimensional code generating software.
In one embodiment of the present invention, the method further comprises:
and the two-dimension code identification module is used for identifying the two-dimension code of the target two-dimension code picture after the recognizable target two-dimension code picture is obtained.
In a specific embodiment of the present invention, the data obtaining module 101 is specifically configured to divide an original two-dimensional code picture by using a grid method to obtain a plurality of grids with the same size; randomly selecting seed points and offset vectors in each grid, and offsetting pixel points in the grid according to the folding coefficient and the bending coefficient by using the diffusion principle on the basis of the seed points to obtain a target offset equation; obtaining a disturbance grid by using a target offset equation; and applying the distortion mapping graph to the original two-dimensional code picture by combining the disturbance grid to obtain a fold two-dimensional code picture.
In a specific embodiment of the present invention, the wrinkle recovery module 103 is specifically configured to perform a group of convolutions on the target wrinkle two-dimensional code by using a target deep learning network, so as to obtain a convolution result; inputting the convolution result into a posing layer for scale transformation to obtain a scale transformation result; inputting the scale transformation result into a DenseNet network for wrinkle recovery processing to obtain a target two-dimensional code picture; each basic block of the DenseNet network is subjected to down sampling once so as to fix the size of the target two-dimensional code picture.
Example four:
corresponding to the above method embodiment, an embodiment of the present invention further provides a two-dimensional code recovery device for wrinkles, where a two-dimensional code recovery device for wrinkles described below and a two-dimensional code recovery method for wrinkles described above may be referred to in a corresponding manner.
Referring to fig. 3, the wrinkle two-dimensional code recovery apparatus includes:
a memory D1 for storing computer programs;
and a processor D2, configured to implement the steps of the folded two-dimensional code recovery method according to the foregoing method embodiment when executing the computer program.
Specifically, referring to fig. 4, fig. 4 is a schematic diagram of a specific structure of a two-dimensional code recovery device for a wrinkle provided in this embodiment, where the two-dimensional code recovery device may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 322 (e.g., one or more processors) and a memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) storing an application 342 or data 344. Memory 332 and storage media 330 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 330 may include one or more modules (not shown), each of which may include a series of instructions operating on a data processing device. Further, the central processor 322 may be configured to communicate with the storage medium 330, and execute a series of instruction operations in the storage medium 330 on the wrinkle two-dimensional code recovery device 301.
The corrugated two-dimensional code recovery device 301 may also include one or more power sources 326, one or more wired or wireless network interfaces 350, one or more input-output interfaces 358, and/or one or more operating systems 341. Such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The steps in the folded two-dimensional code recovery method described above may be implemented by the structure of a folded two-dimensional code recovery apparatus.
Example five:
corresponding to the above method embodiment, an embodiment of the present invention further provides a readable storage medium, and a readable storage medium described below and a wrinkle two-dimensional code recovery method described above may be referred to in correspondence.
A readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the wrinkle two-dimensional code recovery method of the above-mentioned method embodiments.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.