Bar code image recognition method and device based on cyclic generative adversarial network

By using a U-shaped network structure of a recurrent generative adversarial network and an attention mechanism, the problem of barcode image recognition failure in coated scenarios was solved, resulting in clearer and more accurate barcode image recognition and improved recognition success rate.

CN120805956APending Publication Date: 2025-10-17SHENZHEN YANXIANG JINMA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510939131.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Existing barcode image recognition methods struggle to accurately capture the complete boundaries and content of clear barcodes in laminated environments, leading to recognition failures or high misidentification rates, especially when faced with optical interference from laminated materials.

Method used

A recurrent generative adversarial network (RGAN)-based approach is adopted. By constructing a generator model with a U-shaped network structure and introducing an attention mechanism, combined with a discriminator model with a multi-layer convolutional network structure, a RGAN model is built to reconstruct the clarity of coated barcode images, remove optical interference, and restore the clarity and integrity of the barcode.

Benefits of technology

It effectively improves the recognition success rate of barcode images, solves the problem of recognition failure and high error rate caused by unclear barcode imaging in coated scenarios, and achieves more accurate barcode content extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120805956A_ABST
    Figure CN120805956A_ABST
Patent Text Reader

Abstract

The invention discloses a bar code image recognition method and device based on a cyclic generative adversarial network, and relates to the technical field of image processing, and the method comprises the steps: obtaining a film-coated bar code image; based on a preset cyclic generative adversarial network model, sharpening reconstruction is carried out on the film-coated barcode image to obtain a reconstructed film-coated barcode image, and the cyclic generative adversarial network model is constructed based on a cyclic generative adversarial network structure and an attention mechanism; and performing bar code identification on the reconstructed film-coated bar code image to obtain bar code content. According to the invention, the film-covered barcode image recognition based on the cyclic generative adversarial network and the attention mechanism is realized, the problems of recognition failure and high error rate caused by unclear barcode imaging in a film-covered scene in the existing barcode image recognition method are solved, and the recognition success rate of the film-covered barcode image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a bar code image recognition method and device based on a cycle generative adversarial network. BACKGROUND

[0002] One-dimensional code bar decoding in a film-coated scenario is seriously affected by the optical properties of the film-coated material (such as reflection, refraction, blurring, etc.) on the imaging quality. Different film-coated materials and changes in film-coated thickness further increase the complexity of bar code imaging, making it difficult to accurately extract the bar code content.

[0003] The existing bar code image recognition method implemented by using a convolutional neural network algorithm only realizes the positioning and recognition of the bar code. When processing the film-coated scenario, it is often difficult to accurately capture the complete boundary and content of the clear bar code, and it is difficult to cope with complex optical interference, resulting in recognition failure or a significant increase in misrecognition rate.

[0004] The above content is only used to assist in understanding the technical solutions of the present application and does not represent the acknowledgement of the above content as prior art. SUMMARY

[0005] The main purpose of the present application is to provide a bar code image recognition method and device based on a cycle generative adversarial network, which aims to solve the technical problems of existing bar code image recognition methods in the film-coated scenario, such as recognition failure and high error rate caused by unclear bar code imaging.

[0006] To achieve the above purpose, the present application provides a bar code image recognition method based on a cycle generative adversarial network, which comprises:

[0007] obtaining a film-coated bar code image;

[0008] based on a preset cycle generative adversarial network model, performing clear reconstruction on the film-coated bar code image to obtain a reconstructed film-coated bar code image, the cycle generative adversarial network model being constructed based on a cycle generative adversarial network structure and an attention mechanism;

[0009] performing bar code recognition on the reconstructed film-coated bar code image to obtain bar code content.

[0010] In an embodiment, before the step of performing clear reconstruction on the film-coated bar code image based on the preset cycle generative adversarial network model to obtain the reconstructed film-coated bar code image, the method further comprises:

[0011] constructing a generator model of a U-shaped network structure and introducing an attention mechanism in the generator model;

[0012] constructing a discriminator model of a multi-layer convolutional network structure;

[0013] Based on the generator model and the discriminator model, the cyclic generative adversarial network model is constructed.

[0014] In an embodiment, before the step of performing clear reconstruction on the film-coated barcode image based on the preset cyclic generative adversarial network model to obtain a reconstructed film-coated barcode image, the method further comprises:

[0015] obtaining an original film-coated barcode image and a target barcode image;

[0016] reconstructing the original film-coated barcode image through the generator model to obtain a reconstructed barcode image;

[0017] performing authenticity discrimination on the reconstructed barcode image through the discriminator model according to the target barcode image to obtain an image discrimination result;

[0018] calculating a loss value between the original film-coated barcode image and the reconstructed barcode image through a preset loss function according to the image discrimination result, and updating model parameters of the cyclic generative adversarial network model according to the loss value.

[0019] In an embodiment, the generator model comprises an encoder and a decoder,

[0020] The step of performing clear reconstruction on the film-coated barcode image based on the preset cyclic generative adversarial network model to obtain a reconstructed film-coated barcode image comprises:

[0021] inputting the film-coated barcode image into the generator model for processing as follows:

[0022] extracting features of the film-coated barcode image through the encoder to generate a feature map;

[0023] reconstructing the film-coated barcode image through the decoder according to the feature map to output the reconstructed film-coated barcode image.

[0024] In an embodiment, the generator model comprises an encoder and a decoder, the generator model is configured with one or more of a boundary attention module, a spatial attention module and a channel attention module, the boundary attention module is embedded in a skip connection between the encoder and the decoder, and the spatial attention module and the channel attention module are embedded in an encoding path of the encoder.

[0025] In an embodiment, the encoder comprises a plurality of down-sampling stages, and the decoder comprises a plurality of up-sampling stages,

[0026] The step of introducing an attention mechanism into the generator model comprises:

[0027] embedding the boundary attention module in a skip connection between an output layer of each down-sampling stage of the encoder and an input layer of a corresponding up-sampling stage of the decoder;

[0028] embedding the spatial attention module after the output of a convolutional layer of a first down-sampling stage of the encoder;

[0029] embedding the channel attention module after the output of a convolutional layer of a last down-sampling stage of the encoder.

[0030] In an embodiment, before the step of performing clear reconstruction on the coated barcode image based on the preset cyclic generative adversarial network model to obtain a reconstructed coated barcode image, the method further comprises:

[0031] performing gray scale conversion processing on the coated barcode image to obtain a coated barcode gray scale image;

[0032] performing normalization processing on the coated barcode gray scale image to obtain a normalized coated barcode gray scale image, and performing clear reconstruction on the normalized coated barcode gray scale image based on the cyclic generative adversarial network model to obtain the reconstructed coated barcode image.

[0033] In addition, to achieve the above object, the present application further provides a barcode image recognition device based on a cyclic generative adversarial network, which comprises:

[0034] an acquisition module configured to acquire a coated barcode image;

[0035] a reconstruction module configured to perform clear reconstruction on the coated barcode image based on a preset cyclic generative adversarial network model to obtain a reconstructed coated barcode image, wherein the cyclic generative adversarial network model is constructed based on a cyclic generative adversarial network structure and an attention mechanism;

[0036] a recognition module configured to perform barcode recognition on the reconstructed coated barcode image to obtain barcode content.

[0037] In addition, to achieve the above object, the present application further provides a barcode image recognition device based on a cyclic generative adversarial network, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the above barcode image recognition method based on a cyclic generative adversarial network.

[0038] In addition, to achieve the above-mentioned purpose, the application further provides a storage medium, which is a computer readable storage medium, and a computer program is stored on the storage medium, and the computer program is executed by a processor to implement the steps of the bar code image recognition method based on the cycle generative adversarial network.

[0039] In addition, to achieve the above-mentioned purpose, the application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps of the bar code image recognition method based on the cycle generative adversarial network.

[0040] The application provides a bar code image recognition method based on a cycle generative adversarial network. First, a coated bar code image is obtained. Then, the coated bar code image is clearly reconstructed based on a cycle generative adversarial network model. The cycle generative adversarial network model has strong learning ability, and can understand the features and structure of the bar code image. Meanwhile, the attention mechanism introduced can effectively extract and strengthen the key features of the bar code, so as to reconstruct a clearer and more easily recognizable bar code image. Finally, the reconstructed coated bar code image is subjected to bar code recognition. Due to the improvement of the image quality, the bar code image recognition process is more accurate. The problems of the prior art, such as recognition failure and high error rate caused by unclear bar code imaging in the coated scenario, are solved, and the recognition success rate of the coated bar code image is improved. BRIEF DESCRIPTION OF DRAWINGS

[0041] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the application and, together with the specification, serve to explain the principles of the application.

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0043] Figure 1 A flowchart is provided for the first embodiment of the bar code image recognition method based on the cycle generative adversarial network of the application.

[0044] Figure 2 A flowchart is provided for the second embodiment of the bar code image recognition method based on the cycle generative adversarial network of the application.

[0045] Figure 3 A U-shaped network structure diagram is provided for the third embodiment of the bar code image recognition method based on the cycle generative adversarial network of the application.

