Bar code super-resolution method and device based on lightweight attention mechanism

The barcode super-resolution method using a lightweight attention mechanism solves the problems of large network parameter scale and high deployment difficulty, and achieves high-precision super-resolution processing of low-resolution barcode images, thereby improving the decoding accuracy of the barcode reader.

CN122287668APending Publication Date: 2026-06-26SHENZHEN YANXIANG JINMA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN YANXIANG JINMA TECH CO LTD
Filing Date
2026-03-24
Publication Date
2026-06-26

Smart Images

  • Figure CN122287668A_ABST
    Figure CN122287668A_ABST
Patent Text Reader

Abstract

This application relates to a barcode super-resolution method and apparatus based on a lightweight attention mechanism. The method includes: acquiring a barcode image to be processed; performing shallow feature extraction on the barcode image to obtain a shallow feature map, and performing deep feature extraction on the shallow feature map to obtain a deep feature map; performing attention calculation on the barcode region of the deep feature map to obtain an enhanced feature map; fusing the shallow feature map and the enhanced feature map to obtain a first fused feature map; and reconstructing the first fused feature map to obtain a first super-resolution barcode image. This application solves the problems in related technologies where inputting low-resolution barcode images reduces the recognition accuracy of the barcode reader, and existing barcode super-resolution technologies have large network parameter scales and high deployment difficulty. It achieves improved super-resolution processing accuracy of barcode images while reducing computational load, thereby contributing to improved decoding accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, and in particular relates to a barcode super-resolution method and apparatus based on a lightweight attention mechanism. Background Technology

[0002] With the rapid development of technology, barcode technology has become increasingly mature and is used in various fields of commodity circulation. As the core device for barcode recognition, the decoding performance of the barcode reader directly depends on the clarity of the input barcode image. When a low-resolution barcode image is input into the barcode reader, the reader may miss or misdetect the barcode due to blurred boundaries of the barcode area or loss of pixel information.

[0003] Barcode super-resolution methods based on Convolutional Neural Networks (CNNs) extract features through deep convolutions, which can improve the recovery of details. However, their network parameters are large and computationally complex, making them difficult to deploy in embedded barcode readers.

[0004] Currently, no effective solution has been proposed to address the issues that inputting low-resolution barcode images reduces the recognition accuracy of barcode readers, and that existing barcode super-resolution technologies have large network parameter scales and are difficult to deploy. Summary of the Invention

[0005] This application provides a barcode super-resolution method and apparatus based on a lightweight attention mechanism, which at least solves the problems in related technologies where inputting low-resolution barcode images reduces the recognition accuracy of barcode readers, and where existing barcode super-resolution technologies have large network parameter scales and are difficult to deploy.

[0006] In a first aspect, embodiments of this application provide a barcode super-resolution method, comprising: acquiring a barcode image to be processed; performing shallow feature extraction on the barcode image to be processed to obtain a shallow feature map, and performing deep feature extraction on the shallow feature map to obtain a deep feature map; performing attention calculation on the barcode region of the deep feature map to obtain an enhanced feature map; fusing the shallow feature map and the enhanced feature map to obtain a first fused feature map; and reconstructing the first fused feature map to obtain a first super-resolution barcode image.

[0007] In some embodiments, the step of performing attention calculation on the barcode region of the deep feature map to obtain an enhanced feature map includes: for each pixel in the deep feature map, calculating the pixel difference between the pixel and its neighboring pixels; determining the barcode region in the deep feature map based on the pixel difference of each pixel in the deep feature map; and performing attention calculation on the barcode region to obtain the enhanced feature map.

[0008] In some embodiments, the adjacent pixels include pixels adjacent to the pixel to the left or right, and pixels adjacent to the pixel upwards or downwards; determining the barcode region in the deep feature map based on the pixel difference of each pixel in the deep feature map includes: for each pixel in the deep feature map, calculating the sum of the absolute values ​​of the pixel differences between the pixel and each of the pixel's adjacent pixels to obtain the boundary response value of the pixel; if the boundary response value of the pixel is greater than or equal to a preset threshold, marking the pixel as a barcode pixel; if the boundary response value of the pixel is less than the preset threshold, marking the pixel as a background pixel; and determining the barcode region in the deep feature map based on each barcode pixel and each background pixel in the deep feature map.

