Training methods for fuzzy barcode recognition models and fuzzy barcode recognition methods

By fusing the feature information of fuzzy barcodes and clear barcodes for convolution operations, the fuzzy barcode recognition model is optimized, solving the problem of inaccurate recognition of severely fuzzy barcodes by electronic devices and achieving efficient and stable barcode decoding.

CN119578440BActive Publication Date: 2025-10-28SHENZHEN YANXIANG JINMA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411553202.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-10-28
Estimated Expiration
2044-11-01

AI Technical Summary

Technical Problem

In existing technologies, electronic devices struggle to accurately recognize severely blurred barcodes, and image super-resolution technology is ineffective in this situation.

Method used

By acquiring pairs of blurry and clear barcode images, a pre-trained feature extraction model is used to extract feature information from the clear barcode image and fuse it with the feature information from the blurry barcode image. Convolution operations are then performed to generate a loss function to optimize the blurry barcode recognition model.

Benefits of technology

It improves the accuracy and stability of fuzzy barcode recognition, reduces the workload of data collection, increases training speed, avoids the influence of factors such as lighting and damage, and can stably decode severely fuzzy barcodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119578440B_ABST
    Figure CN119578440B_ABST
Patent Text Reader

Abstract

This application relates to the field of barcode recognition technology, and discloses a training method for a fuzzy barcode recognition model, a fuzzy barcode recognition method, a training device for a fuzzy barcode recognition model, a fuzzy barcode recognition device, a training equipment, an electronic device, and a computer-readable storage medium. The method includes: acquiring a training image pair, the training image pair including a fuzzy barcode image and a clear barcode image, each image in the training image pair including first preset barcode information; extracting feature information from the fuzzy barcode image and extracting feature information from the clear barcode image using a feature extraction model; generating fused features based on the feature information of the two images and performing convolution operations to determine the first barcode information; finally, determining a first loss function based on the first preset barcode information and the first barcode information, and optimizing the fuzzy barcode recognition model. Through the above method, the fuzzy barcode recognition model can decode fuzzy barcodes more accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of barcode recognition technology, specifically to a training method for a fuzzy barcode recognition model, a fuzzy barcode recognition method, a training device for a fuzzy barcode recognition model, a fuzzy barcode recognition device, a training equipment, an electronic device, and a computer-readable storage medium. Background Technology

[0002] A barcode is a graphic identifier that uses multiple black bars and spaces of varying widths arranged according to specific encoding rules to represent a set of information. With the rapid development of technology, barcode technology has become increasingly mature, and its application in industrial and civilian fields is becoming more and more widespread. Especially in various sectors of commodity circulation, barcodes are commonly used to carry various information about goods. Barcode technology is also a fundamental technology for supply chain management; therefore, accurate barcode identification can greatly accelerate the circulation of goods.

[0003] However, when electronic devices identify barcodes to obtain barcode information, they are easily affected by many physical factors, especially the image blurring factor, which has the greatest impact on barcode recognition. Current technologies mainly use image super-resolution techniques to process blurred barcode images to improve their resolution and make the barcodes clearer. However, image super-resolution techniques can only restore barcodes in low-resolution or slightly blurred images. For severely blurred images, image super-resolution techniques are almost ineffective in restoring the barcodes, making it difficult for electronic devices to accurately recognize blurred barcodes. Summary of the Invention

[0004] In view of the above problems, embodiments of this application provide a training method for a fuzzy barcode recognition model, a fuzzy barcode recognition method, a training device for a fuzzy barcode recognition model, a fuzzy barcode recognition device, a training equipment, an electronic device, and a computer-readable storage medium to solve the problem that electronic devices in the prior art have difficulty in accurately recognizing fuzzy barcodes.

[0005] According to one aspect of the embodiments of this application, a training method for a fuzzy barcode recognition model is provided. The method includes: acquiring a training image pair, the training image pair including a fuzzy barcode image and a clear barcode image, both the fuzzy barcode image and the clear barcode image including first preset barcode information; extracting feature information from the fuzzy barcode image; extracting feature information from the clear barcode image using a pre-trained feature extraction model; generating fused features based on the feature information of the fuzzy barcode image and the feature information of the clear barcode image; performing a convolution operation on the fused features to determine the first barcode information corresponding to the fuzzy barcode image; determining a first loss function based on the first preset barcode information and the first barcode information; and optimizing the fuzzy barcode recognition model based on the first loss function.

[0006] In one alternative approach, the training steps of the feature extraction model include: obtaining a clear barcode training image from a training database, the clear barcode training image including second preset barcode information; extracting feature information from the clear barcode training image using the feature extraction model; performing a convolution operation on the feature information of the clear barcode training image to obtain second barcode information corresponding to the clear barcode training image; determining a second loss function based on the second preset barcode information and the second barcode information; and optimizing the feature extraction model based on the second loss function.

[0007] In one alternative approach, the steps for constructing the training database include: obtaining the number of codes for the encoded values ​​in the barcode information; generating all code combinations based on the number of codes to obtain multiple second preset barcode information; generating corresponding barcode images based on each second preset barcode information to obtain multiple clear barcode training images; and storing the clear barcode training images in the training database.

[0008] In one alternative approach, convolution operations are performed on the fused features to determine the first barcode information corresponding to the blurred barcode image. Specifically, this includes: performing convolution operations on the fused features to obtain a probability feature tensor, which includes the probability of the encoded value at each position in the barcode information; determining the encoded value corresponding to each position in the first barcode information based on the probability of the encoded value, thereby obtaining the first barcode information corresponding to the blurred barcode image.

