CN113780492A - Two-dimensional code binarization method, device and equipment and readable storage medium - Google Patents

Two-dimensional code binarization method, device and equipment and readable storage medium Download PDF

Info

Publication number
CN113780492A
CN113780492A CN202110883084.8A CN202110883084A CN113780492A CN 113780492 A CN113780492 A CN 113780492A CN 202110883084 A CN202110883084 A CN 202110883084A CN 113780492 A CN113780492 A CN 113780492A
Authority
CN
China
Prior art keywords
dimensional code
image
binarization
preset
code image
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
CN202110883084.8A
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 Xurui Software Technology Co ltd
Original Assignee
Nanjing Xurui Software Technology Co ltd
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 Xurui Software Technology Co ltd filed Critical Nanjing Xurui Software Technology Co ltd
Priority to CN202110883084.8A priority Critical patent/CN113780492A/en
Publication of CN113780492A publication Critical patent/CN113780492A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K17/00Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations
    • G06K17/0022Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations arrangements or provisious for transferring data to distant stations, e.g. from a sensing device
    • G06K17/0025Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations arrangements or provisious for transferring data to distant stations, e.g. from a sensing device the arrangement consisting of a wireless interrogation device in combination with a device for optically marking the record carrier
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Abstract

The application discloses a two-dimensional code binarization method, a two-dimensional code binarization device, two-dimensional code binarization equipment and a readable storage medium. The two-dimensional code binarization method comprises the following steps: acquiring a two-dimensional code image to be identified, wherein the pixel size of the two-dimensional code image to be identified meets a preset image size condition; analyzing a two-dimensional code image to be identified according to the trained two-dimensional code binarization model to obtain an analyzed two-dimensional code image, wherein the pixel size of the analyzed two-dimensional code image meets a preset image size condition; mapping the analyzed two-dimensional code image according to a preset mapping function to obtain a first target two-dimensional code image; and determining a binarization identification result of the first target two-dimensional code image according to a preset threshold value. According to the embodiment of the application, the recognition resolution of the two-dimensional code can be improved.

Description