[0046] Figure 4A boundary attention module structure schematic diagram provided by the third embodiment of the bar code image recognition method based on the cyclic generative adversarial network of the application;

[0047] Figure 5 A module structure schematic diagram of the bar code image recognition device based on the cyclic generative adversarial network of the embodiment of the application;

[0048] Figure 6 A device structure schematic diagram of the hardware running environment involved in the bar code image recognition method based on the cyclic generative adversarial network in the embodiment of the application.

[0049] The object implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the application and do not limit the application.

[0051] In order to better understand the technical solutions of the application, the specific embodiments will be described in detail below with reference to the drawings and the specific embodiments.

[0052] The main solution of the embodiment of the application is: obtaining a laminated bar code image; based on a preset cyclic generative adversarial network model, the laminated bar code image is reconstructed to obtain a reconstructed laminated bar code image, the cyclic generative adversarial network model is constructed based on a cyclic generative adversarial network structure and an attention mechanism; performing bar code recognition on the reconstructed laminated bar code image to obtain bar code content.

[0053] Due to the optical properties of the laminating material (such as reflection, refraction, blur, etc.) in the existing technology one-dimensional code bar decoding in the laminating scene, the imaging quality of the bar code may be severely disturbed. For example, the reflection of the laminated surface will interfere with the contrast of the bar code area, making it difficult to distinguish the bar code from the background; the refraction effect causes the bar code lines to deform or twist, affecting the integrity of their geometric structure; and the blur phenomenon reduces the clarity of the bar code, making it difficult to accurately extract the bar code content.

[0054] The traditional bar code image recognition method is relatively simple and easy to understand in terms of bar code positioning, but it is only suitable for some simple scenes, sensitive to factors such as light and angle, and has poor generalization ability, requiring manual design of feature extractors. When dealing with laminating scenes, it is often difficult to cope with complex optical interference, resulting in the algorithm being unable to accurately capture the complete boundary and content of the bar code, and thus causing recognition failure or a significant increase in misrecognition rate.

[0055] In addition, the different materials of the film (such as PET, PVC, OPP, etc.) and the changes in the thickness of the film further increase the complexity of barcode imaging. For example, high-reflective film may cause overexposure in the barcode area, while semi-transparent film may mix the barcode content with the background, reducing readability. These factors make barcode recognition in the film scenario more complex, and traditional rule-based or simple image processing methods cannot meet the actual needs. Deep learning methods can automatically learn image features and have strong generalization ability, which are suitable for complex scenarios, but require a large amount of computing resources, high model complexity, and cannot meet real-time barcode image recognition scenarios.

[0056] Technical terms related to the present application:

[0057] U-shaped network structure: U-Net network structure, also known as encoder-decoder structure, a codec structure network for image segmentation, which captures context information through down-sampling path, restores spatial details through up-sampling path, and fuses features at different levels through jump connection. It mainly includes encoder (Encoder) and decoder (Decoder).

[0058] Encoder: The image is extracted through a series of convolutional layers. Each layer contains convolution, activation function (such as ReLU), and possibly pooling operation. As the network deepens, the size of the feature map gradually decreases, while the number of feature channels gradually increases, so that higher-level semantic information is extracted.

[0059] Decoder: The up-sampling decoder starts with the feature map received from the encoder, and gradually increases the size of the feature map through up-sampling operations (such as deconvolution). After each up-sampling step, the feature map of the corresponding level of the encoder is spliced with the feature map of the current level of the decoder through jump connection.

[0060] Jump connection: The jump connection in the UNet network directly transmits the feature map of the encoder to the decoder, thereby retaining more spatial information and helping to improve positioning accuracy.

[0061] Attention mechanism: By introducing the attention mechanism, the neural network can automatically learn and selectively focus on important information in the input, improving the performance and generalization ability of the model.

[0062] Channel attention mechanism: By calculating the importance of each channel, the relationship between channels is learned, which improves the expression ability of the network in feature representation, and thus improves the performance of the model.

[0063] Spatial attention mechanism: It aims to introduce an attention module to enable the model to adaptively learn the attention weights of different regions, so as to pay more attention to important image regions and ignore unimportant regions.

[0064] Boundary Attention Module (BAM): By learning the basic topology and geometric properties of boundaries, the model can more accurately infer the boundaries in the image, thereby improving the accuracy and robustness of edge detection.

[0065] SimAM Attention Mechanism (Simple Attention Module): A lightweight attention mechanism designed to enhance the representational capacity of neural networks without significantly increasing computational overhead. By adaptively weighting feature maps, it improves the network's focus on key features.

[0066] In this application, first, the laminated barcode image is acquired, then the laminated barcode image is reconstructed based on the cycle generative adversarial network model, the strong learning ability of the cycle generative adversarial network model is used to understand the characteristics and structure of the barcode image, and the attention mechanism introduced, including the boundary perception module, channel and spatial attention mechanism, can effectively extract and strengthen the key features of the barcode, so as to reconstruct a clearer and more easily recognizable barcode image; Finally, the laminated barcode image after reconstruction is subjected to barcode recognition, due to the improvement of the image quality, the barcode image recognition process is more accurate, solves the problem of recognition failure and high error rate of existing barcode image recognition methods in the laminated scene due to unclear barcode imaging, and improves the recognition success rate of the laminated barcode image.

[0067] It should be noted that the execution subject of the present embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a barcode image recognition device based on a cycle generative adversarial network, etc. In the following, the barcode image recognition device based on the cycle generative adversarial network is taken as an example to explain the present embodiment and each of the following embodiments.

[0068] Based on this, the present application provides a barcode image recognition method based on a cycle generative adversarial network, referring to Figure 1 , Figure 1 The flowchart of the first embodiment of the barcode image recognition method based on the cycle generative adversarial network of the present application is shown in the figure.

[0069] In the present embodiment, the barcode image recognition method based on the cycle generative adversarial network comprises steps S10-S30:

[0070] Step S10, acquiring a laminated barcode image;

[0071] It should be noted that the laminated barcode image refers to the barcode image after the laminating process. The optical properties of the laminating material, such as reflection, refraction, and blurring, can seriously interfere with the imaging quality, making it difficult for traditional barcode recognition methods to accurately recognize the barcode. The laminated barcode image can be directly obtained by an image acquisition device (such as a camera, scanner, etc.).

[0072] It can be understood that, in order to clearly reconstruct and recognize the barcode in the subsequent steps, the laminated barcode image is obtained, and the subsequent steps of clear reconstruction and barcode recognition can be based on this image.

[0073] Specifically, the laminated barcode image can be obtained in various ways, such as using a camera to directly capture the laminated barcode image, or using a scanner to scan and obtain the laminated barcode image. For example, when it is necessary to recognize the laminated barcode on the packaging of a commodity, a portable barcode scanner gun can be used to scan the laminated barcode on the commodity; or in some scenarios that require high-precision recognition, a high-resolution camera can be used to capture the laminated barcode image. For laminated barcodes of different materials and thicknesses, the parameters of the image acquisition device, such as focal length, aperture, exposure time, etc., may need to be adjusted to ensure that the quality of the obtained image meets the requirements of subsequent processing. For example, when capturing a high-reflective laminated barcode, the exposure time may need to be reduced to avoid overexposure; and when capturing a semi-transparent laminated barcode, the aperture size may need to be adjusted to improve the clarity of the image. The combination of different feasible implementations, such as selecting a suitable image acquisition device and adjusting the parameters, can ensure that the laminated barcode image obtained can be processed by clear reconstruction.

[0074] Illustratively, assume that in a supermarket checkout scenario, it is necessary to recognize the laminated barcode on the packaging of a commodity. A barcode scanner gun equipped on the supermarket checkout counter can be used to scan the laminated barcode on the commodity, thereby obtaining the laminated barcode image. The scanner gun irradiates the laminated barcode with a light-emitting diode (LED) light source, then receives the reflected light through a photoelectric sensor and converts it into an electrical signal, and then generates the laminated barcode image. The laminated barcode image obtained at this time may be affected by factors such as reflection and refraction of the laminating material, resulting in low contrast and line deformation, etc. The original laminated barcode image data is obtained, providing a basis for subsequent clear reconstruction and barcode recognition.

[0075] In step S20, the laminated barcode image is clear reconstructed based on a preset cycle generative adversarial network model to obtain a reconstructed laminated barcode image, and the cycle generative adversarial network model is constructed based on a cycle generative adversarial network structure and an attention mechanism.

[0076] It should be noted that the cycle generative adversarial network model is implemented based on a cycle generative adversarial network structure (CycleGAN network structure), which can realize the unpaired image-to-image conversion task, has strong image generation and reconstruction capabilities, and is suitable for processing complex image data. The clear reconstruction refers to the process of processing the laminated barcode image by the model, which can remove the optical interference caused by the laminating material, restore the clarity and integrity of the barcode image, and make it closer to the real identifiable barcode image. The attention mechanism is a mechanism that simulates human attention, which can enable the model to focus on key areas and features when processing images, and improve the attention to important information.

