CN112465092B - Two-dimensional code sample generation method and device, server and storage medium - Google Patents

Two-dimensional code sample generation method and device, server and storage medium Download PDF

Info

Publication number
CN112465092B
CN112465092B CN202011183726.5A CN202011183726A CN112465092B CN 112465092 B CN112465092 B CN 112465092B CN 202011183726 A CN202011183726 A CN 202011183726A CN 112465092 B CN112465092 B CN 112465092B
Authority
CN
China
Prior art keywords
image
dimensional code
inputting
generate
model
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.)
Active
Application number
CN202011183726.5A
Other languages
Chinese (zh)
Other versions
CN112465092A (en
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.)
Shenzhen University
Original Assignee
Shenzhen University
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 Shenzhen University filed Critical Shenzhen University
Priority to CN202011183726.5A priority Critical patent/CN112465092B/en
Publication of CN112465092A publication Critical patent/CN112465092A/en
Application granted granted Critical
Publication of CN112465092B publication Critical patent/CN112465092B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour

Abstract

The invention provides a method for generating a two-dimensional code sample, which comprises the following steps: acquiring an original two-dimensional code to be copied; printing and scanning the original two-dimensional code to generate a first image; inputting the first image into a preset two-dimensional code reconstruction model, and outputting the first image as a second image; and printing and shooting the second image to generate a copied two-dimensional code, and taking the copied two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model. According to the method, the image of the original two-dimensional code after primary printing is firstly reconstructed and then secondarily printed, so that the two-dimensional code sample obtained by copying can be more accurately matched with the information of the original two-dimensional code, and the loophole of the two-dimensional code counterfeit identification model can be more accurately searched.

Description