[0009] According to one aspect of the embodiments of this application, a fuzzy barcode recognition method is provided. The method includes: acquiring a fuzzy barcode image to be recognized; extracting feature information of the fuzzy barcode image to be recognized using a fuzzy barcode recognition model; and performing a convolution operation on the feature information of the fuzzy barcode image to be recognized using the fuzzy barcode recognition model to determine the barcode information corresponding to the fuzzy barcode image to be recognized. The fuzzy barcode recognition model is a fuzzy barcode recognition model obtained after training using the training method described in any of the above claims.

[0010] According to another aspect of the embodiments of this application, a training apparatus for a fuzzy barcode recognition model is provided, comprising: an acquisition module for acquiring training image pairs, the training image pairs including a fuzzy barcode image and a clear barcode image, both the fuzzy barcode image and the clear barcode image including first preset barcode information; a first extraction module for extracting feature information from the fuzzy barcode image; a second extraction module for extracting feature information from the clear barcode image using a pre-trained feature extraction model; a generation module for generating fused features based on the feature information of the fuzzy barcode image and the feature information of the clear barcode image; a first determination module for performing convolution operations on the fused features to determine the first barcode information corresponding to the fuzzy barcode image; a second determination module for determining a first loss function based on the first preset barcode information and the first barcode information; and an optimization processing module for optimizing the fuzzy barcode recognition model based on the first loss function.

[0011] According to another aspect of the embodiments of this application, a fuzzy barcode recognition device is provided, comprising: an acquisition module for acquiring a fuzzy barcode image to be recognized; an extraction module for extracting feature information of the fuzzy barcode image to be recognized using a fuzzy barcode recognition model; and a determination module for performing a convolution operation on the feature information of the fuzzy barcode image to be recognized using the fuzzy barcode recognition model to determine the barcode information corresponding to the fuzzy barcode image to be recognized; wherein the fuzzy barcode recognition model is a fuzzy barcode recognition model obtained after training using the training method of the fuzzy barcode recognition model described in any of the above claims.

[0012] According to another aspect of the embodiments of this application, a training device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the training method for the fuzzy barcode recognition model described in any of the preceding claims.

[0013] According to another aspect of the embodiments of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the above-described fuzzy barcode recognition method.

[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the training method of the fuzzy barcode recognition model described in any of the preceding claims, or, when executed by a processor, implements the aforementioned fuzzy barcode recognition method.

[0015] In this embodiment, when training a fuzzy barcode recognition model, in addition to extracting feature information from fuzzy barcode images using the fuzzy barcode recognition model, accurate feature information is also extracted from clear barcode images using a pre-trained feature extraction model. Furthermore, the first barcode information is determined based on the fused features. This allows the feature information extracted by the feature extraction model to provide guidance for the fuzzy barcode recognition model during barcode decoding, enabling it to extract more accurate feature information from fuzzy barcode images. This not only improves the accuracy of the decoding results but also eliminates the need to directly train the fuzzy barcode recognition model's ability to extract feature information from fuzzy barcode images using a large number of fuzzy barcode images, reducing the workload of data collection and increasing the training speed of the fuzzy barcode recognition model. Moreover, compared to methods that decode based on pixel values, directly extracting feature information from fuzzy barcode images avoids the influence of simple lighting or damage on the decoding results of the fuzzy barcode recognition model, resulting in higher model stability and reliability. Even severely fuzzy barcodes can be decoded stably.

[0016] The above description is merely an overview of the technical solutions of the embodiments of this application. In order to better understand the technical means of the embodiments of this application and to implement them in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the embodiments of this application more obvious and understandable, specific implementation methods of this application are described below. Attached Figure Description

[0017] The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0018] Figure 1 A flowchart illustrating the training method for the fuzzy barcode recognition model provided in an embodiment of this application is shown.

[0019] Figure 2 A flowchart illustrating a training method for a fuzzy barcode recognition model provided in another embodiment of this application is shown.

[0020] Figure 3 A flowchart illustrating the training steps of the feature extraction model provided in an embodiment of this application is shown.

[0021] Figure 4 A flowchart illustrating the steps for constructing the training database according to an embodiment of this application is shown;

[0022] Figure 5 A flowchart illustrating the fuzzy barcode recognition method provided in an embodiment of this application is shown;

[0023] Figure 6A schematic diagram of the structure of the training device for the fuzzy barcode recognition model provided in an embodiment of this application is shown;

[0024] Figure 7 A schematic diagram of the structure of the fuzzy barcode recognition device provided in an embodiment of this application is shown;

[0025] Figure 8 A schematic diagram of the structure of the training device provided in an embodiment of this application is shown;

[0026] Figure 9 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0027] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein.

[0028] Barcodes are increasingly widely used in industrial and consumer sectors. Taking various aspects of commodity logistics as an example, barcodes can carry a variety of information about goods and are one of the important means of modernizing commodity management. To obtain the information carried by a barcode, one only needs to scan the barcode on the product using an electronic device (such as a scanner, mobile phone, tablet, or other handheld device) to obtain detailed product information. Barcode technology effectively improves the transparency of commodity information, enabling more efficient circulation, exchange, and verification of commodity information, thus contributing to improved social efficiency.