[0077] In addition, it should be noted that the cycle generative adversarial network model can learn the mapping relationship between the laminated barcode image and the clear barcode image through the adversarial training of the generator and the discriminator in the cycle generative adversarial network structure, and the attention mechanism can guide the model to focus on the key features and areas of the barcode, so that the reconstructed barcode image is clearer, more complete, and closer to the real identifiable barcode image. The reconstructed laminated barcode image refers to the barcode image after clear reconstruction by the cycle generative adversarial network model, which has removed the optical interference caused by the laminating material, restored the clarity and integrity of the barcode, and is closer to the real identifiable barcode image in the uncoated state.

[0078] It can be understood that the cycle generative adversarial network model constructed by using the cycle generative adversarial network structure and the attention mechanism performs clear reconstruction on the laminated barcode image to solve the problem of optical interference caused by the laminating material, improve the quality and recognizability of the barcode image, and provide a clear and accurate barcode image for the subsequent barcode recognition step, thereby improving the accuracy of the entire barcode recognition method.

[0079] Optionally, the attention mechanism includes one or more of a boundary attention mechanism, a spatial attention mechanism, and a channel attention mechanism. The boundary attention mechanism is mainly used for feature selection and enhancement on the image boundary; the spatial attention mechanism focuses on the importance of different spatial positions on the feature map, highlighting the key areas; and the channel attention mechanism emphasizes useful feature channels and suppresses unimportant channels. For different types of laminated barcode images, the parameters of the model can be adjusted or different combinations of attention mechanisms can be used to obtain the best reconstruction effect.

[0080] Illustratively, the acquired laminated barcode image is input into a preset cycle generative adversarial network model, and the model performs clear reconstruction on the laminated barcode image. Assuming that the laminated barcode image is affected by the reflection of the laminating material, the contrast between the barcode area and the background is low, and the lines are blurred, the lines of the barcode output by the model after clear reconstruction are clear and have high contrast, which can clearly distinguish the barcode area and the background, and prepare for the subsequent barcode recognition.

[0081] In step S30, barcode recognition is performed on the reconstructed film-coated barcode image to obtain the barcode content.

[0082] It should be noted that barcode recognition refers to analyzing and decoding the barcode image through specific algorithms or methods to extract the information contained in the barcode, such as product number, price, etc. The barcode content is the specific information stored in the barcode, usually represented in the form of numbers, letters, or their combinations.

[0083] Additionally, it should be noted that because the reconstructed barcode image has solved the problems caused by optical interference in the film-coated scenario, such as low contrast caused by reflection, line deformation caused by refraction, and reduced clarity caused by blurring, the features of the barcode lines, width, spacing, and boundaries are more obvious and accurate, allowing accurate recognition and decoding. Therefore, the barcode image can be recognized through conventional barcode recognition algorithms (such as template matching-based or image processing-based methods).

[0084] It can be understood that the reconstructed clear barcode image has high quality and recognizability, allowing the barcode recognition algorithm to accurately analyze the structure and features of the barcode and extract the information in the barcode. To recognize the reconstructed clear barcode image and extract the information contained in the barcode, the barcode content is extracted by recognizing the reconstructed clear barcode image, which can convert the reconstructed clear barcode image into useful information, complete the film-coated barcode image recognition, and provide data support for subsequent applications (such as product sales, inventory management, and logistics tracking). Using the clear reconstructed barcode image for barcode recognition can ensure accurate and efficient recognition of the reconstructed clear barcode image, extraction of the barcode content, and improvement of the accuracy of the barcode image recognition method.

[0085] Specifically, a variety of barcode recognition methods can be used to recognize the reconstructed clear barcode image. For example, a template matching-based barcode recognition method can be used to compare the reconstructed barcode image with pre-stored standard barcode templates one by one to find the most similar template and determine the content of the barcode. Alternatively, an image processing-based barcode recognition method can be used, such as through edge detection, binarization processing, morphological operation, etc., to extract the line features of the barcode, and then decode according to the coding rules of the barcode to obtain the barcode content.

[0086] Exemplarily, the barcode image obtained through the clear reconstruction is recognized by using a barcode recognition method based on image processing. First, the reconstructed barcode image is subjected to grayscale processing to convert the color image into a grayscale image, so as to simplify the data and highlight the brightness information. Then, the grayscale image is subjected to binarization processing to convert the grayscale image into a black-and-white image, so that the barcode lines and the background are more distinct. Next, edge detection is performed to extract the edge contour of the barcode. Then, the edges are thinned and denoised through morphological operation to obtain clear barcode lines. Finally, the width, spacing and other characteristics of the lines are analyzed and decoded according to the coding rules of the barcode (such as the coding rules of the EAN-13 barcode), to obtain the barcode content, such as the number information of the product. At this time, the cash register system in the supermarket scene can query the product database according to the number information to obtain the name, price and other detailed information of the product, to complete the sales transaction process.

[0087] In a feasible implementation, before the step of clear reconstruction of the coated barcode image based on the preset cycle generative adversarial network model to obtain the reconstructed coated barcode image, the method further includes:

[0088] In step S2011, a generator model with a U-shaped network structure is constructed, and an attention mechanism is introduced into the generator model.

[0089] It should be noted that the U-shaped network structure refers to an encoder-decoder structure, which is commonly used in image segmentation, reconstruction and other tasks. The input image is down-sampled by the encoder to extract features, and then the features are up-sampled by the decoder to reconstruct the image. The generator model is the generation part in the cycle generative adversarial network, which is responsible for converting the input coated barcode image into a clear barcode image. The introduction of the attention mechanism means that an attention module is added to the generator model, so that the model can focus on the key areas and features of the image, and the quality of the generated image is improved.

[0090] It can be understood that, in order to improve the feature extraction and reconstruction capability of the coated barcode image, the generator model with the U-shaped network structure is constructed and the attention mechanism is introduced. The U-shaped network structure can effectively extract and fuse multi-level features of the image, so that the generator can learn the complex mapping relationship between the coated barcode image and the clear barcode image, so that the generated clear barcode image is more accurate and complete. At the same time, the attention mechanism can guide the generator to focus on the key feature areas of the barcode, such as the barcode edge, the width change of the lines, etc., so as to improve the quality of the reconstructed image and make the generated clear barcode image closer to the real image.

[0091] In step S2012, a discriminator model with a multi-layer convolutional network structure is constructed.

[0092] It should be noted that the multi-layer convolutional network structure refers to a network structure composed of multiple convolutional layers, and the convolutional layers extract local features of the image through convolution operations. The discriminator model is the discriminant part in the cycle generative adversarial network, responsible for judging whether the input image is a real clear barcode image or an image generated by the generator.

[0093] In addition, it should be noted that the discriminator of the multi-layer convolutional network structure can gradually extract multi-level features of the image, from shallow edge and texture features to deep semantic features, thereby comprehensively discriminating the authenticity of the image. For example, through multi-layer convolution operations, the discriminator can learn the feature representation of the clear barcode image, such as the clarity, contrast, and geometric structure of the barcode lines. When the generated image is input, the discriminator can make a judgment based on these features and give a probability value representing the likelihood of the image being a real image.

[0094] It can be understood that in order to improve the authenticity discrimination ability of the generated image and guide the generator to generate more realistic clear barcode images, a discriminator model containing multiple convolutional layer structures is constructed, so that the discriminator can accurately distinguish between real images and generated images, and can continuously optimize its own parameters during the training process to improve the quality of the generated images.

[0095] Step S2013, based on the generator model and the discriminator model, a cycle generative adversarial network model is constructed.

[0096] It should be noted that the cycle generative adversarial network model is an extension architecture based on the generative adversarial network (GAN), which contains two generators and two discriminators, and can realize image conversion between two different domains and form a cycle structure. The generator model and the discriminator model are the generation part and the discrimination part in the cycle generative adversarial network respectively, and the generator is responsible for image conversion and the discriminator is responsible for image authenticity discrimination. The construction represents the structure and function of the generator model and the discriminator model, and the process of combining them into a complete cycle generative adversarial network model.

[0097] In addition, it should be noted that the cycle generative adversarial network model is trained by the two generators and two discriminators, so that the generator can learn the complex mapping relationship between the film-coated barcode image and the clear barcode image, and the cycle consistency constraint ensures the reversibility and consistency of the image conversion, so that the generator can maintain the semantic information and structural integrity of the image during the conversion process.

[0098] It can be understood that, in order to realize the conversion of the laminated barcode image to the clear barcode image, the generator model and the discriminator model are combined into a cycle generative adversarial network model to improve the stability and performance of the model through the cycle consistency constraint of the cycle generative adversarial network, so as to effectively remove the optical interference caused by the laminated material and generate a high-quality clear barcode image.