[0009] In some embodiments, the step of performing attention calculation on the barcode region to obtain the enhanced feature map includes: for each barcode pixel in the barcode region, constructing a pixel region of a preset size centered on the barcode pixel; calculating the pixel value variance of the barcode pixels in each pixel region; assigning attention weights to the barcode pixels based on the pixel value variance of the pixel region corresponding to the barcode pixel; and performing feature enhancement on the deep feature map based on the attention weights of each barcode pixel in the barcode region to obtain the enhanced feature map.

[0010] In some embodiments, the step of performing shallow feature extraction on the barcode image to be processed to obtain a shallow feature map, and performing deep feature extraction on the shallow feature map to obtain a deep feature map includes: performing shallow feature extraction on the barcode image to be processed through the top-level shallow residual block of a plurality of concatenated residual blocks to obtain the shallow feature map; and performing continuous feature extraction on the shallow feature map through a plurality of deep residual blocks other than the shallow residual block to obtain the deep feature map.

[0011] In some embodiments, reconstructing the first fused feature map to obtain the first super-resolution barcode image includes: upsampling the first fused feature map to obtain a first upsampled feature map; performing a convolution operation on the first upsampled feature map to obtain a first convolutional feature map; and compressing the number of channels of the first convolutional feature map to obtain the first super-resolution barcode image.

[0012] In some embodiments, after compressing the number of channels of the first convolutional feature map to obtain the first super-resolution barcode image, the method further includes: upsampling the shallow feature map to obtain a second upsampled feature map, wherein the upsampling factor of the shallow feature map is the same as that of the first fused feature map; fusing the second upsampled feature map with the first convolutional feature map to obtain a second fused feature map; upsampling the second fused feature map to obtain a third upsampled feature map, wherein the upsampling factor of the second fused feature map is the same as that of the shallow feature map and the first fused feature map; performing a convolution operation on the third upsampled feature map to obtain a second convolutional feature map; and compressing the number of channels of the second convolutional feature map to obtain a second super-resolution barcode image.

[0013] Secondly, embodiments of this application provide a barcode super-resolution device, comprising: an acquisition module for acquiring a barcode image to be processed; a feature extraction module for performing shallow feature extraction on the barcode image to be processed to obtain a shallow feature map, and performing deep feature extraction on the shallow feature map to obtain a deep feature map; an attention calculation module for performing attention calculation on the barcode region of the deep feature map to obtain an enhanced feature map; a feature fusion module for fusing the shallow feature map and the enhanced feature map to obtain a first fused feature map; and a reconstruction module for reconstructing the first fused feature map to obtain a first super-resolution barcode image.

[0014] Thirdly, embodiments of this application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the barcode super-resolution method of any of the first aspects described above.

[0015] Fourthly, embodiments of this application provide a computer program product, including a computer program, which, when run, causes the barcode super-resolution method described in any one of the first aspects to be executed.

[0016] Compared to related technologies, the barcode super-resolution method and apparatus based on a lightweight attention mechanism provided in this application can acquire a barcode image to be processed, extract shallow features from the barcode image to obtain a shallow feature map, extract deep features from the shallow feature map to obtain a deep feature map, then perform attention calculation on the barcode region of the deep feature map to obtain an enhanced feature map, and then fuse the shallow feature map and the enhanced feature map to obtain a first fused feature map. Finally, the first fused feature map is reconstructed to obtain a first super-resolution barcode image. Performing attention calculation only on the barcode region of the deep feature map can significantly reduce the computational load of the attention mechanism; enhancing the features of the deep feature map through attention calculation can strengthen the features of the barcode region; and fusing the shallow feature map and the enhanced feature map can combine the texture information of the shallow feature map with the semantic information of the enhanced feature map, thereby improving the accuracy of subsequent super-resolution processing while reducing the computational load, and thus improving decoding accuracy. This application addresses the issues in related technologies where inputting low-resolution barcode images reduces the reader's recognition accuracy, and where existing barcode super-resolution technologies have large network parameter scales and are difficult to deploy. It achieves improved super-resolution processing accuracy of barcode images while reducing computational load, thereby helping to improve decoding accuracy.

[0017] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart of a barcode super-resolution method according to an embodiment of this application; Figure 2 This is a schematic diagram of the structure of multiple residual blocks according to an embodiment of this application; Figure 3 This is a flowchart of a barcode super-resolution method according to another embodiment of this application; Figure 4 This is a flowchart of a barcode super-resolution method according to another embodiment of this application; Figure 5 This is a flowchart of a barcode super-resolution method according to another embodiment of this application; Figure 6This is a schematic diagram of the structure of a barcode super-resolution device according to an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a terminal device according to an embodiment of this application. Detailed Implementation