[0029] However, during barcode scanning, electronic devices are prone to capturing blurry barcode images due to physical factors such as lighting, vibration, and hardware limitations. For low-resolution or low-blurriness blurry barcode images, image super-resolution technology can be used to restore the barcode from the blurry image, enabling the electronic device to accurately identify the corresponding barcode information. However, for barcodes with high blurriness, such as when the image contains 12% or more of missing information, super-resolution processing becomes difficult, making it hard to accurately restore the barcode and for the electronic device to accurately identify the corresponding barcode information.

[0030] Therefore, to better identify barcodes, we can combine two important characteristics of barcodes for recognition and decoding: first, the black bars and spaces of a barcode are arranged in parallel, and their opposite directions tend to be consistent; second, for the readability of the barcode, there is a large difference in reflectivity between the black bars and spaces during manufacturing, which makes the barcode have a large grayscale contrast and rich edge information. Specifically, by searching the grayscale values ​​of the barcode image and finding the positions of all peaks and troughs in the barcode image according to the magnitude relationship of the grayscale values, the midpoint of the peaks and troughs is calculated based on adjacent peaks and troughs. Then, the width of the black bars and spaces is determined based on the midpoint. Finally, according to the barcode encoding rules, that is, the composition rules of individual encoded values ​​in the barcode information, the width combination of the black bars and spaces is decoded. For example, a single encoded value of Code 128 consists of 3 black bars and 3 spaces, and during decoding, the 3 black bars and 3 spaces are combined into a unit block.

[0031] However, while each encoded value in a barcode is independent, there are checksum relationships between them. Processing only the unit block corresponding to a single encoded value utilizes only local information of the barcode, neglecting the global information. Furthermore, when the barcode image has irregular dirt or uneven lighting, the pixel values ​​of the barcode image will change significantly, which can greatly affect the decoding of the barcode, making it easy to make errors when decoding the barcode using pixel values.

[0032] Based on this, in order to further improve the accuracy of fuzzy barcode recognition, this application provides a training method for a fuzzy barcode recognition model. In the process of training the barcode recognition model, a pre-trained feature extraction model guides the fuzzy barcode recognition model to extract feature information from the fuzzy barcode image, so that the fuzzy barcode recognition model can more accurately obtain the feature information of the fuzzy barcode image. In turn, when electronic devices use the fuzzy barcode recognition model to recognize fuzzy barcodes, they can more accurately obtain the barcode information of the fuzzy barcode.

[0033] Specifically, a blurred barcode image and a clear barcode image are acquired as training image pairs, both of which include preset barcode information. The blurred barcode recognition model extracts feature information from the blurred barcode image, while the pre-trained feature extraction model extracts feature information from the clear barcode image. A fused feature is generated based on the feature information extracted by the two models. Then, a convolution operation is performed on the fused feature to obtain the barcode information corresponding to the blurred barcode image. Finally, a loss function is determined based on the barcode information obtained from the convolution operation and the preset barcode information. The blurred barcode recognition model is then optimized based on the loss function, making the feature information extracted by the blurred barcode recognition model from the blurred barcode image closer to the feature information extracted by the feature extraction model from the clear barcode image.

[0034] The training method for the fuzzy barcode recognition model disclosed in this application can be used not only to train models for recognizing fuzzy barcodes, but also to train models for recognizing fuzzy two-dimensional barcodes. This application uses barcodes as an example for illustration only.

[0035] Figure 1 A flowchart illustrating a training method for a fuzzy barcode recognition model provided in an embodiment of this application is shown. This method is executed by a training device. The training device can be a local offline device, such as a computer, or a cloud-based device such as a cloud server. Figure 1 As shown, the method includes the following steps:

[0036] Step S110: Obtain training image pairs, which include blurry barcode images and clear barcode images. Both blurry and clear barcode images include first preset barcode information.

[0037] The blurred barcode image and the clear barcode image are a pair of training images with the same barcode. This means that the electronic device can obtain the first preset barcode information by decoding both the blurred and clear barcode images. The barcode in the blurred barcode image is a blurred barcode with indistinct boundaries between black bars and whitespace, while the barcode in the clear barcode image is a clear barcode with distinct boundaries between black bars and whitespace.

[0038] The first preset barcode information is the information obtained after decoding the barcode. It is usually character information, which can be composed of letters, numbers, or a combination of letters and numbers. For example, the barcode information of an EAN13 barcode is formed by 13 digits. That is, after decoding an EAN13 barcode, you can get information composed of 13 characters, and these characters are all numbers from 0 to 9.

[0039] Step S120: Extract feature information from the blurred barcode image.

[0040] The feature information refers to the features of the fuzzy barcode image, which can include shallow features such as pixel values, edge contours, and textures, as well as deep features such as semantic information between pixels. The feature information can be a vector, such as a one-dimensional feature vector or a two-dimensional feature matrix, or it can be a feature image.

[0041] Step S130: Extract feature information of the clear barcode image using a pre-trained feature extraction model.

[0042] The feature information of a clear barcode image is similar to that of a blurry barcode image, and will not be elaborated further here. Furthermore, during training, the feature information of the clear barcode image is used as the standard answer to guide the optimization of the blurry barcode recognition model, ensuring that the feature information extracted by the trained model continuously approximates that of the clear barcode image. Therefore, the dimensionality of the feature information of the clear barcode image needs to be the same as that of the blurry barcode image. For example, if the feature information of the blurry barcode image is a one-dimensional feature vector, the feature information of the clear barcode image also needs to be a one-dimensional feature vector; if the feature information of the blurry barcode image is a feature image, the feature information of the clear barcode image also needs to be a feature image, and the size, number of channels, etc., of the corresponding feature images of both images also need to be consistent.