Two-dimensional code sample generation method and device, server and storage medium
Technical Field
The embodiment of the invention relates to the technical field of two-dimensional code counterfeit identification, in particular to a method and a device for generating a two-dimensional code sample, a server and a storage medium.
Background
In recent years, two-dimensional codes have become a general information carrier, have the characteristics of large amount of stored information, wide application range, strong noise and interference resistance and the like, are continuously popularized along with the popularization of smart phones, and are particularly widely applied to the aspects of identity authentication, network transmission, electronic certificates, bills and the like. However, operations such as generation, copying, transmission, and reception of the two-dimensional code have many bugs, and are easily broken, counterfeit, and abused by people. The matching degree test generally includes inputting a copied two-dimensional code into a preset two-dimensional code counterfeit identification model as a training sample, determining the matching degree of the copied two-dimensional code and an original two-dimensional code according to a finally output true and false judgment value, or inputting the copied two-dimensional code and a judgment result into the preset two-dimensional code counterfeit identification model as a test sample, and performing iterative correction on parameters of the model. Therefore, how to generate high-quality copied two-dimensional code samples becomes a focus of attention at present.
In the prior art, a commonly used method for generating a duplicate two-dimensional code sample includes:
1. and printing and scanning the original two-dimensional code for one time, and printing and shooting for the second time to generate a two-dimensional code sample. Compared with the original two-dimensional code, the two-dimensional code obtained by copying through the method is printed for more times, so that the two-dimensional code sample and the original two-dimensional code have larger difference and low matching degree.
2. The two-dimensional code is directly generated through deep learning without secondary printing and scanning. And carrying out deep learning on the two-dimension code picture with the fuzzy distortion to obtain an output picture with the same size as the original two-dimension code. Calculating the difference between the output picture and the original two-dimensional code through a loss function, and then updating the model parameters through a Back Propagation (BP) algorithm. The updated model can be used for constructing a high-quality two-dimensional code sample.
The two-dimensional code sample reconstructed by the method is not a regular block structure, and noise can occur, and meanwhile, when a perceptron model is used, a halftone pattern in the restored two-dimensional code cannot be recovered, so that the matching degree of the two-dimensional code sample and the original two-dimensional code is not high, the two-dimensional code sample cannot be used as a high-quality sample to be input into a two-dimensional code counterfeit identification model, and model loopholes are difficult to accurately search.
Disclosure of Invention
The invention provides a method and a device for generating a two-dimensional code sample, a server and a storage medium, wherein an image of an original two-dimensional code after primary printing is firstly reconstructed and then secondarily printed, so that the copied two-dimensional code sample can be more accurately matched with the information of the original two-dimensional code, and the loophole of a two-dimensional code counterfeit identification model can be more accurately searched.
In a first aspect, the present invention provides a method for generating a two-dimensional code sample, including:
acquiring an original two-dimensional code to be copied;
printing and scanning the original two-dimensional code to generate a first image;
inputting the first image into a preset two-dimensional code reconstruction model, and outputting the first image as a second image;
and printing and shooting the second image to generate a copied two-dimensional code, and taking the copied two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model.
Further, the preset two-dimensional code reconstruction model includes a feature extraction model and a feature reconstruction model which are connected in sequence, and then the first image is input into the preset two-dimensional code reconstruction model and output as a second image, including:
inputting the first image into the feature extraction model to extract image features of the first image;
and inputting the image characteristics of the first image into the characteristic reconstruction model as a training set to generate a second image.
Further, the feature extraction model includes a CoarseNet network, an ObjectNet network, and an EdgeNet network, and the inputting the first image into a preset two-dimensional code reconstruction model and outputting the first image as a second image includes:
inputting the first image into the CoarseNet network for reconstruction learning to generate a fourth image;
inputting the fourth image into an ObjectNet network to extract pixel semantic information;
meanwhile, inputting the first image into an EdgeNet network to extract image edge information;
and taking the fourth image, the pixel semantic information and the image edge information as the image characteristics of the first image.
Further, the feature reconstruction model is a DetailNet residual error structure network.
Further, before the first image is input into a preset two-dimensional code reconstruction model and output as a second image, the method further includes:
and carrying out deformation correction on the first image.
Further, the deformation correcting the first image includes:
performing halftone processing on the first image to generate a halftone dot matrix structure;
and carrying out fuzzy processing on the halftone dot matrix structure to generate a first image after deformation correction.
In a second aspect, the present invention provides an apparatus for generating two-dimensional code samples, including:
the acquisition module is used for acquiring an original two-dimensional code to be copied;
the copying module is used for printing and scanning the original two-dimensional code to generate a first image;
the reconstruction module is used for inputting the first image into a preset two-dimensional code reconstruction model and outputting the first image as a second image;
and the sample generating module is used for printing and shooting the second image, generating a copied two-dimensional code, and taking the copied two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model.
Further, the preset two-dimensional code reconstruction model comprises a feature extraction model and a feature reconstruction model which are connected in sequence, and then the reconstruction module is further configured to:
inputting the first image into the feature extraction model to extract image features of the first image;
and inputting the image characteristics of the first image into the characteristic reconstruction model as a training set to generate a second image.
In a third aspect, the present invention provides a server, including a memory, a processor, and a program stored on the memory and executable on the processor, where the processor executes the program to implement the method for generating two-dimensional code samples as described in any one of the above.
In a fourth aspect, the present invention provides a terminal-readable storage medium, on which a program is stored, the program being capable of implementing the method for generating two-dimensional code samples according to any one of the above descriptions when executed by a processor.
According to the method, the image of the original two-dimensional code after primary printing is firstly reconstructed and then secondarily printed, so that the two-dimensional code sample obtained by copying can be more accurately matched with the information of the original two-dimensional code, and the loophole of the two-dimensional code counterfeit identification model can be more accurately searched.
Drawings
Fig. 1 is a flowchart of a method for generating two-dimensional code samples according to the first embodiment.
Fig. 2 is a flowchart of an alternative embodiment of the first embodiment.
Fig. 3 is a flowchart of a method for generating two-dimensional code samples according to the second embodiment.
Fig. 4a and 4b are schematic diagrams of the copy-prevention two-dimensional code according to the second embodiment.
Fig. 5a and 5b are schematic diagrams of the copy-preventing two-dimensional code of the embedded image according to the second embodiment.
Fig. 6 is a flowchart of an alternative embodiment of the second embodiment.
Fig. 7 is a system block diagram of a two-dimensional code sample generation method according to a third embodiment.
Fig. 8 is a block diagram of an alternative embodiment of the third embodiment.
Fig. 9 is a block diagram of a server according to a fourth embodiment.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Before discussing exemplary embodiments in greater detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps may be rearranged. A process may be terminated when its operations are completed, but may have additional steps not included in the figure. A process may correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
Furthermore, the terms "first," "second," and the like may be used herein to describe various orientations, actions, steps, elements, or the like, but the orientations, actions, steps, or elements are not limited by these terms. These terms are only used to distinguish one direction, action, step or element from another direction, action, step or element. For example, the first feature information may be the second feature information or the third feature information, and similarly, the second feature information and the third feature information may be the first feature information without departing from the scope of the present application. The first characteristic information, the second characteristic information and the third characteristic information are characteristic information of the distributed file system, but are not the same characteristic information. The terms "first", "second", etc. are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "plurality", "batch" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
The terms and acronyms mentioned in the examples below have the following meanings:
the antagonistic generation network: a genetic adaptive Network.
Residual structure: the DetailNet is generally used for CNN convolutional neural networks, can overcome the learning degradation problem in neural network learning, and can adapt to deeper neural network learning.
CoarseNet network: compared with the original VGG model, the CNN convolutional neural network overcomes the learning degradation problem in neural network learning by introducing a residual error function, and can adapt to neural network learning of deeper layers.
ObjectNet network: a convolutional neural network of object identification data provides only a test set to speed up the process. ObjectNet does not contain training images to improve recognition efficiency compared to other conventional image datasets.
EdgeNet network: convolutional neural networks based on multiple CNN detection frameworks improve overall performance, accuracy and processing time with reduced energy consumption and the application of edge detectors to high resolution pictures.
Example one
The embodiment provides a method for generating a two-dimensional code sample, as shown in fig. 1, including the following steps:
s101, obtaining an original two-dimensional code to be copied.
In this step, the original two-dimensional code refers to a two-dimensional code generated according to initial information of an authorized producer, and the original two-dimensional code is not subjected to copying operations such as shooting, printing, scanning and the like and contains unchanged initial information. In this step, the two-dimensional code to be copied may be one or more.
And S102, printing and scanning the original two-dimensional code to generate a first image.
In this step, the first image refers to the two-dimensional code that has undergone the first printing and scanning, and in this embodiment and the following embodiments, the first image is defined as a true two-dimensional code.
S103, inputting the first image into a preset two-dimensional code reconstruction model, and outputting the first image as a second image.
In the copying method in the prior art, an original two-dimensional code is printed and scanned once to obtain a first image, and the first image is printed and photographed twice to generate a two-dimensional code sample. Compared with the original two-dimensional code, the two-dimensional code obtained by copying through the method is printed for more times, so that the two-dimensional code sample and the original two-dimensional code have large difference, the matching degree is not high, and in order to avoid poor copying effect caused by secondary printing, the first image printed for one time needs to be reconstructed to obtain the estimated original two-dimensional code. The reconstruction in the embodiment and other embodiments refers to reversely simulating a primary printing and scanning process by using a convolutional neural network, so that secondary printing is realized only by printing once on the basis of the estimated original two-dimensional code. The halftone refers to the picture tone expressed by the size or density of halftone dots, and is used to reflect the technical indexes of the brightness level and the contrast change of black and white of the image.
As shown in fig. 2, the preset two-dimensional code reconstruction model includes a feature extraction model and a feature reconstruction model which are connected in sequence, and then the step includes:
and S1031, inputting the first image into the feature extraction model to extract the image features of the first image.
S1032, inputting the image features of the first image into the feature reconstruction model as a training set to generate a second image.
In an alternative embodiment, in order to make the reconstructed second image more accurate, a two-phase model of color image deglitching halftone grid is optionally used in the two-dimensional code reconstruction function, considering that the original two-dimensional code may have embedded images.
In an alternative embodiment, the feature extraction model includes a CoarseNet network, an ObjectNet network, and an EdgeNet network, and the feature extraction model of the process includes: and inputting the first image into the CoarseNet network for reconstruction learning to generate a fourth image. Inputting the fourth image into an ObjectNet network to extract pixel semantic information. Meanwhile, the first image is input into an EdgeNet network to extract image edge information. And taking the fourth image, the pixel semantic information and the image edge information as the image characteristics of the first image.
In an alternative embodiment, the feature reconstruction model is a DetailNet residual structure network. In another alternative embodiment, the feature reconstruction model is a GAN countermeasure generation network. Taking the detailNet residual structure network as an example, the fourth image, the pixel semantic information and the image edge information of the first-stage model generated in the above steps are taken as features and input into the residual network structure, and the finer and more vivid continuous tone pattern is generated through fusion of the residual structures.
And S104, printing and shooting the second image to generate a copied two-dimensional code, and taking the copied two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model.
In the step, the copied two-dimensional code is directly input into the two-dimensional code counterfeit distinguishing model, if the output result is true, the copying method is proved to be capable of enabling the two-dimensional code counterfeit distinguishing model to be difficult to identify true or false, the loophole of the two-dimensional code counterfeit distinguishing model can be inquired according to the copying process of the copied two-dimensional code and improved, and the counterfeit distinguishing capability is improved.
According to the method, the image of the original two-dimensional code after primary printing is firstly reconstructed and then secondarily printed, so that the copied two-dimensional code sample can be more accurately matched with the information of the original two-dimensional code, and the loophole of the two-dimensional code counterfeit identification model can be more accurately searched.
Example two
In this embodiment, a process of performing data angle restoration on the first image is added on the basis of the above embodiment, so as to avoid errors caused by problems of shooting angle, distance, paper flatness, and the like after the original two-dimensional code is copied. As shown in fig. 3, the method comprises the following steps:
s201, obtaining an original two-dimensional code to be copied.
S202, printing and scanning the original two-dimensional code to generate a first image.
S203, deformation correction is carried out on the first image.
In this step, the distortion correction is used to correct the first image for pixel mismatch with the original image during printing and scanning due to the angle, distance, flatness of the paper, and the like at the time of shooting.
In the process of reconstructing the two-dimensional code, the two-dimensional code after being printed and scanned needs to be restored to the original digital version two-dimensional code. This is a pixel-level matching task, and pixels of the printed and scanned two-dimensional code and the original two-dimensional code need to be matched and restored one by one. Previous experiments performed poorly because the two-dimensional code needs to be positioned after being printed to obtain a training set. The pixels of the two-dimensional code acquired by the positioning algorithm and the original two-dimensional code are not matched due to the angle, the distance, whether paper is flat or not and the like during shooting. The specific possible resulting situation is: the resolution of the shot two-dimensional code is inconsistent with that of the original two-dimensional code. Photographing the two-dimensional code causes deformation such as image tilt.
The method specifically comprises the following steps: and carrying out halftone processing on the first image to generate a halftone dot matrix structure. And carrying out fuzzy processing on the halftone dot matrix structure to generate a first image after deformation correction.
In an alternative embodiment, since the existing copy-prevention two-dimensional code is composed of a finer halftone dot-like structure, a grayscale halftone two-dimensional code is shown in fig. 4a, and a partial enlarged view of the grayscale halftone two-dimensional code is shown in fig. 4b, while image information may also be embedded in the halftone dot-like structure, a halftone two-dimensional code embedded in an image is shown in fig. 5a, and a partial enlarged view of the halftone two-dimensional code embedded in an image is shown in fig. 5 b. When the model is trained, the requirement of the halftone dot matrix structure on the pixel alignment precision of data is higher than that of a black-and-white block structure, and copied samples are not easy to match with an original two-dimensional code. Therefore, in an alternative embodiment, in order to make the copy result more accurate, as shown in fig. 6, step S202 may further include:
and S206, performing inverse halftone processing on the first image.
In the step, the neural network carries out reverse simulation printing and scanning, and carries out reverse halftone processing on the first image so as to avoid interference of a halftone dot matrix structure and more accurately match the original two-dimensional code.
And S204, inputting the first image into a preset two-dimensional code reconstruction model, and outputting the first image as a second image.
S205, printing and shooting the second image to generate a copied two-dimensional code, and taking the copied two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model.
The embodiment avoids the problem that the original two-dimensional code is not matched with the pixels of the first image by performing deformation correction on the first image before secondary printing. Meanwhile, inverse halftone processing is carried out on the first image so as to avoid interference of a halftone dot matrix structure and match the original two-dimensional code more accurately.
EXAMPLE III
As shown in fig. 7, the present embodiment provides a two-dimensional code sample generation apparatus 3, which includes the following modules:
an obtaining module 301, configured to obtain an original two-dimensional code to be copied;
a copying module 302, configured to print and scan the original two-dimensional code, and generate a first image;
a reconstruction module 303, configured to input the first image into a preset two-dimensional code reconstruction model, and output the first image as a second image; in an alternative embodiment, the preset two-dimensional code reconstruction model includes a feature extraction model and a feature reconstruction model that are sequentially connected, and then the reconstruction module is further configured to: inputting the first image into the feature extraction model to extract image features of the first image; and inputting the image characteristics of the first image serving as a training set into the characteristic reconstruction model to generate a second image. Wherein, the feature extraction model includes a CoarseNet network, an ObjectNet network, and an EdgeNet network, and the step of inputting the first image into a preset two-dimensional code reconstruction model and outputting the first image as a second image includes: inputting the first image into the CoarseNet network for reconstruction learning to generate a fourth image; inputting the fourth image into an ObjectNet network to extract pixel semantic information; meanwhile, inputting the first image into an EdgeNet network to extract image edge information; and taking the fourth image, the pixel semantic information and the image edge information as the image characteristics of the first image. Optionally, the feature reconstruction model is a DetailNet residual structure network.
And the sample generation module 304 is configured to print and shoot the second image, generate a duplicate two-dimensional code, and use the duplicate two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model.
In an alternative embodiment, as shown in fig. 8, further comprising:
and a deformation correction module 305, configured to perform deformation correction on the first image. Performing halftone processing on the first image to generate a halftone dot matrix structure; and carrying out fuzzy processing on the halftone dot matrix structure to generate a first image after deformation correction.
The device for generating the two-dimensional code sample provided by the embodiment of the invention can execute the method for generating the two-dimensional code sample provided by any embodiment of the invention, and has the corresponding execution method and beneficial effects of the functional module.
Example four
The present embodiment provides a schematic structural diagram of a server, as shown in fig. 9, the server includes a processor 401, a memory 402, an input device 403, and an output device 404; the number of the processors 401 in the server may be one or more, and one processor 401 is taken as an example in the figure; the processor 401, memory 402, input device 403 and output device 404 in the device/terminal/server may be linked by a bus or other means, as exemplified by the linking via a bus in fig. 9.
The memory 402 is a computer-readable storage medium, and can be used to store software programs, computer-executable programs, and modules, such as program instructions/modules (for example, the obtaining module 301, the copying module 302, and the like) corresponding to the two-dimensional code sample generating method in the embodiment of the present invention. The processor 401 executes various functional applications of the device/terminal/server and data processing by running software programs, instructions and modules stored in the memory 402, that is, implements the above-described two-dimensional code sample generation method.
The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 402 may further include memory located remotely from the processor 401, which may be linked to the device/terminal/server through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means 403 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the device/terminal/server. The output device 404 may include a display device such as a display screen.
The embodiment of the invention also provides a server which can execute the method for generating the two-dimension code sample provided by any embodiment of the invention, and the server has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
The fifth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for generating a two-dimensional code sample according to any embodiment of the present invention:
acquiring an original two-dimensional code to be copied;
printing and scanning the original two-dimensional code to generate a first image;
inputting the first image into a preset two-dimensional code reconstruction model, and outputting the first image as a second image;
and printing and shooting the second image to generate a copied two-dimensional code, and taking the copied two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model.
The computer-readable storage media of embodiments of the invention may take any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical link having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a storage medium may be transmitted over any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or terminal. In the case of a remote computer, the remote computer may be linked to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the link may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (8)

