WO2023284670A1 - Construction method and apparatus for graphic code extraction model, identification method and apparatus, and device and medium - Google Patents

Construction method and apparatus for graphic code extraction model, identification method and apparatus, and device and medium Download PDF

Info

Publication number
WO2023284670A1
WO2023284670A1 PCT/CN2022/104857 CN2022104857W WO2023284670A1 WO 2023284670 A1 WO2023284670 A1 WO 2023284670A1 CN 2022104857 W CN2022104857 W CN 2022104857W WO 2023284670 A1 WO2023284670 A1 WO 2023284670A1
Authority
WO
WIPO (PCT)
Prior art keywords
graphic code
image
sample
code
graphic
Prior art date
Application number
PCT/CN2022/104857
Other languages
French (fr)
Chinese (zh)
Inventor
吴虓杨
张岳晨
莫宇
沈小勇
吕江波
Original Assignee
深圳思谋信息科技有限公司
上海思谋科技有限公司
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 深圳思谋信息科技有限公司, 上海思谋科技有限公司 filed Critical 深圳思谋信息科技有限公司
Publication of WO2023284670A1 publication Critical patent/WO2023284670A1/en

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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • 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/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • 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/146Methods for optical code recognition the method including quality enhancement steps

Definitions

  • the present application relates to the technical field of artificial intelligence, in particular to a method for constructing a pattern code extraction model, a pattern code recognition method, a device, a computer device and a storage medium.
  • the first aspect provides a kind of method of building graphic code extraction model, described method comprises:
  • a graphic code extraction model is constructed by using the augmented image sample, the original image sample of the graphic code and the standard image sample of the graphic code.
  • the obtaining the corresponding standard image sample of the graphic code according to the original image sample of the graphic code includes:
  • the number of the material background image samples is multiple; the fusion of the standard image samples based on the graphic code and the material background image samples to obtain the augmented image samples includes:
  • the initial sample of the augmented image is screened to obtain the augmented image sample.
  • the contrast-preserving fusion of the graphic code standard image sample and a plurality of the material background image samples is obtained to obtain the initial sample of the augmented image, including:
  • Contrast-preserving fusion is performed on the standard image sample of the graphic code with each material background image sample to obtain an initial sample of the augmented image.
  • the contrast-preserving fusion of the graphic code standard image sample and a plurality of the material background image samples is obtained to obtain the initial sample of the augmented image, including:
  • the standard image samples of the graphic code are fused with different material background combinations for multiple times to obtain a plurality of initial samples of the augmented image; each of the material background combinations includes two or more material background image samples.
  • the constructing a graphic code extraction model by using the augmented image sample, the original image sample of the graphic code and the standard image sample of the graphic code includes:
  • the graphic code extraction model to be trained is trained by using the loss calculation result to construct a graphic code extraction model.
  • the second aspect provides a method for identifying a graphic code, the method comprising:
  • the pattern code recognition result output by the pattern code extraction model for the pattern code image to be recognized obtain the pattern code candidate area in the pattern code image to be recognized
  • the performing graphic code edge fitting processing on the graphic code candidate area, and determining the graphic code area in the graphic code image to be recognized includes:
  • the pattern code region in the pattern code image to be recognized is determined.
  • the extracting at least one layer of outer layer edge points of the graphic code candidate area to obtain the outer layer edge point set includes:
  • the method also includes:
  • the image data corresponding to the graphic code area is output to the graphic code decoding module, so that the graphic code decoding module can complete the decoding process.
  • the third aspect provides a device for constructing a graphic code extraction model, including:
  • the sample acquisition module is configured to perform acquisition of graphic code original image samples and material background image samples
  • the sample generation module is configured to obtain a corresponding standard image sample of the graphic code according to the original image sample of the graphic code;
  • the sample fusion module is configured to perform fusion based on the graphic code standard image sample and the material background image sample to obtain an augmented image sample;
  • a model building module configured to construct a graphic code extraction model by using the augmented image samples, the original image samples of the graphic code, and the standard image samples of the graphic code.
  • the sample generation module is configured to execute:
  • the number of material background image samples is multiple; the sample fusion module is configured to execute:
  • the initial sample of the augmented image is screened to obtain the augmented image sample.
  • the sample fusion module is configured to perform:
  • Contrast-preserving fusion is performed on the standard image sample of the graphic code and each of the material background image samples to obtain an initial sample of the augmented image.
  • the fourth aspect provides a graphic code recognition device, including:
  • the model acquisition module is configured to perform the acquisition of the graphic code extraction model constructed according to the method described above;
  • An image input module configured to input the graphic code image to be recognized into the graphic code extraction model
  • the coarse positioning module is configured to execute the pattern code recognition result output for the pattern code image to be recognized according to the pattern code extraction model, and obtain the pattern code candidate area in the pattern code image to be recognized;
  • the fine positioning module is configured to perform graphic code edge fitting processing on the graphic code candidate area, and determine the graphic code area in the graphic code image to be recognized.
  • the fine positioning module is configured to perform:
  • the pattern code region in the pattern code image to be recognized is determined.
  • the fine positioning module is configured to perform, including:
  • a fifth aspect provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
  • a sixth aspect provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
  • the pattern code extraction model constructed according to the above-mentioned method; inputting the pattern code image to be recognized into the pattern code extraction model; according to the pattern code extraction model output pattern code recognition for the pattern code image to be recognized As a result, the graphic code candidate area in the graphic code image to be recognized is obtained; the graphic code edge fitting process is performed on the graphic code candidate area, and the graphic code area in the graphic code image to be recognized is determined.
  • a seventh aspect provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
  • the eighth aspect provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
  • the pattern code extraction model constructed according to the above-mentioned method; inputting the pattern code image to be recognized into the pattern code extraction model; according to the pattern code extraction model output pattern code recognition for the pattern code image to be recognized As a result, the graphic code candidate area in the graphic code image to be recognized is obtained; the graphic code edge fitting process is performed on the graphic code candidate area, and the graphic code area in the graphic code image to be recognized is determined.
  • a ninth aspect provides a computer program product, including a computer program.
  • the computer program is executed by a processor, the steps of the method described in any one of the above-mentioned first aspects, or the steps of the method described in any one of the above-mentioned second aspects are implemented. step.
  • the above scheme can integrate standard graphic codes with various material backgrounds in the model training stage to form augmented image samples with various material background styles, and combine augmented image samples with various material background styles with original image samples of graphic codes and standard graphic codes.
  • the image samples are used together as model training data for model training, and a graphic code extraction model suitable for various application scenarios can be constructed to improve the accuracy of the model's recognition of graphic codes.
  • Fig. 1 is the schematic flow chart of the method for constructing graphic code extraction model in an embodiment
  • Fig. 2 is a schematic flow chart of a pattern code recognition method in an embodiment
  • Fig. 3 is a schematic structural diagram of a device for constructing a graphic code extraction model in an embodiment
  • Fig. 4 is a schematic structural diagram of a pattern code recognition device in an embodiment
  • Fig. 5 is a schematic diagram of the internal structure of a computer device in an embodiment
  • Fig. 6 is a schematic diagram of the internal structure of a computer device in an embodiment.
  • the following part first introduces the method for constructing the pattern code extraction model provided by this application, and then introduces the pattern code recognition method provided by this application.
  • the method for constructing the graphic code extraction model can be mainly executed by the server, for example, the server obtains the original image sample of the graphic code and the material background image sample, and the server obtains the corresponding standard image of the graphic code according to the original image sample of the graphic code Sample; the server obtains an augmented image sample based on the fusion of the aforementioned graphic code standard image sample and the aforementioned material background image sample; the server uses the aforementioned augmented image sample, graphic code original image sample, and aforementioned graphic code standard image sample to construct a graphic code extraction Model.
  • the server can be implemented by an independent server or a server cluster composed of multiple servers.
  • the graphic code recognition method provided in the present application can be mainly executed by the terminal, for example, the terminal obtains the graphic code extraction model constructed according to the above-mentioned method of constructing the graphic code extraction model, and inputs the image of the graphic code to be recognized into the graphic code extraction model ; The terminal obtains the graphic code candidate area in the graphic code image to be recognized according to the graphic code recognition result output by the graphic code extraction model for the graphic code image to be recognized; the terminal performs graphic coding on the graphic code candidate area The edge fitting process determines the graphic code area in the image of the graphic code to be recognized.
  • the terminal can be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices.
  • a method for constructing a graphic code extraction model is provided.
  • the method is applied to a server as an example for illustration. It can be understood that when the method is applied to a terminal, the execution of corresponding steps The subject is changed to a terminal.
  • the method may include the steps of:
  • Step S101 the server obtains the original image sample of the graphic code and the sample of the material background image
  • the server can obtain it through data collection and web crawler technology.
  • a background image of multiple materials which may include various materials that can be used to print graphic codes, such as paper of various colors, various wooden and plastic materials, etc., and may further include various lighting conditions (such materials under different light and dark conditions) to cover the possible application scenarios of graphic codes as much as possible.
  • Step S102 the server obtains the corresponding standard image sample of the graphic code according to the original image sample of the graphic code
  • the server mainly generates the corresponding graphic code standard image sample according to the graphic code information contained in the original image sample of the graphic code, that is, the original image sample is converted to a certain extent on the basis of basically retaining the original graphic code information, so that Form a new graphic code image for subsequent fusion processing.
  • This new graphic code image is called a graphic code standard image sample.
  • This transformation can be, for example, changing the position, direction or shape of the graphic code on the image, etc., which can be implemented in some In the example, it is used to enrich or standardize the shape of the graphic code on the image.
  • this step S102 may include: the server generates the initial sample of the standard image of the graphic code according to the graphic code information carried by the original image sample of the graphic code; the server performs morphological transformation processing on the graphic code points of the initial sample of the standard image of the graphic code , to obtain the standard image sample of the graphic code.
  • the server can first generate a corresponding initial sample of a standard image of a graphic code according to the graphic code information carried by the original image sample of the graphic code.
  • the graphic code information (text information) carried by the original image sample of the graphic code can be extracted first, and then Through the code system of graphic codes such as two-dimensional codes, the text information is changed into standard graphic code picture information, and then a quadrilateral area is set to perform affine transformation on it, so as to obtain the initial sample of the standard image of the graphic code.
  • the server further performs morphological transformation processing on the graphic code points of the initial sample of the standard image of the graphic code to obtain the standard image sample of the graphic code , the morphological transformation process includes at least one of dilation, erosion or random noise.
  • the probability P can be set to perform random morphological transformation (expansion, erosion, random noise, etc.) on the shape of the graphic code points in the initial sample of the graphic code standard image to obtain the standard image sample of the graphic code.
  • Step S103 the server obtains an augmented image sample based on the fusion of the standard image sample of the graphic code and the background image sample of the material; the augmented image sample represents an image sample obtained by fusing the standard image sample of the graphic code and the background image sample of the material.
  • the server may use the material background image sample as the background of the graphic code standard image sample, and fuse the graphic code standard image sample into the material background image sample to obtain an augmented image sample.
  • the number of material background image samples may be multiple, and for this, in one embodiment, step S103 may include:
  • the server performs contrast-preserving fusion of the graphic code standard image sample and multiple material background image samples to obtain the initial sample of the augmented image; the server performs an initial augmented image sample according to the semantic distance between the initial sample of the augmented image and the original image sample of the graphic code. Filter to obtain augmented image samples.
  • the contrast preserving fusion is an algorithm for performing contrast preserving fusion on two pictures by calculating the color distribution of the pictures.
  • the server performs contrast-preserving fusion of the graphic code standard image sample and multiple material background image samples, which may include performing contrast-preserving fusion of the graphic code standard image sample with each material background image sample, and may also include graphic Contrast-preserving fusion of code standard image samples with two or more material background image samples at the same time, and multiple fusions with different material background combinations (that is, the combination of two or more material background image samples), so as to enrich the samples form to obtain an initial sample of the augmented image, and the number of initial samples of the augmented image is also multiple.
  • the server needs to select qualified augmented image initial samples from the augmented image initial samples as augmented image samples.
  • the server in this embodiment can filter according to the semantic distance (D(I_AUG)-D(I_DM)) between the obtained augmented image initial sample (I_AUG) and the graphic code original image sample (I_DM).
  • the server can filter the initial sample of the augmented image as the augmented image sample.
  • step S104 the server uses the augmented image sample, the original image sample of the graphic code, and the standard image sample of the graphic code to construct a graphic code extraction model.
  • ImageNet pre-trained ResNet34 can be used as the backbone network to form a decoder through skip-connection between layers.
  • the augmented image sample and the original image sample of the graphic code can be used as input data for model training
  • the standard image sample of graphic code can be used as label data for model training
  • a graphic code extraction model can be constructed using the input data and label data.
  • the graphic code standard image sample is mainly generated according to the graphic code information carried by the graphic code original image sample, and may be referred to as the graphic code standard image initial sample in the above embodiments, that is, the graphic code standard without morphological transformation Image samples.
  • step S104 specifically includes: the server inputs the augmented image sample and the original image sample of the graphic code into the graphic code extraction model to be trained, and obtains the image code extraction model to be trained for the augmented image sample and the original image of the graphic code
  • the sample output graphic code extraction result sample;
  • the server uses the graphic code extraction result sample and the graphic code standard image sample to perform loss function calculation to obtain the loss calculation result;
  • the server uses the loss calculation result to train the graphic code extraction model to be trained, and constructs the obtained graphic code extraction model.
  • the augmented image sample and the original image sample of the graphic code as the input data for model training will be input into the graphic code extraction model to be trained, and the graphic code extraction model to be trained is aimed at the augmented image Samples and graphic codes
  • the original image samples output corresponding graphic code extraction result samples.
  • the graphic code standard image sample used as the label data for model training will be used to perform loss function calculation with the graphic code extraction result sample to obtain the loss calculation result or called the loss function calculation result. Then the loss calculation result can be used to adjust the model network parameters of the graphic code extraction model to be trained, so as to train the graphic code extraction model to be trained, and construct the graphic code extraction model.
  • the graphic code part in the graphic code extraction result sample output by the graphic code extraction model and the graphic code
  • the graphic code part in the standard image sample is calculated by the loss function, and the loss weight is added to the graphic code quiet zone (quiet zone), and the graphic code extraction model is constructed after a certain iteration.
  • the graphic code quiet zone can be a blank frame outside the QR code to ensure that the scanning device correctly recognizes the QR code. If there is no such frame, the QR code reader will be Due to the interference of external factors, it is impossible to determine what the QR code contains and does not contain.
  • the graphic code quiet zone can be a blank boundary located on one side of the barcode, which is used to ensure that the scanning device correctly recognizes the end mark of the barcode, and avoids obtaining information irrelevant to the barcode.
  • the server obtains the original image sample of the graphic code and the material background image sample, and then the server obtains the corresponding standard image sample of the graphic code according to the original image sample of the graphic code, and then the server obtains the corresponding standard image sample of the graphic code based on the standard image sample of the graphic code and the material background image sample.
  • the image samples are fused to obtain augmented image samples, and the image code extraction model is constructed by using the augmented image samples, the original image samples of the graphic code and the standard image samples of the graphic code.
  • This solution can integrate standard graphic codes with various material backgrounds in the model training stage to form augmented image samples with various material background styles, and combine augmented image samples with various material background styles, original image samples of graphic codes, and graphic codes
  • Standard image samples are also used as model training data for model training, which can construct graphic code extraction models suitable for various application scenarios, and improve the accuracy of the model for graphic code recognition.
  • a pattern code recognition method is provided, and the method is applied to a terminal as an example for illustration. It can be understood that when the method is applied to a server, the subject of execution of the corresponding steps will be changed. for the server.
  • the method may include the steps of:
  • Step S201 the terminal obtains the graphic code extraction model constructed according to the method described in the above embodiment
  • Step S202 the terminal inputs the graphic code image to be recognized into the graphic code extraction model
  • the image of the graphic code to be recognized can be scaled to the set scale space, and basic preprocessing can also be performed, such as a series of grayscale, sharpening, and denoising. Preprocessing operations before input into the pattern code extraction model.
  • Step S203 the terminal obtains the graphic code candidate area in the graphic code image to be recognized according to the graphic code recognition result output by the graphic code extraction model for the graphic code image to be recognized.
  • This step mainly uses the graphic code extraction model to roughly locate the area where the graphic code in the image of the graphic code to be recognized is located.
  • the graphic code extraction model will output the corresponding graphic code recognition result, so that the terminal can obtain the graphic code candidate area in the graphic code image to be recognized according to the graphic code recognition result, which is about to The region where the pattern code is located by the pattern code extraction model on the pattern code image to be recognized is used as the pattern code candidate region.
  • Step S204 the terminal performs graphic code edge fitting processing on the graphic code candidate area, and determines the graphic code area in the graphic code image to be recognized.
  • an edge fitting process is performed on the graphic code candidate area to accurately locate the graphic code area in the graphic code image to be recognized.
  • step S204 specifically includes: the terminal extracts at least one layer of outer edge points of the graphic code candidate area to obtain the outer edge point set; then the terminal performs robust regression fitting on the outer edge point set to obtain the pattern to be recognized The edge fitting result of the graphic code area in the code image; then the terminal determines the graphic code area in the graphic code image to be recognized according to the edge fitting result of the graphic code area.
  • This embodiment is mainly to extract at least one layer of outer layer edge points from the graphic code candidate area roughly positioned by the graphic code extraction model to form an outer layer edge point set, and then perform a robust regression fitting process on the outer layer edge point set so that according to the graphic code area edge
  • the fitting result determines the edge of the graphic code area, and precisely locates the graphic code area in the graphic code image to be recognized according to the edge.
  • the robust regression fitting refers to the statistical robust regression theory, such as Theil-Sen estimation to complete the fitting of the edges of the graphic code area.
  • an edge extraction algorithm can be applied, such as the canny operator to extract edge points from the graphic code candidate area, and extract such as a layer from the outside of the graphic code candidate area to the graphic code candidate area.
  • Edge points (corresponding to the outer layer edge points), as the outer layer edge point set of the area boundary of the fitting graphic code, can then use Theil-Sen estimation to fit the outer layer edge point set to obtain the graphic code area edge fitting result, according to This locates the graphic code area in the graphic code image to be recognized. After the graphic code area is located, the image data corresponding to the graphic code area can be output to the graphic code decoding module for the graphic code decoding module to complete the decoding process.
  • the above pattern code recognition method uses the statistical method of edge extraction and robust regression to realize the high-precision optimization of the edge of the rough positioning of the pattern code candidate area, improve the accuracy of pattern code recognition, and can adapt to continuous changes It has strong robustness and is conducive to improving the readability and decoding rate of graphic codes such as two-dimensional codes (QR, DM codes).
  • QR, DM codes two-dimensional codes
  • a device for constructing a graphic code extraction model is provided, and the device 300 can be applied to a server.
  • the device 300 may include:
  • the sample acquisition module 301 is configured to perform acquisition of graphic code original image samples and material background image samples;
  • the sample generating module 302 is configured to obtain a corresponding standard image sample of the graphic code according to the original image sample of the graphic code;
  • the sample fusion module 303 is configured to perform fusion based on the graphic code standard image sample and the material background image sample to obtain an augmented image sample;
  • the model building module 304 is configured to execute using the augmented image sample, the original image sample of the graphic code and the standard image sample of the graphic code to construct a graphic code extraction model.
  • the sample generating module 302 is configured to generate an initial sample of a standard image of a graphic code according to the graphic code information carried by the original image sample of the graphic code; Performing morphological transformation processing to obtain the standard image sample of the graphic code; the morphological transformation processing includes at least one of expansion, erosion or random noise.
  • the number of material background image samples is multiple; the sample fusion module 303 is configured to perform contrast-preserving fusion of the graphic code standard image sample and multiple material background image samples to obtain an augmented An initial sample of the image: according to the semantic distance between the initial sample of the augmented image and the original image sample of the graphic code, the initial sample of the augmented image is screened to obtain the sample of the augmented image.
  • the model building module 304 is configured to input the augmented image sample and the original image sample of the graphic code into the graphic code extraction model to be trained, and obtain the graphic code extraction model to be trained for the The graphic code extraction result sample output by the augmented image sample and the original image sample of the graphic code; use the graphic code extraction result sample and the graphic code standard image sample to perform loss function calculation to obtain the loss calculation result; use the loss calculation result to calculate the The graphic code extraction model to be trained is trained, and the graphic code extraction model is constructed.
  • a pattern code recognition device is provided, and the device 400 can be applied to a terminal.
  • the device 400 may include:
  • the model acquisition module 401 is configured to perform acquisition of the graphic code extraction model constructed according to the method described above;
  • the image input module 402 is configured to input the graphic code image to be recognized into the graphic code extraction model
  • the coarse positioning module 403 is configured to execute the pattern code recognition result output for the pattern code image to be recognized according to the pattern code extraction model, and obtain the pattern code candidate area in the pattern code image to be recognized;
  • the fine positioning module 404 is configured to perform pattern code edge fitting processing on the pattern code candidate region, and determine the pattern code region in the pattern code image to be recognized.
  • the fine positioning module 404 is configured to extract at least one layer of outer edge points of the graphic code candidate area to obtain an outer edge point set; perform robust regression simulation on the outer edge point set According to the edge fitting result of the pattern code region, the pattern code region in the pattern code image to be recognized is determined.
  • each module in the above-mentioned device for constructing a pattern code extraction model and the pattern code recognition device can be fully or partially realized by software, hardware and a combination thereof.
  • the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure may be shown in FIG. 5 .
  • the computer device includes a processor, memory and a network interface connected by a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer programs and databases.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the database of the computer device is used to store image sample data.
  • the network interface of the computer device is used to communicate with an external terminal via a network connection.
  • a computer device is provided.
  • the computer device may be a terminal, and its internal structure may be as shown in FIG. 6 .
  • the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus.
  • the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system and computer programs.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, an operator network, NFC (Near Field Communication) or other technologies.
  • WIFI Wireless Fidelity
  • NFC Near Field Communication
  • the computer program is executed by the processor, a pattern code recognition method is realized.
  • the display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen
  • the input device of the computer device may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the casing of the computer device , and can also be an external keyboard, touchpad, or mouse.
  • FIGS. 5 and 6 are only block diagrams of partial structures related to the solution of this application, and do not constitute a limitation to the computer equipment on which the solution of this application is applied.
  • the specific computer Devices may include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
  • a computer device including a memory and a processor, where a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps in the foregoing method embodiments are implemented.
  • any references to memory, storage, database or other media used in the various embodiments provided in the present application may include at least one of non-volatile memory and volatile memory.
  • Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory or optical memory, etc.
  • Volatile memory can include Random Access Memory (RAM) or external cache memory.
  • RAM can be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
  • a kind of computer program product comprises computer program, and when this computer program is executed by processor, realizes the step: acquire graphic code original image sample and material background image sample; According to described graphic code original image sample, to obtain the corresponding graphic code standard image sample; based on the fusion of the graphic code standard image sample and the material background image sample, an augmented image sample is obtained; using the augmented image sample, the graphic code original image sample As well as the standard image samples of the graphic code, a graphic code extraction model is constructed.
  • a computer program product including a computer program.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Electromagnetism (AREA)
  • Toxicology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