[0043] Step S140: Generate fused features based on the feature information of the blurred barcode image and the feature information of the clear barcode image.

[0044] Among them, the fusion feature is the feature obtained by fusing the feature information of the blurry barcode image and the feature information of the clear barcode image through multi-scale feature fusion. The fusion feature can fully retain the feature information in the blurry barcode image and the clear barcode image, so that the model can consider the feature information of the blurry barcode image and the clear barcode image at the same time during the training process. In this way, the blurry image recognition model can continuously adjust the parameters so that the feature information of the blurry barcode image it extracts can continuously approach the feature information of the clear barcode image.

[0045] In this embodiment, as an example, the fusion feature can be generated through feature concatenation. That is, the fusion feature can be generated by concatenating the feature information of a blurred barcode image and the feature information of a clear barcode image along a certain dimension. For example, when both the feature information of the blurred barcode image and the feature information of the clear barcode image are feature images, the feature information of the blurred barcode image and the feature information of the clear barcode image can be concatenated along the channel dimension to generate a new feature image, which is the fusion feature. Specifically, assuming the shape of the feature information of the blurred barcode image is... The feature information of a clear barcode image is ,in, Indicates the batch size. and These represent the number of channels for the feature information of the blurred barcode image and the feature information of the clear barcode image, respectively. and Given the height and width of the image, the shape of the fused feature will be... .

[0046] Step S150: Perform convolution operation on the fused features to determine the first barcode information corresponding to the blurred barcode image.

[0047] Specifically, 3x3 convolutional layers or convolutional neural network models consisting of one or more convolutional layers can be used to perform convolution operations on the fused features to determine the first barcode information corresponding to the blurred barcode image. In this embodiment, when a relatively complex convolutional neural network model is required to perform convolution operations on the fused features, or when the encoded value of the first barcode information is relatively complex, a decoding model can be pre-trained using a clear barcode image to directly decode and obtain the corresponding barcode information from the feature information of the barcode image. This decoding model is then applied to the blurred barcode recognition model so that the first barcode information corresponding to the blurred barcode image can be directly obtained after performing convolution operations on the fused features through this decoding model.

[0048] When the encoded value of the first barcode information (e.g., the encoded value of the first barcode information is a number from 0 to 9) is relatively simple, in addition to using a pre-trained decoding model, the probability of the encoded value at each position of the first barcode information can be obtained by performing convolution operations on the fused features, and the first barcode information can be determined based on the probability of the encoded value. Specifically, to further improve the decoding accuracy of the fuzzy barcode recognition model, such as... Figure 2 As shown, Figure 2 The diagram illustrates a flowchart of a training method for a fuzzy barcode recognition model according to another embodiment of this application. Step S150 may include steps S151 and S152, as follows:

[0049] Step S151: Perform convolution operation on the fused features to obtain a probability feature tensor, which includes the probability of the encoded value at each position in the barcode information.

[0050] The probability feature tensor is used to represent the probability of all possible coding combinations of the first barcode information, specifically through the probability of the coded value at each position in the barcode information. For example, the barcode information of the EAN13 barcode consists of 13 numerical values. When decoding the EAN13 barcode, a probability feature tensor with dimensions 1×1×13×10 is obtained after performing a convolution operation on the fused features. In this probability feature tensor, 13 represents the coded value of each bit from the 1st to the 13th bit in the EAN13 barcode, and 10 represents the probability distribution that each coded value may be one of the 10 digits from 0 to 9.

[0051] Step S152: Determine the encoding value corresponding to each position in the first barcode information based on the probability of the encoding value, and obtain the first barcode information corresponding to the fuzzy barcode image.

[0052] When determining the encoded value for each position in the first barcode information based on the probability of the encoded value, the character with the highest probability is usually used as the encoded value for the current position. For example, when determining the encoded value of the first position in an EAN13 barcode, assuming the probability of the first encoded value in the probability feature tensor corresponding to 0 to 9 is... The probability of the last digit is 0.3, which is also the highest among all probabilities. Therefore, the first digit's encoding value is 9. By following this pattern, the encoding values ​​of the second to thirteenth digits can be determined in turn, thus obtaining the final decoding result of the EAN13 barcode, which is the first barcode information corresponding to the EAN13 barcode.

[0053] In steps S151 and S152, the probability of the encoded value at each position in the barcode information is first calculated, and then the encoded value corresponding to each position in the first barcode information is determined to obtain the first barcode information corresponding to the fuzzy barcode image. This fully considers all possible encoding combinations of the first barcode information, ensures the accuracy of the first barcode information, and effectively improves the decoding accuracy of the fuzzy barcode recognition model.

[0054] Step S160: Determine the first loss function based on the first preset barcode information and the first barcode information.

[0055] Step S170: Optimize the fuzzy barcode recognition model according to the first loss function.

[0056] The first loss function is used to update the parameters of the fuzzy barcode recognition model, i.e., to optimize the fuzzy barcode recognition model. The first loss function can be cross-entropy loss, which can not only measure the difference between the feature information extracted by the fuzzy barcode image from the fuzzy barcode recognition model and the feature information extracted by the clear barcode image from the feature extraction model, but also optimize the fuzzy barcode recognition model based on the first preset barcode information, so that the fuzzy barcode recognition model can simultaneously learn the knowledge of the feature extraction model and the encoded value distribution of the first preset barcode information. Of course, the first loss function can also be mean squared error loss, divergence loss, etc. When both the fuzzy barcode recognition model and the feature extraction model include attention mechanisms, an attention loss function can also be used to match the attention maps of the two models.