[0099] Specifically, first, when constructing the generator model of the U-shaped network structure, the following steps can be performed: first, design the encoder part, which is usually composed of multiple convolutional layers and down-sampling layers, for extracting the features of the input image; then, design the decoder part, which is composed of multiple up-sampling layers and convolutional layers, for reconstructing the image; then, introduce a skip connection between the encoder and the decoder to fuse feature information at different levels; finally, embed an attention mechanism module in the generator model, such as a boundary attention module, a spatial attention module, and a channel attention module, etc. For example, a spatial attention module can be added after a specific down-sampling stage of the encoder to highlight the key spatial regions in the current feature map; a boundary attention module can be added in the skip connection between the encoder and the decoder to enhance the feature structure and detail information; a channel attention module can be added before the up-sampling stage of the decoder to select and emphasize useful feature channels.

[0100] Then, when constructing the discriminator model of the multi-layer convolutional network structure, the following steps can be performed: first, determine the input size of the network, which is usually the same as the image size output by the generator; then, design multiple convolutional layers, each followed by an activation function (such as ReLU) and a normalization operation (such as batch normalization) to enhance the feature expression ability and stabilize the training process; then, add a fully connected layer after the last convolutional layer to map the extracted features to a single probability value representing the probability that the input image is a real image. For example, a discriminator model containing 4 convolutional layers can be constructed, each with a kernel size of 4x4, a stride of 2, and a padding mode of same, and using ReLU activation function and batch normalization operation after each convolution. The input channel number of the first convolutional layer is the channel number of the image (such as 1 for grayscale images), and the output channel number is 64; the output channel number of the second convolutional layer is 128; the output channel number of the third convolutional layer is 256; the output channel number of the fourth convolutional layer is 512. The last fully connected layer maps the features extracted by convolution to a probability value, with an output range of 0 to 1, representing the probability that the input image is a real image.

[0101] Finally, when constructing the cycle generative adversarial network model, the following steps can be followed: first, combine the constructed generator model G and the discriminator model D Y into a subnetwork for converting the coated barcode image X into a clear barcode image Y, and determining whether the generated image Y is realistic through the discriminator D Y ; then, combine another generator model F and a discriminator model D X into another subnetwork for converting the clear barcode image Y back to the coated barcode image X, and determining whether the generated image X is realistic through the discriminator D X ; then, through the cycle consistency loss function and the adversarial loss function, the two subnetworks are jointly trained, so that the generators G and F can cooperate with each other to realize bidirectional conversion of the image, and ensure the quality and consistency of the conversion result.

[0102] In the embodiment, first, the generator model with a U-shaped network structure is constructed and the attention mechanism is introduced, so that the generator can effectively extract and reconstruct the features of the barcode image; then, the discriminator model with a multi-layer convolutional network structure is constructed, so that the discriminator can accurately determine the authenticity of the generated image; finally, the cycle generative adversarial network model is constructed based on the constructed generator model and discriminator model, and through adversarial training and cycle consistency constraint, the quality and stability of image reconstruction are further improved, and clearer and more accurate barcode images can be generated.

[0103] In a feasible implementation, before the step of performing clear reconstruction on the coated barcode image based on the preset cycle generative adversarial network model to obtain a reconstructed coated barcode image, the method further includes:

[0104] In step S2021, an original coated barcode image and a target barcode image are obtained.

[0105] It should be noted that the original coated barcode image refers to a coated barcode image that has not been subjected to clear reconstruction processing and contains optical interference caused by the coating material, such as reflection, refraction, blur, etc. The target barcode image refers to a clear and recognizable barcode image corresponding to the original coated barcode image, which can be a barcode image obtained by removing the coating.

[0106] It can be understood that, in order to provide supervised data pairs for subsequent model training, enable the generator to learn how to convert the original laminated barcode image into the target barcode image, enable the discriminator to learn how to distinguish between the real target barcode image and the image generated by the generator, obtain the original laminated barcode image and the target barcode image corresponding thereto as a pair of reference images for model training, provide data support for training of the cycle generative adversarial network model, and ensure that the model can learn effective mapping relationship and feature representation. In addition, through the paired original laminated barcode image and target barcode image, the difference between the image generated by the generator and the target image can be calculated as the basis for optimizing the model parameters, and at the same time the discriminator can learn how to accurately distinguish the authenticity of the image by comparing the real target barcode image and the generated image, so as to guide the generator to generate more realistic images.

[0107] Specifically, the original laminated barcode image and the target barcode image can be obtained in various ways. For example, in a laboratory environment, standard barcode images can be artificially laminated to simulate different lamination materials (such as PET, PVC, OPP, etc.) and thicknesses to generate original laminated barcode images, while retaining the original standard barcode images as target barcode images; or collecting laminated barcode images from actual application scenarios and obtaining corresponding target barcode images through other means (such as manual correction, other professional image processing algorithms, etc.). For large-scale image data acquisition, a data acquisition system can be established to automatically acquire laminated barcode images and obtain corresponding target barcode images through a data labeling platform. For example, in a logistics warehouse, a barcode scanning device is used to acquire laminated barcode images on commodity packaging, and at the same time, by comparing with the standard barcode database in the warehouse management system, the corresponding target barcode images are obtained. It should be noted that when acquiring data, the quality and diversity of the data should be ensured to cover various possible lamination scenarios and barcode types, thereby improving the generalization ability and robustness of the model. For example, laminated barcode images under different lighting conditions, different angles, different lamination materials and thicknesses, and target barcode images of different barcode types (such as EAN-13, Code 128, UPC, etc.) can be acquired. At the same time, the acquired data is preprocessed, such as cropping, scaling, normalization, etc., to unify the size and format of the images, facilitating subsequent model training.

[0108] Step S2022, reconstructing the original laminated barcode image through the generator model to obtain a reconstructed barcode image;

[0109] It should be noted that the generator model is the generation part in the cycle generative adversarial network, responsible for converting the original laminated barcode image into the reconstructed barcode image. The reconstructed barcode image refers to the image obtained by processing the original laminated barcode image according to the learned mapping relationship by the generator model, which should be as close to the target barcode image as possible.

[0110] It can be understood that the original laminated barcode image is input into the initial generator model, and the image conversion capability of the generator model is used to reconstruct the original laminated barcode image, output the reconstructed barcode image, verify the generation effect of the initial generator model, and provide a data basis for subsequent discriminator discrimination and model parameter updating.

[0111] Step S2023, according to the target barcode image, the authenticity of the reconstructed barcode image is discriminated by the discriminator model, and an image discrimination result is obtained;

[0112] It should be noted that the image discrimination result refers to a probability value output by the discriminator model, indicating the possibility of the input image being a real target barcode image.

[0113] It can be understood that the authenticity of the reconstructed barcode image is discriminated by the discriminator model to evaluate the gap between the reconstructed barcode image generated by the generator model and the real target barcode image, guide the optimization of the model parameters of the generator model and the discriminator model itself, and generate more realistic images.

[0114] Step S2024, according to the image discrimination result, the loss value between the original laminated barcode image and the reconstructed barcode image is calculated by a preset loss function, and the model parameters of the cycle generative adversarial network model are updated according to the loss value.

[0115] It should be noted that the loss function is a function designed to measure the difference between the original laminated barcode image and the reconstructed barcode image and guide the model parameter update. The loss value is a numerical value calculated by the loss function, indicating the gap between the generated reconstructed barcode image and the target barcode image. The model parameters are the trainable parameters in the cycle generative adversarial network model, including the weights and biases of the generator model and the discriminator model.

[0116] It can be understood that according to the discrimination result and the loss function, the loss value of the reconstructed barcode image and the target barcode image is calculated, and the loss value is used to adjust the parameters of the model, which considers the reconstruction error (such as the pixel difference, structural difference, etc. of the reconstructed barcode image and the target barcode image) of the generator model and the discrimination result (such as the probability of the reconstructed barcode image being judged as a real image) of the discriminator model. The loss value is propagated back to the model through the back propagation algorithm, and the parameters of the model are updated, so that the model is optimized in the direction of reducing the loss value. The parameters of the cycle generative adversarial network model are optimized through the loss function and the discrimination result, so that the cycle generative adversarial network model can be continuously learned and optimized, and the quality of the reconstructed barcode image generated by the generator model and the discrimination ability of the discriminator model are improved.

[0117] Exemplarily, one or more loss functions can be designed to comprehensively optimize the model, such as adversarial loss, cycle consistency loss, identity loss, and structural loss. Among them, the adversarial loss function is used to make the image generated by the generator be considered as a real image by the discriminator, the cycle consistency loss function is used to ensure the reversibility and consistency of image conversion, the identity loss function is used to keep the input image unchanged when no conversion is needed, and the structural loss function is used to keep the structural similarity between the reconstructed image and the original image. By comprehensively optimizing the performance of the model through these loss functions, the automatic training and performance improvement of the model can be realized, and it is ensured that the generator model can generate more and more realistic and clear barcode images, and the discriminator model can more and more accurately discriminate the authenticity of the image.

