Deep learning-based express sheet bar code detection method

Through a method based on deep learning, the rotatable bounding box and the improved Swin-Transformer algorithm are used to detect express delivery order barcodes, combined with the feature fusion network and circular smooth labels, which solves the problems of slow detection speed and low accuracy in the existing technology. , achieving more efficient barcode recognition of express delivery orders.

CN118658038APending Publication Date: 2024-09-17NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410638161.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

The existing technology is slow in detecting barcodes on express delivery orders, has low recognition accuracy, and cannot achieve selective recognition and customized processing.

Method used

A method based on deep learning is adopted, using rotatable bounding boxes to annotate the data set, extracting feature maps through the improved Swin-Transformer algorithm and feature fusion network, combining YOLOv5 neck network and feature pyramid network for multi-scale feature fusion, and using circular Smooth labels optimize the prediction box, and finally decode the barcode through the zbar library.

Benefits of technology

It improves the speed and accuracy of barcode detection on express delivery orders, can locate and identify barcodes more accurately, supports automated processing, and has good practical feasibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118658038A
    Figure CN118658038A
Patent Text Reader

Abstract

The invention discloses an express waybill bar code detection method based on deep learning. The method comprises the following steps: using a rotatable bounding box to label a collected express waybill detection data set; the method comprises the following steps of: obtaining a feature map through an improved Swinin-Transform algorithm; processing the feature map based on a feature fusion network to obtain a fused feature map; inputting the fused feature map into a detection head for detection; predicting the positioning of the bar code of the express sheet by using the improved bounding box based on the circular smooth label; and for the detected bar code area of the express waybill, decoding the corrected bar code by using the zbar library so as to obtain a bar code analysis result of the express waybill. According to the method, the angle information and the feature information of the target can be better highlighted, so that the position and the shape of the bar code of the express sheet can be more accurately framed, the detection speed and the recognition precision are higher, automatic processing of express packages can be better facilitated, and the method has better practical feasibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of target detection technology, and in particular to a method for detecting express delivery invoice barcodes based on deep learning. Background Art

[0002] In recent years, with the rapid development of the domestic e-commerce economy, the express delivery industry, as an important pillar of e-commerce, has continued to maintain rapid growth. Express delivery companies need to continuously improve the level of intelligent and automated production to meet business needs. Among them, the detection and recognition of the barcode on the express delivery bill is a key link in realizing the intelligence and automation of express delivery companies. By scanning the barcode information on the express delivery bill, the express package can be quickly and accurately matched with the user information, realizing the automatic entry and exit processing of the express package.

[0003] The detection and recognition of the express delivery bill barcode plays an important role in the automatic outbound system. Through the barcode or QR code on the express delivery bill and other information, the automatic outbound system can quickly and accurately match the express package with the user's information and realize the automatic processing of the express package.

[0004] Traditional detection and recognition technology mainly uses OCR technology to check and identify barcodes, QR codes and other information on express delivery bills. OCR technology is a technology that analyzes and processes images, identifies characters in them and converts them into editable text. Compared with manual inspection and recognition, OCR technology has the advantages of fast recognition speed, high accuracy and low cost, which can greatly improve the efficiency and accuracy of express delivery bill processing. However, OCR recognition has strict requirements on the required conditions, high requirements on the quality of the input image, and strict requirements on the angle and position of the barcode. In addition, OCR technology can usually only recognize the entire image, and cannot achieve selective recognition of various information in the express delivery bill, nor can it be customized according to different needs.

[0005] In recent years, emerging technologies such as artificial intelligence and computer vision have been widely used in image recognition. Computer vision technology can assist express delivery companies in automatically photographing express delivery bills, removing noise, and improving image clarity, thereby improving the recognition rate of barcodes. The application of these emerging technologies provides more solutions and technical support for the express delivery industry. For example, computer vision methods based on convolutional neural networks (CNN) and the YOLO algorithm have significantly improved the detection and recognition performance of express delivery bill barcodes. Summary of the invention

[0006] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.

[0007] In view of the above existing problems, the present invention is proposed.