[0057] In the above embodiments, when training the fuzzy barcode recognition model, in addition to extracting feature information from the fuzzy barcode image through the fuzzy barcode recognition model, accurate feature information is also extracted from the clear barcode image through a pre-trained feature extraction model. Furthermore, the first barcode information is determined based on the fused features. This allows the feature information extracted by the feature extraction model to provide guidance for the fuzzy barcode recognition model during barcode decoding, enabling it to extract more accurate feature information from the fuzzy barcode image. This not only improves the accuracy of the decoding result but also eliminates the need to directly train the fuzzy barcode recognition model's ability to extract feature information from fuzzy barcode images using a large number of fuzzy barcode images, reducing the workload of data collection and increasing the training speed of the fuzzy barcode recognition model. Moreover, compared to methods that decode based on pixel values, directly extracting feature information from the fuzzy barcode image avoids the influence of simple lighting or damage on the decoding result of the fuzzy barcode recognition model, resulting in higher model stability and reliability. Even severely fuzzy barcodes can be decoded stably.

[0058] To enable the feature extraction model to extract feature information more accurately from clear barcode images, the model can be trained first. This application provides some embodiments, such as... Figure 3 As shown, Figure 3 The diagram illustrates the training steps of the feature extraction model provided in this embodiment. The training process of the feature extraction model includes the following steps:

[0059] Step S210: Obtain a clear barcode training image from the training database. The clear barcode training image includes second preset barcode information.

[0060] Clear barcode training images can be obtained by downloading images or data packets from the network. Alternatively, existing barcode generation libraries (such as pyBarcode, which can generate EAN13 barcodes, QR codes, etc.) can be used to generate corresponding clear barcode training images. This allows for the establishment of a closed-loop software system (including the entire process of automatic data collection, automatic data labeling, automatic model evaluation, and automatic model updating) during the training of the feature extraction model. This enables the feature extraction model to have a strong self-upgrading capability, allowing it to not only quickly upgrade itself but also adapt to new scenarios.

[0061] Furthermore, in order for the feature extraction model to learn as many barcode features as possible from clear barcode training images during the training process, such as Figure 4 As shown, Figure 4 The flowchart illustrating the steps for constructing the training database according to an embodiment of this application is shown. The training database can be constructed through steps S201 to S204, as detailed below:

[0062] Step S201: Obtain the number of codes in the barcode information.

[0063] The encoding quantity is used to indicate the number of characters contained in the barcode information. For example, the encoding quantity of the ISBN-13 barcode is 13 digits, the encoding quantity of the ISBN-10 barcode is 10 digits, and the encoding quantity of the UPC-A barcode is 12 digits.

[0064] Step S202: Generate all coding combinations according to the number of codes to obtain multiple second preset barcode information.

[0065] In this process, all possible encoding combinations are generated through exhaustive search to obtain all possible decoding results (i.e., the second preset barcode information). For example, the EAN13 barcode has 13 encoded values, and each encoded value can be any number from 0 to 9. Therefore, the EAN13 barcode includes a total of 10^13 decoding results. Similarly, the ISBN-10 barcode includes a total of 10^10 decoding results, and the UPC-A barcode includes a total of 10^12 decoding results.

[0066] Step S203: Generate corresponding barcode images based on each second preset barcode information to obtain multiple clear barcode training images.

[0067] Step S204: Store the clear barcode training images in the training database.

[0068] Specifically, based on the exhaustive search of multiple second-preset barcode information, clear barcode training images corresponding to all encoding combinations are generated, ensuring that the training database includes images of all barcode shapes. For example, the EAN13 barcode includes a total of 10^13 decoding results, which will also correspond to 10^13 barcode shapes. All 10^13 barcode shapes are generated as training images and stored in the training database based on all decoding results, making the training data in the database more comprehensive. Regardless of the shape of the EAN13 barcode in the clear barcode image, the feature extraction model trained in this way can effectively extract feature information from the clear barcode image.

[0069] Steps S201 to S204 exhaustively enumerate all barcode encoding combinations and generate barcodes of all shapes as training data based on all encoding combinations. This makes the data coverage in the training database more comprehensive. The feature extraction model trained using clear barcode training images in the training database can more accurately extract feature information from clear barcode images, thereby better guiding the extraction of feature information from fuzzy barcode images. Furthermore, by directly generating corresponding clear barcode training images using the first preset barcode information, there is no need to collect images from the network, making the acquisition of the training database more convenient.

[0070] Step S220: Use a feature extraction model to extract feature information from the clear barcode training image.

[0071] The feature extraction model can be a convolutional neural network model, such as VGGNet, DenseNet, or MobileNetV3, trained as a backbone. By performing convolution and other operations on the clear barcode training image through the feature extraction model, the feature information extracted by the model has many non-linear features, thus making the feature information more robust.