[0118] In the embodiment, by obtaining the original coated barcode image and the target barcode image, using the generator model for image reconstruction, the discriminator model for authenticity discrimination, and updating the model parameters according to the loss function, the performance of the cycle generative adversarial network model can be effectively optimized, so that the generator model gradually learns how to convert the original coated barcode image into a clear barcode image, and the discriminator model continuously improves the discrimination ability of the generated image, thereby improving the accuracy and stability of the model in the coated barcode image reconstruction.

[0119] The embodiment provides a bar code image recognition method based on a cycle generative adversarial network. First, a laminated bar code image is acquired. Then, the laminated bar code image is clearly reconstructed based on a cycle generative adversarial network model. The strong learning ability of the cycle generative adversarial network model is used to understand the features and structure of the bar code image. Meanwhile, the attention mechanism introduced, including a boundary perception module and channel and spatial attention mechanisms, can effectively extract and strengthen the key features of the bar code, so that the reconstructed bar code image is clearer and easier to recognize. Finally, the laminated bar code image after reconstruction is subjected to bar code recognition. Due to the improvement of the image quality, the laminated bar code image recognition process is more accurate. The problems of recognition failure and high error rate of the existing bar code image recognition method caused by unclear bar code imaging in the laminated scenario are solved, and the recognition success rate of the laminated bar code image is improved.

[0120] Based on the first embodiment of the present application, the same or similar contents as the above first embodiment can be referred to the above introduction, and will not be described in detail. On this basis, please refer to Figure 2 , Figure 2 The flowchart of the second embodiment of the bar code image recognition method based on the cycle generative adversarial network of the present application is shown.

[0121] In the embodiment, the generator model includes an encoder and a decoder. The step of clearly reconstructing the laminated bar code image based on the preset cycle generative adversarial network model includes:

[0122] The laminated bar code image is input into the generator model for processing as follows:

[0123] In step S2031, the laminated bar code image is subjected to feature extraction by the encoder to generate a feature map.

[0124] It should be noted that the encoder is part of the generator model and is responsible for feature extraction of the input laminated bar code image. Feature extraction refers to extracting local and global features of an image through convolutional layers and down-sampling layers to generate a feature map. The convolutional layer can extract local features of an image, such as edges, textures, etc., and the down-sampling layer can gradually reduce the size of the feature map to extract higher-level semantic features, thereby forming a hierarchical feature representation. For example, the first convolutional layer of the encoder extracts shallow features of the image, such as simple textures between pixels; the second convolutional layer extracts more complex feature combinations; and so on, until the last convolutional layer extracts deep semantic features of the image, such as the overall structure and layout of the bar code. The feature map is the multi-dimensional data output by the encoder, which contains feature information of the input image, such as edges, textures, shapes, etc.

[0125] It can be understood that, in order to extract the key information in the image, the laminated barcode image is subjected to feature extraction by the encoder to generate a feature map for image reconstruction, which can convert the original image data into a more compact and expressive feature representation, so that the decoder can generate a high-quality reconstructed image according to the features.

[0126] In step S2032, the laminated barcode image is reconstructed by the decoder according to the feature map, and the reconstructed laminated barcode image is output.

[0127] It should be noted that the decoder is another part of the generator model, which is responsible for reconstructing the image according to the feature map generated by the encoder. Reconstruction refers to gradually restoring the feature map to a reconstructed image with the same size as the input image through upsampling and convolution operations. The reconstructed laminated barcode image represents a clear barcode image generated after the decoder completes the reconstruction process.

[0128] It can be understood that, in order to convert the features extracted by the encoder back to the image space and generate a clear barcode image corresponding to the input laminated barcode image, the decoder is used to reconstruct the feature map, and the size and details of the image are gradually restored through the upsampling and convolution operations of the decoder, so that the reconstructed image has high clarity and recognizability, and the reconstructed clear barcode image is obtained.

[0129] Specifically, the decoder increases the size of the feature map through upsampling operations and refines the features through convolution operations, and finally generates a reconstructed image with the same size as the input image. For example, the first layer of the decoder upsampling layer doubles the size of the feature map, and then refines the features through the convolution layer; the second layer of the upsampling layer again expands the size, and so on, until the size of the input image is restored. At the same time, the decoder can establish a skip connection with the encoder, and splice the feature map of the corresponding layer in the encoder with the feature map in the decoder, so as to fuse the feature information of different layers and improve the quality of the reconstructed image.

[0130] Optionally, the generator model includes an encoder and a decoder, the generator model is configured with one or more of a boundary attention module, a spatial attention module and a channel attention module, the boundary attention module is embedded in a skip connection between the encoder and the decoder, and the spatial attention module and the channel attention module are embedded in an encoding path of the encoder.

[0131] It can be understood that in the encoding path of the encoder, the spatial attention module and the channel attention module process the feature map. The spatial attention module analyzes the importance of each spatial position in the feature map, dynamically adjusts the weight, and highlights the key areas such as the barcode edge; the channel attention module evaluates the importance of each channel in the feature map, emphasizes the channels related to the barcode lines, and suppresses the unimportant channels. The boundary attention module in the skip connection between the encoder and the decoder further enhances the structure and detail information of the feature map, which helps to generate high-definition reconstructed images.

[0132] In a feasible implementation, the encoder includes a plurality of down-sampling stages, the decoder includes a plurality of up-sampling stages, and the step of introducing the attention mechanism in the generator model includes:

[0133] In step S20111, the boundary attention module is embedded in the skip connection between the output layer of each down-sampling stage of the encoder and the input layer of the corresponding up-sampling stage of the decoder.

[0134] It can be understood that the boundary attention module is an attention mechanism for enhancing the boundary information of the feature map. In order to guide the model to focus on the key feature area of the barcode, the attention mechanism is introduced in the generator model to improve the quality of the reconstructed image. The boundary attention module is embedded in the skip connection between the output layer of each down-sampling stage of the encoder and the input layer of the corresponding up-sampling stage of the decoder. After the output feature map of each down-sampling stage is processed by the boundary attention module, it is input into the input layer of the up-sampling stage corresponding to the down-sampling stage. By enhancing the boundary features in each down-sampling stage as the input of the up-sampling stage through the encoder, the boundary definition of the reconstructed image is improved, and the edge of the reconstructed barcode image is clearer.

[0135] In step S20112, the spatial attention module is embedded after the output of the convolutional layer of the first down-sampling stage of the encoder.

[0136] It can be understood that the spatial attention module is implemented based on the feature attention mechanism of highlighting the key spatial positions in the feature map. The spatial attention module is embedded after the output of the convolutional layer of the first down-sampling stage of the encoder. By analyzing the importance of each spatial position in the feature map output by the convolutional layer of the first down-sampling stage, dynamically adjusting the weight, and highlighting the key areas such as the barcode edge, the model can better focus on the barcode area.

[0137] In step S20113, the channel attention module is embedded after the output of the convolutional layer of the last down-sampling stage of the encoder.

[0138] It can be understood that the channel attention module is implemented based on the channel attention mechanism which emphasizes useful feature channels and suppresses unimportant channels. The channel attention module is embedded after the output of the convolutional layer of the last down-sampling stage of the encoder, the importance of each channel in the feature map of the output of the convolutional layer of the last down-sampling stage is evaluated, the channels related to the barcode lines are emphasized, and other channels related to the background and noise are suppressed, so that the model can more effectively utilize the feature information. For example, when the channel attention module finds that the features of the barcode line region are more critical for reconstructing a clear barcode image, the weights are dynamically adjusted to highlight these regions.

[0139] In the embodiment, by embedding the boundary attention module in the skip connection of the encoder and the decoder, embedding the spatial attention module after the output of the convolutional layer of the first down-sampling stage of the encoder, and embedding the channel attention module after the output of the convolutional layer of the last down-sampling stage of the encoder, the model can more accurately focus on the key feature region of the barcode. The boundary information of the feature map is enhanced by the boundary attention module, the edges of the reconstructed barcode image are clearer; the key spatial positions are highlighted by the spatial attention module, so that the model can better focus on the barcode region; and the useful feature channels are emphasized and the unimportant channels are suppressed by the channel attention module, so that the expression ability of the features is improved. The generator model can generate a reconstructed image of higher quality, and the accuracy and robustness of barcode recognition are further improved.

[0140] In a feasible embodiment, before the step of generating the clear reconstructed image of the coated barcode image based on the preset cycle GAN model to obtain the reconstructed coated barcode image, the method further comprises:

[0141] In step S2041, the coated barcode image is subjected to gray scale conversion processing to obtain a coated barcode gray scale image.

[0142] It should be noted that the gray scale conversion processing refers to converting a color image into a gray scale image, and obtaining a single-channel gray scale image by calculating the weighted sum of each color channel. The coated barcode gray scale image is an image after gray scale conversion, and only contains brightness information, without color information.

[0143] It can be understood that since the main information of the barcode image is reflected in the brightness change, i.e., the brightness difference between the lines and gaps of the barcode, the color information has less contribution to the recognition of the barcode. In order to simplify the content of the barcode image, remove the redundant color information, and highlight the brightness information, the obtained coated barcode image is subjected to gray scale conversion processing to obtain a gray scale image. Through the gray scale conversion, the key information of the barcode can be retained, so that the model can focus more on the brightness information for processing, the effect of clear reconstruction is improved, the data amount and the computational complexity of the image are reduced, and the processing efficiency is improved.