1. A method for generating a two-dimensional code sample is characterized by comprising the following steps:
acquiring an original two-dimensional code to be copied;
printing and scanning the original two-dimensional code to generate a first image;
inputting the first image into a preset two-dimensional code reconstruction model, and outputting the first image as a second image;
printing and shooting the second image to generate a copied two-dimensional code, and taking the copied two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model;
before the first image is input into a preset two-dimensional code reconstruction model and output as a second image, the method further includes:
performing deformation correction on the first image;
the deformation correction of the first image includes:
performing halftone processing on the first image to generate a halftone dot matrix structure;
and carrying out fuzzy processing on the halftone dot matrix structure to generate a first image after deformation correction.
2. The method according to claim 1, wherein the preset two-dimensional code reconstruction model includes a feature extraction model and a feature reconstruction model which are connected in sequence, and the inputting the first image into the preset two-dimensional code reconstruction model and outputting the first image as the second image includes:
inputting the first image into the feature extraction model to extract image features of the first image;
and inputting the image characteristics of the first image into the characteristic reconstruction model as a training set to generate a second image.
3. The method of claim 2, wherein the feature extraction model includes a CoarseNet network, an ObjectNet network, and an EdgeNet network, and the inputting the first image into a preset two-dimensional code reconstruction model and outputting the first image as the second image includes:
inputting the first image into the CoarseNet network for reconstruction learning to generate a fourth image;
inputting the fourth image into an ObjectNet network to extract pixel semantic information;
meanwhile, inputting the first image into an EdgeNet network to extract image edge information;
and taking the fourth image, the pixel semantic information and the image edge information as the image characteristics of the first image.
4. The method of claim 2, wherein the feature reconstruction model is a DetailNet residual structure network.
5. An apparatus for generating two-dimensional code samples, comprising:
the acquisition module is used for acquiring an original two-dimensional code to be copied;
the copying module is used for printing and scanning the original two-dimensional code to generate a first image;
the reconstruction module is used for inputting the first image into a preset two-dimensional code reconstruction model and outputting the first image as a second image;
the sample generation module is used for printing and shooting the second image, generating a copied two-dimensional code, and taking the copied two-dimensional code as an input sample of a preset two-dimensional code counterfeit identification model;
the deformation correction module is used for carrying out deformation correction on the first image; performing halftone processing on the first image to generate a halftone dot matrix structure; and carrying out fuzzy processing on the halftone dot matrix structure to generate a first image after deformation correction.
6. The apparatus of claim 5, wherein the preset two-dimensional code reconstruction model comprises a feature extraction model and a feature reconstruction model connected in sequence, and then the reconstruction module is further configured to:
inputting the first image into the feature extraction model to extract image features of the first image;
and inputting the image characteristics of the first image serving as a training set into the characteristic reconstruction model to generate a second image.
7. A server comprising a memory, a processor and a program stored on the memory and executable on the processor, wherein the processor implements the method for generating two-dimensional code samples according to any one of claims 1 to 4 when executing the program.
8. A terminal-readable storage medium, on which a program is stored, the program being capable of implementing the method for generating two-dimensional code samples according to any one of claims 1 to 4 when executed by a processor.
CN202011183726.5A 2020-10-29 2020-10-29 Two-dimensional code sample generation method and device, server and storage medium Active CN112465092B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011183726.5A CN112465092B (en) 2020-10-29 2020-10-29 Two-dimensional code sample generation method and device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011183726.5A CN112465092B (en) 2020-10-29 2020-10-29 Two-dimensional code sample generation method and device, server and storage medium