[0020] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0021] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0022] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0023] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0024] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0025] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0026] With the rapid development of technology, barcode technology has become increasingly mature and is used in various fields of commodity circulation. As the core device for barcode recognition, the decoding performance of the barcode reader directly depends on the clarity of the input barcode image. When a low-resolution barcode image is input into the barcode reader, the reader may miss or misdetect the barcode due to blurred boundaries of the barcode area or loss of pixel information.

[0027] Barcode super-resolution methods based on Convolutional Neural Networks (CNNs) extract features through deep convolutions, which can improve the recovery of details. However, their network parameters are large and computationally complex, making them difficult to deploy in embedded barcode readers.

[0028] Currently, no effective solution has been proposed to address the issues that inputting low-resolution barcode images reduces the recognition accuracy of barcode readers, and that existing barcode super-resolution technologies have large network parameter scales and are difficult to deploy.

[0029] In view of this, embodiments of this application provide a barcode super-resolution method, which can acquire a barcode image to be processed, extract shallow features from the barcode image to obtain a shallow feature map, extract deep features from the shallow feature map to obtain a deep feature map, then perform attention calculation on the barcode region of the deep feature map to obtain an enhanced feature map, and then fuse the shallow feature map and the enhanced feature map to obtain a first fused feature map. Finally, the first fused feature map is reconstructed to obtain a first super-resolution barcode image. Performing attention calculation only on the barcode region of the deep feature map can significantly reduce the computational load of the attention mechanism; enhancing the features of the deep feature map through attention calculation can strengthen the features of the barcode region; and fusing the shallow feature map and the enhanced feature map can combine the texture information of the shallow feature map and the semantic information of the enhanced feature map, thereby improving the accuracy of subsequent super-resolution processing while reducing the computational load, and thus improving decoding accuracy. This application addresses the issues in related technologies where inputting low-resolution barcode images reduces the reader's recognition accuracy, and where existing barcode super-resolution technologies have large network parameter scales and are difficult to deploy. It achieves improved super-resolution processing accuracy of barcode images while reducing computational load, thereby helping to improve decoding accuracy.

[0030] The following will combine Figure 1 This application describes a barcode super-resolution method according to one embodiment. Please refer to [link to relevant documentation]. Figure 1 , Figure 1 This is a flowchart of a barcode super-resolution method according to an embodiment of this application, such as... Figure 1 As shown, the method includes: Step S101: Obtain the barcode image to be processed.

[0031] In this embodiment, the initial image can be preprocessed to obtain a barcode image to be processed. The initial image can be a low-resolution grayscale image (e.g., with a bit depth of 8), and can include barcodes of various barcode types (e.g., QR codes, DataMatrix, GS1-128, etc.).

[0032] The preprocessing described above may include: normalizing the initial image to map the pixel value of each pixel in the initial image to [0, 1] to obtain a normalized image; and using a 3×3 Gaussian filter (standard deviation σ=0.5) to denoise the normalized image to obtain the barcode image to be processed.

[0033] The above processing can reduce the interference of noise in the initial image on subsequent super-resolution processing.

[0034] Step S102: Perform shallow feature extraction on the barcode image to be processed to obtain a shallow feature map, and then perform deep feature extraction on the shallow feature map to obtain a deep feature map.

[0035] In this embodiment, a lightweight barcode feature extraction (L-BFE) mechanism can be set up to extract the basic features of the barcode image to be processed, thereby obtaining a multi-scale feature map.

[0036] Figure 2 This is a schematic diagram of the structure of multiple residual blocks according to an embodiment of this application, such as... Figure 2 As shown, step S102 above includes: using the shallow residual block located at the top layer of a plurality of serially connected residual blocks (i.e., Figure 2 The residual block 1) performs shallow feature extraction on the barcode image to be processed to obtain a shallow feature map; and then performs continuous feature extraction on the shallow feature map through multiple deep residual blocks other than the shallow residual blocks to obtain a deep feature map.