[0072] In this embodiment of the application, as an example, a 224x224 image can be used as input, and a classification model can be trained using MobileNetV3 as the backbone. The specific structure of this model can be: [224x224x1]->[112x112x16]->[112x112x16]->[56x56x24]->[56x56x24]->[28x28x40]->[28x28x40] 28x40]->[14x14x80]->[14x14x80]->[14x14x80]->[14x14x80]->[14x14x80]->[14x14x112]->[14x14x112]->[7x7x160]->[7x7x160]->[7x7x160]->[7x7x960]->[7x7x960]->[1x1x1280]->[1x1x1000]. Once the model converges, the parameters of the intermediate layers are extracted as parameters for the feature extraction model. For example, [56x56x24]->[56x56x24]->[28x28x40]->[28x28x40]->[14x14x80]->[14x14x80]->[14x14x80]->[14x14x80]->[14x14x80]->[14x14x80] ->[14ⅹ14ⅹ112]->[14ⅹ14ⅹ112]->[7ⅹ7ⅹ160]->[7ⅹ7ⅹ160]->[7ⅹ7ⅹ160]->[7ⅹ7ⅹ960]->[7ⅹ7ⅹ960] serves as the feature extraction model, i.e., the input dimension of the feature model is [56ⅹ56ⅹ24], and the output dimension is [7ⅹ7ⅹ960].

[0073] Step S230: Perform convolution operation on the feature information of the clear barcode training image to obtain the second barcode information corresponding to the clear barcode training image.

[0074] Step S240: Determine the second loss function based on the second preset barcode information and the second barcode information.

[0075] Step S250: Optimize the feature extraction model according to the second loss function.

[0076] In this process, the barcode in the clear barcode training image is decoded using the feature information extracted from the clear barcode training image to obtain the second barcode information. Finally, a second loss function is determined based on the difference between the second barcode information and the second preset barcode information, and this second loss function is used to optimize the feature extraction model. The second loss function can be cross-entropy loss, KL divergence, mean squared error loss, etc.

[0077] In the above embodiments, the feature extraction model is trained using clear barcode training images, enabling it to accurately extract corresponding feature information from clear barcode images and provide guidance for the fuzzy barcode recognition model. Furthermore, during feature extraction model training, the output dimension can be adjusted based on the training results and the requirements of actual task inference. This allows the model to quickly extract feature information from clear barcode images and achieves higher accuracy in decoding based on that feature information. Simultaneously, the output dimension of the module extracting feature information from fuzzy barcode images in the fuzzy barcode recognition model can be determined based on the output dimension of the feature extraction model. This avoids the need to adjust the internal convolutional downsampling structure of the model during training, effectively accelerating the model's training speed.

[0078] For example, suppose the output dimension of the feature extraction model is If the decoding accuracy is poor and the model training speed is slow when determining the second barcode information based on the feature information of this output dimension, then a convolutional downsampling structure can be added to the feature extraction model, that is, compressing the output dimension of the feature extraction model to... The feature extraction model is then retrained, and its output dimension is adjusted based on the training results. Finally, the model with the best feature extraction performance across multiple training iterations is selected as the feature extraction model, and the same output dimension is sampled for the module extracting feature information from fuzzy barcode images in the fuzzy barcode recognition model.

[0079] According to another aspect of the embodiments of this application, a method for recognizing fuzzy barcodes is provided, such as... Figure 5 As shown, Figure 5 This diagram illustrates a flowchart of a fuzzy barcode recognition method provided in an embodiment of this application. The method is executed by an electronic device. This electronic device can be a server or a terminal device (e.g., a mobile phone, tablet, etc.), or a scanning device such as a laser scanner, an image-type red light scanner, or a light pen. The fuzzy barcode recognition model used in this method is a fuzzy barcode recognition model obtained after training using the training method described in any of the above embodiments. Figure 5 As shown, the method includes the following steps:

[0080] Step S310: Obtain the image of the blurred barcode to be recognized.

[0081] The blurred barcode image to be identified can be an image containing a blurred barcode pre-acquired by an electronic device through methods such as downloading from the network or taking a picture, or it can be an image captured in real time by the electronic device when scanning the barcode on an item. For example, the barcode may become blurred due to light or shadow on the location of the barcode on the item; or the barcode may become blurred when the electronic device or the item moves into the image during image acquisition. The blurred barcode image to be identified can be an image containing only a blurred barcode, or it can include other content besides the blurred barcode (e.g., the environment, other items in the scene, etc.).

[0082] Furthermore, not all barcodes in images captured by electronic devices are blurry. The fuzzy barcode recognition model of this application is primarily trained using blurry barcode images, and its accuracy in decoding clear barcodes may be relatively lower compared to models trained by directly sampling clear barcode images. Therefore, two barcode decoding methods can be simultaneously set in the electronic device to accurately recognize blurry and clear barcodes respectively. In this case, when the electronic device acquires an image to be recognized, it can first determine whether the barcode in the image is clear or blurry. If the barcode in the image is blurry, the image is used as the blurry barcode image to be recognized, and the fuzzy barcode recognition model is used to decode the barcode in the blurry barcode image. If the barcode in the image is clear, another decoding method is used to decode the barcode in the image.

[0083] Step S320: Use a fuzzy barcode recognition model to extract feature information from the fuzzy barcode image to be recognized.

[0084] Step S330: Perform convolution operation on the feature information of the fuzzy barcode image to be identified using the fuzzy barcode recognition model to determine the barcode information corresponding to the fuzzy barcode image to be identified.

[0085] The process involves using a fuzzy barcode recognition model to extract feature information from the fuzzy barcode image to be recognized, and then determining the corresponding barcode information based on this feature information. Of course, before using the fuzzy barcode recognition model to extract feature information from the fuzzy barcode image, image segmentation, noise filtering, and image rotation can be used to adjust the image, enabling the fuzzy barcode recognition model to better extract feature information from it.