Provided in the present application are a construction method and apparatus for a graphic code extraction model, a graphic code identification method and apparatus, and a computer device and a storage medium. The construction method comprises: acquiring a graphic code original image sample and a material background image sample (S101); obtaining a corresponding graphic code standard image sample according to the graphic code original image sample (S102); obtaining an augmented image sample on the basis of the fusion of the graphic code standard image sample and the material background image sample (S103); and constructing a graphic code extraction model by using the augmented image sample, the graphic code original image sample and the graphic code standard image sample (S104).

Description

图形码提取模型构建方法、识别方法、装置、设备和介质Image code extraction model construction method, recognition method, device, equipment and medium
本申请要求2021年7月12日申请的,申请号为2021107853537、名称为“图形码提取模型构建方法、识别方法、装置、设备和介质”的中国专利申请的优先权,在此将其全文引入作为参考。This application claims the priority of the Chinese patent application filed on July 12, 2021 with the application number 2021107853537 and titled "Graphic Code Extraction Model Construction Method, Recognition Method, Device, Equipment and Medium", which is hereby incorporated in its entirety Reference.
技术领域technical field
本申请涉及人工智能技术领域,特别是涉及一种构建图形码提取模型的方法、图形码识别方法、装置、计算机设备和存储介质。The present application relates to the technical field of artificial intelligence, in particular to a method for constructing a pattern code extraction model, a pattern code recognition method, a device, a computer device and a storage medium.
背景技术Background technique
随着人工智能技术的发展,出现了运用神经网络模型对各类场景中的如二维码等图形码进行扫描和提取的技术。With the development of artificial intelligence technology, there have been technologies that use neural network models to scan and extract graphic codes such as QR codes in various scenarios.
然而,相关技术中用于图形码提取的神经网络模型在构建或训练时,由于采用的训练样本复杂度低和数量有限等因素,使训练得到的模型在实际应用中难以适应图形码所处的多变和多样的应用场景,导致这种方式训练得到的模型在实际应用场景中对图形码的识别准确性较低。However, when the neural network model used for graphic code extraction in the related art is constructed or trained, due to factors such as the low complexity and limited number of training samples used, it is difficult for the trained model to adapt to the actual application of the graphic code. Changeable and diverse application scenarios lead to low recognition accuracy of the model trained in this way for graphic codes in actual application scenarios.
发明内容Contents of the invention
基于此,有必要针对上述技术问题,提供一种构建图形码提取模型的方法、图形码识别方法、装置、计算机设备和存储介质。Based on this, it is necessary to provide a method for constructing a pattern code extraction model, a pattern code recognition method, a device, a computer device and a storage medium for the above technical problems.
第一方面提供一种构建图形码提取模型的方法,所述方法包括:The first aspect provides a kind of method of building graphic code extraction model, described method comprises:
获取图形码原始图像样本和材质背景图像样本;Obtain the original image sample of the graphics code and the material background image sample;
根据所述图形码原始图像样本,得到对应的图形码标准图像样本;Obtaining a corresponding standard image sample of the graphic code according to the original image sample of the graphic code;
基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本;Obtaining an augmented image sample based on the fusion of the graphic code standard image sample and the material background image sample;
利用所述增广图像样本、所述图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型。A graphic code extraction model is constructed by using the augmented image sample, the original image sample of the graphic code and the standard image sample of the graphic code.
在一些实施例中,所述根据所述图形码原始图像样本,得到对应的图形码标准图像样本,包括:In some embodiments, the obtaining the corresponding standard image sample of the graphic code according to the original image sample of the graphic code includes:
根据所述图形码原始图像样本携带的图形码信息,生成图形码标准图像初始样本;Generate an initial sample of a standard image of a graphic code according to the graphic code information carried by the original image sample of the graphic code;
对所述图形码标准图像初始样本的图形码点进行形态学变换处理,得到对应的图形码标准图像样本;其中,所述形态学变换处理至少包括膨胀、腐蚀和随机噪声其中之一。Performing morphological transformation processing on the graphic code points of the initial sample of the standard graphic code image to obtain the corresponding standard image sample of the graphic code; wherein, the morphological transformation process includes at least one of expansion, erosion and random noise.
在一些实施例中,所述材质背景图像样本的数量为多个;所述基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本,包括:In some embodiments, the number of the material background image samples is multiple; the fusion of the standard image samples based on the graphic code and the material background image samples to obtain the augmented image samples includes:
将所述图形码标准图像样本与多个所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本;Contrast-preserving fusion of the graphic code standard image sample and a plurality of the material background image samples to obtain an initial sample of the augmented image;
根据所述增广图像初始样本与所述图形码原始图像样本的语义距离,对所述增广图像初始样本进行筛选,得到增广图像样本。According to the semantic distance between the initial sample of the augmented image and the original image sample of the graphic code, the initial sample of the augmented image is screened to obtain the augmented image sample.
在一些实施例中,所述将所述图形码标准图像样本与多个所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本,包括:In some embodiments, the contrast-preserving fusion of the graphic code standard image sample and a plurality of the material background image samples is obtained to obtain the initial sample of the augmented image, including:
将所述图形码标准图像样本分别与每一材质背景图像样本进行对比度保留融合,得到增广图像初始样本。Contrast-preserving fusion is performed on the standard image sample of the graphic code with each material background image sample to obtain an initial sample of the augmented image.
在一些实施例中,所述将所述图形码标准图像样本与多个所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本,包括:In some embodiments, the contrast-preserving fusion of the graphic code standard image sample and a plurality of the material background image samples is obtained to obtain the initial sample of the augmented image, including:
将所述图形码标准图像样本分别与不同材质背景组合的多次融合,得到多个增广图像初始样本;每个所述材质背景组合中包括两个或以上的所述材质背景图像样本。The standard image samples of the graphic code are fused with different material background combinations for multiple times to obtain a plurality of initial samples of the augmented image; each of the material background combinations includes two or more material background image samples.
在一些实施例中,所述利用所述增广图像样本、图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型,包括:In some embodiments, the constructing a graphic code extraction model by using the augmented image sample, the original image sample of the graphic code and the standard image sample of the graphic code includes:
将所述增广图像样本和所述图形码原始图像样本输入待训练的图形码提取模型;Inputting the augmented image sample and the original image sample of the graphic code into the graphic code extraction model to be trained;
获取所述待训练的图形码提取模型针对所述增广图像样本和所述图形码原始图像样本输出的图形码提取结果样本;Obtaining a graphic code extraction result sample output by the graphic code extraction model to be trained for the augmented image sample and the graphic code original image sample;
利用所述图形码提取结果样本和所述图形码标准图像样本进行损失函数计算,得到损失计算结果;Using the graphic code extraction result samples and the graphic code standard image samples to perform loss function calculations to obtain loss calculation results;
利用所述损失计算结果对所述待训练的图形码提取模型进行训练,构建图形码提取模型。The graphic code extraction model to be trained is trained by using the loss calculation result to construct a graphic code extraction model.
第二方面提供一种图形码识别方法,所述方法包括:The second aspect provides a method for identifying a graphic code, the method comprising:
获取根据如上所述的方法构建得到的图形码提取模型;Obtain the graphic code extraction model constructed according to the above-mentioned method;
将待识别图形码图像输入至所述图形码提取模型;Inputting the pattern code image to be recognized into the pattern code extraction model;
根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码 图像中的图形码候选区域;According to the pattern code recognition result output by the pattern code extraction model for the pattern code image to be recognized, obtain the pattern code candidate area in the pattern code image to be recognized;
对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。Perform graphic code edge fitting processing on the graphic code candidate area to determine the graphic code area in the graphic code image to be recognized.
在一些实施例中,所述对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域,包括:In some embodiments, the performing graphic code edge fitting processing on the graphic code candidate area, and determining the graphic code area in the graphic code image to be recognized includes:
提取所述图形码候选区域的至少一层外层边缘点,得到外层边缘点集;Extracting at least one layer of outer layer edge points of the graphic code candidate area to obtain an outer layer edge point set;
对所述外层边缘点集进行稳健回归拟合,得到所述待识别图形码图像中的图形码区域边缘拟合结果;performing robust regression fitting on the outer layer edge point set to obtain an edge fitting result of the graphic code region in the graphic code image to be recognized;
根据所述图形码区域边缘拟合结果,确定所述待识别图形码图像中的图形码区域。According to the edge fitting result of the pattern code region, the pattern code region in the pattern code image to be recognized is determined.
在一些实施例中,所述提取所述图形码候选区域的至少一层外层边缘点,得到外层边缘点集,包括:In some embodiments, the extracting at least one layer of outer layer edge points of the graphic code candidate area to obtain the outer layer edge point set includes:
应用边缘提取算法对所述图形码候选区域进行边缘点提取;Applying an edge extraction algorithm to extract edge points from the graphic code candidate area;
自所述图形码候选区域外侧向所述图形码候选区域内提取至少一层的边缘点,作为外层边缘点集。Extracting at least one layer of edge points from the outside of the pattern code candidate region to the interior of the pattern code candidate region as an outer layer edge point set.
在一些实施例中,所述方法还包括:In some embodiments, the method also includes:
在定位出所述图形码区域后,输出所述图形码区域对应的图像数据给图形码解码模块,以供所述图形码解码模块完成解码处理。After the graphic code area is located, the image data corresponding to the graphic code area is output to the graphic code decoding module, so that the graphic code decoding module can complete the decoding process.
第三方面提供一种构建图形码提取模型的装置,包括:The third aspect provides a device for constructing a graphic code extraction model, including:
样本获取模块,被配置为执行获取图形码原始图像样本和材质背景图像样本;The sample acquisition module is configured to perform acquisition of graphic code original image samples and material background image samples;
样本生成模块,被配置为执行根据所述图形码原始图像样本,得到对应的图形码标准图像样本;The sample generation module is configured to obtain a corresponding standard image sample of the graphic code according to the original image sample of the graphic code;
样本融合模块,被配置为执行基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本;The sample fusion module is configured to perform fusion based on the graphic code standard image sample and the material background image sample to obtain an augmented image sample;
模型构建模块,被配置为执行利用所述增广图像样本、所述图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型。A model building module configured to construct a graphic code extraction model by using the augmented image samples, the original image samples of the graphic code, and the standard image samples of the graphic code.
在一些实施例中,所述样本生成模块,被配置为执行:In some embodiments, the sample generation module is configured to execute:
根据所述图形码原始图像样本携带的图形码信息,生成图形码标准图像初始样本;以及,Generate an initial sample of a standard image of a graphic code according to the graphic code information carried by the original image sample of the graphic code; and,
对所述图形码标准图像初始样本的图形码点进行形态学变换处理,得到对应的图形码标准图像样本;其中,所述形态学变换处理至少包括膨胀、腐蚀和随机噪声其中之一。Performing morphological transformation processing on the graphic code points of the initial sample of the standard graphic code image to obtain the corresponding standard image sample of the graphic code; wherein, the morphological transformation process includes at least one of expansion, erosion and random noise.
在一些实施例中,所述材质背景图像样本的数量为多个;所述样本融合模块,被配置为执行:In some embodiments, the number of material background image samples is multiple; the sample fusion module is configured to execute:
将所述图形码标准图像样本与多个所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本;以及,Contrast-preserving fusion of the graphic code standard image sample and a plurality of the material background image samples to obtain an initial sample of the augmented image; and,
根据所述增广图像初始样本与所述图形码原始图像样本的语义距离,对所述增广图像初始样本进行筛 选,得到增广图像样本。According to the semantic distance between the initial sample of the augmented image and the original image sample of the graphic code, the initial sample of the augmented image is screened to obtain the augmented image sample.
在一些实施例中,所述样本融合模块,被配置为执行:In some embodiments, the sample fusion module is configured to perform:
将所述图形码标准图像样本分别与每一所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本。Contrast-preserving fusion is performed on the standard image sample of the graphic code and each of the material background image samples to obtain an initial sample of the augmented image.
第四方面提供一种图形码识别装置,包括:The fourth aspect provides a graphic code recognition device, including:
模型获取模块,被配置为执行获取根据如上所述的方法构建得到的图形码提取模型;The model acquisition module is configured to perform the acquisition of the graphic code extraction model constructed according to the method described above;
图像输入模块,被配置为执行将待识别图形码图像输入至所述图形码提取模型;An image input module configured to input the graphic code image to be recognized into the graphic code extraction model;
粗定位模块,被配置为执行根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码图像中的图形码候选区域;The coarse positioning module is configured to execute the pattern code recognition result output for the pattern code image to be recognized according to the pattern code extraction model, and obtain the pattern code candidate area in the pattern code image to be recognized;
精定位模块,被配置为执行对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。The fine positioning module is configured to perform graphic code edge fitting processing on the graphic code candidate area, and determine the graphic code area in the graphic code image to be recognized.
在一些实施例中,所述精定位模块,被配置为执行:In some embodiments, the fine positioning module is configured to perform:
提取所述图形码候选区域的至少一层外层边缘点,得到外层边缘点集;Extracting at least one layer of outer layer edge points of the graphic code candidate area to obtain an outer layer edge point set;
对所述外层边缘点集进行稳健回归拟合,得到所述待识别图形码图像中的图形码区域边缘拟合结果;以及,performing robust regression fitting on the outer edge point set to obtain an edge fitting result of the graphic code region in the graphic code image to be recognized; and,
根据所述图形码区域边缘拟合结果,确定所述待识别图形码图像中的图形码区域。According to the edge fitting result of the pattern code region, the pattern code region in the pattern code image to be recognized is determined.
在一些实施例中,所述精定位模块,被配置为执行,包括:In some embodiments, the fine positioning module is configured to perform, including:
应用边缘提取算法对所述图形码候选区域进行边缘点提取;Applying an edge extraction algorithm to extract edge points from the graphic code candidate area;
自所述图形码候选区域外侧向所述图形码候选区域内提取至少一层的边缘点,作为外层边缘点集。Extracting at least one layer of edge points from the outside of the pattern code candidate region to the interior of the pattern code candidate region as an outer layer edge point set.
第五方面提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:A fifth aspect provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
获取图形码原始图像样本和材质背景图像样本;根据所述图形码原始图像样本,得到对应的图形码标准图像样本;基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本;利用所述增广图像样本、所述图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型。Obtain the original image sample of the graphic code and the background image sample of the material; obtain the standard image sample of the corresponding graphic code according to the original image sample of the graphic code; based on the fusion of the standard image sample of the graphic code and the background image sample of the material, obtain the widening image samples; using the augmented image samples, the original image samples of the graphic codes and the standard image samples of the graphic codes to construct a graphic code extraction model.
第六方面提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:A sixth aspect provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
获取根据如上所述的方法构建得到的图形码提取模型;将待识别图形码图像输入至所述图形码提取模型;根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码 图像中的图形码候选区域;对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。Obtaining the pattern code extraction model constructed according to the above-mentioned method; inputting the pattern code image to be recognized into the pattern code extraction model; according to the pattern code extraction model output pattern code recognition for the pattern code image to be recognized As a result, the graphic code candidate area in the graphic code image to be recognized is obtained; the graphic code edge fitting process is performed on the graphic code candidate area, and the graphic code area in the graphic code image to be recognized is determined.
第七方面提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:A seventh aspect provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
获取图形码原始图像样本和材质背景图像样本;根据所述图形码原始图像样本,得到对应的图形码标准图像样本;基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本;利用所述增广图像样本、所述图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型。Obtain the original image sample of the graphic code and the background image sample of the material; obtain the standard image sample of the corresponding graphic code according to the original image sample of the graphic code; based on the fusion of the standard image sample of the graphic code and the background image sample of the material, obtain the widening image samples; using the augmented image samples, the original image samples of the graphic codes and the standard image samples of the graphic codes to construct a graphic code extraction model.
第八方面提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:The eighth aspect provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
获取根据如上所述的方法构建得到的图形码提取模型;将待识别图形码图像输入至所述图形码提取模型;根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码图像中的图形码候选区域;对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。Obtaining the pattern code extraction model constructed according to the above-mentioned method; inputting the pattern code image to be recognized into the pattern code extraction model; according to the pattern code extraction model output pattern code recognition for the pattern code image to be recognized As a result, the graphic code candidate area in the graphic code image to be recognized is obtained; the graphic code edge fitting process is performed on the graphic code candidate area, and the graphic code area in the graphic code image to be recognized is determined.
第九方面提供一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述第一方面任一项所述的方法的步骤,或上述第二方面任一项所述的方法的步骤。A ninth aspect provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the method described in any one of the above-mentioned first aspects, or the steps of the method described in any one of the above-mentioned second aspects are implemented. step.
上述方案能够在模型训练阶段将标准图形码与各种材质背景进行融合从而形成材质背景风格多样的增广图像样本,将材质背景风格多样的增广图像样本与图形码原始图像样本和图形码标准图像样本一并作为模型训练数据进行模型训练,能够构建得到适应各类应用场景的图形码提取模型,提高模型对图形码识别的准确性。The above scheme can integrate standard graphic codes with various material backgrounds in the model training stage to form augmented image samples with various material background styles, and combine augmented image samples with various material background styles with original image samples of graphic codes and standard graphic codes. The image samples are used together as model training data for model training, and a graphic code extraction model suitable for various application scenarios can be constructed to improve the accuracy of the model's recognition of graphic codes.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其他特征、目的和优点将从说明书、附图以及权利要求书变得明显。The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below. Other features, objects and advantages of the present application will be apparent from the description, drawings and claims.
附图说明Description of drawings
为了更好地描述和说明这里公开的那些实施例和示例,可以参考一副或多副附图。用于描述附图的附加细节或示例不应当被认为是对所公开的发明、目前描述的实施例和/或示例以及目前理解的这些发明的最佳模式中的任何一者的范围的限制。For a better description and illustration of those embodiments and examples disclosed herein, reference may be made to one or more of the accompanying drawings. Additional details or examples used to describe the drawings should not be considered limitations on the scope of any of the disclosed inventions, the presently described embodiments and/or examples, and the best mode of these inventions currently understood.
图1为一个实施例中构建图形码提取模型的方法的流程示意图;Fig. 1 is the schematic flow chart of the method for constructing graphic code extraction model in an embodiment;
图2为一个实施例中图形码识别方法的流程示意图;Fig. 2 is a schematic flow chart of a pattern code recognition method in an embodiment;
图3为一个实施例中构建图形码提取模型的装置的结构示意图;Fig. 3 is a schematic structural diagram of a device for constructing a graphic code extraction model in an embodiment;
图4为一个实施例中图形码识别装置的结构示意图;Fig. 4 is a schematic structural diagram of a pattern code recognition device in an embodiment;
图5为一个实施例中计算机设备的内部结构示意图;Fig. 5 is a schematic diagram of the internal structure of a computer device in an embodiment;
图6为一个实施例中计算机设备的内部结构示意图。Fig. 6 is a schematic diagram of the internal structure of a computer device in an embodiment.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.
以下部分首先对本申请提供的构建图形码提取模型的方法进行介绍,然后再对本申请提供的图形码识别方法进行介绍。The following part first introduces the method for constructing the pattern code extraction model provided by this application, and then introduces the pattern code recognition method provided by this application.
其中,本申请提供的构建图形码提取模型的方法可以主要由服务器执行,例如,服务器获取图形码原始图像样本和材质背景图像样本,服务器根据该图形码原始图像样本,得到对应的图形码标准图像样本;服务器基于前述图形码标准图像样本与前述材质背景图像样本的融合,得到增广图像样本;服务器利用前述增广图像样本、图形码原始图像样本以及前述图形码标准图像样本,构建图形码提取模型。该服务器可以用独立的服务器或者是多个服务器组成的服务器集群来实现。Wherein, the method for constructing the graphic code extraction model provided by the present application can be mainly executed by the server, for example, the server obtains the original image sample of the graphic code and the material background image sample, and the server obtains the corresponding standard image of the graphic code according to the original image sample of the graphic code Sample; the server obtains an augmented image sample based on the fusion of the aforementioned graphic code standard image sample and the aforementioned material background image sample; the server uses the aforementioned augmented image sample, graphic code original image sample, and aforementioned graphic code standard image sample to construct a graphic code extraction Model. The server can be implemented by an independent server or a server cluster composed of multiple servers.
本申请提供的图形码识别方法可以主要由终端执行,例如,终端获取根据如上述构建图形码提取模型的方法构建得到的图形码提取模型,将待识别图形码图像输入至所述图形码提取模型;终端根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码图像中的图形码候选区域;终端对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。该终端可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备。The graphic code recognition method provided in the present application can be mainly executed by the terminal, for example, the terminal obtains the graphic code extraction model constructed according to the above-mentioned method of constructing the graphic code extraction model, and inputs the image of the graphic code to be recognized into the graphic code extraction model ; The terminal obtains the graphic code candidate area in the graphic code image to be recognized according to the graphic code recognition result output by the graphic code extraction model for the graphic code image to be recognized; the terminal performs graphic coding on the graphic code candidate area The edge fitting process determines the graphic code area in the image of the graphic code to be recognized. The terminal can be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices.
在一个实施例中,如图1所示,提供了一种构建图形码提取模型的方法,以该方法应用于服务器为例进行说明,可以理解的,当该方法应用于终端时对应步骤的执行主体便变更为终端。该方法可以包括以下步骤:In one embodiment, as shown in FIG. 1 , a method for constructing a graphic code extraction model is provided. The method is applied to a server as an example for illustration. It can be understood that when the method is applied to a terminal, the execution of corresponding steps The subject is changed to a terminal. The method may include the steps of:
步骤S101,服务器获取图形码原始图像样本和材质背景图像样本;Step S101, the server obtains the original image sample of the graphic code and the sample of the material background image;
其中,本申请在模型构建阶段,对如图像等相关特征的描述将统一采用如图像样本等描述方式,以便与模型应用即图形码识别阶段进行区分。本步骤中,对于图形码原始图像样本和材质背景图像样本,服务器可以通过数据采集和网络爬虫技术获得,图形码原始图像样本是包含如二维码等图形码的图像,材质背景图像样本是包含多种材质的背景图像,该材质可以包括各类可被用于印刷图形码的材质,如各种颜色的 纸质、各类木制和塑料材质等等,还可以进一步包括各种照明条件(如不同明暗条件)下的此类材质,以尽可能覆盖图形码可能存在的应用场景。Among them, in the model construction stage of this application, the description of related features such as images will be uniformly described by such as image samples, so as to distinguish it from the model application, that is, the graphic code recognition stage. In this step, for the original image sample of the graphic code and the sample of the background image of the material, the server can obtain it through data collection and web crawler technology. A background image of multiple materials, which may include various materials that can be used to print graphic codes, such as paper of various colors, various wooden and plastic materials, etc., and may further include various lighting conditions ( Such materials under different light and dark conditions) to cover the possible application scenarios of graphic codes as much as possible.
步骤S102,服务器根据图形码原始图像样本,得到对应的图形码标准图像样本;Step S102, the server obtains the corresponding standard image sample of the graphic code according to the original image sample of the graphic code;
本步骤服务器主要是根据图形码原始图像样本所包含的图形码信息,生成与之对应的图形码标准图像样本,也即在基本保留原始图形码信息的基础上对原始图像样本进行一定转化,以形成新的图形码图像用于后续融合处理,该新的图形码图像称为图形码标准图像样本,该转化可例如是改变图形码在图像上的位置、方向或形状等等,可在一些实施例中用于丰富或规范图形码在图像上的形态。In this step, the server mainly generates the corresponding graphic code standard image sample according to the graphic code information contained in the original image sample of the graphic code, that is, the original image sample is converted to a certain extent on the basis of basically retaining the original graphic code information, so that Form a new graphic code image for subsequent fusion processing. This new graphic code image is called a graphic code standard image sample. This transformation can be, for example, changing the position, direction or shape of the graphic code on the image, etc., which can be implemented in some In the example, it is used to enrich or standardize the shape of the graphic code on the image.
在一个实施例中,该步骤S102可以包括:服务器根据图形码原始图像样本携带的图形码信息,生成图形码标准图像初始样本;服务器对图形码标准图像初始样本的图形码点进行形态学变换处理,得到图形码标准图像样本。In one embodiment, this step S102 may include: the server generates the initial sample of the standard image of the graphic code according to the graphic code information carried by the original image sample of the graphic code; the server performs morphological transformation processing on the graphic code points of the initial sample of the standard image of the graphic code , to obtain the standard image sample of the graphic code.
本实施例中,服务器可以先根据根据图形码原始图像样本携带的图形码信息生成相应的图形码标准图像初始样本,具体可先提取图形码原始图像样本携带的图形码信息(文字信息),然后通过如二维码等图形码的码制,将该文字信息变化为标准图形码图片信息,然后设定一个四边形区域对其进行仿射变换,从而即可得到图形码标准图像初始样本。In this embodiment, the server can first generate a corresponding initial sample of a standard image of a graphic code according to the graphic code information carried by the original image sample of the graphic code. Specifically, the graphic code information (text information) carried by the original image sample of the graphic code can be extracted first, and then Through the code system of graphic codes such as two-dimensional codes, the text information is changed into standard graphic code picture information, and then a quadrilateral area is set to perform affine transformation on it, so as to obtain the initial sample of the standard image of the graphic code.
在此基础上,为丰富图形码的形态以使模型适应更多样和多变的应用场景,服务器进一步对图形码标准图像初始样本的图形码点进行形态学变换处理,得到图形码标准图像样本,该形态学变换处理至少包括膨胀、腐蚀或者随机噪声的其中之一。具体的,可设定概率P对图形码标准图像初始样本中的图形码点的形状进行随机形态学变换(膨胀、腐蚀、随机噪声等),得到图形码标准图像样本。On this basis, in order to enrich the shape of the graphic code so that the model can adapt to more diverse and changeable application scenarios, the server further performs morphological transformation processing on the graphic code points of the initial sample of the standard image of the graphic code to obtain the standard image sample of the graphic code , the morphological transformation process includes at least one of dilation, erosion or random noise. Specifically, the probability P can be set to perform random morphological transformation (expansion, erosion, random noise, etc.) on the shape of the graphic code points in the initial sample of the graphic code standard image to obtain the standard image sample of the graphic code.
步骤S103,服务器基于图形码标准图像样本与材质背景图像样本的融合,得到增广图像样本;该增广图像样本表征图形码标准图像样本与材质背景图像样本融合得到的图像样本。Step S103, the server obtains an augmented image sample based on the fusion of the standard image sample of the graphic code and the background image sample of the material; the augmented image sample represents an image sample obtained by fusing the standard image sample of the graphic code and the background image sample of the material.
本步骤中,服务器可以将材质背景图像样本作为图形码标准图像样本的背景,将图形码标准图像样本融合到材质背景图像样本中,得到增广图像样本。在具体应用中,材质背景图像样本的数量可以是多个,对此,在一个实施例中,步骤S103可以包括:In this step, the server may use the material background image sample as the background of the graphic code standard image sample, and fuse the graphic code standard image sample into the material background image sample to obtain an augmented image sample. In a specific application, the number of material background image samples may be multiple, and for this, in one embodiment, step S103 may include:
服务器将图形码标准图像样本与多个材质背景图像样本进行对比度保留融合,得到增广图像初始样本;服务器根据增广图像初始样本与图形码原始图像样本的语义距离,对增广图像初始样本进行筛选,得到增广图像样本。The server performs contrast-preserving fusion of the graphic code standard image sample and multiple material background image samples to obtain the initial sample of the augmented image; the server performs an initial augmented image sample according to the semantic distance between the initial sample of the augmented image and the original image sample of the graphic code. Filter to obtain augmented image samples.
其中,对比度保留融合(histogram preserving blending),是通过计算图片色彩分布对两张图片进行对比度保留融合的算法。本实施例中,服务器将图形码标准图像样本与多个材质背景图像样本进行对 比度保留融合,可以包括将图形码标准图像样本分别与每一材质背景图像样本进行对比度保留融合,还可以包括将图形码标准图像样本同时与两个或以上的材质背景图像样本进行对比度保留融合并进行分别与不同材质背景组合(即两个或以上的材质背景图像样本的组合)的多次融合,从而以丰富样本形态,得到增广图像初始样本,该增广图像初始样本的数量也是多个。Among them, the contrast preserving fusion (histogram preserving blending) is an algorithm for performing contrast preserving fusion on two pictures by calculating the color distribution of the pictures. In this embodiment, the server performs contrast-preserving fusion of the graphic code standard image sample and multiple material background image samples, which may include performing contrast-preserving fusion of the graphic code standard image sample with each material background image sample, and may also include graphic Contrast-preserving fusion of code standard image samples with two or more material background image samples at the same time, and multiple fusions with different material background combinations (that is, the combination of two or more material background image samples), so as to enrich the samples form to obtain an initial sample of the augmented image, and the number of initial samples of the augmented image is also multiple.
接着服务器需要从增广图像初始样本中筛选符合条件的增广图像初始样本,作为增广图像样本。本实施例服务器可根据所获得的增广图像初始样本(I_AUG)与图形码原始图像样本(I_DM)的语义距离(D(I_AUG)-D(I_DM))进行筛选,示例性的,若语义距离低于或等于语义距离阈值,则服务器可将该增广图像初始样本筛选为增广图像样本。Next, the server needs to select qualified augmented image initial samples from the augmented image initial samples as augmented image samples. The server in this embodiment can filter according to the semantic distance (D(I_AUG)-D(I_DM)) between the obtained augmented image initial sample (I_AUG) and the graphic code original image sample (I_DM). Exemplarily, if the semantic distance is lower than or equal to the semantic distance threshold, the server can filter the initial sample of the augmented image as the augmented image sample.
步骤S104,服务器利用增广图像样本、图形码原始图像样本以及图形码标准图像样本,构建图形码提取模型。In step S104, the server uses the augmented image sample, the original image sample of the graphic code, and the standard image sample of the graphic code to construct a graphic code extraction model.
本步骤中,对于图形码提取模型,可使用ImageNet预训练的ResNet34作为骨干网络,通过层间的跳跃连接(skip-connection)组成解码器。具体的,可将增广图像样本和图形码原始图像样本作为模型训练的输入数据,图形码标准图像样本作为模型训练的标签数据,利用该输入数据和标签数据构建图形码提取模型。其中,图形码标准图像样本主要是根据图形码原始图像样本携带的图形码信息生成的,在如上部分实施例中或被称为图形码标准图像初始样本,即未经过形态学变换的图形码标准图像样本。In this step, for the image code extraction model, ImageNet pre-trained ResNet34 can be used as the backbone network to form a decoder through skip-connection between layers. Specifically, the augmented image sample and the original image sample of the graphic code can be used as input data for model training, and the standard image sample of graphic code can be used as label data for model training, and a graphic code extraction model can be constructed using the input data and label data. Wherein, the graphic code standard image sample is mainly generated according to the graphic code information carried by the graphic code original image sample, and may be referred to as the graphic code standard image initial sample in the above embodiments, that is, the graphic code standard without morphological transformation Image samples.
在一个实施例中,步骤S104具体包括:服务器将增广图像样本和图形码原始图像样本输入待训练的图形码提取模型,获取待训练的图形码提取模型针对增广图像样本和图形码原始图像样本输出的图形码提取结果样本;服务器利用图形码提取结果样本和图形码标准图像样本进行损失函数计算,得到损失计算结果;服务器利用损失计算结果对待训练的图形码提取模型进行训练,构建得到图形码提取模型。In one embodiment, step S104 specifically includes: the server inputs the augmented image sample and the original image sample of the graphic code into the graphic code extraction model to be trained, and obtains the image code extraction model to be trained for the augmented image sample and the original image of the graphic code The sample output graphic code extraction result sample; the server uses the graphic code extraction result sample and the graphic code standard image sample to perform loss function calculation to obtain the loss calculation result; the server uses the loss calculation result to train the graphic code extraction model to be trained, and constructs the obtained graphic code extraction model.
本实施例的训练过程中,作为模型训练的输入数据的增广图像样本和图形码原始图像样本将被输入到待训练的图形码提取模型中,待训练的图形码提取模型针对该增广图像样本和图形码原始图像样本输出相应的图形码提取结果样本。作为模型训练的标签数据的图形码标准图像样本将用于与该图形码提取结果样本进行损失函数计算,得到损失计算结果或称为损失函数计算结果。然后该损失计算结果可被用以调整待训练的图形码提取模型的模型网络参数,从而对该待训练的图形码提取模型进行训练,构建得到图形码提取模型。In the training process of this embodiment, the augmented image sample and the original image sample of the graphic code as the input data for model training will be input into the graphic code extraction model to be trained, and the graphic code extraction model to be trained is aimed at the augmented image Samples and graphic codes The original image samples output corresponding graphic code extraction result samples. The graphic code standard image sample used as the label data for model training will be used to perform loss function calculation with the graphic code extraction result sample to obtain the loss calculation result or called the loss function calculation result. Then the loss calculation result can be used to adjust the model network parameters of the graphic code extraction model to be trained, so as to train the graphic code extraction model to be trained, and construct the graphic code extraction model.
在具体的应用当中,服务器将增广图像样本和图形码原始图像样本输入到待训练的图形码提取模型后,可将图形码提取模型输出的图形码提取结果样本中的图形码部分与图形码标准图像样本中的图形码部分行损失函数计算,并对图形码静区(quiet zone)部分添加损失权重,经过一定迭代后构建得到图形码 提取模型。例如对于二维码而言,图形码静区(quiet zone)可以是二维码外侧的空白边框,用来保证扫描设备正确识别该二维码,如果没有这个边框,二维码阅读器会因为外界因素的干扰而无法确定二维码包含和不包含的内容。对于条形码而言,图形码静区(quiet zone)可以是位于条形代码某一边的空白边界,用来保证扫描设备正确识别条码的结束标记,避免获取与该条形代码无关的信息。In a specific application, after the server inputs the augmented image sample and the original image sample of the graphic code to the graphic code extraction model to be trained, the graphic code part in the graphic code extraction result sample output by the graphic code extraction model and the graphic code The graphic code part in the standard image sample is calculated by the loss function, and the loss weight is added to the graphic code quiet zone (quiet zone), and the graphic code extraction model is constructed after a certain iteration. For example, for a QR code, the graphic code quiet zone (quiet zone) can be a blank frame outside the QR code to ensure that the scanning device correctly recognizes the QR code. If there is no such frame, the QR code reader will be Due to the interference of external factors, it is impossible to determine what the QR code contains and does not contain. For barcodes, the graphic code quiet zone (quiet zone) can be a blank boundary located on one side of the barcode, which is used to ensure that the scanning device correctly recognizes the end mark of the barcode, and avoids obtaining information irrelevant to the barcode.
上述构建图形码提取模型的方法,服务器获取图形码原始图像样本和材质背景图像样本,接着服务器根据图形码原始图像样本得到对应的图形码标准图像样本,然后服务器基于图形码标准图像样本与材质背景图像样本的融合得到增广图像样本,利用增广图像样本和图形码原始图像样本以及图形码标准图像样本,构建图形码提取模型。该方案能够在模型训练阶段将标准图形码与各种材质背景进行融合,从而形成材质背景风格多样的增广图像样本,将材质背景风格多样的增广图像样本、图形码原始图像样本和图形码标准图像样本一并作为模型训练数据进行模型训练,能够构建得到适应各类应用场景的图形码提取模型,提高模型对图形码识别的准确性。In the above method of constructing a graphic code extraction model, the server obtains the original image sample of the graphic code and the material background image sample, and then the server obtains the corresponding standard image sample of the graphic code according to the original image sample of the graphic code, and then the server obtains the corresponding standard image sample of the graphic code based on the standard image sample of the graphic code and the material background image sample. The image samples are fused to obtain augmented image samples, and the image code extraction model is constructed by using the augmented image samples, the original image samples of the graphic code and the standard image samples of the graphic code. This solution can integrate standard graphic codes with various material backgrounds in the model training stage to form augmented image samples with various material background styles, and combine augmented image samples with various material background styles, original image samples of graphic codes, and graphic codes Standard image samples are also used as model training data for model training, which can construct graphic code extraction models suitable for various application scenarios, and improve the accuracy of the model for graphic code recognition.
在一个实施例中,如图2所示,提供了一种图形码识别方法,以该方法应用于终端为例进行说明,可以理解的,当该方法应用于服务器时对应步骤的执行主体便变更为服务器。该方法可以包括以下步骤:In one embodiment, as shown in FIG. 2 , a pattern code recognition method is provided, and the method is applied to a terminal as an example for illustration. It can be understood that when the method is applied to a server, the subject of execution of the corresponding steps will be changed. for the server. The method may include the steps of:
步骤S201,终端获取根据如上实施例所述的方法构建得到的图形码提取模型;Step S201, the terminal obtains the graphic code extraction model constructed according to the method described in the above embodiment;
步骤S202,终端将待识别图形码图像输入至图形码提取模型;Step S202, the terminal inputs the graphic code image to be recognized into the graphic code extraction model;
本步骤中,获取待识别图形码图像后,可先将该待识别图形码图像缩放至设定尺度空间,还可以进行基础的预处理,如灰度化、锐化和去噪等一系列的预处理操作,之后再输入到图形码提取模型中。In this step, after obtaining the image of the graphic code to be recognized, the image of the graphic code to be recognized can be scaled to the set scale space, and basic preprocessing can also be performed, such as a series of grayscale, sharpening, and denoising. Preprocessing operations before input into the pattern code extraction model.
步骤S203,终端根据图形码提取模型针对待识别图形码图像输出的图形码识别结果,得到待识别图形码图像中的图形码候选区域。Step S203, the terminal obtains the graphic code candidate area in the graphic code image to be recognized according to the graphic code recognition result output by the graphic code extraction model for the graphic code image to be recognized.
本步骤主要是由图形码提取模型对待识别图形码图像中的图形码所在区域进行粗定位。其中,待识别图形码图像输入到图形码提取模型后,图形码提取模型将输出相应的图形码识别结果,从而终端根据该图形码识别结果得到待识别图形码图像中的图形码候选区域,即将图形码提取模型在待识别图形码图像上定位到的图形码所在区域作为图形码候选区域。This step mainly uses the graphic code extraction model to roughly locate the area where the graphic code in the image of the graphic code to be recognized is located. Among them, after the graphic code image to be recognized is input to the graphic code extraction model, the graphic code extraction model will output the corresponding graphic code recognition result, so that the terminal can obtain the graphic code candidate area in the graphic code image to be recognized according to the graphic code recognition result, which is about to The region where the pattern code is located by the pattern code extraction model on the pattern code image to be recognized is used as the pattern code candidate region.
步骤S204,终端对图形码候选区域进行图形码边缘拟合处理,确定待识别图形码图像中的图形码区域。Step S204, the terminal performs graphic code edge fitting processing on the graphic code candidate area, and determines the graphic code area in the graphic code image to be recognized.
本步骤是在图形码提取模型粗定位的基础上,对图形码候选区域进行边缘拟合处理以精确定位出待识别图形码图像中的图形码区域。In this step, on the basis of rough positioning of the graphic code extraction model, an edge fitting process is performed on the graphic code candidate area to accurately locate the graphic code area in the graphic code image to be recognized.
在一个实施例中,步骤S204具体包括:终端提取图形码候选区域的至少一层外层边缘点,得到外层边缘点集;之后终端对外层边缘点集进行稳健回归拟合,得到待识别图形码图像中的图形码区域边缘拟合 结果;之后终端根据图形码区域边缘拟合结果,确定待识别图形码图像中的图形码区域。In one embodiment, step S204 specifically includes: the terminal extracts at least one layer of outer edge points of the graphic code candidate area to obtain the outer edge point set; then the terminal performs robust regression fitting on the outer edge point set to obtain the pattern to be recognized The edge fitting result of the graphic code area in the code image; then the terminal determines the graphic code area in the graphic code image to be recognized according to the edge fitting result of the graphic code area.
本实施例主要是从图形码提取模型粗定位的图形码候选区域抽取至少一层外层边缘点形成外层边缘点集,然后对外层边缘点集进行稳健回归拟合处理从而根据图形码区域边缘拟合结果确定图形码区域的边缘,根据该边缘精确定位到待识别图形码图像中的图形码区域。其中,稳健回归拟合是引用统计学稳健回归理论,如Theil-Sen估计完成对图形码区域的边的拟合。在具体应用中,对于外层边缘点的提取,可应用边缘提取算法,如canny算子对图形码候选区域进行边缘点提取,并自图形码候选区域外侧向图形码候选区域内提取如一层的边缘点(对应于外层边缘点),作为拟合图形码区域边界的外层边缘点集,然后可利用Theil-Sen估计对外层边缘点集进行拟合得到图形码区域边缘拟合结果,据此定位出待识别图形码图像中的图形码区域,定位出图形码区域后,可输出该图形码区域对应的图像数据给图形码解码模块,以供图形码解码模块完成解码处理。This embodiment is mainly to extract at least one layer of outer layer edge points from the graphic code candidate area roughly positioned by the graphic code extraction model to form an outer layer edge point set, and then perform a robust regression fitting process on the outer layer edge point set so that according to the graphic code area edge The fitting result determines the edge of the graphic code area, and precisely locates the graphic code area in the graphic code image to be recognized according to the edge. Among them, the robust regression fitting refers to the statistical robust regression theory, such as Theil-Sen estimation to complete the fitting of the edges of the graphic code area. In specific applications, for the extraction of outer layer edge points, an edge extraction algorithm can be applied, such as the canny operator to extract edge points from the graphic code candidate area, and extract such as a layer from the outside of the graphic code candidate area to the graphic code candidate area. Edge points (corresponding to the outer layer edge points), as the outer layer edge point set of the area boundary of the fitting graphic code, can then use Theil-Sen estimation to fit the outer layer edge point set to obtain the graphic code area edge fitting result, according to This locates the graphic code area in the graphic code image to be recognized. After the graphic code area is located, the image data corresponding to the graphic code area can be output to the graphic code decoding module for the graphic code decoding module to complete the decoding process.
上述图形码识别方法,在模型粗定位的基础上运用边缘提取和稳健回归的统计学方法,实现对图形码候选区域粗定位的边缘高精度优化,提高图形码识别准确性,且能够适应不断变化的应用场景,具有较强的鲁棒性,有利于提升如二维码(QR、DM码)等图形码的可读性及解码率。The above pattern code recognition method, based on the rough positioning of the model, uses the statistical method of edge extraction and robust regression to realize the high-precision optimization of the edge of the rough positioning of the pattern code candidate area, improve the accuracy of pattern code recognition, and can adapt to continuous changes It has strong robustness and is conducive to improving the readability and decoding rate of graphic codes such as two-dimensional codes (QR, DM codes).
应该理解的是,虽然如上流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the above flow chart are displayed in sequence according to the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the above flowchart may include multiple steps or multiple stages, these steps or stages are not necessarily executed at the same time, but may be executed at different times, the execution order of these steps or stages It does not necessarily have to be performed sequentially, but can be performed alternately or alternately with other steps or at least a part of steps or stages in other steps.
在一个实施例中,如图3所示,提供了一种构建图形码提取模型的装置,该装置300可应用于服务器。该装置300可以包括:In one embodiment, as shown in FIG. 3 , a device for constructing a graphic code extraction model is provided, and the device 300 can be applied to a server. The device 300 may include:
样本获取模块301,被配置为执行获取图形码原始图像样本和材质背景图像样本;The sample acquisition module 301 is configured to perform acquisition of graphic code original image samples and material background image samples;
样本生成模块302,被配置为执行根据所述图形码原始图像样本,得到对应的图形码标准图像样本;The sample generating module 302 is configured to obtain a corresponding standard image sample of the graphic code according to the original image sample of the graphic code;
样本融合模块303,被配置为执行基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本;The sample fusion module 303 is configured to perform fusion based on the graphic code standard image sample and the material background image sample to obtain an augmented image sample;
模型构建模块304,被配置为执行利用所述增广图像样本和图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型。The model building module 304 is configured to execute using the augmented image sample, the original image sample of the graphic code and the standard image sample of the graphic code to construct a graphic code extraction model.
在一个实施例中,样本生成模块302,被配置为执行根据所述图形码原始图像样本携带的图形码信 息,生成图形码标准图像初始样本;对所述图形码标准图像初始样本的图形码点进行形态学变换处理,得到所述图形码标准图像样本;所述形态学变换处理至少包括膨胀、腐蚀或者随机噪声的其中之一。In one embodiment, the sample generating module 302 is configured to generate an initial sample of a standard image of a graphic code according to the graphic code information carried by the original image sample of the graphic code; Performing morphological transformation processing to obtain the standard image sample of the graphic code; the morphological transformation processing includes at least one of expansion, erosion or random noise.
在一个实施例中,所述材质背景图像样本的数量为多个;样本融合模块303,被配置为执行将所述图形码标准图像样本与多个材质背景图像样本进行对比度保留融合,得到增广图像初始样本;根据所述增广图像初始样本与所述图形码原始图像样本的语义距离,对所述增广图像初始样本进行筛选,得到所述增广图像样本。In one embodiment, the number of material background image samples is multiple; the sample fusion module 303 is configured to perform contrast-preserving fusion of the graphic code standard image sample and multiple material background image samples to obtain an augmented An initial sample of the image: according to the semantic distance between the initial sample of the augmented image and the original image sample of the graphic code, the initial sample of the augmented image is screened to obtain the sample of the augmented image.
在一个实施例中,模型构建模块304,被配置为执行将所述增广图像样本和图形码原始图像样本输入待训练的图形码提取模型,获取所述待训练的图形码提取模型针对所述增广图像样本和图形码原始图像样本输出的图形码提取结果样本;利用所述图形码提取结果样本和图形码标准图像样本进行损失函数计算,得到损失计算结果;利用所述损失计算结果对所述待训练的图形码提取模型进行训练,构建得到所述图形码提取模型。In one embodiment, the model building module 304 is configured to input the augmented image sample and the original image sample of the graphic code into the graphic code extraction model to be trained, and obtain the graphic code extraction model to be trained for the The graphic code extraction result sample output by the augmented image sample and the original image sample of the graphic code; use the graphic code extraction result sample and the graphic code standard image sample to perform loss function calculation to obtain the loss calculation result; use the loss calculation result to calculate the The graphic code extraction model to be trained is trained, and the graphic code extraction model is constructed.
在一个实施例中,如图4所示,提供了一种图形码识别装置,该装置400可应用于终端。该装置400可以包括:In one embodiment, as shown in FIG. 4 , a pattern code recognition device is provided, and the device 400 can be applied to a terminal. The device 400 may include:
模型获取模块401,被配置为执行获取根据如上所述的方法构建得到的图形码提取模型;The model acquisition module 401 is configured to perform acquisition of the graphic code extraction model constructed according to the method described above;
图像输入模块402,被配置为执行将待识别图形码图像输入至所述图形码提取模型;The image input module 402 is configured to input the graphic code image to be recognized into the graphic code extraction model;
粗定位模块403,被配置为执行根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码图像中的图形码候选区域;The coarse positioning module 403 is configured to execute the pattern code recognition result output for the pattern code image to be recognized according to the pattern code extraction model, and obtain the pattern code candidate area in the pattern code image to be recognized;
精定位模块404,被配置为执行对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。The fine positioning module 404 is configured to perform pattern code edge fitting processing on the pattern code candidate region, and determine the pattern code region in the pattern code image to be recognized.
在一个实施例中,精定位模块404,被配置为执行提取所述图形码候选区域的至少一层外层边缘点,得到外层边缘点集;对所述外层边缘点集进行稳健回归拟合,得到所述待识别图形码图像中的图形码区域边缘拟合结果;根据所述图形码区域边缘拟合结果,确定所述待识别图形码图像中的图形码区域。In one embodiment, the fine positioning module 404 is configured to extract at least one layer of outer edge points of the graphic code candidate area to obtain an outer edge point set; perform robust regression simulation on the outer edge point set According to the edge fitting result of the pattern code region, the pattern code region in the pattern code image to be recognized is determined.
关于构建图形码提取模型的装置和图形码识别装置的具体限定可以分别参见上文中对于构建图形码提取模型的方法和图形码识别方法的限定,在此不再赘述。上述构建图形码提取模型的装置和图形码识别装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitations of the device for constructing the pattern code extraction model and the pattern code recognition device, please refer to the limitations of the method for constructing the pattern code extraction model and the pattern code recognition method above respectively, and will not repeat them here. Each module in the above-mentioned device for constructing a pattern code extraction model and the pattern code recognition device can be fully or partially realized by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图5所 示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储图像样本数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种构建图形码提取模型的方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure may be shown in FIG. 5 . The computer device includes a processor, memory and a network interface connected by a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs and databases. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store image sample data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for constructing a pattern code extraction model is realized.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图6所示。该计算机设备包括通过系统总线连接的处理器、存储器、通信接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、运营商网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种图形码识别方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure may be as shown in FIG. 6 . The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, an operator network, NFC (Near Field Communication) or other technologies. When the computer program is executed by the processor, a pattern code recognition method is realized. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the casing of the computer device , and can also be an external keyboard, touchpad, or mouse.
本领域技术人员可以理解,图5和6中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structures shown in Figures 5 and 6 are only block diagrams of partial structures related to the solution of this application, and do not constitute a limitation to the computer equipment on which the solution of this application is applied. The specific computer Devices may include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
在一个实施例中,还提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。In one embodiment, there is also provided a computer device, including a memory and a processor, where a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the foregoing method embodiments are implemented.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic  Random Access Memory,DRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the computer programs can be stored in a non-volatile computer-readable memory In the medium, when the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, any references to memory, storage, database or other media used in the various embodiments provided in the present application may include at least one of non-volatile memory and volatile memory. Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
基于此,在一个实施例中,提供一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现步骤:获取图形码原始图像样本和材质背景图像样本;根据所述图形码原始图像样本,得到对应的图形码标准图像样本;基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本;利用所述增广图像样本、所述图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型。Based on this, in one embodiment, a kind of computer program product is provided, comprises computer program, and when this computer program is executed by processor, realizes the step: acquire graphic code original image sample and material background image sample; According to described graphic code original image sample, to obtain the corresponding graphic code standard image sample; based on the fusion of the graphic code standard image sample and the material background image sample, an augmented image sample is obtained; using the augmented image sample, the graphic code original image sample As well as the standard image samples of the graphic code, a graphic code extraction model is constructed.
在另一个实施例中,提供一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现步骤:获取根据如上所述的方法构建得到的图形码提取模型;将待识别图形码图像输入至所述图形码提取模型;根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码图像中的图形码候选区域;对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。In another embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps of: obtaining the graphic code extraction model constructed according to the above-mentioned method; Input to the pattern code extraction model; according to the pattern code recognition result output by the pattern code extraction model for the pattern code image to be recognized, obtain the pattern code candidate area in the pattern code image to be recognized; for the pattern The code candidate area is subjected to graphic code edge fitting processing to determine the graphic code area in the graphic code image to be recognized.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several implementation modes of the present application, and the description thereof is relatively specific and detailed, but it should not be construed as limiting the scope of the patent for the invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the scope of protection of the patent application should be based on the appended claims.