Two-dimensional code binarization method, device and equipment and readable storage medium
Technical Field
The application belongs to the field of two-dimension code identification, and particularly relates to a two-dimension code binarization method, device and equipment and a readable storage medium.
Background
The two-dimensional code becomes an important tool for modern life, industrial production and warehouse logistics, and the information stored in a background database when the bar code is used in the past can be directly contained in the bar code by the aid of huge information carrying capacity of the two-dimensional code.
The two-dimensional code is as the entry of mobile internet, uses more and more extensively, among the prior art, in order to improve two-dimensional code recognition resolution, often adopts global binarization or local binarization's scheme, improves two-dimensional code recognition resolution. However, the two-dimensional code recognition rate is still low due to uneven brightness, blurring, deformation and information loss of the obtained two-dimensional code image caused by the printing quality problem and the complex imaging environment.
Disclosure of Invention
The embodiment of the application provides a two-dimensional code binarization method, a two-dimensional code binarization device, a two-dimensional code binarization equipment and a readable storage medium, which can improve the recognition resolution of a two-dimensional code.
In a first aspect, an embodiment of the present application provides a two-dimensional code binarization method, including:
acquiring a two-dimensional code image to be identified, wherein the pixel size of the two-dimensional code image to be identified meets a preset image size condition;
analyzing a two-dimensional code image to be identified according to the trained two-dimensional code binarization model to obtain an analyzed two-dimensional code image, wherein the pixel size of the analyzed two-dimensional code image meets a preset image size condition;
mapping the analyzed two-dimensional code image according to a preset mapping function to obtain a first target two-dimensional code image;
and determining a binarization identification result of the first target two-dimensional code image according to a preset threshold value.
In some realizations of the first aspect, the trained two-dimensional code binarization model comprises a feature coding layer and a feature decoding layer; analyzing a two-dimensional code image to be identified according to the trained two-dimensional code binarization model to obtain an analyzed two-dimensional code image, and the method comprises the following steps:
extracting the features of the two-dimensional code image to be recognized according to the feature coding layer to obtain feature coded data;
and performing data analysis on the feature decoding image according to the feature decoding layer to obtain an analyzed two-dimensional code image.
In some implementation manners of the first aspect, according to a preset threshold, before analyzing the two-dimensional code image to be recognized according to the trained two-dimensional code binarization model to obtain an analyzed two-dimensional code image, the method further includes:
acquiring a two-dimensional code training sample set, wherein the two-dimensional code training sample set comprises a plurality of training images and at least one label image, each label image comprises a two-dimensional code image, and each training image comprises a preprocessed two-dimensional code image;
and training a preset two-dimensional code binarization network according to the two-dimensional code training sample set to obtain a trained two-dimensional code binarization model.
In some implementation manners of the first aspect, the preset mapping function is a preset Sigmoid function, and the preset two-dimensional code binarization network is trained according to a two-dimensional code training sample set to obtain a trained two-dimensional code binarization model, including:
inputting a plurality of training images into a preset two-dimensional code binarization network to obtain an initial identification image;
mapping the initial identification image according to a preset Sigmoid function to obtain a target identification image;
and calculating loss values of the other image and the label image according to a preset loss function, and obtaining a trained two-dimensional code binarization model under the condition that the loss values meet preset conditions.
In some implementations of the first aspect, obtaining a two-dimensional code training sample set includes:
acquiring a two-dimensional code image;
and carrying out random image transformation processing on the two-dimensional code image to obtain a preset number of training images.
In some realizations of the first aspect, the random image transformation process includes at least one of: random position transform processing, image fusion processing, sharpness transform processing, brightness transform processing, contrast transform, random blur processing, random noise processing, and random pixel setting 0 processing.
In a second aspect, an embodiment of the present application provides a two-dimensional code binarization device, including:
the device comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring a two-dimensional code image to be identified, and the pixel size of the two-dimensional code image to be identified meets a preset image size condition;
the processing module is used for analyzing the two-dimensional code image to be identified according to the trained two-dimensional code binarization model to obtain an analyzed two-dimensional code image, wherein the pixel size of the analyzed two-dimensional code image meets a preset image size condition;
the processing module is further used for mapping the analyzed two-dimensional code image according to a preset mapping function to obtain a first target two-dimensional code image;
and the identification module is used for determining a binarization identification result of the first target two-dimensional code image according to a preset threshold value.
In some realizations of the second aspect, the trained two-dimensional code binarization model comprises a feature coding layer and a feature decoding layer;
the processing module is also used for extracting the characteristics of the two-dimensional code image to be recognized according to the characteristic coding layer to obtain characteristic coded data;
and the processing module is also used for carrying out data analysis on the characteristic decoding image according to the characteristic decoding layer to obtain an analyzed two-dimensional code image.
In a third aspect, the present application provides a two-dimensional code binarization device, including: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the two-dimensional code binarization method described in the first aspect or any one of the implementable manners of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, where computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are executed by a processor, the two-dimensional code binarization method according to the first aspect or any one of the realizable manners of the first aspect is implemented.
The embodiment of the application provides a two-dimensional code binarization method, a two-dimensional code binarization device, two-dimensional code binarization equipment and a readable storage medium, wherein the two-dimensional code image to be identified meeting the preset image size condition is acquired, the identification efficiency of a two-dimensional code can be subsequently improved, the two-dimensional code image to be identified can be analyzed after being input into a trained two-dimensional code binarization model, so that the noise in the two-dimensional code image to be identified can be effectively reduced, then, the analyzed two-dimensional code image is mapped through a preset mapping function to obtain a first target two-dimensional code image, and then, the identification rate of a binarization identification result of the target two-dimensional code image can be effectively improved according to a preset threshold value.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly described below, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a two-dimensional code binarization method provided in an embodiment of the present application;
fig. 2 is a schematic diagram of a network structure provided in an embodiment of the present application;
fig. 3 is a schematic diagram of a binarization effect of a two-dimensional code provided in an embodiment of the application;
fig. 4 is a schematic structural diagram of a two-dimensional code binarization device provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of a two-dimensional code binarization device provided in an embodiment of the application.
Detailed Description
Features and exemplary embodiments of various aspects of the present application will be described in detail below, and in order to make objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are intended to be illustrative only and are not intended to be limiting. It will be apparent to one skilled in the art that the present application may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the present application by illustrating examples thereof.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The two-dimensional code becomes an important tool for modern life, industrial production and warehouse logistics, and the information stored in a background database when the bar code is used in the past can be directly contained in the bar code by the aid of huge information carrying capacity of the two-dimensional code.
The two-dimensional code is as the entry of mobile internet, uses more and more extensively, among the prior art, in order to improve two-dimensional code recognition resolution, often adopts global binarization or local binarization's scheme, improves two-dimensional code recognition resolution. However, the two-dimensional code recognition rate is still low due to uneven brightness, blurring, deformation and information loss of the obtained two-dimensional code image caused by the printing quality problem and the complex imaging environment.
In order to solve the prior art problems, embodiments of the present application provide a two-dimensional code binarization method, device, and apparatus, and a readable storage medium. The two-dimensional code image to be recognized meeting the preset image size condition in size is acquired, the recognition efficiency of the two-dimensional code can be subsequently improved, the two-dimensional code image to be recognized is input into a trained two-dimensional code binarization model, an analyzed two-dimensional code image can be obtained, and therefore noise in the two-dimensional code image to be recognized can be effectively reduced.
The two-dimensional code binarization method provided by the embodiment of the application is introduced below. Fig. 1 shows a schematic flow diagram of a two-dimensional code binarization method provided in an embodiment of the present application. As shown in fig. 1, the method may include the steps of:
and step 110, acquiring a two-dimensional code image to be identified.
The pixel size of the two-dimensional code image to be recognized meets a preset image size condition.
The common two-dimensional code is a pattern which is distributed on a plane according to a certain rule by using a certain specific geometric figure, has alternate colors and records data symbol information.
In some embodiments, an image including a two-dimensional code is acquired in real time through a camera of the electronic device, or the image including the two-dimensional code stored in the electronic device, and problems such as blur, deformation, noise, uneven illumination, poor printing quality, and the like of the two-dimensional code in a real scene may cause failure in binarization of the two-dimensional code. In order to improve the accuracy of binarization of the two-dimensional code, in some embodiments, after an image including the two-dimensional code is obtained, the image of the two-dimensional code is preprocessed, and the pixel size of the image of the two-dimensional code to be recognized meets a preset image size condition. The preprocessing the image of the two-dimensional code may further include: and determining whether the pixels of the area where the two-dimensional code is located meet a preset image size condition, and if not, performing preset image enhancement processing on the image to obtain the two-dimensional code image to be identified.
After obtaining the two-dimensional code image to be recognized, step 120 may be performed.
And 120, analyzing the two-dimension code image to be identified according to the trained two-dimension code binarization model to obtain an analyzed two-dimension code image.
In some embodiments, in order to reduce an error of mapping an image in a subsequent step and improve the accuracy of two-dimensional code binarization, a two-dimensional code binarization network is trained into a two-dimensional code binarization model which can analyze that the pixel size of a two-dimensional code image meets a preset image size condition.
In some embodiments, the trained two-dimensional code binarization model comprises a feature coding layer and a feature decoding layer; step 120 in the embodiment of the present application specifically includes: extracting the features of the two-dimensional code image to be recognized according to the feature coding layer to obtain feature coded data; and performing data analysis on the feature decoding image according to the feature decoding layer to obtain an analyzed two-dimensional code image.
For example, with reference to the network structure diagram shown in fig. 2, the feature coding layer (Encoder) may include a 3-layer downsampling Convolution (conversion) module, and perform downsampling feature extraction three times on the two-dimensional Code image to be identified that meets the preset image size condition to obtain feature coded data (Code), and the feature decoding layer may include a 3-layer upsampling and transposing Convolution (transformed conversion) module, and perform data analysis on the feature coded data, that is, perform data reconstruction (Decoder) on the feature coded data through upsampling, and obtain the analyzed two-dimensional Code image. The two-dimensional code image after analysis is obtained by extracting and reconstructing the features in the two-dimensional code image to be recognized, so that the noise in the two-dimensional code image to be recognized can be effectively removed, and the accuracy of the two-dimensional code binarization is improved.
And step 130, mapping the analyzed two-dimensional code image according to a preset mapping function to obtain a first target two-dimensional code image.
For example, each pixel point is mapped to a (0, 1) interval according to a preset mapping function, and a mapping value of each pixel point is obtained.
In some embodiments, the preset mapping function may be a Sigmoid function, as shown in equation (1).
Figure BDA0003192869000000061
And x is each pixel point in the analyzed two-dimensional code image.
And according to a preset mapping function, corresponding to each pixel point in the analyzed two-dimensional code image, wherein the value range after compression is 0-1.
Next, step 140 may be performed.
And 140, determining a binarization identification result of the first target two-dimensional code image according to a preset threshold value.
According to a preset threshold value, the first target two-dimensional code image can be converted, and a binarization identification result of the first target two-dimensional code image is obtained.
Illustratively, taking the preset mapping function as a Sigmoid function as an example, correspondingly, the preset threshold may be 0.5, when the mapping value of the pixel is less than 0.5, the pixel is determined to be black, and when the mapping value of the pixel is greater than or equal to 0.5, the pixel is determined to be white, and finally, the binarization identification result of the first target two-dimensional code image may be obtained.
The two-dimensional code binarization method provided by the embodiment of the application can be used for obtaining the two-dimensional code image to be recognized, which meets the requirement of size to meet the preset image size condition, and can be used for subsequently improving the recognition efficiency of the two-dimensional code, and after the two-dimensional code image to be recognized is input into a trained two-dimensional code binarization model, the two-dimensional code image after analysis can be obtained, so that the noise in the two-dimensional code image to be recognized can be effectively reduced, and then the two-dimensional code image after analysis is subjected to mapping processing through a preset mapping function to obtain a first target two-dimensional code image, and then the recognition rate of the binarization recognition result of the target two-dimensional code image can be effectively improved according to a preset threshold value.
Fig. 3 is a schematic diagram of a binarization effect of a two-dimensional code provided in an embodiment of the present application, where fig. 3(a) is a schematic diagram of an identification result of binarizing and segmenting a two-dimensional code image based on a global threshold algorithm in the prior art, fig. 3(b) is a schematic diagram of an identification result of binarizing and segmenting a two-dimensional code image based on a local threshold algorithm in the prior art, and fig. 3(c) is a schematic diagram of a binarization result of a two-dimensional code obtained based on a two-dimensional code binarization method provided in an embodiment. In addition, the two-dimensional code image is subjected to binarization segmentation relative to a local threshold algorithm, and the problems of large calculation amount and low recognition speed exist, so that the two-dimensional code binarization method provided by the embodiment of the application can improve the recognition speed of the two-dimensional code.
In addition, in order to obtain a two-dimensional code binarization model with high recognition resolution, in some embodiments, the obtaining of the trained two-dimensional code binarization model may include the following steps: firstly, acquiring a two-dimensional code training sample set, wherein the two-dimensional code training sample set comprises a plurality of training images and at least one label image, each label image comprises a two-dimensional code image, and each training image comprises a preprocessed two-dimensional code image; and then, training a preset two-dimensional code binarization network according to the two-dimensional code training sample set to obtain a trained two-dimensional code binarization model.
In some embodiments, obtaining a two-dimensional code training sample set comprises: and acquiring two-dimensional code images, and performing random image transformation processing on the two-dimensional code images to obtain training images in a preset number.
Because collecting the stained two-dimensional code image as the training sample and labeling the stained two-dimensional code image consumes a large amount of time cost and labor cost, in order to improve the acquisition efficiency of the two-dimensional code training sample and reduce the cost consumption, in the embodiment of the application, a complete lossless two-dimensional code image can be acquired and used as the reference sample, and the simulated stained two-dimensional code image can be obtained by performing random image transformation processing on the complete lossless two-dimensional code image.
As a specific example, the random image transformation process includes at least one of: random position transform processing, image fusion processing, sharpness transform processing, brightness transform processing, contrast transform, random blur processing, random noise processing, and random pixel setting 0 processing.
According to the embodiment of the application, the training images with the preset number can be obtained only by setting the times of random image transformation processing. Therefore, the difficulty of collecting the two-dimensional code image with stain as the training sample can be reduced, and the cost consumption is reduced.
In some embodiments, the preset mapping function is a preset Sigmoid function, and the training of the preset two-dimensional code binarization network is performed according to a two-dimensional code training sample set to obtain a trained two-dimensional code binarization model, including: inputting a plurality of training images into a preset two-dimensional code binarization network to obtain an initial identification image; mapping the initial identification image according to a preset Sigmoid function to obtain a target identification image; and calculating loss values of the other image and the label image according to a preset loss function, and obtaining a trained two-dimensional code binarization model under the condition that the loss values meet preset conditions. Illustratively, reverse gradient calculation is performed based on the loss value, parameters of the two-dimensional code binarization model are updated, and the trained two-dimensional code binarization model is finally obtained.
Specifically, the preset loss function may be a BCELoss formula, as shown in formula (2).
Figure BDA0003192869000000081
Wherein n is the total number of pixels, xnIs the predicted value of the pixel point of the model output, ynIs the actual value of the pixel point binarization.
Illustratively, by taking a complete lossless two-dimensional code imageLine marking to obtain pixel point ynThe actual value of the binarization.
According to the training method for the preset two-dimensional code binarization network, the time cost and the labor cost for obtaining the training samples can be effectively reduced, the preset two-dimensional code binarization network adopts a light weight network design mode, the model reasoning speed is high, and the preset two-dimensional code binarization network can have higher accuracy and higher calculation speed after training is completed.
Fig. 4 is a schematic structural diagram of a two-dimensional code binarization device provided in an embodiment of the present application, and as shown in fig. 4, the two-dimensional code binarization device 400 may include: an acquisition module 410, a processing module 420, and an identification module 430.
The acquiring module 410 is configured to acquire a two-dimensional code image to be recognized, where a pixel size of the two-dimensional code image to be recognized meets a preset image size condition;
the processing module 420 is configured to analyze the two-dimensional code image to be recognized according to the trained two-dimensional code binarization model to obtain an analyzed two-dimensional code image, where a pixel size of the analyzed two-dimensional code image meets a preset image size condition;
the processing module is further used for mapping the analyzed two-dimensional code image according to a preset mapping function to obtain a first target two-dimensional code image;
the identifying module 430 is configured to determine a binarization identifying result of the first target two-dimensional code image according to a preset threshold.
In some embodiments, the trained two-dimensional code binarization model comprises a feature coding layer and a feature decoding layer;
the processing module 420 is further configured to perform feature extraction on the to-be-identified two-dimensional code image according to the feature coding layer to obtain feature coded data;
the processing module 420 is further configured to perform data analysis on the feature decoding image according to the feature decoding layer to obtain an analyzed two-dimensional code image.
The two-dimensional code binarization device provided by the embodiment of the application can be used for acquiring the two-dimensional code image to be recognized, the size of which is satisfied with the preset image size condition, the recognition efficiency of the two-dimensional code can be subsequently improved, the two-dimensional code image to be recognized can be input into a trained two-dimensional code binarization model, and then the two-dimensional code image after analysis can be obtained, so that the noise in the two-dimensional code image to be recognized can be effectively reduced, and then the two-dimensional code image after analysis is mapped through a preset mapping function to obtain a first target two-dimensional code image, and then the recognition rate of the binarization recognition result of the target two-dimensional code image can be effectively improved according to a preset threshold value.
In some embodiments, the obtaining module 410 is further configured to obtain a two-dimensional code training sample set, where the two-dimensional code training sample set includes a plurality of training images and at least one label image, each label image includes a two-dimensional code image, and each training image includes a preprocessed two-dimensional code image;
the processing module 420 is further configured to train a preset two-dimensional code binarization network according to the two-dimensional code training sample set, so as to obtain a trained two-dimensional code binarization model.
In some embodiments, the predetermined mapping function is a predetermined Sigmoid function, and the sample set is trained according to a two-dimensional code.
The processing module 420 is further configured to input the plurality of training images into a preset two-dimensional code binarization network to obtain an initial identification image;
the processing module 420 is further configured to perform mapping processing on the initial identification image according to a preset Sigmoid function to obtain a target identification image;
the processing module 420 is further configured to calculate loss values of the other image and the label image according to a preset loss function, and obtain a trained two-dimensional code binarization model when the loss values meet a preset condition.
In some embodiments, the obtaining module 410 is further configured to obtain a two-dimensional code image;
the processing module 420 is further configured to perform random image transformation processing on the two-dimensional code image to obtain a preset number of training images.
In some embodiments, the random image transformation process includes at least one of: random position transform processing, image fusion processing, sharpness transform processing, brightness transform processing, contrast transform, random blur processing, random noise processing, and random pixel setting 0 processing.
It can be understood that the two-dimensional code binarization device 400 in the embodiment of the present application may correspond to an execution main body of the two-dimensional code binarization method provided in the embodiment of the present application, and specific details of operations and/or functions of each module/unit of the two-dimensional code binarization device 400 may refer to the descriptions of the corresponding parts in the two-dimensional code binarization method in fig. 1 in the embodiment of the present application, and for brevity, no further description is provided here.
The two-dimensional code binarization device provided by the embodiment of the application can also effectively reduce the time cost and the labor cost for acquiring the training samples, the preset two-dimensional code binarization network adopts a light weight network design mode, and the model reasoning speed is high, so that the preset two-dimensional code binarization network can have higher accuracy and higher calculation speed after the training is completed.
Fig. 5 shows a schematic structural diagram of a two-dimensional code binarization device according to an embodiment of the application. As shown in fig. 5, the apparatus may include a processor 501 and a memory 502 storing computer program instructions.
Specifically, the processor 501 may include a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement the embodiments of the present Application.
Memory 502 may include a mass storage for information or instructions. By way of example, and not limitation, memory 502 may include a Hard Disk Drive (HDD), a floppy Disk Drive, flash memory, an optical Disk, a magneto-optical Disk, tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. In one example, memory 502 can include removable or non-removable (or fixed) media, or memory 502 is non-volatile solid-state memory. The memory 502 may be internal or external to the two-dimensional code binarizing apparatus.
In one example, the Memory 502 may be a Read Only Memory (ROM). In one example, the ROM may be mask programmed ROM, programmable ROM (prom), erasable prom (eprom), electrically erasable prom (eeprom), electrically rewritable ROM (earom), or flash memory, or a combination of two or more of these.
The processor 501 reads and executes the computer program instructions stored in the memory 502 to implement the method described in the embodiment of the present application, and achieves the corresponding technical effect achieved by executing the method in the embodiment of the present application, which is not described herein again for brevity.
In one example, the two-dimensional code binarization device can further comprise a communication interface 503 and a bus 510. As shown in fig. 5, the processor 501, the memory 502, and the communication interface 503 are connected via a bus 510 to complete communication therebetween.
The communication interface 503 is mainly used for implementing communication between modules, apparatuses, units and/or devices in the embodiments of the present application.
Bus 510 comprises hardware, software, or both to couple the components of the online information traffic charging apparatus to one another. By way of example, and not limitation, a Bus may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (Front Side Bus, FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) Bus, an infiniband interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a Micro Channel Architecture (MCA) Bus, a Peripheral Component Interconnect (PCI) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a video electronics standards association local (VLB) Bus, or other suitable Bus or a combination of two or more of these. Bus 510 may include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
The two-dimensional code binarization device can execute the two-dimensional code binarization method in the embodiment of the application, thereby realizing the corresponding technical effect of the two-dimensional code binarization method described in the embodiment of the application.
In addition, by combining the two-dimensional code binarization method in the above embodiments, the embodiments of the present application can be implemented by providing a readable storage medium. The readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any one of the two-dimensional code binarization methods in the above embodiments.
It is to be understood that the present application is not limited to the particular arrangements and instrumentality described above and shown in the attached drawings. A detailed description of known methods is omitted herein for the sake of brevity. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and illustrated, and those skilled in the art can make various changes, modifications, and additions or change the order between the steps after comprehending the spirit of the present application.
The functional blocks shown in the above-described structural block diagrams may be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic Circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, plug-in, function card, or the like. When implemented in software, the elements of the present application are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine-readable medium or transmitted by a data signal carried in a carrier wave over a transmission medium or a communication link. A "machine-readable medium" may include any medium that can store or transfer information. Examples of a machine-readable medium include electronic circuits, semiconductor Memory devices, Read-Only memories (ROMs), flash memories, Erasable Read-Only memories (EROMs), floppy disks, Compact disk Read-Only memories (CD-ROMs), optical disks, hard disks, optical fiber media, Radio Frequency (RF) links, and so forth. The code segments may be downloaded via computer networks such as the internet, intranet, etc.
It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, may be performed in an order different from the order in the embodiments, or may be performed simultaneously.
Aspects of the present disclosure are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions/acts specified in the flowchart and/or block diagram block or blocks. Such a processor may be, but is not limited to, a general purpose processor, a special purpose processor, an application specific processor, or a field programmable logic circuit. It will also be understood that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware for performing the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As described above, only the specific embodiments of the present application are provided, and it can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the module and the unit described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. It should be understood that the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered within the scope of the present application.