[0086] The above embodiments extract feature information from the fuzzy barcode image to be recognized using a fuzzy barcode recognition model, and then determine the corresponding barcode information based on the feature information. This makes the decoding of fuzzy barcodes more stable and reliable, with a higher decoding rate, and can stably decode even severely fuzzy barcodes. Furthermore, the deep learning model's propulsion can be accelerated using faster inference platforms (e.g., GPUs, CPUs, NPUs, etc.) to achieve real-time decoding of fuzzy barcodes, meeting the needs of scenarios with higher real-time decoding requirements (e.g., industrial decoding scenarios).

[0087] According to one aspect of the embodiments of this application, a training device for a fuzzy barcode recognition model is also provided, such as... Figure 6 As shown, Figure 6 The diagram shows a schematic of the structure of a training device for a fuzzy barcode recognition model provided in an embodiment of this application. The training device 1 for the fuzzy barcode recognition model includes an acquisition module 11, a first extraction module 12, a second extraction module 13, a generation module 14, a first determination module 15, a second determination module 16, and an optimization processing module 17.

[0088] The acquisition module 11 is used to acquire training image pairs, which include a blurred barcode image and a clear barcode image. Both the blurred and clear barcode images include first preset barcode information. The first extraction module 12 is used to extract feature information from the blurred barcode image. The second extraction module 13 is used to extract feature information from the clear barcode image using a pre-trained feature extraction model. The generation module 14 is used to generate fused features based on the feature information of the blurred and clear barcode images. The first determination module 15 is used to perform convolution operations on the fused features to determine the first barcode information corresponding to the blurred barcode image. The second determination module 16 is used to determine a first loss function based on the first preset barcode information and the first barcode information. The optimization processing module 17 is used to optimize the blurred barcode recognition model based on the first loss function.

[0089] In the above embodiments, the training device 1 for the fuzzy barcode recognition model, when training the fuzzy barcode recognition model, not only extracts feature information from the fuzzy barcode image through the fuzzy barcode recognition model, but also extracts accurate feature information from the clear barcode image through a pre-trained feature extraction model. Furthermore, it determines the first barcode information based on the fused features. This allows the feature information extracted by the feature extraction model to provide guidance for the fuzzy barcode recognition model during barcode decoding, enabling it to extract more accurate feature information from the fuzzy barcode image. This not only improves the accuracy of the decoding result but also eliminates the need to directly train the fuzzy barcode recognition model's ability to extract feature information from fuzzy barcode images using a large number of fuzzy barcode images, reducing the workload of data collection and increasing the training speed of the fuzzy barcode recognition model. Moreover, compared to methods that decode based on pixel values, directly extracting feature information from the fuzzy barcode image avoids the influence of simple lighting or damage on the decoding result of the fuzzy barcode recognition model, resulting in higher model stability and reliability. Even severely fuzzy barcodes can be decoded stably.

[0090] According to one aspect of the embodiments of this application, a fuzzy barcode recognition device is also provided, such as... Figure 7 As shown, Figure 7 A schematic diagram of the structure of the fuzzy barcode recognition device provided in this application embodiment is shown. The fuzzy barcode recognition device 2 includes an acquisition module 21, an extraction module 22, and a determination module 23. The acquisition module 21 is used to acquire a fuzzy barcode image to be recognized. The extraction module 22 is used to extract feature information from the fuzzy barcode image to be recognized using a fuzzy barcode recognition model. The determination module 23 is used to perform a convolution operation on the feature information of the original fuzzy barcode image to be recognized using the fuzzy barcode recognition model to determine the barcode information corresponding to the fuzzy barcode image to be recognized. The fuzzy barcode recognition model is a fuzzy barcode recognition model obtained after training using the training method described in any of the above embodiments.

[0091] In the above embodiments, the fuzzy barcode recognition device 2 uses a fuzzy barcode recognition model to extract feature information from the fuzzy barcode image to be recognized, and then determines the corresponding barcode information based on the feature information. This makes the decoding of fuzzy barcodes more stable and reliable, with a higher decoding rate, and even severely fuzzy barcodes can be decoded stably. Furthermore, the deep learning model's propulsion can be accelerated using faster inference platforms (e.g., GPUs, CPUs, NPUs, etc.) to achieve real-time decoding of fuzzy barcodes, meeting the needs of scenarios with higher real-time decoding requirements (e.g., industrial decoding scenarios).

[0092] This application also extracts a training device in its embodiments. Figure 8The diagram illustrates the structure of a training device provided in an embodiment of this application. The specific embodiments of this application do not limit the specific implementation of the training device. Figure 8 As shown, the training device 3 may include a processor 31 and a memory 32.

[0093] The memory 32 is used to store the computer program 33. The memory 32 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device. The computer program 33 may include computer-executable instructions.

[0094] Processor 31 is used to execute computer program 33 to implement the training method embodiment of the fuzzy barcode recognition model described below. Processor 31 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The training device includes one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0095] This application also provides an electronic device. Figure 9 The diagram illustrates the structure of an electronic device provided in an embodiment of this application. The specific embodiments of this application do not limit the specific implementation of the electronic device. Figure 9 As shown, the electronic device 4 may include a processor 41 and a memory 42.

[0096] The memory 42 is used to store the computer program 43. The memory 42 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device. The computer program 43 may include computer-executable instructions.

[0097] The processor 41 is used to execute the computer program 43 to implement the above-described embodiment of the fuzzy barcode recognition method.