[0008] Therefore, the present invention provides a courier delivery invoice barcode detection method based on deep learning to solve the problems of slow detection speed and low recognition accuracy in the prior art.

[0009] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0010] The collected express delivery bill detection dataset is labeled using a rotatable bounding box;

[0011] The feature map is obtained through the improved Swin-Transformer algorithm;

[0012] Processing the feature map based on a feature fusion network to obtain a fused feature map;

[0013] Input the fused feature map into the detection head for detection;

[0014] Predict the location of express delivery order barcodes using bounding box output improved based on circular smooth labels;

[0015] For the detected express delivery bill barcode area, the zbar library is used to decode the corrected barcode to obtain the barcode parsing result of the express delivery bill.

[0016] As a preferred solution of the express delivery bill barcode detection method based on deep learning described in the present invention, wherein: the collected express delivery bill detection data set uses a rotatable bounding box in a rotating annotation tool to label the express delivery bill barcode area in the data set, and generate a corresponding file. The annotated information of the rotatable bounding box includes the coordinates xywh of the rectangular bounding box of the express delivery bill barcode area and the angle between the edge of the bounding box and the horizontal line.

[0017] As a preferred solution of the express delivery form barcode detection method based on deep learning described in the present invention, wherein: the improved Swin-Transformer algorithm obtains a feature map, and a CBAM hybrid attention module is embedded in the Swin-Transformer structure, that is, a CBAM module is embedded in the Patch Merging layer in its network structure. The hybrid attention module is constructed based on channel attention and spatial attention. After the input image is initially extracted by the network, it is first processed by the channel attention mechanism, and the channel attention map F′ is generated by using the channel relationship of the feature. The process can be expressed as:

[0018]

[0019] AvgPool(F) represents average pooling of feature F, and MaxPool(F) represents maximum pooling of feature F. These two features are then processed by MLP and Sigmoid function (σ) as channel weight coefficients, and finally multiplied with feature F to obtain the channel attention map F′.

[0020] The spatial attention mechanism is used to process the channel attention map F′, obtain the spatial relationship between features and generate the spatial attention map F″. The process can be expressed as:

[0021]

[0022] After performing average pooling and maximum pooling operations on the channel attention map F′, a convolutional layer with a size of 7×7 (f 7 ×7 ) is operated, and then processed by the Sigmoid function to generate the spatial weight coefficient, and finally multiplied with the channel attention map F′ to obtain the spatial attention map F″.

[0023] As a preferred solution of the express delivery form barcode detection method based on deep learning described in the present invention, wherein: the improved Swin-Transformer algorithm obtains the feature map, comprising the following steps:

[0024] The input express delivery color image X = [H, W, 3], where H is the height of the image, W is the width of the image, and 3 is the number of channels of the image. The image X is split into multiple non-overlapping patches through the Patch splitting module, and the pixel values ​​in each patch are concatenated into a vector. These vectors are mapped to a space of lower dimension C through linear projection to generate a token vector sequence as the input of the algorithm. The typical value of C is 96.

[0025] The generated token vector sequence is input into the Transformer encoder. In Swin-Transformer, multiple Swin-Transformer Blocks are usually used as the components of the encoder. Each Swin-TransformerBlock contains a multi-head self-attention layer and a position-based feed-forward neural network to capture the global and local dependencies between image features. The self-attention mechanism uses the feature sequence x as the processing unit, and then passes through three weight matrices W q , W k and W v They are converted into Query vector, Key vector and Value vector respectively. The dot product of Query vector and Key vector is used to get the weight matrix. The weight matrix is ​​multiplied by the Value vector to get the multi-head attention output vector x. The multi-head attention output vector x is expressed as:

[0026]

[0027] Among them, d k is the length of the global attention head, Softmax is the normalized exponential function;

[0028] The token vector is input into the linear embedding layer and the Swin-Transformer Block module for the first stage of processing;

[0029] After the above steps, the feature vectors of the image are obtained. These feature vectors are processed by the Patch Merging layer that integrates the hybrid attention mechanism to achieve a similar downsampling operation. Subsequently, they are processed by the Swin-TransformerBlock module to obtain the feature map out1.