[0144] In step S2042, the film-coated barcode grayscale image is normalized to obtain a normalized film-coated barcode grayscale image, and the normalized film-coated barcode grayscale image is clear reconstructed based on the cycle generative adversarial network model to obtain the reconstructed film-coated barcode image.

[0145] It should be noted that normalization refers to scaling the image pixel value to a specific range, usually 0 to 1 or -1 to 1, adjusting the distribution of pixel values through linear transformation or other methods. The normalized film-coated barcode grayscale image is a grayscale image after normalization, and the pixel value is within the specified range.

[0146] It can be understood that in order to ensure that the image data input into the cycle generative adversarial network model has a suitable numerical range, improve the numerical stability and training efficiency of the model, the grayscale film-coated barcode image is normalized to map pixel values of different ranges to a unified range to obtain a normalized image, so that the input data of the model has similar scales, which can prevent overflow or underflow caused by excessively large or small pixel values, so that the model can be trained and inferred within a stable numerical range, to ensure the numerical stability of the model during training and inference, thereby improving the performance and generalization ability of the model.

[0147] In this embodiment, through grayscale conversion, the image content is simplified, redundant color information is removed, brightness information is highlighted, and the complexity of subsequent processing is reduced; through normalization, it is ensured that the image data input into the cycle generative adversarial network model has a suitable numerical range, and the numerical stability and training efficiency of the model are improved. The clear reconstruction of the cycle generative adversarial network model provides better data input, further improves the quality of the reconstructed image and the accuracy of barcode recognition, and enhances the performance of the barcode image recognition method in the film-coated scene, so that it can run more stably and efficiently.

[0148] In this embodiment, through the encoder feature extraction and decoder image reconstruction, the clear reconstruction process of the barcode image recognition method is more specific and operable, which can more effectively extract the features of the film-coated barcode image and reconstruct a high-quality clear barcode image. The collaborative work of the encoder and the decoder and the enhanced role of the attention mechanism further improve the quality of the reconstructed image and the accuracy of barcode recognition.

[0149] Based on the first and / or second embodiments of the present application, in the third embodiment of the present application, the same or similar contents as the above first and second embodiments can refer to the above introduction, and the following will not be repeated.

[0150] Exemplarily, in order to facilitate the understanding of the implementation process of the bar code image recognition method based on the cycle generative adversarial network obtained after combining the first and second embodiments, an improved cycle generative adversarial network-based laminated bar code recognition scheme is proposed, which specifically includes:

[0151] 1. Image preprocessing: After obtaining the input laminated bar code image, the image is converted into a grayscale image to simplify the image content, remove redundant information, and highlight the brightness information, which is helpful for subsequent processing. Then, the grayscale image is normalized to scale the pixel value to 0 to 1. Through normalization, the numerical stability of the model during training can be ensured, and the calculation problem caused by too large or too small numerical range can be prevented.

[0152] 2. Generator model: The improved BAM-UNet structure is adopted. On the basis of the original U-Net network structure, first, the boundary attention module is introduced to replace the original skip connection, which is used to enhance the feature structure and detail information. The structural information helps to locate the bar code area, and the detail features such as line edges and width changes determine the reconstruction accuracy. The generated feature map after fusion is rich and accurate in structure and detail information, which helps to generate high-definition repaired images. Secondly, by integrating the spatial attention module and the channel attention module, the image reconstruction effect is significantly improved. Specifically, the spatial attention module is embedded after the first downsampling convolution layer, which dynamically adjusts the spatial weight of the feature map by learning the importance of each spatial position, thereby highlighting the key areas in the image (such as bar code edges and target outlines). The channel attention module is added after the last downsampling convolution layer, which dynamically adjusts the channel weight of the feature map, emphasizes useful feature channels and suppresses unimportant channels, and further optimizes feature representation. This design enables the model to more accurately capture image details and improve reconstruction performance in complex scenarios.

[0153] As shown in Figure 3 , Figure 3 is a U-shaped network structure diagram provided by the third embodiment of the bar code image recognition method based on the cycle generative adversarial network of the present application. First, the preprocessed 256x256 single-channel laminated bar code image is input, and the image is converted into 64 channels through an initial 3x3 convolution layer. Subsequently, multiple downsampling stages are performed, each of which includes a convolution layer, a batch normalization, and a ReLU activation function, and the feature transmission and reconstruction effect is enhanced through residual connection and attention mechanism (including spatial attention SA and channel attention CA). Finally, the image size is gradually restored through the upsampling stage until the output is a clear bar code image with the same size as the input. In the whole process, the network combines the feature maps of the encoder and the decoder through the boundary perception module (BAM) to realize high-quality image reconstruction.

[0154] As shown in Figure 4 ,Figure 4 The boundary attention module structure schematic diagram provided by the third embodiment of the barcode image recognition method based on the cycle generative adversarial network is provided. The boundary attention module receives a feature map X with a size of HxWxD in , respectively through SimAM (Simple Attention Module), spatial attention SA module, and the feature maps after two times of processing are respectively Hadamard product with the original feature map X in , and finally the enhanced feature map is obtained. The similarity perception activation module is used to calculate the similarity between each pixel and its surrounding pixels in the feature map, so as to dynamically adjust the weight of each pixel, thereby realizing the enhancement of important features and the suppression of irrelevant features. The spatial attention module is used to analyze the importance of each spatial position in the feature map, dynamically adjust the weight, and highlight the key regions such as barcode edges. The structure and detail information of the feature are strengthened, wherein the structure information is helpful for positioning the barcode region, and the detail feature is related to the reconstruction accuracy of line edges and width changes, so as to generate a feature map with rich structure and details and high precision, which helps to generate a high-definition repaired image.

[0155] 3. Discriminator model: a simple and efficient 4-layer convolutional network structure is adopted, and a full connection layer is added at the end. Specifically, the model gradually extracts multi-level features of the input image through four convolutional operations, and an activation function and a normalization operation are connected after each convolutional operation, so as to enhance the feature expression ability and stabilize the training process. The last full connection layer maps the features extracted by convolution to a single output, which is used to judge the authenticity of the input image. This design not only reduces the model complexity, but also ensures the sensitivity and discrimination ability of the discriminator to image details, thereby effectively supporting the training of the generative adversarial network.

[0156] 4. Loss function design: the loss function is a core component in the training process of the cycle generative adversarial network model, and directly affects the performance of the generator and the discriminator. The present scheme designs multiple loss functions to ensure that the model can generate high-quality reconstructed clear images and maintain the semantic consistency of the images. Specifically, the following loss functions are included:

[0157] 4.1 Adversarial loss: used to train the generator and the discriminator, so that the generator can generate realistic images, and the discriminator can accurately distinguish between generated images and real images. The following domain X represents the original film image, and the domain Y represents the high-definition reconstructed image. For the generator G and the discriminator DY from the domain X to the domain Y, the adversarial loss can be represented as:

[0158] L adv (G,D Y )=E y~pdata(Y) [logD Y (y)]+Ex~pdata(X) [log(1-D Y (G(x)))]

[0159] where G is a generator from domain X to domain Y, D Y is a discriminator to determine whether an image is a real image from domain Y or an image generated by generator G, x ~ p data (X) represents an image sampled from the data distribution of domain X, y ~ p data (Y) represents an image sampled from the data distribution of domain Y, E represents the expected value for calculating the average value, D Y (y) represents the probability that the discriminator considers y to be domain Y, G(x) represents the generator G converting the image x of domain X to the image of domain Y, D Y (G(x)) represents the probability that the discriminator considers the generated data G(x) to be domain Y.

[0160] For the generator F from domain Y to domain X and the discriminator D X , the adversarial loss can be represented as:

[0161] L adv (F,D X )=E x~pdata(X) [logD X (x)]+E y~pdata(Y) [log(1-D X (F(y)))]

[0162] where F is a generator from domain Y to domain X, D X is a discriminator to determine whether an image is a real image from domain X or an image generated by generator F, x ~ p data (X) represents an image sampled from the data distribution of domain X, y ~ p data (Y) represents an image sampled from the data distribution of domain Y, E represents the expected value for calculating the average value, D X (x) represents the probability that the discriminator considers x to be domain X, F(y) represents the generator F converting the image y of domain Y to the image of domain X. D X (F(y)) represents the probability that the discriminator considers the generated data F(y) to be domain X.

[0163] 4.2 Cycle Consistency Loss: It can ensure that the barcode image remains consistent when it goes from the film-covered scene to the reconstructed clear image and returns to the film-covered scene, preventing mode collapse. The cycle consistency loss can be represented as:

[0164] L cycle (G,F)=E x~pdata(x) [||F(G(x))-x||1]+Ey~pdata(Y) [||G(F(y))-y||1]