[0037] In this embodiment, the L-BFE mechanism extracts features from the barcode image to be processed through eight concatenated residual blocks. Each residual block can consist of two depthwise separable modules, each including: a 3×3 depthwise separable convolution module, a batch normalization module, a ReLU activation module, and a 1×1 convolution module. The combination of 3×3 depthwise separable convolution and 1×1 convolution replaces the traditional 3×3 convolution. Each residual block learns the periodic features of the barcode through residual connections, guiding the direction of feature extraction, and finally outputs shallow and deep feature maps.

[0038] Compared to using convolutional neural networks and generative adversarial networks for barcode super-resolution processing, the residual block design described above has lower computational and parameter requirements, thus enabling lightweight modeling while ensuring feature extraction accuracy. This makes it suitable for embedded devices with lower computational performance and storage capacity (such as barcode readers).

[0039] Step S103: Perform attention calculation on the barcode region of the deep feature map to obtain the enhanced feature map.

[0040] In this embodiment, a lightweight attention module (LAM) can be set up to perform attention calculations on the barcode region of the deep feature map, so as to highlight the boundary information of the barcode region and the features of the information-dense areas in the barcode region.

[0041] By performing attention calculations only on the barcode region of the deep feature map and not on the background region, the high computational load caused by calculating global attention can be avoided, while also ensuring that detailed information of the barcode region is not missed.

[0042] Figure 3 This is a flowchart of a barcode super-resolution method according to another embodiment of this application, such as... Figure 3 As shown, step S103 above includes: Step S301: For each pixel in the deep feature map, calculate the pixel difference between the pixel and its neighboring pixels.

[0043] In this embodiment, adjacent pixels include pixels that are adjacent to the pixel to the left or right, and pixels that are adjacent to the pixel upwards or downwards.

[0044] As an example, for each pixel in a deep feature map, the pixel difference between that pixel and its right-hand neighbor, and the pixel difference between that pixel and its upward-hand neighbor can be calculated.

[0045] Since barcode areas in an image typically have high contrast and periodic distribution, it is possible to determine whether a pixel is within a barcode area by calculating the pixel difference between a pixel and its right- or top-adjacent pixels.

[0046] Step S302: Determine the barcode region in the deep feature map based on the pixel difference of each pixel in the deep feature map.

[0047] In this embodiment, step S302 includes: for each pixel in the deep feature map, calculating the sum of the absolute values ​​of the pixel differences between each pixel and its neighboring pixels to obtain the boundary response value of the pixel; if the boundary response value of the pixel is greater than or equal to a preset threshold, marking the pixel as a barcode pixel; if the boundary response value of the pixel is less than the preset threshold, marking the pixel as a background pixel; and determining the barcode region in the deep feature map based on each barcode pixel and each background pixel in the deep feature map.

[0048] In this embodiment, the boundary response value of a pixel can be calculated according to the following mathematical expression: R(x, y)=|I(x, y) I(x+1, y)∣+∣I(x, y) I(x, y+1)∣; Where R(x, y) is the pixel boundary response value, (x, y) is the position coordinate of the pixel on the deep feature map, I(x, y) is the pixel value of the pixel, I(x+1, y) is the pixel value of the pixel to the right of the pixel, and I(x, y+1) is the pixel value of the pixel to the top of the pixel.

[0049] After obtaining the boundary response value of a pixel, the boundary response value can be compared with a preset threshold. If the boundary response value of a pixel is greater than or equal to the preset threshold, the pixel can be determined to be located in the barcode area and marked as a barcode pixel; otherwise, it is marked as a background pixel.

[0050] The aforementioned preset threshold can be set adaptively. For example, the preset threshold can be equal to 1.2 times the average pixel value of all pixels on the deep feature map.

[0051] After determining the pixel type of each pixel, a mask can be obtained, which can be used to extract the barcode region from the deep feature map.

[0052] Step S303: Perform attention calculation on the barcode region to obtain an enhanced feature map.

[0053] In this embodiment, performing attention calculation only on the barcode region of the deep feature map can significantly reduce the computational load of the attention mechanism. By enhancing the features of the deep feature map through attention calculation, the features of the barcode region can be strengthened, thereby improving the accuracy of subsequent super-resolution processing while reducing the computational load, and thus improving the decoding accuracy.