Publications (2)

Publication Number Publication Date
CN112465092A CN112465092A (en) 2021-03-09
CN112465092B true CN112465092B (en) 2023-03-03

Family

ID=74835651

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011183726.5A Active CN112465092B (en) 2020-10-29 2020-10-29 Two-dimensional code sample generation method and device, server and storage medium

Country Status (1)

Country Link
CN (1) CN112465092B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115130491B (en) * 2022-08-29 2023-01-31 荣耀终端有限公司 Automatic code scanning method and terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109920013A (en) * 2019-01-30 2019-06-21 北京交通大学 Image reconstructing method and device based on gradual convolution measurement network
CN111340729A (en) * 2019-12-31 2020-06-26 深圳大学 Training method for depth residual error network for removing Moire pattern of two-dimensional code
WO2020191520A1 (en) * 2019-03-22 2020-10-01 罗伯特·博世有限公司 Microstructure detection based anti-counterfeiting paper product, and manufacturing method and authentication method therefor
CN111738058A (en) * 2020-05-07 2020-10-02 华南理工大学 Reconstruction attack method aiming at biological template protection based on generation of countermeasure network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109920013A (en) * 2019-01-30 2019-06-21 北京交通大学 Image reconstructing method and device based on gradual convolution measurement network
WO2020191520A1 (en) * 2019-03-22 2020-10-01 罗伯特·博世有限公司 Microstructure detection based anti-counterfeiting paper product, and manufacturing method and authentication method therefor
CN111340729A (en) * 2019-12-31 2020-06-26 深圳大学 Training method for depth residual error network for removing Moire pattern of two-dimensional code
CN111738058A (en) * 2020-05-07 2020-10-02 华南理工大学 Reconstruction attack method aiming at biological template protection based on generation of countermeasure network

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
A Copy-Proof Scheme Based on the Spectral;Changsheng Chen etal;《IEEE TRANSACTIONS ON INFORMATION FORENSICS AND SECURITY》;20190812;第15卷;第1058右栏第1-2段、第1059页左栏最后一段、第1061页左栏第2段,图2、5 *
Changsheng Chen etal.A Copy-Proof Scheme Based on the Spectral.《IEEE TRANSACTIONS ON INFORMATION FORENSICS AND SECURITY》.2019,第15卷 *