Claims (20)

  1. 一种构建图形码提取模型的方法,其特征在于,包括:A method for constructing a pattern code extraction model, characterized in that it comprises:
    获取图形码原始图像样本和材质背景图像样本;Obtain the original image sample of the graphics code and the material background image sample;
    根据所述图形码原始图像样本,得到对应的图形码标准图像样本;Obtaining a corresponding standard image sample of the graphic code according to the original image sample of the graphic code;
    基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本;Obtaining an augmented image sample based on the fusion of the graphic code standard image sample and the material background image sample;
    利用所述增广图像样本、所述图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型。A graphic code extraction model is constructed by using the augmented image sample, the original image sample of the graphic code and the standard image sample of the graphic code.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述图形码原始图像样本,得到对应的图形码标准图像样本,包括:The method according to claim 1, wherein said obtaining a corresponding graphic code standard image sample according to said graphic code original image sample comprises:
    根据所述图形码原始图像样本携带的图形码信息,生成图形码标准图像初始样本;Generate an initial sample of a standard image of a graphic code according to the graphic code information carried by the original image sample of the graphic code;
    对所述图形码标准图像初始样本的图形码点进行形态学变换处理,得到对应的图形码标准图像样本;其中,所述形态学变换处理至少包括膨胀、腐蚀和随机噪声其中之一。Performing morphological transformation processing on the graphic code points of the initial sample of the standard graphic code image to obtain the corresponding standard image sample of the graphic code; wherein, the morphological transformation process includes at least one of expansion, erosion and random noise.
  3. 根据权利要求1所述的方法,其特征在于,所述材质背景图像样本的数量为多个;所述基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本,包括:The method according to claim 1, wherein the quantity of the material background image samples is multiple; the fusion of the standard image samples based on the graphic code and the material background image samples obtains the augmented image samples ,include:
    将所述图形码标准图像样本与多个所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本;Contrast-preserving fusion of the graphic code standard image sample and a plurality of the material background image samples to obtain an initial sample of the augmented image;
    根据所述增广图像初始样本与所述图形码原始图像样本的语义距离,对所述增广图像初始样本进行筛选,得到增广图像样本。According to the semantic distance between the initial sample of the augmented image and the original image sample of the graphic code, the initial sample of the augmented image is screened to obtain the augmented image sample.
  4. 根据权利要求3所述的方法,其特征在于,所述将所述图形码标准图像样本与多个所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本,包括:The method according to claim 3, wherein said performing contrast-preserving fusion of said graphic code standard image sample and a plurality of said material background image samples to obtain an initial sample of an augmented image, comprising:
    将所述图形码标准图像样本分别与每一所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本。Contrast-preserving fusion is performed on the standard image sample of the graphic code and each of the material background image samples to obtain an initial sample of the augmented image.
  5. 根据权利要求3所述的方法,其特征在于,所述将所述图形码标准图像样本与多个所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本,包括:The method according to claim 3, wherein said performing contrast-preserving fusion of said graphic code standard image sample and a plurality of said material background image samples to obtain an initial sample of an augmented image, comprising:
    将所述图形码标准图像样本分别与不同材质背景组合的多次融合,得到多个增广图像初始样本;其中,每个所述材质背景组合中包括两个或以上的所述材质背景图像样本。Multiple fusions of the graphic code standard image samples with different material background combinations respectively, to obtain a plurality of augmented image initial samples; wherein, each of the material background combinations includes two or more material background image samples .
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述利用所述增广图像样本、所述图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型,包括:The method according to any one of claims 1 to 5, wherein said use of said augmented image sample, said graphic code original image sample and said graphic code standard image sample to construct a graphic code extraction model, include:
    将所述增广图像样本和所述图形码原始图像样本输入待训练的图形码提取模型;Inputting the augmented image sample and the original image sample of the graphic code into the graphic code extraction model to be trained;
    获取所述待训练的图形码提取模型针对所述增广图像样本和所述图形码原始图像样本输出的图形码提取结果样本;Obtaining a graphic code extraction result sample output by the graphic code extraction model to be trained for the augmented image sample and the graphic code original image sample;
    利用所述图形码提取结果样本和所述图形码标准图像样本进行损失函数计算,得到损失计算结果;Using the graphic code extraction result samples and the graphic code standard image samples to perform loss function calculations to obtain loss calculation results;
    利用所述损失计算结果对所述待训练的图形码提取模型进行训练,构建图形码提取模型。The graphic code extraction model to be trained is trained by using the loss calculation result to construct a graphic code extraction model.
  7. 一种图形码识别方法,其特征在于,包括:A pattern code recognition method, characterized in that, comprising:
    获取根据如权利要求1至6任一项所述的方法构建的图形码提取模型;Obtaining a graphic code extraction model constructed according to the method according to any one of claims 1 to 6;
    将待识别图形码图像输入至所述图形码提取模型;Inputting the pattern code image to be recognized into the pattern code extraction model;
    根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码图像中的图形码候选区域;According to the pattern code recognition result output by the pattern code extraction model for the pattern code image to be recognized, the pattern code candidate area in the pattern code image to be recognized is obtained;
    对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。Perform graphic code edge fitting processing on the graphic code candidate area to determine the graphic code area in the graphic code image to be recognized.
  8. 根据权利要求7所述的方法,其特征在于,所述对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域,包括:The method according to claim 7, wherein said performing graphic code edge fitting processing on said graphic code candidate area, and determining the graphic code area in said graphic code image to be recognized comprises:
    提取所述图形码候选区域的至少一层外层边缘点,得到外层边缘点集;Extracting at least one layer of outer layer edge points of the graphic code candidate area to obtain an outer layer edge point set;
    对所述外层边缘点集进行稳健回归拟合,得到所述待识别图形码图像中的图形码区域边缘拟合结果;performing robust regression fitting on the outer layer edge point set to obtain an edge fitting result of the graphic code region in the graphic code image to be recognized;
    根据所述图形码区域边缘拟合结果,确定所述待识别图形码图像中的图形码区域。According to the edge fitting result of the pattern code region, the pattern code region in the pattern code image to be recognized is determined.
  9. 根据权利要求8所述的方法,其特征在于,所述提取所述图形码候选区域的至少一层外层边缘点,得到外层边缘点集,包括:The method according to claim 8, wherein said extracting at least one layer of outer layer edge points of said graphic code candidate area to obtain an outer layer edge point set comprises:
    应用边缘提取算法对所述图形码候选区域进行边缘点提取;Applying an edge extraction algorithm to extract edge points from the graphic code candidate area;
    自所述图形码候选区域外侧向所述图形码候选区域内提取至少一层的边缘点,作为外层边缘点集。Extracting at least one layer of edge points from the outside of the pattern code candidate region to the interior of the pattern code candidate region as an outer layer edge point set.
  10. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method according to claim 7, wherein the method further comprises:
    在定位出所述图形码区域后,输出所述图形码区域对应的图像数据给图形码解码模块,以供所述图形码解码模块完成解码处理。After the graphic code area is located, the image data corresponding to the graphic code area is output to the graphic code decoding module, so that the graphic code decoding module can complete the decoding process.
  11. 一种构建图形码提取模型的装置,其特征在于,包括:A device for constructing a graphic code extraction model, characterized in that it comprises:
    样本获取模块,被配置为执行获取图形码原始图像样本和材质背景图像样本;The sample acquisition module is configured to perform acquisition of graphic code original image samples and material background image samples;
    样本生成模块,被配置为执行根据所述图形码原始图像样本,得到对应的图形码标准图像样本;The sample generation module is configured to obtain a corresponding standard image sample of the graphic code according to the original image sample of the graphic code;
    样本融合模块,被配置为执行基于所述图形码标准图像样本与所述材质背景图像样本的融合,得到增广图像样本;The sample fusion module is configured to perform fusion based on the graphic code standard image sample and the material background image sample to obtain an augmented image sample;
    模型构建模块,被配置为执行利用所述增广图像样本、所述图形码原始图像样本以及所述图形码标准图像样本,构建图形码提取模型。A model building module configured to construct a graphic code extraction model by using the augmented image samples, the original image samples of the graphic code, and the standard image samples of the graphic code.
  12. 根据权利要求11所述的装置,其特征在于,所述样本生成模块,被配置为执行:The device according to claim 11, wherein the sample generation module is configured to execute:
    根据所述图形码原始图像样本携带的图形码信息,生成图形码标准图像初始样本;以及,Generate an initial sample of a standard image of a graphic code according to the graphic code information carried by the original image sample of the graphic code; and,
    对所述图形码标准图像初始样本的图形码点进行形态学变换处理,得到对应的图形码标准图像样本;其中,所述形态学变换处理至少包括膨胀、腐蚀和随机噪声其中之一。Performing morphological transformation processing on the graphic code points of the initial sample of the standard graphic code image to obtain the corresponding standard image sample of the graphic code; wherein, the morphological transformation process includes at least one of expansion, erosion and random noise.
  13. 根据权利要求11所述的装置,其特征在于,所述材质背景图像样本的数量为多个;所述样本融合模块,被配置为执行:The device according to claim 11, wherein the quantity of the material background image samples is multiple; the sample fusion module is configured to execute:
    将所述图形码标准图像样本与多个所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本;以及,Contrast-preserving fusion of the graphic code standard image sample and a plurality of the material background image samples to obtain an initial sample of the augmented image; and,
    根据所述增广图像初始样本与所述图形码原始图像样本的语义距离,对所述增广图像初始样本进行筛选,得到增广图像样本。According to the semantic distance between the initial sample of the augmented image and the original image sample of the graphic code, the initial sample of the augmented image is screened to obtain the augmented image sample.
  14. 根据权利要求13所述的装置,其特征在于,其特征在于,所述样本融合模块,被配置为执行:The device according to claim 13, characterized in that, the sample fusion module is configured to execute:
    将所述图形码标准图像样本分别与每一所述材质背景图像样本进行对比度保留融合,得到增广图像初始样本。Contrast-preserving fusion is performed on the standard image sample of the graphic code and each of the material background image samples to obtain an initial sample of the augmented image.
  15. 一种图形码识别装置,其特征在于,包括:A graphic code recognition device is characterized in that it comprises:
    模型获取模块,被配置为执行获取根据如权利要求1至6任一项所述的方法构建的图形码提取模型;A model acquisition module configured to perform acquisition according to the graphic code extraction model constructed by the method according to any one of claims 1 to 6;
    图像输入模块,被配置为执行将待识别图形码图像输入至所述图形码提取模型;An image input module configured to input the graphic code image to be recognized into the graphic code extraction model;
    粗定位模块,被配置为执行根据所述图形码提取模型针对所述待识别图形码图像输出的图形码识别结果,得到所述待识别图形码图像中的图形码候选区域;The coarse positioning module is configured to execute the pattern code recognition result output for the pattern code image to be recognized according to the pattern code extraction model, and obtain the pattern code candidate area in the pattern code image to be recognized;
    精定位模块,被配置为执行对所述图形码候选区域进行图形码边缘拟合处理,确定所述待识别图形码图像中的图形码区域。The fine positioning module is configured to perform graphic code edge fitting processing on the graphic code candidate area, and determine the graphic code area in the graphic code image to be recognized.
  16. 根据权利要求15所述的装置,其特征在于,所述精定位模块,被配置为执行:The device according to claim 15, wherein the fine positioning module is configured to perform:
    提取所述图形码候选区域的至少一层外层边缘点,得到外层边缘点集;Extracting at least one layer of outer layer edge points of the graphic code candidate area to obtain an outer layer edge point set;
    对所述外层边缘点集进行稳健回归拟合,得到所述待识别图形码图像中的图形码区域边缘拟合结果;以及,performing robust regression fitting on the outer edge point set to obtain an edge fitting result of the graphic code region in the graphic code image to be recognized; and,
    根据所述图形码区域边缘拟合结果,确定所述待识别图形码图像中的图形码区域。According to the edge fitting result of the pattern code region, the pattern code region in the pattern code image to be recognized is determined.
  17. 根据权利要求16所述的装置,其特征在于,其中,所述精定位模块,被配置为执行:The device according to claim 16, wherein the fine positioning module is configured to perform:
    应用边缘提取算法对所述图形码候选区域进行边缘点提取;以及,Applying an edge extraction algorithm to extract edge points from the graphic code candidate area; and,
    自所述图形码候选区域外侧向所述图形码候选区域内提取至少一层的边缘点,作为外层边缘点集。Extracting at least one layer of edge points from the outside of the pattern code candidate region to the interior of the pattern code candidate region as an outer layer edge point set.
  18. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至10中任一项所述的方法的步骤。A computer device, comprising a memory and a processor, the memory stores a computer program, wherein the processor implements the steps of the method according to any one of claims 1 to 10 when executing the computer program.
  19. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至10中任一项所述的方法的步骤。A computer-readable storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are realized.
  20. 一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至10中任一项所述的方法的步骤。A computer program product, comprising a computer program, characterized in that, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