[0054] In one embodiment, step S303 includes: for each barcode pixel in the barcode region, constructing a pixel region of a preset size centered on the barcode pixel; calculating the pixel value variance of the barcode pixels in each pixel region; assigning attention weights to the barcode pixels based on the pixel value variance of the pixel region corresponding to the barcode pixel; and performing feature enhancement on the deep feature map based on the attention weights of each barcode pixel in the barcode region to obtain an enhanced feature map.

[0055] In this embodiment, the preset size can be a 3×3 local window (i.e., the pixel region includes 8 other pixels in addition to the pixel located at the center of the local window). By constructing a 3×3 pixel region, attention calculation based on this pixel region can significantly reduce the computational load of the attention mechanism.

[0056] Attention weights can be assigned to barcode pixels according to the following mathematical expression: W(x, y)=Var(window(x, y)) / ∑Var(window(x, y)); Where W(x, y) is the attention weight of the barcode pixel, (x, y) is the position coordinate of the barcode pixel on the deep feature map, Var(window(x, y)) is the variance of the pixel value of the pixel region corresponding to the barcode pixel, and ∑Var(window(x, y)) is the sum of the variances of the pixel values ​​of all pixel regions on the deep feature map.

[0057] In this embodiment, the larger the variance of pixel values ​​in a pixel region, the richer the details in that pixel region. Therefore, a higher attention weight can be assigned to the barcode pixels corresponding to that pixel region.

[0058] Once the attention weights for all pixels in the deep feature map have been calculated, a weight map is obtained. Multiplying the deep feature map by this weight map yields the enhanced feature map.

[0059] By performing attention calculations on the barcode region in the deep feature map using the LAM module described above, the computational load can be reduced while focusing on the barcode region in the deep feature map, enhancing the detail information and boundary clarity of the barcode region, thereby effectively improving the accuracy of subsequent super-resolution processing.

[0060] Step S104: The shallow feature map and the enhanced feature map are fused to obtain the first fused feature map.

[0061] Step S105: Reconstruct the first fused feature map to obtain the first super-resolution barcode image.

[0062] In this embodiment, a progressive barcode feature fusion (PBFF) mechanism can be set up for feature fusion and image reconstruction. The PBFF mechanism can fuse shallow feature maps and enhanced feature maps. Since shallow feature maps contain more detailed information (e.g., edge information, texture information, local contrast information, etc.), while enhanced feature maps are processed by the LAM module and focus on the barcode area, enhancing the details and boundary clarity of the barcode area, combining the two can provide richer feature representation for subsequent upsampling processing.

[0063] In this embodiment, 2× and 4× super-resolution ratios can be supported. For example, an input barcode image of size H×W can be used to output super-resolution barcode images of size 2H×2W and 4H×4W.

[0064] In other embodiments, other super-resolution ratios may also be supported, and this application does not limit them.

[0065] Figure 4 This is a flowchart of a barcode super-resolution method according to another embodiment of this application, such as... Figure 4 As shown, step S105 above includes: Step S401: Upsample the first fused feature map to obtain the first upsampled feature map.

[0066] Step S402: Perform a convolution operation on the first upsampled feature map to obtain the first convolutional feature map.

[0067] Step S403: Compress the number of channels in the first convolutional feature map to obtain the first super-resolution barcode image.

[0068] In one embodiment, after step S403 described above, the method further includes: Step S404: Upsample the shallow feature map to obtain a second upsampled feature map. The upsampling factor of the shallow feature map is the same as that of the first fused feature map.

[0069] Step S405: Fuse the second upsampled feature map with the first convolutional feature map to obtain the second fused feature map.

[0070] Step S406: Upsample the second fused feature map to obtain a third upsampled feature map. The upsampling factor of the second fused feature map is the same as that of the shallow feature map and the first fused feature map.

[0071] Step S407: Perform a convolution operation on the third upsampled feature map to obtain the second convolutional feature map.

[0072] Step S408: Compress the number of channels in the second convolutional feature map to obtain the second super-resolution barcode image.

[0073] In this embodiment, the PBFF mechanism can achieve high-precision barcode super-resolution processing by fusing features and optimizing details in stages.