[0030] In the second stage, the image features are processed, and the Patch Merging layer with a hybrid attention mechanism and the Swin-Transformer Block module are used as the main basic components. The model can effectively capture the global and local information in the image, realize feature fusion and multi-scale feature extraction. In this stage, feature maps out1, out2 and out3 are obtained, and their sizes are [H / 8, W / 8, 2C], [H / 16, W / 16, 4C] and [H / 32, W / 32, 8C] respectively.

[0031] As a preferred solution of the express delivery form barcode detection method based on deep learning described in the present invention, wherein: the feature map is processed based on the feature fusion network to obtain a fused feature map, and the feature fusion network refers to the neck network of YOLOv5, and the obtained feature map out3 is convolved through the CBS module to obtain a high-level feature map f3;

[0032] The high-level feature map f3 is upsampled and concatenated with the feature map out2 to obtain a feature map, and the middle-level feature map f2 is obtained after being processed by the C3Ⅱ_1 module and the convolution operation of the CBS module;

[0033] The middle-level feature map f2 is upsampled and concatenated with the feature map out1, and processed by the C3Ⅱ_1 module to obtain the bottom-level feature map f1, which is output to the detection head;

[0034] The bottom feature map f1 is processed by the CBS module and concatenated with the middle feature map f2. The concatenated feature map is processed by the C3Ⅱ_1 module to obtain a new middle feature map f2′ which is then output to the detection head.

[0035] The new middle-level feature map f2′ is convolved with the CBS module and concatenated with the high-level feature map f3. The concatenated feature map is processed by the C3Ⅱ_1 module to obtain a new high-level feature map f3′, which is then output to the detection head.

[0036] As a preferred solution of the express delivery invoice barcode detection method based on deep learning described in the present invention, the CBS module is composed of a Conv function, a BN function and a SiLU function, wherein the Conv function is used to perform convolution operations on feature maps, the BN function performs batch normalization operations on data, and the SiLU function is used as the final activation function.

[0037] As a preferred solution of the express delivery invoice barcode detection method based on deep learning described in the present invention, the C3 module is composed of 3 CBS modules and multiple Bottleneck modules. The C3 module learns the residual features, and the structure includes two branches. The first branch uses multiple specified Bottleneck stacks and 3 standard CBS modules, and the second branch only passes through one CBS module. Finally, the two branches are spliced.

[0038] As a preferred solution of the express delivery invoice barcode detection method based on deep learning described in the present invention, wherein: the fused feature map is input into the detection head for detection, combining the feature pyramid network and the path aggregation network, wherein the feature pyramid network is top-down, passing down the strong semantic features of the high level, enhancing the entire pyramid, enhancing the semantic information, and not passing the positioning information, the path aggregation network adds a bottom-up pyramid behind the feature pyramid network, passing up the strong positioning features of the low level, and directly using the multi-scale fused feature map in the path aggregation network to input into the detection head for detection.

[0039] As a preferred solution of the express delivery form barcode detection method based on deep learning described in the present invention, the improved prediction frame is an optimized prediction frame based on the circular smooth label, the angle is predicted by classification rather than regression, and a suitable window function is selected to avoid the angle periodicity problem, wherein the circular smooth label is expressed as:

[0040]

[0041] Among them, g(x) represents the window function, r is the radius of the window function, and θ represents the angle of the current bounding box.

[0042] As a preferred solution of the express delivery bill barcode detection method based on deep learning described in the present invention, the detected express delivery bill barcode area is decoded using the zbar library to obtain the decoding information of the barcode.

[0043] Beneficial effects of the present invention: The present invention uses a rotatable detection frame instead of a traditional horizontal detection frame to extract the image features of the express delivery bill, which can better highlight the angle information of the target, thereby more accurately locating the area where the express delivery bill barcode is located. With the help of the improved Swin-Transformer algorithm's high performance in extracting image features and fusing the multi-scale feature map through the YOLOv5 neck network, compared with other existing methods, it has higher detection speed and recognition accuracy, can better assist in the automated processing of express parcels, and has good practical feasibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:

[0045] Figure 1A schematic diagram of the basic flow of a method for detecting express delivery bill barcodes based on deep learning provided by one embodiment of the present invention;

[0046] Figure 2 A schematic diagram of the structure of a CBAM hybrid attention module of a courier delivery order barcode detection method based on deep learning provided by one embodiment of the present invention;

[0047] Figure 3 A schematic diagram of a network model structure of a method for detecting express delivery invoice barcodes based on deep learning provided by one embodiment of the present invention;

[0048] Figure 4 A schematic diagram of the structure of a C3 module of a method for detecting express delivery invoice barcodes based on deep learning provided by one embodiment of the present invention;

[0049] Figure 5 A schematic diagram of improved prediction box prediction information of a courier delivery bill barcode detection method based on deep learning provided by one embodiment of the present invention;

[0050] Figure 6 A schematic diagram of a circular smooth label of a courier delivery invoice barcode detection method based on deep learning provided by one embodiment of the present invention;

[0051] Figure 7 A schematic diagram of the express delivery bill barcode detection results of an express delivery bill barcode detection method based on deep learning provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0052] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0053] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0054] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0055] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.

[0056] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0057] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0058] Example 1

[0059] Reference Figure 1-7 , is an embodiment of the present invention, and provides a method for detecting express delivery bill barcodes based on deep learning, such as Figure 1 As shown, the following steps are included:

[0060] S1: Label the collected express delivery bill detection dataset using a rotatable bounding box;

[0061] Furthermore, in the collected express delivery bill detection dataset images, the rotatable bounding box of the rolabelimg rotation annotation tool is used to label the target area where the barcode in the image is located and generate the corresponding file. The information annotated by the rotatable bounding box includes the coordinates xywh of the rectangular bounding box of the express delivery bill barcode and the angle between the edge of the bounding box and the horizontal line. Compared with the traditional horizontal bounding box, the rotatable bounding box can better highlight the angle information of the target;

[0062] S2: feature map obtained by improved Swin-Transformer algorithm;

[0063] Furthermore, the labeled dataset is divided into training set, validation set and test set. The image preprocessing operation is to facilitate the model to process the dataset, and the image size in the dataset is adjusted to a multiple of 32 to accommodate convolution and pooling operations. This ensures that the feature map can still maintain sufficient resolution and information after multiple convolutions and pooling, preventing information loss and model performance degradation;

[0064] Furthermore, Figure 2 As shown in the figure, the improved Swin-Transformer algorithm is to embed the CBAM hybrid attention module in the Swin-Transformer structure, that is, embed the CBAM module in the Patch Merging layer in its network structure. The CBAM attention mechanism can help the model pay more attention to the important feature information of the express delivery form barcode area and ignore the interference factors around the target, thereby improving the accuracy of model recognition. The hybrid attention module is constructed based on channel attention and spatial attention. After the input image is initially extracted by the network, it is first processed by the channel attention mechanism. The channel attention map F′ is generated by using the channel relationship of the feature. The process can be expressed as:

[0065]

[0066] AvgPool(F) represents average pooling of feature F, and MaxPool(F) represents maximum pooling of feature F. These two features are then processed by MLP and Sigmoid function (σ) as channel weight coefficients, and finally multiplied with feature F to obtain the channel attention map F′.

[0067] The spatial attention mechanism is used to process the channel attention map F′, obtain the spatial relationship between features and generate the spatial attention map F″. The process can be expressed as:

[0068]

[0069] After performing average pooling and maximum pooling operations on the channel attention map F′, a convolutional layer with a size of 7×7 (f 7 ×7 ) is operated, and then processed by the Sigmoid function to generate the spatial weight coefficient, and finally multiplied with the channel attention map F′ to obtain the spatial attention map F″;

[0070] Furthermore, the overall structure of the network model is as follows Figure 3 As shown, the process of extracting image features using the improved Swin-Transformer algorithm is as follows:

[0071] A1: The input express delivery color image X = [H, W, 3], where H is the height of the image, W is the width of the image, and 3 is the number of channels of the image. The image X is split into multiple non-overlapping patches through the Patch splitting module, and the pixel values ​​in each patch are concatenated into a vector. These vectors are then mapped to a space of lower dimension C through linear projection to generate a token vector sequence as the input of the algorithm. The typical value of C is 96.

[0072] A2: Input the generated token vector sequence into the Transformer encoder. In Swin-Transformer, multiple Swin-Transformer Blocks are usually used as the components of the encoder. Each Swin-Transformer Block contains a multi-head self-attention layer and a position-based feed-forward neural network to capture the global and local dependencies between image features. The self-attention mechanism uses the feature sequence x as the processing unit, and then passes through three weight matrices W q , W k and W v They are converted into Query vector, Key vector and Value vector respectively. The dot product of Query vector and Key vector is used to get the weight matrix. The weight matrix is ​​multiplied by the Value vector to get the multi-head attention output vector x. The multi-head attention output vector x is expressed as:

[0073]

[0074] Among them, d k is the length of the global attention head, Softmax is the normalized exponential function;

[0075] A3: Input the token vector into the linear embedding layer and Swin-Transformer Block module for the first stage of processing;

[0076] A4: The improved Swin-Transformer algorithm mainly embeds a CBAM hybrid attention module based on the channel attention mechanism and the spatial attention mechanism in its Patch Merging layer, making it easier for the model to extract feature information at local locations. At this time, the Patch Merging layer and the Swin-Transformer Block module can be processed as a whole;

[0077] A5: After the first processing stage, the feature vectors of the image are obtained. These feature vectors are processed by the Patch Merging layer that integrates the hybrid attention mechanism to achieve a similar downsampling operation. Subsequently, after the Swin-Transformer Block module is processed, the feature map out1 is obtained;

[0078] A6: Next, the stage processing method of the network model composed of the improved Patch Merging layer and the Swin-Transformer Block module is used as the second processing stage to process the image features, and feature map out1 (size is [H / 8, W / 8, 2C]), feature map out2 (size is [H / 16, W / 16, 4C]), and feature map out3 (size is [H / 32, W / 32, 8C]) are obtained respectively. In this way, multi-scale feature maps can be extracted to help the model capture objects and detail information of different scales, thereby improving the performance and robustness of the model.

[0079] For example, the express delivery label detection dataset is adjusted from an image with a width × height × number of channels of 1280 × 720 × 3 to an image with a width × height × number of channels of 640 × 640 × 3, where the units of width and height are pixels. The preprocessed training set images are input into the improved Swin Transformer structure, and three feature maps are output after processing, namely out1: (feature map size is 80 × 80 × 192), out2: (feature map size is 40 × 40 × 384) and out3: (feature map size is 20 × 20 × 768).

[0080] S3: Processing the feature map based on a feature fusion network to obtain a fused feature map;

[0081] Furthermore, the feature fusion network refers to the YOLOv5 neck network, and the feature map out3 is convolved through the CBS module to obtain the high-level feature map f3;

[0082] The high-level feature map f3 is upsampled and then concatenated with the feature map out2 to obtain a feature map, which is processed by the C3Ⅱ_1 module and then convolved by the CBS module to obtain the middle-level feature map f2;

[0083] The middle-level feature map f2 is upsampled and then concatenated with the feature map out1. After being processed by the C3Ⅱ_1 module, the bottom-level feature map f1 is obtained and output to the detection head.

[0084] After that, the bottom-level feature map f1 is processed by the CBS module and then concatenated with the middle-level feature map f2. The concatenated feature map is processed by the C3Ⅱ_1 module to obtain a new middle-level feature map f2′, which is then output to the detection head.

[0085] Finally, the new middle-level feature map f2′ is convolved with the CBS module and then concatenated with the high-level feature map f3. The concatenated feature map is processed with the C3Ⅱ_1 module to obtain the new high-level feature map f3′, which is then output to the detection head.