PCT/CN2022/104857 2021-07-12 2022-07-11 Construction method and apparatus for graphic code extraction model, identification method and apparatus, and device and medium WO2023284670A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110785353.7A CN113468906B (en) 2021-07-12 2021-07-12 Graphic code extraction model construction method, identification device, equipment and medium
CN202110785353.7 2021-07-12

Publications (1)

Publication Number Publication Date
WO2023284670A1 true WO2023284670A1 (en) 2023-01-19

Family

ID=77879841

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/104857 WO2023284670A1 (en) 2021-07-12 2022-07-11 Construction method and apparatus for graphic code extraction model, identification method and apparatus, and device and medium

Country Status (2)

Country Link
CN (1) CN113468906B (en)
WO (1) WO2023284670A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113468906B (en) * 2021-07-12 2024-03-26 深圳思谋信息科技有限公司 Graphic code extraction model construction method, identification device, equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103955663A (en) * 2014-04-22 2014-07-30 广州宽度信息技术有限公司 QR code fouling resistance identification method
CN109344904A (en) * 2018-10-16 2019-02-15 杭州睿琪软件有限公司 Generate method, system and the storage medium of training sample
CN109858488A (en) * 2018-12-28 2019-06-07 众安信息技术服务有限公司 A kind of handwriting samples recognition methods and system based on sample enhancing
CN110070130A (en) * 2019-04-23 2019-07-30 杭州智趣智能信息技术有限公司 A kind of certificate information recognition methods, transposition, equipment and medium
CN111275080A (en) * 2020-01-14 2020-06-12 腾讯科技(深圳)有限公司 Artificial intelligence-based image classification model training method, classification method and device
CN113468906A (en) * 2021-07-12 2021-10-01 深圳思谋信息科技有限公司 Graphic code extraction model construction method, recognition method, device, equipment and medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10346721B2 (en) * 2017-11-01 2019-07-09 Salesforce.Com, Inc. Training a neural network using augmented training datasets
CN109325491B (en) * 2018-08-16 2023-01-03 腾讯科技(深圳)有限公司 Identification code identification method and device, computer equipment and storage medium
CN109145815B (en) * 2018-08-21 2022-05-03 深圳大学 SAR target recognition method and device, computer equipment and storage medium
CN109815765A (en) * 2019-01-21 2019-05-28 东南大学 A kind of method and device for extracting the business license information containing two dimensional code
CN110490193B (en) * 2019-07-24 2022-11-08 西安网算数据科技有限公司 Single character area detection method and bill content identification method
CN110619330A (en) * 2019-09-18 2019-12-27 上海眼控科技股份有限公司 Recognition model training method and device, computer equipment and recognition method
CN112016630B (en) * 2020-09-03 2024-03-19 平安科技(深圳)有限公司 Training method, device, equipment and storage medium based on image classification model
CN112232349B (en) * 2020-09-23 2023-11-03 成都佳华物链云科技有限公司 Model training method, image segmentation method and device
CN112990205B (en) * 2021-05-11 2021-11-02 创新奇智(北京)科技有限公司 Method and device for generating handwritten character sample, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103955663A (en) * 2014-04-22 2014-07-30 广州宽度信息技术有限公司 QR code fouling resistance identification method
CN109344904A (en) * 2018-10-16 2019-02-15 杭州睿琪软件有限公司 Generate method, system and the storage medium of training sample
CN109858488A (en) * 2018-12-28 2019-06-07 众安信息技术服务有限公司 A kind of handwriting samples recognition methods and system based on sample enhancing
CN110070130A (en) * 2019-04-23 2019-07-30 杭州智趣智能信息技术有限公司 A kind of certificate information recognition methods, transposition, equipment and medium
CN111275080A (en) * 2020-01-14 2020-06-12 腾讯科技(深圳)有限公司 Artificial intelligence-based image classification model training method, classification method and device
CN113468906A (en) * 2021-07-12 2021-10-01 深圳思谋信息科技有限公司 Graphic code extraction model construction method, recognition method, device, equipment and medium