[0074] Figure 5 This is a flowchart of a barcode super-resolution method according to another embodiment of this application, such as... Figure 4 and Figure 5 As shown, firstly, we can obtain Figure 2 The top-level residual block among the multiple residual blocks shown ( Figure 2 Residual block 1 in Figure 5 The shallow feature map (H×W×64) output by the LRB1 module is fused with the enhanced feature map F1' (H×W×64) output by the LAM module in the channel dimension to obtain the first fused feature map F_fuse1 (H×W×64); then, the PixelShuffle technique is used to upsample F_fuse1 by 2 times to generate the first upsampled feature map F_up1 (2H×2W×64); subsequently, it is passed through a 3×3 depthwise separable convolutional module ( Figure 5The DW module in the DW module performs a convolution operation on F_up1 to optimize the local details of F_up1, resulting in the first convolutional feature map F_dw1 (2H×2W×64). Then, it undergoes a 1×1 convolution ( Figure 5 The 1×1Conv module in the image compresses the number of channels of F_dw1 from 64 to 1, resulting in the first super-resolution barcode image (2H×2W) in the 2× super-resolution scenario.

[0075] like Figure 5 As shown, if 4× super-resolution processing is required on the barcode image to be processed, it can be done first... Figure 2 The shallow feature map output from residual block 1 is upsampled by 2x to obtain a second upsampled feature map F_shallow_up (2H×2W×64). This is then fused with the first convolutional feature map F_dw1 in the channel dimension to generate a second fused feature map F_fuse2. Then, PixelShuffle technology can be used to upsample F_fuse2 by 2x to obtain a third upsampled feature map F_up2 (4H×4W×64). The local details of F_up2 are further optimized by a 3×3 depthwise separable convolutional module to output a second convolutional feature map F_dw2 (4H×4W×64). Finally, the number of channels of F_dw2 is compressed to 1 by a 1×1 convolution to obtain the second super-resolution barcode image (4H×4W) in the 4× super-resolution scene.

[0076] It should be noted that if the barcode image to be processed needs to be subjected to super-resolution processing at other ratios, the upsampling factor can be modified to adapt to the super-resolution processing factor.

[0077] By combining the L-BFE mechanism, LAM module, and PBFF mechanism, the number of model parameters can be effectively reduced and the super-resolution accuracy of barcodes can be improved. The L-BFE mechanism uses a depthwise separable convolution module, which can be combined with 16-bit quantization to control the number of model parameters to 4.5M, thus meeting the requirements of real-time recognition and satisfying the high-speed scanning and lightweight adaptation needs of industrial production lines. The LAM module focuses on the barcode region in the feature map, and the progressive upsampling combined with the PBFF mechanism can effectively improve the clarity of the barcode image after super-resolution processing, thereby improving the detail recovery accuracy of the barcode image.

[0078] Through the steps S101 to S105 described above, a barcode image to be processed can be obtained. Shallow feature extraction is performed on the barcode image to obtain a shallow feature map, and deep feature extraction is then performed on the shallow feature map to obtain a deep feature map. Attention calculation is then performed on the barcode region of the deep feature map to obtain an enhanced feature map. Furthermore, the shallow feature map and the enhanced feature map can be fused to obtain a first fused feature map. Finally, the first fused feature map is reconstructed to obtain a first super-resolution barcode image. Performing attention calculation only on the barcode region of the deep feature map can significantly reduce the computational load of the attention mechanism; feature enhancement of the deep feature map through attention calculation can achieve feature strengthening of the barcode region; and fusing the shallow feature map and the enhanced feature map can combine the texture information of the shallow feature map with the semantic information of the enhanced feature map, thereby improving the accuracy of subsequent super-resolution processing while reducing computational load, and thus improving decoding accuracy. This application addresses the issues in related technologies where inputting low-resolution barcode images reduces the reader's recognition accuracy, and where existing barcode super-resolution technologies have large network parameter scales and are difficult to deploy. It achieves improved super-resolution processing accuracy of barcode images while reducing computational load, thereby helping to improve decoding accuracy.

[0079] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0080] Corresponding to the barcode super-resolution method described in the above embodiments, Figure 6 A schematic diagram of a barcode super-resolution device according to an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiment of this application are shown.

[0081] Please see Figure 6 The barcode super-resolution device 5 includes: an acquisition module 50 for acquiring a barcode image to be processed; a feature extraction module 51 for performing shallow feature extraction on the barcode image to be processed to obtain a shallow feature map, and performing deep feature extraction on the shallow feature map to obtain a deep feature map; an attention calculation module 52 for performing attention calculation on the barcode region of the deep feature map to obtain an enhanced feature map; a feature fusion module 53 for fusing the shallow feature map and the enhanced feature map to obtain a first fused feature map; and a reconstruction module 54 for reconstructing the first fused feature map to obtain a first super-resolution barcode image.