[0165] where G denotes a generator from domain X to domain Y, F denotes a generator from domain Y to domain X, G(x) denotes the result of generator G transforming a domain X image x into a domain Y image, F(G(x)) denotes the result of generator F transforming a domain Y image G(x) back into domain X, F(y) denotes the result of generator F transforming a domain Y image y into a domain X image, G(F(y)) denotes the result of generator G transforming a domain X image F(y) back into a domain Y image, ||·||1 denotes the L1 norm, i.e., the sum of the absolute values of the elements in a vector, used to measure the difference between two vectors, ||F(G(x))-x||1 denotes the difference between the original domain X image x and the image after being transformed by generator G into a domain Y image and then transformed back into a domain X image by generator F. ||G(F(y))-y||1 denotes the difference between the original domain Y image y and the image after being transformed by generator F into a domain X image and then transformed back into a domain Y image by generator G.

[0166] 4.3 Identity Loss: Ensures that the input barcode image remains unchanged when no transformation is needed, enhancing the stability of the generator. Identity loss can be represented as:

[0167] L identity (G,F)=E x~pdata(X) [||G(x)-x||1]+E y~pdata(Y) [||F(y)-y||1]

[0168] where G is a generator from domain X to domain Y, F is a generator from domain Y to domain X, x ~ p data (X) denotes an image sampled from the data distribution of domain X, y ~ p data (Y) denotes an image sampled from the data distribution of domain Y, G(x) denotes the result of generator G transforming a domain X image x into a domain Y image, F(y) denotes the result of generator F transforming a domain Y image y into a domain X image. ||G(x)-x||1 denotes the difference between the original image x and the image generated by generator G when the input image x already belongs to domain X. ||F(y)-y||1 denotes the difference between the original image y and the image generated by generator F when the input image y already belongs to domain Y.

[0169] 4.4 Structural Loss: Ensures that the generated high-definition reconstructed barcode image is structurally consistent with the barcode of the input film image, enhancing the stability of the generator. Structural loss can be represented as:

[0170] L structural (G,F)=E x~pdata(X)[1-SSIM(G(x),x)]+E y~pdata(Y) [1-SSIM(F(y),y)]

[0171] Where G is the generator from domain X to domain Y, F is the generator from domain Y to domain X, x~p data (X) represents an image sampled from the data distribution of domain X, y~p data (Y) represents an image sampled from the data distribution of domain Y, SSIM(G(x),x) represents the structural similarity index between the generated image G(x) and the original image x, and SSIM(F(y),y) represents the structural similarity index between the generated image F(y) and the original image y.

[0172] SSIM(x,y)=[(2μ x μ y +c1)(2σ xy +c2)] / [(μ x 2 +μ y 2 +c1)(σ x 2 +σ y 2 +c2)]

[0173] where μ x and μ y are the mean of images x and y, σ x 2 and σ y 2 are the variances of images x and y, σ xy is the covariance of images x and y, c1 and c2 are constants used to stabilize the formula.

[0174] 4.5 Total loss function:

[0175] L total =L adv +λ cycle ·L cycle +λ identity ·L identity +λ ssim ·L structural

[0176] where λ cycle and λ identity Set to 10 and 5, λ ssim Set to 1.

[0177] In the model training stage, first input the mulch barcode image and the corresponding clear barcode image, then preprocess these images, including grayscale and normalization, to simplify the image content and highlight the brightness information. Next, through the generator with the improved BAM-UNet structure, using the boundary attention module (BAM), spatial attention (SA) and channel attention (CA) mechanism, the preprocessed images are reconstructed to output clear barcode images. Then, the discriminator discriminates the authenticity of the reconstructed clear images through its 4-layer convolutional network and fully connected layer. In this process, the performance of the generator and the discriminator is evaluated by calculating the adversarial loss, cycle consistency loss, structural loss and identity loss. Finally, the model parameters of the generator and the discriminator are updated according to the results of the loss function until the training is completed, thereby improving the recognition effect of the barcode in the mulch scene.

[0178] In the model testing stage, first input the mulch barcode image, then preprocess it, including converting to a grayscale image and normalization processing, to simplify the image content and highlight the brightness information. Next, the generator with the improved BAM-UNet structure uses the boundary perception module (BAM), spatial attention (SA) and channel attention (CA) mechanism to process the preprocessed image, and reconstructs a clear barcode image. Then decoding is performed to identify the barcode content. The entire mulch barcode recognition process is completed. This process aims to improve the recognition accuracy and robustness of blurred barcode images.

[0179] In this embodiment, based on the improved CycleGAN network architecture, a special design is made to solve the problem of insufficient barcode recognition accuracy in the mulch scene. By improving the CycleGAN network structure, including introducing the BAM-UNet generator with the boundary perception module (BAM), spatial attention (SA) and channel attention (CA) module, and a high-efficiency multi-layer convolutional network structure discriminator, the mulch barcode image is reconstructed in depth and clarity. Involving image preprocessing, feature extraction, reconstruction and authenticity discrimination, through the loss function design of adversarial loss, cycle consistency loss, structural loss and identity loss, the stability and efficiency of the model in the training process are ensured, and the recognition rate of the mulch barcode is significantly improved, even in the case of poor imaging, reliable recognition results can be obtained.

[0180] It should be noted that the above examples are only for understanding the present application and do not constitute a limitation on the present application based on the barcode image recognition method based on the cycle generative adversarial network. More forms of simple transformation based on this technical concept are within the protection scope of the present application.

[0181] The present application also provides a barcode image recognition device based on the cycle generative adversarial network, please refer to Figure 5The bar code image recognition device based on the cycle generative adversarial network comprises:

[0182] An acquisition module 10 is configured to acquire a coated bar code image.

[0183] A reconstruction module 20 is configured to perform clear reconstruction on the coated bar code image based on a preset cycle generative adversarial network model to obtain a reconstructed coated bar code image, wherein the cycle generative adversarial network model is constructed based on a cycle generative adversarial network structure and an attention mechanism.

[0184] An identification module 30 is configured to perform bar code identification on the reconstructed coated bar code image to obtain bar code content.

[0185] Optionally, the reconstruction module 20 is further configured to:

[0186] construct a generator model of a U-shaped network structure and introduce an attention mechanism into the generator model;

[0187] construct a discriminator model of a multi-layer convolutional network structure;

[0188] construct the cycle generative adversarial network model based on the generator model and the discriminator model.

[0189] Optionally, the reconstruction module 20 is further configured to:

[0190] acquire an original coated bar code image and a target bar code image;

[0191] reconstruct the original coated bar code image through the generator model to obtain a reconstructed bar code image;

[0192] perform authenticity discrimination on the reconstructed bar code image through the discriminator model according to the target bar code image to obtain an image discrimination result;

[0193] calculate a loss value between the original coated bar code image and the reconstructed bar code image through a preset loss function according to the image discrimination result, and update model parameters of the cycle generative adversarial network model according to the loss value.

[0194] Optionally, the generator model comprises an encoder and a decoder, and the reconstruction module 20 is further configured to:

[0195] input the coated bar code image into the generator model for processing as follows:

[0196] perform feature extraction on the coated bar code image through the encoder to generate a feature map;

[0197] According to the feature map, the laminated barcode image is reconstructed by the decoder, and a reconstructed laminated barcode image is output.

[0198] Optionally, the generator model comprises an encoder and a decoder, the generator model is configured with one or more of a boundary attention module, a spatial attention module and a channel attention module, the boundary attention module is embedded in a skip connection between the encoder and the decoder, and the spatial attention module and the channel attention module are embedded in an encoding path of the encoder.

[0199] Optionally, the encoder comprises a plurality of down-sampling stages, the decoder comprises a plurality of up-sampling stages, and the reconstruction module 20 is further configured to:

[0200] embed the boundary attention module in a skip connection between an output layer of each down-sampling stage of the encoder and an input layer of a corresponding up-sampling stage of the decoder;

[0201] embed the spatial attention module after the output of a convolutional layer of the first down-sampling stage of the encoder;

[0202] embed the channel attention module after the output of a convolutional layer of the last down-sampling stage of the encoder.

[0203] Optionally, the reconstruction module 20 is further configured to:

[0204] perform a grayscale conversion on the laminated barcode image to obtain a laminated barcode grayscale image;

[0205] perform a normalization on the laminated barcode grayscale image to obtain a normalized laminated barcode grayscale image, and perform a clear reconstruction on the normalized laminated barcode grayscale image based on the cycle generative adversarial network model to obtain the reconstructed laminated barcode image.

[0206] The barcode image recognition device based on the cycle generative adversarial network provided in the present application adopts the barcode image recognition method based on the cycle generative adversarial network in the above embodiments, and can solve the technical problems of the existing barcode image recognition method, such as recognition failure and high error rate caused by unclear imaging of the barcode in the laminating scene. Compared with the prior art, the barcode image recognition device based on the cycle generative adversarial network provided in the present application has the same beneficial effects as the barcode image recognition method based on the cycle generative adversarial network provided in the above embodiments, and other technical features in the barcode image recognition device based on the cycle generative adversarial network are the same as the features disclosed in the above embodiments, which will not be repeated here.