Claims (10)

1. A two-dimensional code binarization method is characterized by comprising the following steps:
acquiring a two-dimensional code image to be identified, wherein the pixel size of the two-dimensional code image to be identified meets a preset image size condition;
analyzing the two-dimensional code image to be identified according to a trained two-dimensional code binarization model to obtain an analyzed two-dimensional code image, wherein the pixel size of the analyzed two-dimensional code image meets the preset image size condition;
mapping the analyzed two-dimensional code image according to a preset mapping function to obtain a first target two-dimensional code image;
and determining a binarization identification result of the first target two-dimensional code image according to a preset threshold value.
2. The method according to claim 1, wherein the trained two-dimensional code binarization model comprises a feature coding layer and a feature decoding layer; the method for analyzing the two-dimension code image to be identified according to the trained two-dimension code binarization model to obtain the analyzed two-dimension code image comprises the following steps:
extracting the features of the two-dimensional code image to be identified according to the feature coding layer to obtain feature coded data;
and performing data analysis on the feature decoding image according to the feature decoding layer to obtain the analyzed two-dimensional code image.
3. The method according to claim 1, wherein before the analyzing the two-dimensional code image to be recognized according to the trained two-dimensional code binarization model according to a preset threshold value to obtain an analyzed two-dimensional code image, the method further comprises:
acquiring a two-dimensional code training sample set, wherein the two-dimensional code training sample set comprises a plurality of training images and at least one label image, each label image comprises a two-dimensional code image, and each training image comprises the two-dimensional code image after preprocessing;
and training a preset two-dimensional code binarization network according to the two-dimensional code training sample set to obtain the trained two-dimensional code binarization model.
4. The method according to claim 3, wherein a preset mapping function is a preset Sigmoid function, and the training of a preset two-dimensional code binarization network according to the two-dimensional code training sample set to obtain the trained two-dimensional code binarization model comprises:
inputting the training images into a preset two-dimensional code binarization network to obtain an initial identification image;
mapping the initial identification image according to the preset Sigmoid function to obtain a target identification image;
and calculating loss values of the target other image and the label image according to a preset loss function, and obtaining the trained two-dimensional code binarization model under the condition that the loss values meet preset conditions.
5. The method of claim 3, wherein obtaining the two-dimensional code training sample set comprises:
acquiring a two-dimensional code image;
and carrying out random image transformation processing on the two-dimensional code image to obtain a preset number of training images.
6. The method of claim 5, wherein the stochastic image transform process comprises at least one of: random position transform processing, image fusion processing, sharpness transform processing, brightness transform processing, contrast transform, random blur processing, random noise processing, and random pixel setting 0 processing.
7. A two-dimensional code binarization device is characterized by comprising:
the device comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring a two-dimensional code image to be identified, and the pixel size of the two-dimensional code image to be identified meets a preset image size condition;
the processing module is used for analyzing the two-dimensional code image to be recognized according to the trained two-dimensional code binarization model to obtain an analyzed two-dimensional code image, wherein the pixel size of the analyzed two-dimensional code image meets the preset image size condition;
the processing module is further used for mapping the analyzed two-dimensional code image according to a preset mapping function to obtain a first target two-dimensional code image;
and the identification module is used for determining a binarization identification result of the first target two-dimensional code image according to a preset threshold value.
8. The device of claim 7, wherein the trained two-dimensional code binarization model comprises a feature coding layer and a feature decoding layer;
the processing module is further used for performing feature extraction on the two-dimensional code image to be identified according to the feature coding layer to obtain feature coded data;
the processing module is further configured to perform data analysis on the feature decoding image according to the feature decoding layer to obtain the two-dimensional code image after analysis.
9. A two-dimensional code binarization device is characterized by comprising: a processor, and a memory storing computer program instructions;
the processor reads and executes the computer program instructions to implement the two-dimensional code binarization method according to any one of claims 1-6.
10. A readable storage medium, characterized in that the readable storage medium has stored thereon computer program instructions, which when executed by a processor, implement the two-dimensional code binarization method according to any one of claims 1-6.
CN202110883084.8A 2021-08-02 2021-08-02 Two-dimensional code binarization method, device and equipment and readable storage medium Pending CN113780492A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110883084.8A CN113780492A (en) 2021-08-02 2021-08-02 Two-dimensional code binarization method, device and equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110883084.8A CN113780492A (en) 2021-08-02 2021-08-02 Two-dimensional code binarization method, device and equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN113780492A true CN113780492A (en) 2021-12-10