[0082] In one embodiment, the attention calculation module 52 is further configured to calculate the pixel difference between adjacent pixels for each pixel in the deep feature map; determine the barcode region in the deep feature map based on the pixel difference of each pixel in the deep feature map; and perform attention calculation on the barcode region to obtain an enhanced feature map.

[0083] In one embodiment, adjacent pixels include pixels adjacent to the pixel to the left or right, and pixels adjacent to the pixel upwards or downwards; the attention calculation module 52 is further configured to calculate the sum of the absolute values ​​of the pixel differences between each pixel and its adjacent pixels for each pixel in the deep feature map, to obtain the boundary response value of the pixel; if the boundary response value of the pixel is greater than or equal to a preset threshold, the pixel is marked as a barcode pixel; if the boundary response value of the pixel is less than the preset threshold, the pixel is marked as a background pixel; and based on each barcode pixel and each background pixel in the deep feature map, the barcode region in the deep feature map is determined.

[0084] In one embodiment, the attention calculation module 52 is further configured to construct a pixel region of a preset size centered on each barcode pixel in the barcode region; calculate the pixel value variance of the barcode pixels in each pixel region; assign attention weights to the barcode pixels based on the pixel value variance of the pixel region corresponding to the barcode pixels; and perform feature enhancement on the deep feature map based on the attention weights of each barcode pixel in the barcode region to obtain an enhanced feature map.

[0085] In one embodiment, the feature extraction module 51 is further configured to perform shallow feature extraction on the barcode image to be processed through the top shallow residual block in a series of residual blocks to obtain a shallow feature map; and to perform continuous feature extraction on the shallow feature map through multiple deep residual blocks other than the shallow residual blocks to obtain a deep feature map.

[0086] In one embodiment, the reconstruction module 54 is further configured to upsample the first fused feature map to obtain a first upsampled feature map; perform a convolution operation on the first upsampled feature map to obtain a first convolutional feature map; and compress the number of channels of the first convolutional feature map to obtain a first super-resolution barcode image.

[0087] In one embodiment, the reconstruction module 54 is further configured to upsample the shallow feature map to obtain a second upsampled feature map, wherein the upsampling factor of the shallow feature map is the same as that of the first fused feature map; fuse the second upsampled feature map with the first convolutional feature map to obtain a second fused feature map; upsample the second fused feature map to obtain a third upsampled feature map, wherein the upsampling factor of the second fused feature map is the same as that of the shallow feature map and the first fused feature map; perform a convolution operation on the third upsampled feature map to obtain a second convolutional feature map; and compress the number of channels of the second convolutional feature map to obtain a second super-resolution barcode image.

[0088] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0089] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0090] Figure 7 This is a schematic diagram of the structure of a terminal device according to an embodiment of this application. Figure 7 As shown, the terminal device 6 includes: at least one processor 60 ( Figure 7 (Only one is shown in the diagram) a processor, a memory 61, and a computer program 62 stored in the memory 61 and executable on at least one processor 60, wherein the processor 60 executes the computer program 62 to implement the steps in any of the above-described barcode super-resolution method embodiments.

[0091] Terminal device 6 can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. Terminal device 6 may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will understand that... Figure 7This is merely an example of terminal device 6 and does not constitute a limitation on terminal device 6. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0092] The processor 60 can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0093] In some embodiments, memory 61 may be an internal storage unit of terminal device 6, such as a hard disk or memory of terminal device 6. In other embodiments, memory 61 may be an external disk of terminal device 6, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on terminal device 6. In other embodiments, memory 61 may include both internal storage units and external disks of terminal device 6. Memory 61 is used to store operating system, applications, bootloader, data, and other programs, such as the program code of computer program 62. Memory 61 may also be used to temporarily store data that has been output or will be output.

[0094] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various barcode super-resolution method embodiments above.

[0095] This application provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the various barcode super-resolution method embodiments.

[0096] This application implements all or part of the processes in the methods of the above embodiments, which can be accomplished by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a barcode super-resolution device or terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, such as a USB flash drive, a portable hard drive, a magnetic disk, or an optical disk.