[0086] Furthermore, the CBS module is composed of a Conv function, a BN function and a SiLU function, wherein the Conv function is used to perform a convolution operation on the feature map, the BN function performs a batch normalization operation on the data, and the SiLU function is used as the final activation function;

[0087] Furthermore, by Figure 4 As shown in the schematic diagram of the C3 module, the C3 module consists of 3 CBS modules and multiple Bottleneck modules. The C3 module mainly learns the residual features. The structure includes two branches. The first branch uses the above-specified multiple Bottleneck stacks and 3 standard CBS modules. The second branch only passes through one CBS module, and finally the two branches are spliced.

[0088] For example, the feature map of size (20×20×768) output by the improved Swin-Transformer structure is convolved by the CBS module and then dimensionally reduced to obtain a high-level feature map f3 (size 20×20×512);

[0089] The high-level feature map f3 (size is 20×20×512) is upsampled (size is 40×40×512), and then concatenated with the feature map out2 obtained by the backbone network to obtain a feature map, which is first processed by the C3Ⅱ_1 module, and then reduced in dimension by the CBS module convolution operation to obtain the middle-level feature map f2 (size is 40×40×256);

[0090] The middle-layer feature map f2 (size is 40×40×256) is upsampled (size is 80×80×256), and then concatenated with the feature map out1 obtained by the backbone network. After being processed by the C3Ⅱ_1 module, the bottom-layer feature map f1 (size is 80×80×256) is obtained and output to the detection head.

[0091] The bottom feature map f1 (size is 80×80×256) is processed by downsampling operation (size is 40×40×256) and then concatenated with the middle feature map f2 (size is 40×40×256). The concatenated feature map is processed by C3Ⅱ_1 module to obtain a new middle feature map f2′ (size is 40×40×512) and then output to the detection head;

[0092] The new middle-level feature map f2′ (size is 40×40×512) is processed by downsampling operation (size is 20×20×512), and then concatenated with the high-level feature map f3 (size is 20×20×512). The concatenated feature map is processed by C3Ⅱ_1 module to obtain a new high-level feature map f3′ (size is 20×20×1024) and then output to the detection head;

[0093] S4: Input the fused feature map into the detection head for detection;

[0094] Furthermore, the model combines the Feature Pyramid Network (FPN) and the Path Aggregation Network (PANet). The Feature Pyramid Network is top-down, passing down the strong semantic features of the high-level layers, enhancing the entire pyramid, enhancing the semantic information, and not passing the positioning information. The Path Aggregation Network adds a bottom-up pyramid behind the Feature Pyramid Network. This operation is a supplement to the Feature Pyramid Network, passing up the strong positioning features of the low-level layers, and combining the two can achieve better feature fusion effects. Then the multi-scale fusion feature map in the Path Aggregation Network is directly used to input into the detection head for detection.

[0095] S5: Prediction of express delivery barcode positioning using bounding box output based on improved circular smooth labels.

[0096] The improved prediction box prediction information is as follows Figure 5 As shown in Figure 2, compared to the original horizontal detection box, which only displays the coordinates of the rectangular bounding box containing the target, the improved prediction box prediction information highlights Bθ ij This important target angle information enables the improved prediction box to better represent the target information and more accurately define the shape and position of the target.

[0097] Furthermore, if regression is used to predict the angle, it will lead to boundary discontinuity problems, which will cause the loss value of the model to suddenly increase when calculating the boundary, which will greatly affect the detection results.

[0098] like Figure 6As shown in the schematic diagram of the circular smooth label in , the improved prediction box will process the predicted angle and the real angle of the target using a window function. Because of this form of processing, the circular smooth label formed by the window function processing can avoid the sudden change of the error between the angle information predicted by the model and the real angle information. This processing method enables the model to be more stable during the training process.

[0099] The improved prediction frame is an optimized prediction frame based on the circular smooth label (CSL), the angle is predicted by classification rather than regression, and a suitable window function is selected to avoid the angle periodicity problem. The calculation process of the circular smooth label (CSL) is as follows:

[0100]

[0101] Where g(x) represents the window function, r is the radius of the window function, and θ represents the angle of the current bounding box. The Gaussian function can be selected as the window function. The formula of the Gaussian function is:

[0102]

[0103] The one-dimensional graph of the Gaussian function is a characteristically symmetrical "bell curve" shape, where a is the height of the curve peak, b is the coordinate of the center of the peak, and c is called the standard deviation, which represents the width of the bell shape. The label value is continuous at the boundary. By applying the Gaussian function as a window function, it is possible to classify the angles and obtain better prediction results.

[0104] like Figure 7 As shown in the schematic diagram of the express delivery label barcode detection results, the improved prediction box can completely and correctly frame the area where the target barcode is located, so that the subsequent decoding process can more accurately interpret the information contained in the barcode.

[0105] S6: Use the zbar library to decode the detected express delivery label barcode area to obtain the barcode decoding information.

[0106] Furthermore, after obtaining the express delivery barcode detected by the model, the zbar library is used to decode the barcode. Zbar is an open source software suite for reading barcodes from various sources. It supports many popular symbol systems (barcode types). Zbar uses advanced image processing and decoding algorithms, which can accurately identify barcodes and QR codes in different environments and has high decoding accuracy.

[0107] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for detecting express delivery bill barcodes based on deep learning, characterized in that: include: The collected express delivery bill detection dataset is labeled using a rotatable bounding box; The feature map is obtained through the improved Swin-Transformer algorithm; Processing the feature map based on a feature fusion network to obtain a fused feature map; Input the fused feature map into the detection head for detection; Predict the location of express delivery order barcodes using bounding box output improved based on circular smooth labels; For the detected express delivery bill barcode area, the zbar library is used to decode the corrected barcode to obtain the barcode parsing result of the express delivery bill.

2. According to claim 1, a method for detecting express delivery bill barcodes based on deep learning is characterized in that: The collected express delivery bill detection data set uses a rotatable bounding box in a rotating annotation tool to label the express delivery bill barcode area in the data set and generate a corresponding file. The information annotated by the rotatable bounding box includes the coordinates xywh of the rectangular bounding box of the express delivery bill barcode area and the angle between the edge of the bounding box and the horizontal line.

3. According to the deep learning-based express delivery bill barcode detection method of claim 1, it is characterized by: The improved Swin-Transformer algorithm obtains a feature map, and a CBAM hybrid attention module is embedded in the Swin-Transformer structure, that is, a CBAM module is embedded in the Patch Merging layer in its network structure. The hybrid attention module is constructed based on channel attention and spatial attention. After the input image is initially extracted by the network, it is first processed by the channel attention mechanism, and the channel attention map F′ is generated by using the channel relationship of the feature. The process can be expressed as: AvgPool(F) represents average pooling of feature F, and MaxPool(F) represents maximum pooling of feature F. These two features are then processed by MLP and Sigmoid function (σ) as channel weight coefficients, and finally multiplied with feature F to obtain the channel attention map F′. The spatial attention mechanism is used to process the channel attention map F′, obtain the spatial relationship between features and generate the spatial attention map F″. The process can be expressed as: After performing average pooling and maximum pooling operations on the channel attention map F′, a convolutional layer with a size of 7×7 (f 7×7 ) is operated, and then processed by the Sigmoid function to generate the spatial weight coefficient, and finally multiplied with the channel attention map F′ to obtain the spatial attention map F″.

