CN114528865B - Training method and device of bar code detection model and bar code detection method and device - Google Patents

Training method and device of bar code detection model and bar code detection method and device Download PDF

Info

Publication number
CN114528865B
CN114528865B CN202210162962.1A CN202210162962A CN114528865B CN 114528865 B CN114528865 B CN 114528865B CN 202210162962 A CN202210162962 A CN 202210162962A CN 114528865 B CN114528865 B CN 114528865B
Authority
CN
China
Prior art keywords
bar code
sample data
training
data
detection model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210162962.1A
Other languages
Chinese (zh)
Other versions
CN114528865A (en
Inventor
高红超
江维
李昌源
刘华祠
曹继华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong OPT Machine Vision Co Ltd
Original Assignee
Guangdong OPT Machine Vision 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 Guangdong OPT Machine Vision Co Ltd filed Critical Guangdong OPT Machine Vision Co Ltd
Priority to CN202210162962.1A priority Critical patent/CN114528865B/en
Publication of CN114528865A publication Critical patent/CN114528865A/en
Application granted granted Critical
Publication of CN114528865B publication Critical patent/CN114528865B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/14131D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06018Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking one-dimensional coding
    • G06K19/06028Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking one-dimensional coding using bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • 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/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

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

Abstract

The invention discloses a training method and device of a bar code detection model, the bar code detection method and device, a large amount of high-quality training Data can be obtained by only needing a small amount of initial sample Data, the bar code detection model obtained based on the Data training has strong universality and high robustness, the bar code detection model can be suitable for code reading and positioning under various industrial scenes, and can position and identify QRCode, data Matrix two-dimensional codes and one-dimensional codes at any angle commonly used by industry, and the bar code detection model has the advantages of less marking Data, high quality of generated training Data, high detection accuracy of a positioning model obtained by training, high speed and the like.

Description

Training method and device of bar code detection model and bar code detection method and device
Technical Field
The invention belongs to the technical field of machine vision, and particularly relates to a training method and device of a bar code detection model, and a bar code detection method and device.
Background
A barcode (barcode) is a graphic identifier for expressing a set of information, including a one-dimensional barcode (one-dimensional code) and a two-dimensional barcode (two-dimensional code), in which a plurality of black bars and white spaces having different widths are arranged according to a certain coding rule. Along with the continuous improvement of intelligent industrial production demands, the complexity of an intelligent manufacturing system is continuously increased, industrial products and parts are identified by utilizing one-dimensional codes and two-dimensional codes, the generation tracking of the products and the parts is realized, and the assembly management, the life cycle maintenance and the like are already industry standards of the automatic industry. Meanwhile, the application of the two-dimension code in aspects of warehouse logistics, file management, ticket information storage and processing and the like enables convenience in the fields to be improved remarkably.
Unlike civil barcodes, the application environment of industrial barcodes is often complex, for example, problems of distortion, blurring, abrasion, low contrast, no static area, serious noise interference and the like exist, and the conventional detection positioning method cannot meet the requirements.
The detection positioning method based on the deep learning is superior to the conventional detection positioning method in terms of robustness and accuracy, however, the method requires large-scale training data when based on the deep learning training model, and meanwhile, the method is high in hardware requirements when implemented.
Disclosure of Invention
The invention provides a training method and device for a bar code detection model and a bar code detection method and device, which can solve or at least partially solve the technical problems.
For this purpose, the invention adopts the following technical scheme:
in a first aspect, a method for training a bar code detection model is provided, including:
acquiring first sample data, wherein the first sample data comprises a first number of bar code pictures with bar code patterns, and the bar code patterns comprise one-dimensional codes and/or two-dimensional codes;
acquiring second sample data, wherein the second sample data comprises a second number of background pictures without bar code patterns;
generating third sample data based on the first sample data and the second sample data, the third sample data including a third amount of training data, the training data being combined from the bar code pattern and the background picture, the third amount being greater than the second amount and the first amount;
and training to obtain a detection model of the bar code based on the third sample data and the target frame of the bar code graph in the third sample data.
Optionally, the generating third sample data based on the first sample data and the second sample data includes:
respectively cutting the first number of bar code pictures to obtain bar code patterns in the bar code pictures;
performing geometric image change operation on the bar code graph obtained by cutting to obtain the bar code graph after the geometric image change operation;
and respectively and randomly attaching the bar code graph subjected to the geometric image change operation to the second number of background pictures to generate the third number of training data.
Optionally, the training to obtain a detection model of the barcode based on the third sample data and the target frame of the barcode pattern in the third sample data includes:
based on the third sample data and the target frame of the bar code graph in the third sample data, gradually adjusting model parameters for the third sample data of each batch through the stages of feature extraction, feature fusion, target prediction, loss calculation, parameter updating and the like, and training to obtain the detection model of the bar code.
Optionally, in the feature extraction stage, a feature map of the third sample data is extracted.
Optionally, in the feature fusion stage, the feature map size input into the convolutional neural network is reduced to a first size, a second size, and a third size, respectively.
Optionally, in the target prediction stage, predicting the data obtained in the feature fusion stage to obtain an abscissa of a center point, an ordinate of the center point, a width, a height and a rotation angle of the bar code pattern in the third sample data, respectively.
Optionally, the geometric image change operation includes at least one of flipping, rotating, scaling, blurring, noise adding, color conversion, and random erasure.
In a second aspect, a method for detecting a bar code is provided, including:
acquiring a target picture to be detected;
and detecting the bar code in the target picture based on the detection model of the bar code trained by the method, and outputting the position and the type of the bar code if the bar code exists.
In a third aspect, a training device for a bar code detection model is provided, including:
a first acquisition unit configured to acquire first sample data including a first number of bar code pictures with bar code patterns including one-dimensional codes and/or two-dimensional codes;
a second acquisition unit configured to acquire second sample data including a second number of background pictures without bar code patterns;
a generating unit, configured to generate third sample data based on the first sample data and the second sample data, where the third sample data includes a third number of training data, where the training data is obtained by combining the barcode graphic and the background graphic, and the third number is greater than the second number and the first number;
and the model training unit is used for training to obtain a detection model of the bar code based on the third sample data and the target frame of the bar code graph in the third sample data.
In a fourth aspect, there is provided a bar code detection apparatus comprising:
the image acquisition module is used for acquiring a target image to be detected;
and the bar code detection module is used for detecting the bar code in the target picture based on the bar code detection model trained by the method, and outputting the position and the type of the bar code if the bar code exists.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
according to the training method and device for the bar code detection model, and the bar code detection method and device, a large amount of high-quality third sample Data (third quantity of training Data) can be obtained only by a small amount of first sample Data (first quantity of bar code pictures) and second sample Data which are convenient to acquire, the bar code detection model obtained based on the training of the Data is high in universality and robustness, high in accuracy and high in detection speed, and is suitable for code reading and positioning in various different industrial scenes, and the QRCode, data Matr ix two-dimensional codes and one-dimensional codes of any angle commonly used in industry can be positioned and identified.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
The structures, proportions, sizes, etc. shown in the present specification are shown only for the purposes of illustration and description, and are not intended to limit the scope of the invention, which is defined by the claims, so that any structural modifications, changes in proportions, or adjustments of sizes, which do not affect the efficacy or the achievement of the present invention, should fall within the scope of the invention.
FIGS. 1 and 2 are a method flow chart of a training method of a bar code detection model according to the present embodiment;
FIG. 3 is a flowchart of a bar code detection method according to the present embodiment;
fig. 4 is a block diagram of a training device of the bar code detection model according to the present embodiment;
FIG. 5 is a block diagram showing the components of the bar code detecting device according to the present embodiment;
fig. 6 is a network configuration diagram of a detection model provided in the present embodiment;
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions of 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 apparent that the embodiments described below are only some embodiments of the present invention, not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Please refer to fig. 1 to 6.
As shown in fig. 1 to 3, the embodiment provides a training method and a bar code detection method for a bar code detection model, which have the advantages of less data dependence, high quality of generated data, strong model generality, high robustness and the like, and are used for solving the problems of large scale, poor generality, low robustness and the like of one-dimensional code or two-dimensional code dependent data in the prior art. Specifically, as shown in fig. 1, the training method of the bar code detection model includes the following steps:
s11, acquiring first sample data, wherein the first sample data comprise a first number of bar code pictures with bar code patterns, and the bar code patterns comprise one-dimensional codes and/or two-dimensional codes; alternatively, one bar code pattern may include one or more one-dimensional codes, or include one or more two-dimensional codes, or may include one or more one-dimensional codes and one or more two-dimensional codes at the same time.
S12, acquiring second sample data, wherein the second sample data comprise a second number of background pictures without bar code patterns;
s13, generating third sample data based on the first sample data and the second sample data, wherein the third sample data comprises a third quantity of training data, the training data is obtained by combining the bar code graph and the background picture, and the third quantity is larger than the second quantity and the first quantity; optionally, the combined training data may include: the combination data of the one-dimensional code and the background picture, the combination data of the two-dimensional code and the background picture, or the combination data of the one-dimensional code, the two-dimensional code and the background picture.
S14, training to obtain a detection model of the bar code based on the third sample data and the target frame of the bar code graph in the third sample data.
In step S11, the first sample data only needs to include a small number of bar code pictures, and the bar code patterns in the bar code pictures may be rotated or not rotated. Specifically, after the first sample data is collected, the rectangular frames of the bar code patterns can be marked, and then each bar code pattern is cut according to marking information to generate a data set.
The purpose of steps S12-S13 is to generate a large amount of training data, i.e. third sample data. It should be noted that, the second sample data is easier to obtain than the first sample data, for example, an industrial camera may be used to capture a picture or a web crawler may be used to capture a picture, so as to obtain a background picture. In step S13, a large amount (i.e., a third amount) of training data can be obtained by combining the bar code pattern and the background picture. Then, through step S14, a detection model of the bar code can be successfully obtained through training.
As shown in fig. 2, as an alternative implementation manner of the present embodiment, step S13 specifically includes the following steps:
s131, respectively cutting the first number of bar code pictures to obtain bar code patterns in the bar code pictures;
s132, performing geometric image change operation on the bar code graph obtained by cutting to obtain the bar code graph after the geometric image change operation;
s133, respectively and randomly attaching the bar code patterns subjected to the geometric image change operation to the second number of background pictures to generate the third number of training data.
Wherein the geometric image change operation includes at least one of flipping, rotating, scaling, blurring, noise adding, color conversion, and random erasure. At least one of flipping, rotation, scaling, blurring, noise adding, color conversion, and random erasing may be randomly selected to operate when the geometric image change operation is performed.
It should be noted that, in this embodiment, not only the third sample data may be used to train the model, but also the original first sample data may be selected to train the model.
For step S133, in the random pasting process, a pre-pasting position is randomly generated, a maximum value max_iou of the IOU (image merging ratio) of the pasted area is calculated, if max_iou <0.1 (indicating that the pasted area is not repeated or the repetition rate is low), the paste is performed to the position, and barcode information of the position is recorded.
Further, as shown in fig. 6, the network structure of the detection model includes three parts, namely feature extraction, feature fusion and target prediction. Thus, step S14 may comprise the steps of:
based on the third sample data and the target frame of the bar code graph in the third sample data, gradually adjusting model parameters for the third sample data of each batch through the stages of feature extraction, feature fusion, target prediction, loss calculation, parameter updating and the like, and training to obtain the detection model of the bar code.
Specifically, in the feature extraction stage, a feature map of the third sample data is extracted.
Further, in the feature fusion stage, the feature map size input into the convolutional neural network is respectively reduced to a first size, a second size and a third size, and the feature map is extracted from the third sample data through the feature extraction stage. For example, the first size (width or height) is 16 times the size of the target image, the second size is 32 times the size, and the third size is 64 times the size, which can reduce the model size and improve the detection efficiency.
Further, in the target prediction stage, the data obtained in the feature fusion stage are predicted to obtain an abscissa x, an ordinate y, a width w, a height h and a rotation angle θ of a center point of the barcode pattern in the third sample data, respectively. Compared with the prior art, the description of the target frame predicted by the embodiment is increased by the rotation angle theta, so that the QRCode, the Data Matrix two-dimensional code and the one-dimensional code of any angle commonly used in industry can be positioned and identified.
Specifically, in the target prediction stage, the bar code data is subjected to cluster analysis, 3 heads are designed for the network structure, each Head has 4 anchor frames, and the description of the predicted target frame is increased by a rotation angle theta.
The calculation formula of the calculation amount of the model is as follows:
wherein C is / C in (2) represents the number of convolution kernels and represents the layer-one convolution; k represents the size of the convolution kernel, e.g., the size of a particular convolution kernel may be represented as K x K, 3*3, etc.; n represents that the network has N convolution layers; f (F) w Representing the width of the feature map; f (F) h Representing the high of the feature map.
As a specific application scenario of this embodiment, if the detection model is YOLO V5, for an input target picture to be detected, a parameter of the target picture to be detected is WxH (where W is a width of the target picture and H is a height of the target picture), in the model of this embodiment, a feature map input to the convolutional neural network is reduced to W/8*h/8 (where W is reduced to one eighth of the original feature map, H is reduced to one eighth of the original feature map), W/16×h/16, and W/32×h/32, so as to improve the detection speed.
Further, the present embodiment modifies the description (x, y, w, h) of the existing predicted target frame into (x, y, w, h, θ), that is, increases the description of the rotation angle θ of the image, and has the capability of detecting the two-dimensional code and the one-dimensional code with the rotation angle.
Specifically, the network structure can check three types of common codes, namely QRCode, data Matrix two-dimensional code and one-dimensional code, and each layer of target prediction module comprises 4 anchor frames with different scales, so that the output dimension of the module is as follows:
4*(x,y,w,h,θ,conf,p dm ,p qr ,p barcode )=36
wherein x, y, w, h, θ represent the center point coordinates (x, y) of the frame, the width w, the height h and the rotation angle θ, respectively, the confidence level conf of whether the bar code exists or not, and the probabilities of belonging to DM, QR and one-dimensional codes are p respectively dm ,p qr ,p barcode
Further, the loss function of the model is:
Loss=λ coord ∑loss(xy)+λ coord ∑loss(wh)+λ conf ∑loss(conf)+λ cls ∑loss(cls)+λ angle ∑loss(θ)
where loss (xy) represents the center point loss of the model predictive code, loss (wh) represents the wide and high loss of the model predictive code, loss (conf) represents the confidence loss of whether the model prediction is a code, loss (cls) represents the class loss of the model prediction, and loss (θ) represents the loss of the model prediction angle.
Specifically, the optimizer of the model may select Adam optimization algorithm, momentum:0.937, initializing learning rate to be 0.01, training 50 ten thousand pictures in data scale, and stopping after training for 90 rounds.
Referring to fig. 3, the method for detecting a bar code provided in this embodiment includes the following steps:
s21, acquiring a target picture to be detected;
s22, detecting the bar code in the target picture based on the detection model of the bar code trained by the training method, and outputting the position and the type (such as one-dimensional code or two-dimensional code) of the bar code if the bar code exists.
Specifically, extracting features of the target picture to be detected through a model, and obtaining a large number of candidate two-dimensional codes or one-dimensional code target candidate frames through target prediction; then deleting redundant candidate frames from the candidate frames by utilizing a non-maximum suppression algorithm, setting a proper threshold tau, and outputting the confidence coefficient of the candidate frames con f i> τ Is a target frame of (1).
According to the bar code detection method provided by the embodiment, a large amount of high-quality third sample data (third amount of training data) can be obtained only by a small amount of first sample data (first amount of bar code pictures); the bar code detection model obtained based on the Data training has strong universality and high robustness, is suitable for code reading and positioning under various different industrial scenes, can position and identify the QRCode, the Data Matr i x two-dimensional code and the one-dimensional code of any angle commonly used in industry, and has the advantages of high detection speed, high universality, high detection accuracy and the like.
As shown in fig. 4, in another embodiment of the present application, a training device for a barcode detection model is provided, which may be used to implement the above training method for a barcode detection model, and specifically includes:
a first acquisition unit 11 for acquiring first sample data including a first number of bar code pictures with bar code patterns including one-dimensional codes and/or two-dimensional codes;
a second acquisition unit 12 for acquiring second sample data including a second number of background pictures without bar code patterns, the second number being larger than the first number;
a generating unit 13, configured to generate third sample data based on the first sample data and the second sample data, where the third sample data includes a third number of training data, where the training data is obtained by combining the barcode graphic and the background graphic, and the third number is greater than the second number;
and a model training unit 14, configured to train to obtain a detection model of the barcode based on the third sample data and the target frame of the barcode pattern in the third sample data.
Since the training method of how to implement the bar code detection model is explained above, the description is omitted here. Compared with the prior art, the training device for the bar code detection model provided by the embodiment can obtain a large amount of high-quality training sample data only by a small amount of initial sample data, and has the advantages of less marking data, high quality of generated training data, high detection accuracy of the positioning model obtained by training, high speed and the like.
As shown in fig. 5, in another embodiment of the present application, there is further provided a bar code detection device, specifically including:
a picture acquisition module 21, configured to acquire a target picture to be detected;
the barcode detection module 22 is configured to detect the barcode in the target picture based on the detection model of the barcode trained by the training method as described above, and if the barcode exists, output the position and the type (for example, a one-dimensional code or a two-dimensional code) of the barcode.
Since the training method and the method for implementing the barcode detection model are specifically described above, the description thereof is omitted here. Compared with the prior art, the bar code detection device provided by the embodiment can obtain a large amount of high-quality training sample data only by a small amount of initial sample data, and has the advantages of less marking data, high quality of generated training data, high detection accuracy of a positioning model obtained by training, high speed and the like.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the 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 scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. The training method of the bar code detection model is characterized by comprising the following steps of:
acquiring first sample data, wherein the first sample data comprises a first number of bar code pictures with bar code patterns, and the bar code patterns comprise one-dimensional codes and/or two-dimensional codes;
acquiring second sample data, wherein the second sample data comprises a second number of background pictures without bar code patterns;
generating third sample data based on the first sample data and the second sample data, the third sample data including a third amount of training data, the training data being combined from the bar code pattern and the background picture, the third amount being greater than the second amount and the first amount;
training to obtain a detection model of the bar code based on the third sample data and a target frame of the bar code graph in the third sample data;
the generating third sample data based on the first sample data and the second sample data includes:
respectively cutting the first number of bar code pictures to obtain bar code patterns in the bar code pictures;
performing geometric image change operation on the bar code graph obtained by cutting to obtain the bar code graph after the geometric image change operation;
randomly attaching the bar code patterns subjected to the geometric image change operation to the second number of background pictures respectively to generate the third number of training data;
the training to obtain a detection model of the bar code based on the third sample data and the target frame of the bar code graph in the third sample data comprises the following steps:
based on the third sample data and the target frame of the bar code graph in the third sample data, gradually adjusting model parameters for the third sample data of each batch through the stages of feature extraction, feature fusion, target prediction, loss calculation, parameter updating and the like, and training to obtain a detection model of the bar code;
the target frame of the bar code graph comprises a center abscissa description x, a center ordinate description y, a frame height description h, a frame width description w and a frame rotation angle description theta.
2. Training method according to claim 1, characterized in that in the feature extraction stage a feature map of the third sample data is extracted.
3. The training method of claim 1, wherein the feature map size input into the convolutional neural network is scaled down to a first size, a second size, and a third size, respectively, during the feature fusion stage.
4. The training method according to claim 1, wherein in the target prediction stage, the data obtained in the feature fusion stage are predicted to obtain an abscissa of a center point, an ordinate of a center point, a width, a height, and a rotation angle of a bar code pattern in the third sample data, respectively.
5. The training method of claim 1, wherein the geometric image change operation comprises at least one of flipping, rotating, scaling, blurring, noise-adding, color conversion, and random erasure.
6. A bar code detection method, comprising:
acquiring a target picture to be detected;
detecting the bar code in the target picture based on a detection model of the bar code trained by the method according to any one of claims 1 to 5, and outputting the position and the category of the bar code if the bar code exists.
7. The training device of bar code detection model, its characterized in that includes:
a first acquisition unit configured to acquire first sample data including a first number of bar code pictures with bar code patterns including one-dimensional codes and/or two-dimensional codes;
a second acquisition unit configured to acquire second sample data including a second number of background pictures without bar code patterns;
a generating unit, configured to generate third sample data based on the first sample data and the second sample data, where the third sample data includes a third number of training data, where the training data is obtained by combining the barcode graphic and the background graphic, and the third number is greater than the second number and the first number;
the generating unit generates third sample data according to the following steps:
respectively cutting the first number of bar code pictures to obtain bar code patterns in the bar code pictures;
performing geometric image change operation on the bar code graph obtained by cutting to obtain the bar code graph after the geometric image change operation;
randomly attaching the bar code patterns subjected to the geometric image change operation to the second number of background pictures respectively to generate the third number of training data;
the model training unit is used for training to obtain a detection model of the bar code based on the third sample data and the target frame of the bar code graph in the third sample data;
the model training unit trains to obtain a detection model of the bar code according to the following steps:
based on the third sample data and the target frame of the bar code graph in the third sample data, gradually adjusting model parameters for the third sample data of each batch through the stages of feature extraction, feature fusion, target prediction, loss calculation, parameter updating and the like, and training to obtain the detection model of the bar code.
8. Bar code detection device, its characterized in that includes:
the image acquisition module is used for acquiring a target image to be detected;
and the bar code detection module is used for detecting the bar code in the target picture based on the bar code detection model obtained by training the method in any one of claims 1-7, and outputting the position and the type of the bar code if the bar code exists.
CN202210162962.1A 2022-02-22 2022-02-22 Training method and device of bar code detection model and bar code detection method and device Active CN114528865B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210162962.1A CN114528865B (en) 2022-02-22 2022-02-22 Training method and device of bar code detection model and bar code detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210162962.1A CN114528865B (en) 2022-02-22 2022-02-22 Training method and device of bar code detection model and bar code detection method and device

Publications (2)

Publication Number Publication Date
CN114528865A CN114528865A (en) 2022-05-24
CN114528865B true CN114528865B (en) 2024-02-20

Family

ID=81625708

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210162962.1A Active CN114528865B (en) 2022-02-22 2022-02-22 Training method and device of bar code detection model and bar code detection method and device

Country Status (1)

Country Link
CN (1) CN114528865B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115310469B (en) * 2022-10-12 2023-02-14 广东奥普特科技股份有限公司 Bar code positioning model training method, positioning method, system, equipment and medium
US12020114B1 (en) * 2024-01-22 2024-06-25 The DTX Company Real-time comprehensive quick response (“QR”) code testing for reliable scanning

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376830A (en) * 2018-10-17 2019-02-22 京东方科技集团股份有限公司 Two-dimensional code generation method and device
CN111523610A (en) * 2020-05-06 2020-08-11 青岛联合创智科技有限公司 Article identification method for efficient sample marking
CN111861955A (en) * 2020-06-22 2020-10-30 北京百度网讯科技有限公司 Method and device for constructing image editing model
CN111931783A (en) * 2020-08-18 2020-11-13 创新奇智(重庆)科技有限公司 Training sample generation method, machine-readable code identification method and device
CN112183150A (en) * 2020-10-16 2021-01-05 上海了物网络科技有限公司 Image two-dimensional code and preparation method, analysis device and analysis method thereof
CN112580382A (en) * 2020-12-28 2021-03-30 哈尔滨工程大学 Two-dimensional code positioning method based on target detection
CN112949338A (en) * 2021-03-16 2021-06-11 太原科技大学 Two-dimensional bar code accurate positioning method combining deep learning and Hough transformation

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376830A (en) * 2018-10-17 2019-02-22 京东方科技集团股份有限公司 Two-dimensional code generation method and device
CN111523610A (en) * 2020-05-06 2020-08-11 青岛联合创智科技有限公司 Article identification method for efficient sample marking
CN111861955A (en) * 2020-06-22 2020-10-30 北京百度网讯科技有限公司 Method and device for constructing image editing model
CN111931783A (en) * 2020-08-18 2020-11-13 创新奇智(重庆)科技有限公司 Training sample generation method, machine-readable code identification method and device
CN112183150A (en) * 2020-10-16 2021-01-05 上海了物网络科技有限公司 Image two-dimensional code and preparation method, analysis device and analysis method thereof
CN112580382A (en) * 2020-12-28 2021-03-30 哈尔滨工程大学 Two-dimensional code positioning method based on target detection
CN112949338A (en) * 2021-03-16 2021-06-11 太原科技大学 Two-dimensional bar code accurate positioning method combining deep learning and Hough transformation

Also Published As

Publication number Publication date
CN114528865A (en) 2022-05-24

Similar Documents

Publication Publication Date Title
CN112232349B (en) Model training method, image segmentation method and device
CN110322495B (en) Scene text segmentation method based on weak supervised deep learning
CN114528865B (en) Training method and device of bar code detection model and bar code detection method and device
CN113591967B (en) Image processing method, device, equipment and computer storage medium
CN111680690B (en) Character recognition method and device
CN112949338A (en) Two-dimensional bar code accurate positioning method combining deep learning and Hough transformation
CN111209858B (en) Real-time license plate detection method based on deep convolutional neural network
CN111598860A (en) Lithium battery defect detection method based on yolov3 network embedded in self-attention door module
CN111242026B (en) Remote sensing image target detection method based on spatial hierarchy perception module and metric learning
CN113392669B (en) Image information detection method, detection device and storage medium
CN111833237A (en) Image registration method based on convolutional neural network and local homography transformation
CN111860027A (en) Two-dimensional code identification method and device
CN114119480A (en) Crack defect detection system based on deep learning
CN112307919A (en) Improved YOLOv 3-based digital information area identification method in document image
CN116994140A (en) Cultivated land extraction method, device, equipment and medium based on remote sensing image
CN111523429A (en) Deep learning-based steel pile identification method
CN114677596A (en) Remote sensing image ship detection method and device based on attention model
CN111597845A (en) Two-dimensional code detection method, device and equipment and readable storage medium
CN115761225A (en) Image annotation method based on neural network interpretability
CN111783608A (en) Face changing video detection method
CN113657225B (en) Target detection method
CN112580382B (en) Two-dimensional code positioning method based on target detection
CN110991201A (en) Bar code detection method and related device
CN111680680B (en) Target code positioning method and device, electronic equipment and storage medium
CN116612280A (en) Vehicle segmentation method, device, computer equipment and computer 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
GR01 Patent grant
GR01 Patent grant