[0098] The processor 41 may be a central processing unit (CPU), an ASIC, or one or more integrated circuits configured to implement the embodiments of this application. The electronic device 4 includes one or more processors 41, which may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs.

[0099] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described training method embodiment for the fuzzy barcode recognition model, or, when executed by a processor, implements the above-described fuzzy barcode recognition method embodiment.

[0100] This application provides a computer program that can be executed by a processor to implement the above-described training method embodiment for the fuzzy barcode recognition model, or the computer program can be executed by a processor to implement the above-described fuzzy barcode recognition method embodiment.

[0101] This application provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described embodiment of the training method for the fuzzy barcode recognition model, or, when executed by a processor, implements the above-described embodiment of the fuzzy barcode recognition method.

[0102] In the several embodiments provided in this application, any function, if implemented as a software functional module / unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, part or all of the technical solutions of this application can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or other electronic device) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0103] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, the embodiments of this application are not directed to any particular programming language. It should be understood that the content of this application described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of this application.

[0104] It should be noted that the above embodiments are illustrative of this application and not restrictive, and those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In claims enumerating several means, several units or modules of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the order of execution.

[0105] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A training method for a fuzzy barcode recognition model, characterized in that, The method includes: Acquire training image pairs, the training image pairs including blurry barcode images and clear barcode images, both the blurry barcode images and the clear barcode images including first preset barcode information; Extract the feature information of the blurred barcode image; The feature information of the clear barcode image is extracted using a pre-trained feature extraction model; A fusion feature is generated based on the feature information of the blurred barcode image and the feature information of the clear barcode image; The fused features are convolved to obtain a probability feature tensor, which includes the probability of the encoded value at each position in the barcode information; the character with the highest probability is determined as the encoded value corresponding to each position in the first barcode information based on the probability of the encoded value, thus obtaining the first barcode information corresponding to the blurred barcode image; A first loss function is determined based on the first preset barcode information and the first barcode information; The fuzzy barcode recognition model is optimized based on the first loss function.

2. The training method for the fuzzy barcode recognition model according to claim 1, characterized in that, The training steps of the feature extraction model include: Obtain a clear barcode training image from the training database, wherein the clear barcode training image includes second preset barcode information; The feature extraction model described above is used to extract feature information from the clear barcode training image; Perform convolution operation on the feature information of the clear barcode training image to obtain the second barcode information corresponding to the clear barcode training image; A second loss function is determined based on the second preset barcode information and the second barcode information; The feature extraction model is optimized based on the second loss function.

3. The training method for the fuzzy barcode recognition model according to claim 2, characterized in that, The steps for constructing the training database include: Retrieve the number of codes in the barcode information; All code combinations are generated based on the number of codes to obtain multiple second preset barcode information; Generate corresponding barcode images based on each of the second preset barcode information to obtain multiple clear barcode training images; The clear barcode training image is stored in the training database.

4. A method for recognizing fuzzy barcodes, characterized in that, The method includes: Acquire the image of the blurred barcode to be recognized; The feature information of the fuzzy barcode image to be identified is extracted using a fuzzy barcode recognition model. The fuzzy barcode recognition model performs convolution operations on the feature information of the fuzzy barcode image to be recognized, thereby determining the barcode information corresponding to the fuzzy barcode image to be recognized. The fuzzy barcode recognition model is a fuzzy barcode recognition model obtained by training it using the training method for the fuzzy barcode recognition model as described in any one of claims 1-3.

5. A training device for a fuzzy barcode recognition model, characterized in that, The device includes: The acquisition module is used to acquire training image pairs, the training image pairs including a blurred barcode image and a clear barcode image, both the blurred barcode image and the clear barcode image including a first preset barcode information; The first extraction module is used to extract feature information from the blurred barcode image; The second extraction module is used to extract feature information from the clear barcode image using a pre-trained feature extraction model. The generation module is used to generate fused features based on the feature information of the blurred barcode image and the feature information of the clear barcode image; The first determining module is used to perform convolution operation on the fused features to obtain a probability feature tensor, wherein the probability feature tensor includes the probability of the encoded value at each position in the barcode information; and to determine the character with the highest probability as the encoded value corresponding to each position in the first barcode information according to the probability of the encoded value, thereby obtaining the first barcode information corresponding to the blurred barcode image. The second determining module is used to determine a first loss function based on the first preset barcode information and the first barcode information; An optimization processing module is used to optimize the fuzzy barcode recognition model based on the first loss function.

6. A fuzzy barcode recognition device, characterized in that, The device includes: The acquisition module is used to acquire the image of the blurred barcode to be recognized; The extraction module is used to extract feature information from the fuzzy barcode image to be identified using a fuzzy barcode recognition model; The determination module is used to perform convolution operations on the feature information of the fuzzy barcode image to be identified through the fuzzy barcode recognition model to determine the barcode information corresponding to the fuzzy barcode image to be identified. The fuzzy barcode recognition model is a fuzzy barcode recognition model obtained by training it using the training method for the fuzzy barcode recognition model as described in any one of claims 1-3.

7. A training device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the training method for the fuzzy barcode recognition model according to any one of claims 1 to 3.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the fuzzy barcode recognition method of claim 4.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the training method of the fuzzy barcode recognition model according to any one of claims 1 to 3, or when the computer program is executed by the processor, it implements the fuzzy barcode recognition method according to claim 4.

Citation Information

Patent Citations

  • Code128 bar code automatic reading method based on global optimization

    CN111368576A

  • Image processing method and device, model training method and device, and equipment

    CN113313635A