CN111860027A - Two-dimensional code identification method and device - Google Patents

Two-dimensional code identification method and device Download PDF

Info

Publication number
CN111860027A
CN111860027A CN202010530228.7A CN202010530228A CN111860027A CN 111860027 A CN111860027 A CN 111860027A CN 202010530228 A CN202010530228 A CN 202010530228A CN 111860027 A CN111860027 A CN 111860027A
Authority
CN
China
Prior art keywords
dimensional code
pattern
model
identification
pixel points
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
CN202010530228.7A
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.)
Beike Technology Co Ltd
Original Assignee
Beike 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 Beike Technology Co Ltd filed Critical Beike Technology Co Ltd
Priority to CN202010530228.7A priority Critical patent/CN111860027A/en
Publication of CN111860027A publication Critical patent/CN111860027A/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
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Toxicology (AREA)
  • Electromagnetism (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention provides a method and a device for identifying a two-dimensional code, wherein the method comprises the following steps: inputting a pattern to be recognized with a two-dimensional code into a pre-trained neural network model, and obtaining the probability that pixel points in the pattern to be recognized output by the neural network model are located in the two-dimensional code; obtaining pixel points in the two-dimensional code according to the probability that the pixel points are located in the two-dimensional code, and calculating the minimum circumscribed rectangle of the pixel points in the two-dimensional code to obtain an identification frame in the pattern to be identified; and identifying the two-dimension code framed by the identification frame to obtain a two-dimension code identification result. According to the embodiment of the invention, the mode of predicting the regression vertex coordinates by the advanced EAST model is optimized, so that the advanced EAST model originally applied to character detection, particularly long text detection, can accurately identify square patterns, and the robustness and the accuracy of two-dimensional code identification are enhanced.

Description

Two-dimensional code identification method and device
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for identifying a two-dimensional code.
Background
The two-dimensional Code is also called as a two-dimensional Bar Code, a common two-dimensional Code is a QR Code, which is called as a Quick Response, and is an ultra-popular coding mode on mobile equipment in recent years.
At present, most two-dimensional code detection and identification methods are based on traditional imaging and morphology, and the methods have certain limitations, such as only identifying specific two-dimensional codes such as black and white and high resolution.
Disclosure of Invention
Embodiments of the present invention provide a method and an apparatus for recognizing a two-dimensional code, which overcome the above problems or at least partially solve the above problems.
In a first aspect, an embodiment of the present invention provides a method for identifying a two-dimensional code, including:
inputting a pattern to be recognized with a two-dimensional code into a pre-trained neural network model, and obtaining the probability that pixel points in the pattern to be recognized output by the neural network model are located in the two-dimensional code;
obtaining pixel points in the two-dimensional code according to the probability that the pixel points are located in the two-dimensional code, and calculating the minimum circumscribed rectangle of all the pixel points in the two-dimensional code to obtain an identification frame in the pattern to be identified;
identifying the two-dimensional code framed by the identification frame to obtain a two-dimensional code identification result;
the neural network model is an improved advanced address model, a sample pattern with a two-dimensional code is taken as a label of the improved advanced address model, and a marking result of whether a pixel in the sample pattern is located in the two-dimensional code is taken as a sample label;
The only loss calculated during the training of the improved advanced model is the loss of the score map parameter; the score map parameter is used for representing the probability that the pixel point is located in the identification frame.
Further, the receptive field of the improved AdvanceaST model is 40-55.
Further, the improved method for training the advanced east model comprises the following steps:
setting the hyper-parameters of the improved AdvancedEAST model to obtain a plurality of groups of AdvancedEAST models to be trained with different hyper-parameter combinations;
and determining the AdvancedEAST model with the optimal hyper-parameter combination according to the training effect of the multiple groups of AdvancedEAST models to be trained.
Further, the hyper-parameters include, but are not limited to, a batch size of batch, a pixel _ threshold internal point threshold, a side _ vertex _ pixel _ threshold internal head and tail point threshold, and a round _ threshold head and tail point range.
Further, the training effect is characterized by the ratio of the intersection and union of the predicted recognition box border and the real recognition box.
Further, the pixel point located in the two-dimensional code is obtained according to the probability that the pixel point is located in the two-dimensional code, and the minimum circumscribed rectangle of the pixel point located in the identification frame is calculated to obtain the identification frame in the pattern to be identified, specifically:
Taking the pixel points with the probability greater than a preset threshold value as pixel points in the two-dimensional code;
and determining a minimum circumscribed rectangle containing the pixel points in the two-dimensional code, and taking the minimum circumscribed rectangle as the identification frame.
Further, the identifying the two-dimensional code framed by the identifying frame to obtain a two-dimensional code identifying result specifically includes:
segmenting the area in the identification frame from the pattern to be identified, and carrying out perspective transformation on the area in the identification frame to obtain a two-dimensional code pattern;
and decoding the two-dimension code pattern by using a zbar library to obtain a two-dimension code identification result.
In a second aspect, an embodiment of the present invention provides an apparatus for identifying a two-dimensional code, including:
the probability calculation module is used for inputting the pattern to be recognized with the two-dimensional code into a pre-trained neural network model and obtaining the probability that pixel points in the pattern to be recognized output by the neural network model are positioned in the two-dimensional code;
the recognition frame output module is used for obtaining the pixel points in the two-dimensional code according to the probability that each pixel point is located in the two-dimensional code, and calculating the minimum circumscribed rectangle of the pixel points in the two-dimensional code to obtain the recognition frame in the pattern to be recognized;
The two-dimension code identification module is used for identifying the two-dimension code framed by the identification frame to obtain a two-dimension code identification result;
the neural network model is an improved advanced address model, a sample pattern with a two-dimensional code is taken as a label of the improved advanced address model, and a marking result of whether a pixel in the sample pattern is located in the two-dimensional code is taken as a sample label;
the only loss calculated during the training of the improved advanced model is the loss of the score map parameter; the score map parameter is used for representing the probability that the pixel point is located in the identification frame.
Further, the receptive field of the improved AdvanceaST model is 40-55.
Further, still include the model training module, the model training module includes:
a hyper-parameter setting unit, configured to set a hyper-parameter of the improved advanced east model, so as to obtain multiple groups of advanced east models to be trained, which have different hyper-parameter combinations;
and the screening unit is used for determining the Advance EAST model with the optimal hyper-parameter combination according to the training effects of the multiple groups of Advance EAST models to be trained.
Further, the hyper-parameters include, but are not limited to, a batch size of batch, a pixel _ threshold internal point threshold, a side _ vertex _ pixel _ threshold internal head and tail point threshold, and a round _ threshold head and tail point range.
Further, the training effect is characterized by the ratio of the intersection and union of the predicted recognition box border and the real recognition box.
Further, the identification frame output module specifically includes:
the probability screening unit is used for taking the pixel points with the probability greater than a preset threshold value as the pixel points positioned in the identification frame;
and the external rectangle determining unit is used for determining the minimum external rectangle containing all the pixel points in the two-dimensional code and taking the minimum external rectangle as the identification frame.
Further, the two-dimensional code recognition module specifically includes:
the perspective changing unit is used for dividing the area in the identification frame from the pattern to be identified, and carrying out perspective conversion on the area in the identification frame to obtain a two-dimensional code pattern;
and the decoding unit is used for decoding the two-dimensional code pattern by using a zbar library to obtain a two-dimensional code identification result.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method provided in the first aspect when executing the program.
In a fourth aspect, an embodiment of the present invention provides a non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the method as provided in the first aspect.
According to the two-dimensional code identification method and device provided by the embodiment of the invention, the mode of predicting the regression vertex coordinates by the advanced EAST model is optimized, so that the square pattern can be accurately identified by the advanced EAST model originally applied to character detection, particularly long text detection, and the robustness and accuracy of two-dimensional code identification are enhanced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a diagram illustrating recognition results of an AdvancEAST model according to an embodiment of the prior art;
FIG. 2 is a diagram illustrating the recognition result of an advanced east model according to another embodiment;
Fig. 3 is a schematic flowchart of a two-dimensional code recognition method according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating an identification frame region obtained after an image segmentation operation according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an identification frame region after perspective transformation according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an identification apparatus for a two-dimensional code according to an embodiment of the present invention;
fig. 7 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to overcome the defects in the prior art, the invention conception of the embodiment of the invention is as follows: by optimizing the mode of predicting the regression vertex coordinates by the advanced east model, the original advanced east model applied to character detection, particularly long text detection, can accurately identify square patterns, so that the robustness and accuracy of two-dimensional code identification are enhanced.
The advanced east model is a scene character detection algorithm, and has the characteristic that the more obvious the difference between the length and the width is when a rectangle is identified, the closer the output identification frame is to a standard rectangle, and is often applied to the field of long text detection. In a scheme of character recognition by using an advanced east model, which is described by https:// blog. csdn. net/chenjie7140/article/details/100709923, the document on the advanced east model retrieved randomly from the internet is taken as an example, an effect diagram for recognizing a motor vehicle driving license is disclosed, as shown in fig. 1, fig. 1 is a recognition result schematic diagram of the existing advanced east model, and as can be seen from the recognition result of the existing advanced east model, each text information is framed by a recognition frame, and the longer the text is, the more standard the rectangle is, for example, recognition frames corresponding to three texts, namely, a certificate number "33 xxxxxxxxxxx", an address "east ampere area of the Danjiang province, Ming., Black dragon river)," initial lead date "; however, the recognition frame corresponding to the text message with less words is less standard, for example, the recognition frame corresponding to "man", "6 years" and "name" has two width sides with different lengths, especially the recognition frame of "man", which is close to the diamond shape, and a significant problem can be seen from fig. 1: the existing advanced east model cannot be recognized for a square frame, for example, "the police department of public transport for south chang city, Jiangxi province" is in a standard square, but the existing advanced east model does not recognize the square frame at all.
It can be seen that the occurring advanced test model in the blog for detecting advanced high-efficiency scene text described in https:// www.sohu.com/a/257372528_100279313 can not accurately recognize the square, the last figure of the blog is an effect figure for recognizing long text and short text, as shown in fig. 2, fig. 2 is a schematic view of the recognition result of the advanced test model of another prior embodiment, as can be seen from fig. 2, the long text of "love only and food nonnegative" is framed by a recognition box close to the standard rectangle, and for the short text of "light" and "set", the recognition box is far from the standard rectangle, and the recognition corresponding to the "set" is found to be closer to the trapezoid.
In the above two examples, it can be found that if the existing advanced east model is used to identify a square such as a two-dimensional code, the defect that the identification frame is irregular and a partial area of the two-dimensional code is missing will inevitably occur, so that a person skilled in the art will not motivate to apply the advanced east model suitable for identifying a long text to the identification of a pattern with a standard square such as a two-dimensional code. At present, no technical scheme exists for applying the advanced east model to the detection of the two-dimensional code and obtaining practical application.
Fig. 3 is a schematic flow chart of a two-dimensional code identification method according to an embodiment of the present invention, as shown in fig. 3, including:
s101, inputting the pattern to be recognized with the two-dimensional code into a pre-trained neural network model, and obtaining the probability that pixel points in the pattern to be recognized output by the neural network model are located in the two-dimensional code.
The neural network model is an improved advanced east model, the improved advanced east model takes a sample pattern with a two-dimensional code as a label, and a marking result of whether each pixel in the sample pattern is positioned in the two-dimensional code is taken as a sample label. Optionally, in the embodiment of the present invention, a manual marking mode is adopted, and a marking result is set for each pixel in the sample pattern: if the pixel is located in the two-dimensional code, the marking result of the pixel is 1, and if the pixel is not located in the two-dimensional code, the marking result of the pixel is 0, and the embodiment of the invention defines whether the pixel is located in the two-dimensional code, and the following method can be adopted:
the coordinates of 4 vertex pixels of the two-dimensional code are determined, the 4 vertex pixels are connected to obtain a square area, and all pixels in the square area (including the boundary of the square area) are used as pixels in the two-dimensional code.
Further, the loss calculated during the improved advanced test model training in the embodiment of the present invention is only the loss of the scoremap parameter; the score map parameter, i.e. the confidence level, is used to characterize the probability in the target region of the pixel point location, it should be understood that the target region is a two-dimensional code in the embodiment of the present invention.
In the prior art, a vector output by an output layer of an advanced east model is a 7-dimensional vector, three parameters, namely 1-bit score map parameters, are recorded in the 7-dimensional vector, and the probability that each pixel point is located in a target area is represented; judging whether a pixel point belongs to the boundary of a target region and the head or the tail of the target region by using a 2-bit vertex code parameter; the 4-bit vertex geo parameter is valid only in the head and tail regions, meaning the distance from the head and tail boundaries. The existing model can be summarized as the following steps when performing prediction:
s1, determining activation point (pixel point in the two-dimensional code) according to the value output by the score map;
s2, traversing all activation points, and combining the activation points adjacent to each other left and right in the feature map to form a plurality of region lists;
s3, traversing all the region lists, and combining the upper and lower adjacent region lists in the feature map to form a region group;
S4, traversing points in the region group, and determining head/tail elements according to the value output by the vertex code;
s5, carrying out weighted average on vertex geo parameters predicted by head (tail) elements in each region group to obtain the final text box vertex.
Therefore, the conventional advanced east model only uses boundary pixels to predict the regression vertex coordinates. If the target area is a square, the advanced east model judges pixel points on the left side and the upper side as head pixels and judges the right side and the lower side as tail pixels, weighted average is taken at the last merging branch, taking a square with the side length of 1 as an example, points (0,1) and (1,1) can be predicted to be the top points of the head pixels, and the top points which can return after weighting are (0.5, 1), so that rhombus can appear.
Based on the analysis, the loss calculated during the training of the improved advanced east model is only the loss of the score map parameter, but not the loss of the score map parameter, the vertex code parameter and the vertex geo parameter, and the embodiment of the invention has the significance that the identification frame is not calculated in a weighted average mode by vertex geo when the identification frame is obtained, but the minimum circumscribed rectangle formed by the pixel points with the probability higher than the preset threshold value in the two-dimensional code is directly used as the identification frame, so that the defect that the square pattern is easily identified into the patterns of a diamond shape, a trapezoid shape and the like by the conventional advanced east model is overcome, and the method is really suitable for identifying the two-dimensional code.
S102, obtaining pixel points in the two-dimensional code according to the probability that the pixel points are located in the two-dimensional code, and calculating the minimum circumscribed rectangle of the pixel points in the two-dimensional code to obtain an identification frame in the pattern to be identified;
s103, identifying the two-dimensional code framed by the identification frame to obtain a two-dimensional code identification result
After the identification frame is obtained, the two-dimensional code, which is the pattern in the frame, can be extracted, and the two-dimensional code identification result can be obtained by identifying through the existing two-dimensional code scanning tool, such as zbar.
According to the embodiment of the invention, the mode of predicting the regression vertex coordinates by the advanced EAST model is optimized, so that the advanced EAST model originally applied to character detection can accurately identify the square pattern, and the robustness and the accuracy of two-dimensional code identification are enhanced. The two-dimensional code recognition method is applied to the two-dimensional code recognition on the tax receipt, and the accuracy and efficiency are obviously higher than those of the existing two-dimensional code recognition method on the tax receipt after the two-dimensional code recognition method is verified.
On the basis of the above embodiments, as an optional embodiment, the reception field of the improved advanced east model is 40-55.
In the convolutional neural network, the definition of a Receptive Field (Receptive Field) is the size of an area where pixel points on a feature map (feature map) output by each layer of the convolutional neural network are mapped on an input picture, the Receptive Field of the existing advanced east model is usually set below 30, such as 20 and 25, and the like.
On the basis of the above embodiments, as an optional embodiment, the method for training the improved advancedreast model includes:
and setting the hyper-parameters of the improved AdvancedEAST model to obtain a plurality of groups of AdvancedEAST models to be trained with different hyper-parameter combinations.
It should be understood that the hyper-parameters determine the network structure, number of layers, etc. for the parameters set by the neural network prior to training, and may generally include network depth, number of intra-parameters, learning rate, number of layers, etc. The embodiment of the invention sets a plurality of groups of advanced models to be trained, and the hyper-parameters of each group of advanced models to be trained are different, so that different models are trained, and the optimal model is found out.
And determining the AdvancedEAST model with the optimal hyper-parameter combination according to the training effect of the multiple groups of AdvancedEAST models to be trained. Optionally, the training effect is characterized by a ratio between an intersection and a union of the predicted recognition box border and the real recognition box. A higher ratio indicates a more accurate detection model.
On the basis of the above embodiments, as an alternative embodiment, the super parameters include, but are not limited to, a batch size of batch, a pixel _ threshold internal point threshold, a side _ vertex _ threshold internal head and tail point threshold, and a round _ threshold head and tail point value range.
On the basis of the foregoing embodiments, as an optional embodiment, the obtaining, according to the probability that the pixel point is located in the two-dimensional code, the pixel point located in the two-dimensional code, and calculating a minimum circumscribed rectangle of the pixel point located in the two-dimensional code to obtain the recognition frame in the pattern to be recognized specifically includes:
taking the pixel points with the probability greater than a preset threshold value as pixel points positioned in the identification frame;
and determining the minimum circumscribed rectangle containing all the pixel points in the identification frame, and taking the minimum circumscribed rectangle as the identification frame.
It should be understood that the score map parameter records the probability that each pixel point is located in the recognition frame, and by setting a preset threshold, the pixel points not smaller than the preset threshold are used as the pixel points in the recognition frame, and then the coordinates of the pixel points in the pattern to be recognized are determined according to the identifications of the pixel points.
Optionally, the step of determining the minimum bounding rectangle in the embodiment of the present invention includes:
step 1, determining 4 vertex pixels in pixel points located in an identification frame and a quadrangle formed by the 4 vertex pixels, wherein it can be understood that the 4 vertex pixels are respectively: the pattern recognition method comprises the steps that a pixel point with the minimum X-axis coordinate and the minimum Y-axis coordinate at the same time, a pixel point with the maximum X-axis coordinate and the maximum Y-axis coordinate at the same time, a pixel point with the maximum X-axis coordinate and the minimum Y-axis coordinate, and a pixel point with the minimum X-axis coordinate and the maximum Y-axis coordinate are arranged in a pattern to be recognized in advance.
Step 2, constructing four tangent lines of a quadrilateral through four vertex pixels;
step 3, if one (or two) lines coincide with one side of the quadrangle, calculating the area of the rectangle determined by the four tangent lines, and storing the area as the current minimum value; otherwise define the current minimum as infinity.
Step 4, rotating the line clockwise until one of the tangential lines is coincident with one side of the quadrangle;
step 5, calculating the area of the new rectangle and comparing the area with the current minimum value; if the current minimum value is smaller than the current minimum value, updating and storing the rectangle information for determining the minimum value.
And repeating the step 4 and the step 5 until the line rotates by more than 90 degrees.
And outputting a circumscribed rectangle.
On the basis of the foregoing embodiments, as an optional embodiment, identifying the two-dimensional code according to the identification frame to obtain a two-dimensional code identification result, specifically:
the identification frame area is segmented from the pattern to be identified, and perspective transformation is carried out on the identification frame area to obtain a two-dimensional code pattern;
and decoding the two-dimension code pattern by using a zbar library to obtain a two-dimension code identification result.
In the embodiment of the present invention, since the identification frame may have other clusters besides the two-dimensional code region, for example, a black border existing after being cut into a small image, as shown in fig. 4, fig. 4 is a schematic diagram of the identification frame region obtained after the image segmentation operation according to the embodiment of the present invention, and the right border in fig. 4 has a black border, such a result may reduce the identification accuracy of the two-dimensional code information. The embodiment of the invention carries out perspective transformation on the identification frame area, wherein the perspective transformation refers to transformation that a shadow bearing surface (perspective surface) rotates a certain angle around a trace line (perspective axis) according to a perspective rotation law by utilizing the condition that three points of a perspective center, an image point and a target point are collinear, the original projection light beam is damaged, and the projection geometric figure on the shadow bearing surface can still be kept unchanged. In short, the perspective transformation is to project the picture to a new viewing plane, fig. 5 is a schematic diagram of the recognition frame region after the perspective transformation according to the embodiment of the present invention, and it can be seen from fig. 5 that the influence of the black border is removed after the perspective transformation.
The zbar bar Code decoder is an open-source two-dimensional Code (including a bar Code) decoder, can identify two-dimensional codes such as video streams, image files, handheld scanners, video equipment (such as a camera) and the like, and supports the bar codes/two-dimensional codes of common coding modes such as EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code39, QR Code (two-dimensional Code) and the like.
Fig. 6 is a schematic structural diagram of an identification apparatus for a two-dimensional code according to an embodiment of the present invention, and as shown in fig. 6, the identification apparatus for a two-dimensional code includes: the probability calculation module 201, the identification box output module 202 and the two-dimensional code identification module 203 specifically:
a probability calculation module 201, configured to input a pattern to be recognized with a two-dimensional code into a pre-trained neural network model, and obtain a probability that each pixel point in the pattern to be recognized output by the neural network model is located in the two-dimensional code;
the recognition frame output module 202 is configured to obtain pixel points located in the two-dimensional code according to the probability that each pixel point is located in the two-dimensional code, and calculate a minimum circumscribed rectangle of the pixel points located in the two-dimensional code to obtain a recognition frame in the pattern to be recognized;
the two-dimension code identification module 203 is used for identifying the two-dimension code framed by the identification frame to obtain a two-dimension code identification result;
The neural network model is an improved advanced address model, a sample pattern with a two-dimensional code is taken as a label of the improved advanced address model, and a marking result of whether each pixel in the sample pattern is located in the two-dimensional code is taken as a sample label;
the only loss calculated during the training of the improved advanced model is the loss of the score map parameter; the score map parameter is used for characterizing the probability that each pixel point is located in the recognition frame.
The two-dimensional code identification device provided in the embodiment of the present invention specifically executes the flow of the identification method embodiments of the two-dimensional codes, and please refer to the contents of the identification method embodiments of the two-dimensional codes in detail, which is not described herein again. The recognition device of the two-dimensional code provided by the embodiment of the invention enables the advanced EAST model originally applied to character detection to accurately recognize the square pattern by optimizing the mode of predicting the regression vertex coordinates by the advanced EAST model, thereby enhancing the robustness and the accuracy of the two-dimensional code recognition.
On the basis of the above embodiments, as an optional embodiment, the reception field of the improved advanced east model is 40-55.
On the basis of the above embodiments, as an optional embodiment, the method further includes a model training module, where the model training module includes:
A hyper-parameter setting unit, configured to set a hyper-parameter of the improved advanced east model, so as to obtain multiple groups of advanced east models to be trained, which have different hyper-parameter combinations;
and the screening unit is used for determining the Advance EAST model with the optimal hyper-parameter combination according to the training effects of the multiple groups of Advance EAST models to be trained.
On the basis of the above embodiments, as an alternative embodiment, the super parameters include, but are not limited to, a batch size of batch, a pixel _ threshold internal point threshold, a side _ vertex _ threshold internal head and tail point threshold, and a round _ threshold head and tail point value range.
On the basis of the above embodiments, as an optional embodiment, the training effect is characterized by a ratio between an intersection and a union of a predicted recognition frame border and a real recognition frame.
On the basis of the foregoing embodiments, as an optional embodiment, the identification frame output module specifically includes:
the probability screening unit is used for taking the pixel points with the probability greater than a preset threshold value as the pixel points positioned in the identification frame;
and the external rectangle determining unit is used for determining the minimum external rectangle containing the pixel points in the identification frame and taking the minimum external rectangle as the identification frame.
On the basis of the foregoing embodiments, as an optional embodiment, the two-dimensional code identification module specifically includes:
the perspective changing unit is used for dividing the area in the identification frame from the pattern to be identified, and carrying out perspective conversion on the area in the identification frame to obtain a two-dimensional code pattern;
and the decoding unit is used for decoding the two-dimensional code pattern by using a zbar library to obtain a two-dimensional code identification result.
Fig. 7 is a schematic entity structure diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 7, the electronic device may include: a processor (processor)310, a communication Interface (communication Interface)320, a memory (memory)330 and a communication bus 340, wherein the processor 310, the communication Interface 320 and the memory 330 communicate with each other via the communication bus 340. The processor 310 may call a computer program stored on the memory 330 and operable on the processor 310 to execute the two-dimensional code recognition method provided by the above embodiments, for example, including: inputting a pattern to be recognized with a two-dimensional code into a pre-trained neural network model, and obtaining the probability that each pixel point in the pattern to be recognized output by the neural network model is positioned in the two-dimensional code; obtaining all pixel points in the two-dimensional code according to the probability that each pixel point is located in the two-dimensional code, and calculating the minimum circumscribed rectangle of the pixel points in the two-dimensional code to obtain the identification frame in the pattern to be identified; identifying the two-dimensional code framed by the identification frame to obtain a two-dimensional code identification result; the neural network model is an improved advanced address model, a sample pattern with a two-dimensional code is taken as a label of the improved advanced address model, and a marking result of whether a pixel in the sample pattern is located in the two-dimensional code is taken as a sample label; the only loss calculated during the training of the improved advanced model is the loss of the score map parameter; the score map parameter is used for representing the probability that the pixel point is located in the identification frame.
In addition, the logic instructions in the memory 330 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or make a contribution to the prior art, or may be implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
An embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the two-dimensional code identification method provided in the foregoing embodiments when executed by a processor, and for example, the method includes: inputting a pattern to be recognized with a two-dimensional code into a pre-trained neural network model, and obtaining the probability that pixel points in the pattern to be recognized output by the neural network model are located in the two-dimensional code; obtaining all pixel points in the two-dimensional code according to the probability that the pixel points are located in the two-dimensional code, and calculating the minimum circumscribed rectangle of all the pixel points in the two-dimensional code to obtain the identification frame in the pattern to be identified; identifying the two-dimensional code framed by the identification frame to obtain a two-dimensional code identification result; the neural network model is an improved advanced address model, a sample pattern with a two-dimensional code is taken as a label of the improved advanced address model, and a marking result of whether a pixel in the sample pattern is located in the two-dimensional code is taken as a sample label; the only loss calculated during the training of the improved advanced model is the loss of the score map parameter; the score map parameter is used for representing the probability that the pixel point is located in the identification frame.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A two-dimensional code recognition method is characterized by comprising the following steps:
inputting a pattern to be recognized with a two-dimensional code into a pre-trained neural network model, and obtaining the probability that pixel points in the pattern to be recognized output by the neural network model are located in the two-dimensional code;
obtaining pixel points in the two-dimensional code according to the probability that the pixel points are located in the two-dimensional code, and calculating the minimum circumscribed rectangle of the pixel points in the two-dimensional code to obtain an identification frame in the pattern to be identified;
identifying the two-dimensional code framed by the identification frame to obtain a two-dimensional code identification result;
the neural network model is an improved advanced address model, a sample pattern with a two-dimensional code is taken as a label of the improved advanced address model, and a marking result of whether a pixel in the sample pattern is located in the two-dimensional code is taken as a sample label;
The only loss calculated during the training of the improved advanced model is the loss of the score map parameter; the score map parameter is used for representing the probability that the pixel point is located in the identification frame.
2. The method for recognizing the two-dimensional code according to claim 1, wherein the reception field of the improved advanced east model is 40-55.
3. The two-dimensional code recognition method according to claim 1 or 2, wherein the improved advanced east model training method comprises:
setting the hyper-parameters of the improved AdvancedEAST model to obtain a plurality of groups of AdvancedEAST models to be trained with different hyper-parameter combinations;
and determining the AdvancedEAST model with the optimal hyper-parameter combination according to the training effect of the multiple groups of AdvancedEAST models to be trained.
4. The method for identifying the two-dimensional code according to claim 3, wherein the hyper-parameters include, but are not limited to, a batch size of batch, a pixel threshold internal point threshold, a side threshold pixel threshold internal head and tail point threshold, and a trunk threshold head and tail point value range.
5. The method for recognizing the two-dimensional code according to claim 3, wherein the training effect is characterized by a ratio between an intersection and a union of a predicted recognition box border and a real recognition box.
6. The method for recognizing the two-dimensional code according to claim 1, wherein the obtaining of the pixel point located in the two-dimensional code according to the probability that the pixel point is located in the two-dimensional code, and the calculating of the minimum circumscribed rectangle of the pixel point located in the two-dimensional code are performed to obtain the recognition frame in the pattern to be recognized specifically:
taking the pixel points with the probability greater than a preset threshold value as pixel points in the two-dimensional code;
and determining a minimum circumscribed rectangle containing the pixel points in the two-dimensional code, and taking the minimum circumscribed rectangle as the identification frame.
7. The method for recognizing the two-dimensional code according to claim 1, wherein the recognizing the two-dimensional code framed by the recognition frame to obtain a two-dimensional code recognition result specifically comprises:
segmenting the area in the identification frame from the pattern to be identified, and carrying out perspective transformation on the area in the identification frame to obtain a two-dimensional code pattern;
and decoding the two-dimension code pattern by using a zbar library to obtain a two-dimension code identification result.
8. An identification device of a two-dimensional code, comprising:
the probability calculation module is used for inputting the pattern to be recognized with the two-dimensional code into a pre-trained neural network model and obtaining the probability that pixel points in the pattern to be recognized output by the neural network model are positioned in the two-dimensional code;
The recognition frame output module is used for obtaining the pixel points in the two-dimensional code according to the probability that the pixel points are located in the two-dimensional code, and calculating the minimum circumscribed rectangle of the pixel points in the two-dimensional code to obtain the recognition frame in the pattern to be recognized;
the two-dimension code identification module is used for identifying the two-dimension code framed by the identification frame to obtain a two-dimension code identification result;
the neural network model is an improved advanced address model, a sample pattern with a two-dimensional code is taken as a label of the improved advanced address model, and a marking result of whether a pixel in the sample pattern is located in the two-dimensional code is taken as a sample label;
the only loss calculated during the training of the improved advanced model is the loss of the score map parameter; the score map parameter is used for representing the probability that the pixel point is located in the identification frame.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for recognizing a two-dimensional code according to any one of claims 1 to 7 when executing the program.
10. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method for recognizing a two-dimensional code according to any one of claims 1 to 7.
CN202010530228.7A 2020-06-11 2020-06-11 Two-dimensional code identification method and device Pending CN111860027A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010530228.7A CN111860027A (en) 2020-06-11 2020-06-11 Two-dimensional code identification method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010530228.7A CN111860027A (en) 2020-06-11 2020-06-11 Two-dimensional code identification method and device

Publications (1)

Publication Number Publication Date
CN111860027A true CN111860027A (en) 2020-10-30

Family

ID=72986592

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010530228.7A Pending CN111860027A (en) 2020-06-11 2020-06-11 Two-dimensional code identification method and device

Country Status (1)

Country Link
CN (1) CN111860027A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112541417A (en) * 2020-12-03 2021-03-23 山东众阳健康科技集团有限公司 Efficient decoding method used in character detection
CN114022558A (en) * 2022-01-05 2022-02-08 深圳思谋信息科技有限公司 Image positioning method and device, computer equipment and storage medium
WO2022267387A1 (en) * 2021-06-21 2022-12-29 梅卡曼德(北京)机器人科技有限公司 Image recognition method and apparatus, electronic device, and storage medium
CN116301459A (en) * 2023-02-27 2023-06-23 荣耀终端有限公司 Code scanning method and related device
CN117314951A (en) * 2023-11-20 2023-12-29 四川数盾科技有限公司 Two-dimensional code recognition preprocessing method and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103714327A (en) * 2013-12-30 2014-04-09 上海合合信息科技发展有限公司 Method and system for correcting image direction
CN105404837A (en) * 2015-11-17 2016-03-16 上海斐讯数据通信技术有限公司 Item locating method and system
US20180350021A1 (en) * 2017-03-16 2018-12-06 Sawar PEDAWI Global address system and method
CN110378165A (en) * 2019-05-31 2019-10-25 阿里巴巴集团控股有限公司 Two-dimensional code identification method, two dimensional code fixation and recognition method for establishing model and its device
CN110399760A (en) * 2019-07-23 2019-11-01 广东工业大学 A kind of batch two dimensional code localization method, device, electronic equipment and storage medium
CN110569769A (en) * 2019-08-29 2019-12-13 浙江大搜车软件技术有限公司 image recognition method and device, computer equipment and storage medium
CN111104813A (en) * 2019-12-16 2020-05-05 北京达佳互联信息技术有限公司 Two-dimensional code image key point detection method and device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103714327A (en) * 2013-12-30 2014-04-09 上海合合信息科技发展有限公司 Method and system for correcting image direction
CN105404837A (en) * 2015-11-17 2016-03-16 上海斐讯数据通信技术有限公司 Item locating method and system
US20180350021A1 (en) * 2017-03-16 2018-12-06 Sawar PEDAWI Global address system and method
CN110378165A (en) * 2019-05-31 2019-10-25 阿里巴巴集团控股有限公司 Two-dimensional code identification method, two dimensional code fixation and recognition method for establishing model and its device
CN110399760A (en) * 2019-07-23 2019-11-01 广东工业大学 A kind of batch two dimensional code localization method, device, electronic equipment and storage medium
CN110569769A (en) * 2019-08-29 2019-12-13 浙江大搜车软件技术有限公司 image recognition method and device, computer equipment and storage medium
CN111104813A (en) * 2019-12-16 2020-05-05 北京达佳互联信息技术有限公司 Two-dimensional code image key point detection method and device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
SUN MING 等: "Identification of QR codes based on pattern recognition", 2010 WORLD AUTOMATION CONGRESS *
蒋冲宇 等: "基于神经网络的发票文字检测与识别方法", 武汉工程大学学报, no. 06 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112541417A (en) * 2020-12-03 2021-03-23 山东众阳健康科技集团有限公司 Efficient decoding method used in character detection
CN112541417B (en) * 2020-12-03 2022-09-16 山东众阳健康科技集团有限公司 Efficient decoding method used in character detection
WO2022267387A1 (en) * 2021-06-21 2022-12-29 梅卡曼德(北京)机器人科技有限公司 Image recognition method and apparatus, electronic device, and storage medium
CN114022558A (en) * 2022-01-05 2022-02-08 深圳思谋信息科技有限公司 Image positioning method and device, computer equipment and storage medium
CN114022558B (en) * 2022-01-05 2022-08-26 深圳思谋信息科技有限公司 Image positioning method, image positioning device, computer equipment and storage medium
CN116301459A (en) * 2023-02-27 2023-06-23 荣耀终端有限公司 Code scanning method and related device
CN116301459B (en) * 2023-02-27 2023-10-20 荣耀终端有限公司 Code scanning method and related device
CN117314951A (en) * 2023-11-20 2023-12-29 四川数盾科技有限公司 Two-dimensional code recognition preprocessing method and system
CN117314951B (en) * 2023-11-20 2024-01-26 四川数盾科技有限公司 Two-dimensional code recognition preprocessing method and system

Similar Documents

Publication Publication Date Title
CN111860027A (en) Two-dimensional code identification method and device
CN110738207B (en) Character detection method for fusing character area edge information in character image
CN110738125B (en) Method, device and storage medium for selecting detection frame by Mask R-CNN
CN113160192A (en) Visual sense-based snow pressing vehicle appearance defect detection method and device under complex background
CN110659647A (en) Seal image identification method and device, intelligent invoice identification equipment and storage medium
CN111340028A (en) Text positioning method and device, electronic equipment and storage medium
CN111680690B (en) Character recognition method and device
CN112767369A (en) Defect identification and detection method and device for small hardware and computer readable storage medium
CN113269267B (en) Training method of target detection model, target detection method and device
US20210390282A1 (en) Training data increment method, electronic apparatus and computer-readable medium
CN114170227B (en) Product surface defect detection method, device, equipment and storage medium
CN115239644B (en) Concrete defect identification method, device, computer equipment and storage medium
CN110738030A (en) Table reconstruction method and device, electronic equipment and storage medium
CN107578011A (en) The decision method and device of key frame of video
CN112215190A (en) Illegal building detection method based on YOLOV4 model
CN114119480A (en) Crack defect detection system based on deep learning
CN112085721A (en) Damage assessment method, device and equipment for flooded vehicle based on artificial intelligence and storage medium
CN117094975A (en) Method and device for detecting surface defects of steel and electronic equipment
CN113591507A (en) Robust two-dimensional code DataMatrix positioning method and system
CN111199240A (en) Training method of bank card identification model, and bank card identification method and device
CN113537037A (en) Pavement disease identification method, system, electronic device and storage medium
CN115908774A (en) Quality detection method and device of deformed material based on machine vision
CN111428530B (en) Two-dimensional code image detection and identification equipment, device and method
CN113128500A (en) Mask-RCNN-based non-motor vehicle license plate recognition method and system
JP2004094427A (en) Slip image processor and program for realizing the same device

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