Also Published As

Publication number Publication date
CN112465092A (en) 2021-03-09

Similar Documents

Publication Publication Date Title
CN107111782B (en) Neural network structure and method thereof
CN109784181B (en) Picture watermark identification method, device, equipment and computer readable storage medium
CN112560861B (en) Bill processing method, device, equipment and storage medium
CN108229274B (en) Method and device for training multilayer neural network model and recognizing road characteristics
CN109635714B (en) Correction method and device for document scanning image
CN113570508A (en) Image restoration method and device, storage medium and terminal
US20240062343A1 (en) Image Restoration Method and Apparatus, Image Restoration Device and Storage Medium
CN112927144A (en) Image enhancement method, image enhancement device, medium, and electronic apparatus
CN111353956B (en) Image restoration method and device, computer equipment and storage medium
CN113592735A (en) Text page image restoration method and system, electronic equipment and computer readable medium
Liu et al. Underwater image colour constancy based on DSNMF
CN112465092B (en) Two-dimensional code sample generation method and device, server and storage medium
CN110188815B (en) Feature point sampling method, device, equipment and storage medium
Ge et al. A screen‐shooting resilient document image watermarking scheme using deep neural network
US11068682B2 (en) QR code generation method and apparatus for terminal device
Zhou et al. MSAR‐DefogNet: Lightweight cloud removal network for high resolution remote sensing images based on multi scale convolution
CN113297986A (en) Handwritten character recognition method, device, medium and electronic equipment
CN112116565B (en) Method, apparatus and storage medium for generating countersamples for falsifying a flip image
US20070076948A1 (en) Method and system for optimizing print-scan simulations
CN114241493B (en) Training method and training device for training data of augmented document analysis model
US20220398698A1 (en) Image processing model generation method, processing method, storage medium, and terminal
CN112911341B (en) Image processing method, decoder network training method, device, equipment and medium
CN113065407B (en) Financial bill seal erasing method based on attention mechanism and generation countermeasure network
CN114329024A (en) Icon searching method and system
JP2024505766A (en) End-to-end watermarking system

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
GR01 Patent grant
GR01 Patent grant