[0207] The application provides a bar code image recognition device based on a cycle generative adversarial network. The bar code image recognition device based on the cycle generative adversarial network comprises at least one processor and a memory in communication connection with the at least one processor. The memory stores instructions executable by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the bar code image recognition method based on the cycle generative adversarial network in the first embodiment.

[0208] Reference will now be made to the following description Figure 6 which shows a structural diagram of a bar code image recognition device based on a cycle generative adversarial network suitable for implementing embodiments of the application. The bar code image recognition device based on the cycle generative adversarial network in the embodiments of the application can include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistant), PADs (Portable Application Description), PMPs (Portable Media Player), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. Figure 6 The bar code image recognition device based on the cycle generative adversarial network shown is only an example and should not impose any limitation on the functions and use range of the embodiments of the application.

[0209] As Figure 6As shown, the barcode image recognition device based on cycle generative adversarial network can include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to programs stored in a read-only memory 1002 or loaded from a storage device 1003 into a random access memory 1004. In the random access memory 1004, various programs and data required for the barcode image recognition device based on cycle generative adversarial network to operate are also stored. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are connected to each other through a bus 1005. An input / output interface 1006 is also connected to the bus. Generally, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; the storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the barcode image recognition device based on cycle generative adversarial network to communicate with other devices wirelessly or by wire to exchange data. Although the barcode image recognition device based on cycle generative adversarial network with various systems is shown in the figure, it should be understood that all the systems shown are not required to be implemented or possessed. More or fewer systems can be alternatively implemented or possessed.

[0210] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication device, or installed from the storage device 1003, or installed from the read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.

[0211] The bar code image recognition device based on the cycle generative adversarial network provided in the application adopts the bar code image recognition method based on the cycle generative adversarial network in the above embodiment, and can solve the technical problems of the existing bar code image recognition method, such as recognition failure and high error rate caused by unclear bar code imaging in the film coating scene. Compared with the prior art, the bar code image recognition device based on the cycle generative adversarial network provided in the application has the same beneficial effects as the bar code image recognition method based on the cycle generative adversarial network provided in the above embodiment, and other technical features in the bar code image recognition device based on the cycle generative adversarial network are the same as the features disclosed in the previous embodiment method, which will not be repeated here.

[0212] It should be understood that various parts of the present application can be realized by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0213] The above is merely specific implementation of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

[0214] The present application provides a computer readable storage medium having computer readable program instructions (i.e. computer programs) stored thereon, the computer readable program instructions being used to execute the bar code image recognition method based on the cycle generative adversarial network in the above embodiment.

[0215] The computer readable storage medium provided in the application may, for example, be a U disk, but is not limited to an electric, magnetic, optical, electromagnetic, infrared or semiconductor system, system or device, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electric connection with one or more conductive wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiment, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to an electric wire, an optical cable, an RF (Radio Frequency), etc., or any suitable combination of the above.

[0216] The above computer readable storage medium can be contained in the bar code image recognition device based on the cycle generative adversarial network, or can exist independently without being assembled into the bar code image recognition device based on the cycle generative adversarial network.

[0217] The above computer readable storage medium carries one or more programs, when the one or more programs are executed by the bar code image recognition device based on the cycle generative adversarial network, the bar code image recognition device based on the cycle generative adversarial network is caused to: acquire a laminated bar code image; based on a preset cycle generative adversarial network model, perform clear reconstruction on the laminated bar code image to obtain a reconstructed laminated bar code image, the cycle generative adversarial network model being constructed based on a cycle generative adversarial network structure and an attention mechanism; perform bar code recognition on the reconstructed laminated bar code image to obtain bar code content.

[0218] Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0219] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment or part of code, and the module, program segment or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, as well as the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or can be implemented using a combination of dedicated hardware and computer instructions.

[0220] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.

[0221] The computer-readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned barcode image recognition method based on a recurrent generative adversarial network. This computer-readable storage medium can address the technical issues of existing barcode image recognition methods in lamination scenarios, such as unclear barcode imaging, which leads to recognition failures and high error rates. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the barcode image recognition method based on a recurrent generative adversarial network provided in the aforementioned embodiments, and are not further elaborated here.

[0222] The application also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the bar code image recognition method based on the cycle generative adversarial network as described above.

[0223] The computer program product provided by the application can solve the technical problems of the existing bar code image recognition method, such as recognition failure and high error rate caused by unclear bar code imaging in the film coating scene. Compared with the prior art, the beneficial effects of the computer program product provided by the application are the same as those of the bar code image recognition method based on the cycle generative adversarial network provided by the above-mentioned embodiments, and are not described here.

[0224] The above only describes some embodiments of the application, and does not limit the patent scope of the application. Any equivalent structural transformation, direct / indirect application in other related technical fields, or direct / indirect application in other related technical fields based on the technical concept of the application, the contents of the specification and the drawings are included in the patent protection scope of the application.

Claims

1. A barcode image recognition method based on a cyclic generative adversarial network, characterized in that: The barcode image recognition method based on the cyclic generative adversarial network includes: Get the laminated barcode image; Based on a preset cyclic generative adversarial network model, the coated barcode image is clearly reconstructed to obtain a reconstructed coated barcode image, wherein the cyclic generative adversarial network model is constructed based on a cyclic generative adversarial network structure and an attention mechanism; The reconstructed coated barcode image is subjected to barcode recognition to obtain barcode content.

2. The barcode image recognition method based on a cyclic generative adversarial network according to claim 1, characterized in that: Before the step of reconstructing the coated barcode image based on the preset cyclic generative adversarial network model to obtain the reconstructed coated barcode image, the method further includes: Constructing a generator model with a U-shaped network structure and introducing an attention mechanism into the generator model; Construct a discriminator model with a multi-layer convolutional network structure; Based on the generator model and the discriminator model, the cyclic generative adversarial network model is constructed.

3. The barcode image recognition method based on a cyclic generative adversarial network according to claim 2, characterized in that: Before the step of reconstructing the coated barcode image based on the preset cyclic generative adversarial network model to obtain the reconstructed coated barcode image, the method further includes: Obtain the original coated barcode image and the target barcode image; Reconstructing the original coated barcode image through the generator model to obtain a reconstructed barcode image; According to the target barcode image, the authenticity of the reconstructed barcode image is discriminated by the discriminator model to obtain an image discrimination result; According to the image discrimination result, a loss value between the original coated barcode image and the reconstructed barcode image is calculated by a preset loss function, and the model parameters of the recurrent generative adversarial network model are updated according to the loss value.

4. The barcode image recognition method based on a cyclic generative adversarial network according to claim 2, wherein: The generator model includes an encoder and a decoder. The step of reconstructing the coated barcode image based on a preset cyclic generative adversarial network model to obtain a reconstructed coated barcode image includes: The coated barcode image is input into the generator model for the following processing: Extracting features from the coated barcode image using the encoder to generate a feature map; The decoder reconstructs the coated barcode image according to the feature map, and outputs the reconstructed coated barcode image.

5. The barcode image recognition method based on a cyclic generative adversarial network according to claim 2, characterized in that: The generator model includes an encoder and a decoder, and the generator model is configured with one or more of a boundary attention module, a spatial attention module and a channel attention module. The boundary attention module is embedded in the jump connection between the encoder and the decoder, and the spatial attention module and the channel attention module are embedded in the encoding path of the encoder.

6. The barcode image recognition method based on a cyclic generative adversarial network according to claim 5, characterized in that: The encoder includes several downsampling stages, and the decoder includes several upsampling stages. The step of introducing an attention mechanism into the generator model comprises: Embedding the boundary attention module in the skip connection between the output layer of each downsampling stage in the encoder and the input layer of the corresponding upsampling stage in the decoder; Embed the spatial attention module after the output of the convolutional layer of the first downsampling stage in the encoder; The channel attention module is embedded after the output of the convolutional layer of the last downsampling stage in the encoder.

7. The barcode image recognition method based on a cyclic generative adversarial network according to claim 1, characterized in that: Before the step of reconstructing the coated barcode image based on the preset cyclic generative adversarial network model to obtain the reconstructed coated barcode image, the method further includes: Performing grayscale conversion processing on the coated barcode image to obtain a coated barcode grayscale image; The coated barcode grayscale image is normalized to obtain a normalized coated barcode grayscale image, and the normalized coated barcode grayscale image is clearly reconstructed based on the cyclic generative adversarial network model to obtain the reconstructed coated barcode image.

8. A barcode image recognition device based on a cyclic generative adversarial network, characterized in that: The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the barcode image recognition method based on a cyclic generative adversarial network as claimed in any one of claims 1 to 7.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the barcode image recognition method based on the cyclic generative adversarial network as described in any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The computer program product includes a computer program, which, when executed by a processor, implements the steps of the barcode image recognition method based on a recurrent generative adversarial network as claimed in any one of claims 1 to 7.