Family

ID=78836575

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110883084.8A Pending CN113780492A (en) 2021-08-02 2021-08-02 Two-dimensional code binarization method, device and equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113780492A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117576617A (en) * 2024-01-16 2024-02-20 杭州长河智信科技有限公司 Decoding system based on automatic adjustment of different environments

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109325491A (en) * 2018-08-16 2019-02-12 腾讯科技(深圳)有限公司 Identification code recognition methods, device, computer equipment and storage medium
CN110991457A (en) * 2019-11-26 2020-04-10 北京达佳互联信息技术有限公司 Two-dimensional code processing method and device, electronic equipment and storage medium
CN111310508A (en) * 2020-02-14 2020-06-19 北京化工大学 Two-dimensional code identification method
US20200226440A1 (en) * 2018-10-17 2020-07-16 Boe Technology Group Co., Ltd. Two-dimensional code image generation method and apparatus, storage medium and electronic device
CN111783494A (en) * 2020-06-24 2020-10-16 成都明灯云工程科技有限公司 Damaged two-dimensional code recovery method of convolution self-encoder combined with binary segmentation
CN112651257A (en) * 2020-12-23 2021-04-13 福建新大陆支付技术有限公司 Two-dimensional code, bar code image positioning and identifying method and storage medium thereof
CN112927254A (en) * 2021-02-26 2021-06-08 华南理工大学 Single word tombstone image binarization method, system, device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109325491A (en) * 2018-08-16 2019-02-12 腾讯科技(深圳)有限公司 Identification code recognition methods, device, computer equipment and storage medium
US20200226440A1 (en) * 2018-10-17 2020-07-16 Boe Technology Group Co., Ltd. Two-dimensional code image generation method and apparatus, storage medium and electronic device
CN110991457A (en) * 2019-11-26 2020-04-10 北京达佳互联信息技术有限公司 Two-dimensional code processing method and device, electronic equipment and storage medium
CN111310508A (en) * 2020-02-14 2020-06-19 北京化工大学 Two-dimensional code identification method
CN111783494A (en) * 2020-06-24 2020-10-16 成都明灯云工程科技有限公司 Damaged two-dimensional code recovery method of convolution self-encoder combined with binary segmentation
CN112651257A (en) * 2020-12-23 2021-04-13 福建新大陆支付技术有限公司 Two-dimensional code, bar code image positioning and identifying method and storage medium thereof
CN112927254A (en) * 2021-02-26 2021-06-08 华南理工大学 Single word tombstone image binarization method, system, device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117576617A (en) * 2024-01-16 2024-02-20 杭州长河智信科技有限公司 Decoding system based on automatic adjustment of different environments
CN117576617B (en) * 2024-01-16 2024-04-16 杭州长河智信科技有限公司 Decoding system based on automatic adjustment of different environments