[0097] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0098] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0099] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0100] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0101] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A barcode super-resolution method, characterized in that, include: Obtain the barcode image to be processed; Shallow feature extraction is performed on the barcode image to be processed to obtain a shallow feature map, and deep feature extraction is performed on the shallow feature map to obtain a deep feature map; Attention calculation is performed on the barcode region of the deep feature map to obtain an enhanced feature map; The shallow feature map and the enhanced feature map are fused to obtain a first fused feature map; The first fused feature map is reconstructed to obtain the first super-resolution barcode image.

2. The method according to claim 1, characterized in that, The step of performing attention calculation on the barcode region of the deep feature map to obtain the enhanced feature map includes: For each pixel in the deep feature map, calculate the pixel difference between the pixel and its neighboring pixels; The barcode region in the deep feature map is determined based on the pixel difference of each pixel in the deep feature map. Attention calculations are performed on the barcode region to obtain the enhanced feature map.

3. The method according to claim 2, characterized in that, The adjacent pixels include pixels adjacent to the pixel to the left or right, and pixels adjacent to the pixel upwards or downwards; determining the barcode region in the deep feature map based on the pixel difference value of each pixel in the deep feature map includes: For each pixel in the deep feature map, the sum of the absolute values ​​of the pixel differences between the pixel and each of its neighboring pixels is calculated to obtain the boundary response value of the pixel; If the boundary response value of the pixel is greater than or equal to a preset threshold, the pixel is marked as a barcode pixel; If the boundary response value of a pixel is less than the preset threshold, the pixel is marked as a background pixel. The barcode region in the deep feature map is determined based on each barcode pixel and each background pixel in the deep feature map.

4. The method according to claim 3, characterized in that, The process of performing attention calculations on the barcode region to obtain the enhanced feature map includes: For each barcode pixel in the barcode area, a pixel area of ​​a preset size is constructed with the barcode pixel as the center; Calculate the variance of the pixel value of each barcode pixel in each pixel region; Attention weights are assigned to the barcode pixels based on the variance of the pixel values ​​of the pixel region corresponding to the barcode pixels. Based on the attention weight of each barcode pixel in the barcode region, feature enhancement is performed on the deep feature map to obtain the enhanced feature map.

5. The method according to any one of claims 1 to 4, characterized in that, The process of performing shallow feature extraction on the barcode image to be processed to obtain a shallow feature map, and then performing deep feature extraction on the shallow feature map to obtain a deep feature map, includes: The shallow feature map is obtained by extracting shallow features from the barcode image to be processed through the top shallow residual block in a series of residual blocks. The deep feature map is obtained by continuously extracting features from the shallow feature map using multiple deep residual blocks other than the shallow residual blocks.

6. The method according to any one of claims 1 to 4, characterized in that, The process of reconstructing the first fused feature map to obtain the first super-resolution barcode image includes: The first fused feature map is upsampled to obtain a first upsampled feature map; Perform a convolution operation on the first upsampled feature map to obtain a first convolutional feature map; The number of channels in the first convolutional feature map is compressed to obtain the first super-resolution barcode image.

7. The method according to claim 6, characterized in that, After compressing the number of channels of the first convolutional feature map to obtain the first super-resolution barcode image, the method further includes: The shallow feature map is upsampled to obtain a second upsampled feature map, wherein the upsampling factor of the shallow feature map is the same as that of the first fused feature map; The second upsampled feature map is fused with the first convolutional feature map to obtain the second fused feature map; The second fused feature map is upsampled to obtain a third upsampled feature map, wherein the upsampling factor of the second fused feature map is the same as that of the shallow feature map and the first fused feature map; Perform a convolution operation on the third upsampled feature map to obtain a second convolutional feature map; The number of channels in the second convolutional feature map is compressed to obtain the second super-resolution barcode image.

8. A barcode super-resolution device, characterized in that, include: The acquisition module is used to acquire the barcode image to be processed; The feature extraction module is used to perform shallow feature extraction on the barcode image to be processed to obtain a shallow feature map, and to perform deep feature extraction on the shallow feature map to obtain a deep feature map. The attention calculation module is used to perform attention calculation on the barcode region of the deep feature map to obtain an enhanced feature map; A feature fusion module is used to fuse the shallow feature map with the enhanced feature map to obtain a first fused feature map; The reconstruction module is used to reconstruct the first fused feature map to obtain the first super-resolution barcode image.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the barcode super-resolution method as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, Includes a computer program, which, when run, causes the barcode super-resolution method as described in any one of claims 1 to 7 to be performed.