4. According to claim 1, a method for detecting express delivery bill barcodes based on deep learning is characterized in that: The improved Swin-Transformer algorithm obtains the feature map, including the following steps: The input express delivery color image X = [H, W, 3], where H is the height of the image, W is the width of the image, and 3 is the number of channels of the image. The image X is split into multiple non-overlapping patches through the Patch splitting module, and the pixel values ​​in each patch are concatenated into a vector. These vectors are mapped to a space of lower dimension C through linear projection to generate a token vector sequence as the input of the algorithm. The typical value of C is 96. The generated token vector sequence is input into the Transformer encoder. In Swin-Transformer, multiple Swin-Transformer Blocks are usually used as the components of the encoder. Each Swin-Transformer Block contains a multi-head self-attention layer and a position-based feed-forward neural network to capture the global and local dependencies between image features. The self-attention mechanism uses the feature sequence x as the processing unit, and then passes three weight matrices W q , W k and W v They are converted into Query vector, Key vector and Value vector respectively. The dot product of Query vector and Key vector is used to get the weight matrix. The weight matrix is ​​multiplied by the Value vector to get the multi-head attention output vector x. The multi-head attention output vector x is expressed as: Among them, d k is the length of the global attention head, Softmax is the normalized exponential function; The token vector is input into the linear embedding layer and the Swin-Transformer Block module for the first stage of processing; After the above steps, the feature vectors of the image are obtained. These feature vectors are processed by the Patch Merging layer that integrates the hybrid attention mechanism to achieve a downsampling-like operation. Subsequently, they are processed by the Swin-Transformer Block module to obtain the feature map out1. In the second stage, the image features are processed, and the Patch Merging layer with a hybrid attention mechanism and the SwinTransformer Block module are used as the main basic components. The model can effectively capture the global and local information in the image, realize feature fusion and multi-scale feature extraction. In this stage, feature maps out1, out2 and out3 are obtained, and their sizes are [H / 8, W / 8, 2C], [H / 16, W / 16, 4C] and [H / 32, W / 32, 8C] respectively.

5. The method for detecting express delivery bill barcode based on deep learning according to claim 1, characterized in that: The feature fusion network based on the above method obtains a fused feature map, wherein the feature fusion network applies the neck network of YOLOv5, and performs a convolution operation on the feature map out3 through the CBS module to obtain a high-level feature map f3; The high-level feature map f3 is upsampled and concatenated with the feature map out2 to obtain a feature map, and the middle-level feature map f2 is obtained after being processed by the C3Ⅱ_1 module and the convolution operation of the CBS module; The middle-level feature map f2 is upsampled and concatenated with the feature map out1, and processed by the C3Ⅱ_1 module to obtain the bottom-level feature map f1, which is output to the detection head; The bottom feature map f1 is processed by the CBS module and concatenated with the middle feature map f2. The concatenated feature map is processed by the C3Ⅱ_1 module to obtain a new middle feature map f2′ which is then output to the detection head. The new middle-level feature map f2′ is convolved with the CBS module and concatenated with the high-level feature map f3. The concatenated feature map is processed by the C3Ⅱ_1 module to obtain a new high-level feature map f3′, which is then output to the detection head.

6. A method for detecting express delivery bill barcodes based on deep learning as claimed in claim 5, characterized in that: The CBS module consists of a Conv function, a BN function and a SiLU function, wherein the Conv function is used to perform a convolution operation on the feature map, the BN function performs a batch normalization operation on the data, and the SiLU function is used as the final activation function.

7. A method for detecting express delivery bill barcodes based on deep learning according to any one of claims 6, characterized in that: The C3 module consists of 3 CBS modules and multiple Bottleneck modules. The C3 module learns the residual features. The structure includes two branches, where the first branch uses multiple specified Bottleneck stacks and 3 standard CBS modules, and the second branch only passes through one CBS module. Finally, the two branches are spliced.

8. The method for detecting express delivery bill barcode based on deep learning according to claim 1, characterized in that: The fused feature map is input into the detection head for detection, which combines the feature pyramid network and the path aggregation network. The path aggregation network adds a bottom-up pyramid behind the feature pyramid network to pass the strong positioning features of the lower layer up, and inputs the multi-scale fused feature map in the path aggregation network into the detection head for detection.

9. The method for detecting express delivery bill barcode based on deep learning according to claim 1, characterized in that: The improved prediction optimizes the prediction box based on the circular smooth label, predicts the angle by classification rather than regression, and selects a suitable window function to avoid the angle periodicity problem, wherein the circular smooth label is expressed as: Among them, g(x) represents the window function, r is the radius of the window function, and θ represents the angle of the current bounding box.

10. The method for detecting express delivery bill barcode based on deep learning according to claim 9, characterized in that: Use the zbar library to decode the detected express delivery label barcode area to obtain the barcode decoding information.