Similar Documents

Publication Publication Date Title
CN111369545B (en) Edge defect detection method, device, model, equipment and readable storage medium
CN111079764B (en) Low-illumination license plate image recognition method and device based on deep learning
CN111062355A (en) Human body action recognition method
CN111860439A (en) Unmanned aerial vehicle inspection image defect detection method, system and equipment
CN108764235B (en) Target detection method, apparatus and medium
CN113591967A (en) Image processing method, device and equipment and computer storage medium
CN114882039B (en) PCB defect identification method applied to automatic PCB sorting process
CN113723377A (en) Traffic sign detection method based on LD-SSD network
CN112149713B (en) Method and device for detecting insulator image based on insulator image detection model
CN111507337A (en) License plate recognition method based on hybrid neural network
CN113780110A (en) Method and device for detecting weak and small targets in image sequence in real time
CN117094975A (en) Method and device for detecting surface defects of steel and electronic equipment
CN111340041B (en) License plate recognition method and device based on deep learning
CN112784835A (en) Method and device for identifying authenticity of circular seal, electronic equipment and storage medium
CN113723216A (en) Lane line detection method and device, vehicle and storage medium
CN109712134B (en) Iris image quality evaluation method and device and electronic equipment
CN117058063A (en) Battery defect detection method and device and electronic equipment
CN113780492A (en) Two-dimensional code binarization method, device and equipment and readable storage medium
CN111696064B (en) Image processing method, device, electronic equipment and computer readable medium
CN111311573B (en) Branch determination method and device and electronic equipment
CN111754497B (en) Industrial defect detection method and system based on geometric algebra
CN111797923A (en) Training method of image classification model, and image classification method and device
CN111242051A (en) Vehicle identification optimization method and device and storage medium
CN115731179A (en) Track component detection method, terminal and storage medium
CN115345806A (en) Object detection method and device, electronic equipment and readable storage medium

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