Also Published As

Publication number Publication date
CN113468906B (en) 2024-03-26
CN113468906A (en) 2021-10-01

Similar Documents

Publication Publication Date Title
CN109961009B (en) Pedestrian detection method, system, device and storage medium based on deep learning
Lopes et al. A learned representation for scalable vector graphics
WO2022001623A1 (en) Image processing method and apparatus based on artificial intelligence, and device and storage medium
CN111615702B (en) Method, device and equipment for extracting structured data from image
US20110216976A1 (en) Updating Image Segmentation Following User Input
CN110222330B (en) Semantic recognition method and device, storage medium and computer equipment
CN103946865B (en) Method and apparatus for contributing to the text in detection image
CN111507285A (en) Face attribute recognition method and device, computer equipment and storage medium
Yang et al. Directional connectivity-based segmentation of medical images
WO2023284670A1 (en) Construction method and apparatus for graphic code extraction model, identification method and apparatus, and device and medium
JP7320570B2 (en) Method, apparatus, apparatus, medium and program for processing images
CN116610304B (en) Page code generation method, device, equipment and storage medium
CN113378852A (en) Key point detection method and device, electronic equipment and storage medium
CN116030466B (en) Image text information identification and processing method and device and computer equipment
US11763075B1 (en) Method and system of discovering templates for documents
CN115393376A (en) Medical image processing method, medical image processing device, computer equipment and storage medium
CN112395834B (en) Brain graph generation method, device and equipment based on picture input and storage medium
CN113128496B (en) Method, device and equipment for extracting structured data from image
Hu et al. Mathematical formula detection in document images: A new dataset and a new approach
CN113936187A (en) Text image synthesis method and device, storage medium and electronic equipment
CN104112135B (en) Text image extraction element and method
US20240169143A1 (en) Method and system of generating an editable document from a non-editable document
CN113033656B (en) Interactive hole detection data expansion method based on generation countermeasure network
Chen et al. Script-level word sample augmentation for few-shot handwritten text recognition
CN116304163B (en) Image retrieval method, device, computer equipment and medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22841306

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE