End-to-end bill identification method and device

Through the improved YOLOv5 and CRNN algorithms, combined with BiFPN and CBAM modules, the problem of low text positioning and recognition accuracy in bill recognition is solved, and efficient and accurate bill recognition is achieved, which is suitable for various types of bill images.

CN118587728APending Publication Date: 2024-09-03中国邮政储蓄银行股份有限公司

Patent Information

Application Number
CN202410731171.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

In existing bill recognition technology, text positioning accuracy is low and recognition accuracy is insufficient. In particular, complete detection of text areas with significant discrimination is difficult. Moreover, the traditional method is complex and time-consuming, and cannot meet the needs of practical applications.

Method used

The improved YOLOv5 algorithm is used for text target positioning detection, combined with the bidirectional feature pyramid network BiFPN and the convolutional recurrent neural network CRNN, and the ResNet residual network and CBAM attention module are used for feature extraction and text recognition to enhance the feature representation and detection speed of the model. .

Benefits of technology

It improves the positioning accuracy and recognition accuracy of the bill text area, adapts to the recognition of different styles of bills, reduces the number of model parameters, improves the detection speed and recognition accuracy, and realizes intelligent recognition of multiple types of bill images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587728A
    Figure CN118587728A
Patent Text Reader

Abstract

The invention discloses an end-to-end bill identification method and device. The method comprises the following steps: carrying out preprocessing operations including de-noising, graying and tilt correction on an input bill image; carrying out positioning detection on a text target in the preprocessed bill image by adopting improved YOLOv5 to obtain a bill text area; according to the improved YOLOv5, layered similar residual connection is applied to a multi-scale feature extraction module C3 of the YOLOv5, and meanwhile, a multi-scale feature connection mode of the YOLOv5 is improved from a path aggregation network PANet to a bidirectional feature pyramid network BiFPN; performing text recognition on the positioned bill text region by adopting an improved convolutional recurrent neural network (CRNN) algorithm, and outputting recognized bill text content; according to the improved CRNN algorithm, a ResNet residual network is adopted as a feature extraction module, and an attention module comprising a channel dimension and a space dimension is introduced between residual blocks of the ResNet. According to the scheme, intelligent identification of various types of bill images can be realized, the detection speed is high, and the identification precision is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of bill recognition, and in particular relates to an end-to-end bill recognition method and device. Background Art

[0002] Existing bill recognition requires a lot of manpower and material resources to organize, archive and count bills. Intelligent bill recognition first uses a computer to identify the bill image information, and then connects it to the financial management system for automatic business processing. This can save labor costs, reduce error rates, and improve the reimbursement experience.

[0003] Currently, bill recognition methods fall into two main categories: OCR detection and recognition of bill images, and deep learning-based bill detection and recognition. OCR-based methods typically use a series of processes, including binarization, layout analysis, line segmentation, character segmentation, and character recognition, to detect differences in textual textures and determine their shapes. Character recognition then translates these shapes into computer text. Deep learning-based methods, on the other hand, utilize convolutional neural networks to adaptively construct feature descriptions driven by training data, identifying discriminative textual information and ultimately recognizing bills.

[0004] Traditional OCR-based bill recognition methods have complex operational processes and slow detection speeds, making them unsuitable for recognizing a wide variety of bills in large quantities. With the rapid development of deep learning, researchers have combined bill text detection and recognition with deep learning methods, providing a variety of object detection-based algorithms to detect and locate bill images.

[0005] Although using target detection algorithms for text detection and positioning is desirable, compared to object detection, text detection requires covering the entire length of the text. However, due to the lack of obvious closed contours and the presence of blank spaces in text lines, direct use of target detection algorithms for text detection is unsatisfactory. Currently, there are still two major problems:

[0006] 1) Accurate text positioning. Invoice recognition requires identifying the text within the invoice border. However, the characters in the text exist in small local areas, and some invoice images also contain decimal points. Due to factors such as character offset, it is very difficult to fully detect text areas with significant differentiation. The current common target detection and positioning algorithms use the regression box level for positioning. This method is suitable for objects with well-closed boundaries such as rigid bodies, while text is often composed of a series of loose strokes. Especially for text with arbitrary orientation or stroke width, using only the regression box result as the positioning result will have large deviations, making the text line positioning task very challenging. Therefore, it is necessary to accurately locate the invoice image to obtain the invoice text area.

[0007] 2) Recognition accuracy. After accurately locating a line of text, the recognition of the entire line of text is usually reduced to a sequence learning problem, using LSTM to combine frame-level encoding, frame-level recognition, and sequence decoding with the attention mechanism. However, LSTM is a model provided for processing time series signals. The use of flattening operations to forcibly convert a two-dimensional feature image into a one-dimensional feature vector will significantly destroy the spatial / structural information of the image and the underlying pixel spatial correlation information. Although LSTM-free algorithms have been provided to address the above problems, these algorithms are complex and time-consuming and cannot meet the needs of actual applications. It is necessary to design a more powerful network to autonomously learn the important features of the input image and strengthen the feature extraction of deeper image information. Summary of the Invention

[0008] Based on the above description, an embodiment of the present invention provides an end-to-end bill recognition method and apparatus.

[0009] According to a first aspect of the present invention, an end-to-end bill recognition method is provided, comprising the following steps:

[0010] S1, performing preprocessing operations including denoising, grayscale conversion, and tilt correction on the input bill image;

[0011] S2, using an improved YOLOv5 to locate and detect the text target in the preprocessed bill image to obtain the bill text area; the improved YOLOv5 applies a hierarchical residual-like connection to the multi-scale feature extraction module C3 of YOLOv5, and at the same time improves the multi-scale feature connection mode of YOLOv5 from the path aggregation network PANet to the bidirectional feature pyramid network BiFPN;

[0012] S3, uses an improved convolutional recurrent neural network (CRNN) algorithm to perform text recognition on the located bill text area and outputs the recognized bill text content; the improved CRNN algorithm uses the ResNet residual network as a feature extraction module, and introduces an attention module including two dimensions, channel and spatial, between the residual blocks of ResNet.

[0013] According to a second aspect of the present invention, an end-to-end bill recognition device is provided, comprising:

[0014] An image preprocessing unit, used to perform preprocessing operations including denoising, grayscale conversion, and tilt correction on the input bill image;

[0015] A bill text localization unit is configured to locate and detect text objects in a preprocessed bill image using an improved YOLOv5 algorithm to obtain the bill text area. The improved YOLOv5 algorithm applies a hierarchical residual-like connection to the multi-scale feature extraction module C3 of YOLOv5, and simultaneously improves the multi-scale feature connection mode of YOLOv5 from a path aggregation network PANet to a bidirectional feature pyramid network BiFPN.

[0016] The bill text recognition unit is used to use an improved convolutional recurrent neural network (CRNN) algorithm to perform text recognition on the located bill text area and output the recognized bill text content; the improved CRNN algorithm uses the ResNet residual network as a feature extraction module and introduces an attention module including channel and spatial dimensions between the residual blocks of ResNet.

[0017] According to a third aspect of the present invention, a computer-readable storage medium is provided that stores one or more programs, which, when executed, controls the device where the computer-readable storage medium is located to execute the aforementioned method.

[0018] According to the fourth aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the aforementioned method.

[0019] The beneficial effects of the embodiments of the present invention are:

[0020] The end-to-end bill recognition method and device provided by the embodiment of the present invention adopts the improved YOLOv5 to locate and detect text targets in the preprocessed bill image, applies the hierarchical residual connection to the multi-scale feature extraction module C3 of YOLOv5, enhances the feature representation capability of the model, and obtains higher detection accuracy; at the same time, the multi-scale feature connection mode of YOLOv5 is improved from the path aggregation network PANet to the bidirectional feature pyramid network BiFPN, and reduces the number of model parameters and improves the detection speed by compressing the model channel and assigning learnable weights to the node input features; adopts the improved convolutional recurrent neural network CRNN algorithm to perform text recognition on the located bill text area, uses the ResNet residual network to realize the feature extraction of the bill text area, and inserts the CBAM attention module between the ResNet residual blocks to enhance the feature extraction capability of the backbone network. The attention module can sequentially learn the attention mapping of the input features from the channel and spatial dimensions, and enhance the input features accordingly. Based on the CBAM module, the model can focus only on necessary features and ignore irrelevant features, thereby enhancing the recognition capability of small characters. Compared to traditional bill recognition methods based on OCR character recognition, the present invention can adapt to end-to-end recognition of bills of different styles, has strong adaptability, and has higher recognition accuracy. Compared to previous bill recognition methods based on deep learning, the present invention improves the bill text detection rate and accuracy, and achieves good recognition results for text of different sizes. As can be seen, the embodiment of the present invention can realize intelligent recognition of various types of bill images, has high versatility, adopts a small number of model parameters, has fast detection speed, high recognition accuracy, convenient engineering deployment, and strong practical feasibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The accompanying drawings, which constitute part of the present invention, are intended to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are intended to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings:

[0022] Figure 1 A schematic flow chart of an end-to-end bill recognition method provided by an embodiment of the present invention;

[0023] Figure 2 A schematic diagram of the structure of an improved YOLOv5 network provided by an embodiment of the present invention;

[0024] Figure 3 A schematic diagram of the structure of the C3 module integrated with Res2Net provided in an embodiment of the present invention;

[0025] Figure 4 A schematic diagram of the structure of a multi-scale feature fusion network provided by an embodiment of the present invention;

[0026] Figure 5 A schematic diagram of the structure of the CRNN convolutional recurrent neural network provided in an embodiment of the present invention;

[0027] Figure 6 A schematic diagram of the structure of ResNet integrated with the CBAM module provided in an embodiment of the present invention;

[0028] Figure 7 A schematic diagram of the structure of a channel attention module provided in an embodiment of the present invention;

[0029] Figure 8 A schematic diagram of the structure of a spatial attention module provided by an embodiment of the present invention;

[0030] Figure 9 A schematic structural diagram of an end-to-end bill recognition device provided by an embodiment of the present invention;

[0031] Figure 10 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "including" and "having" and any variations thereof in the description and claims of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or are inherent to these processes, methods, products or apparatus.

[0034] The design concept of this invention is to provide an end-to-end bill recognition method based on text detection and multi-scale feature fusion. First, the input bill image is preprocessed with operations such as denoising, grayscaling, and tilt correction. Then, a text localization and detection algorithm based on an improved YOLOv5 is used to locate and detect text objects in the bill image to obtain the bill text area. Finally, an improved convolutional recurrent neural network (CRNN) algorithm is used to perform text recognition on the located bill text area, and the recognized bill text content is output. This method adopts a small number of model parameters, has a fast computation speed, is easy to deploy in projects, and has strong practical application significance.

[0035] Example 1

[0036] According to the first aspect of the present invention, see Figure 1 As shown, an embodiment of the present invention provides an end-to-end bill recognition method, comprising the steps of:

[0037] S1, performing preprocessing operations including denoising, grayscale, and tilt correction on the input bill image.

[0038] Invoices contain multiple types of information, including service name, amount, tax rate, and tax amount. This information can be affected by scanning, resulting in printing offsets and other issues. Accurate target positioning can effectively eliminate the influence of background on classification. The purpose of preprocessing the input bill image in step S1 is to improve the quality of the bill image to be recognized and reduce interference from external useless information.

[0039] S2, using an improved YOLOv5 to locate and detect text targets in the preprocessed bill image to obtain the bill text area; the improved YOLOv5 applies hierarchical residual-like connections to the multi-scale feature extraction module C3 of YOLOv5, and at the same time improves the multi-scale feature connection method of YOLOv5 from the path aggregation network PANet to the bidirectional feature pyramid network BiFPN.

[0040] In order to solve the problem of slow positioning speed and poor accuracy of bill text location, the present invention provides a text positioning detection algorithm based on improved YOLOv5, such as Figure 2 shown.

[0041] The YOLOv5 network is a one-stage target detection algorithm that operates on the entire image. Compared with sliding window-based target positioning and detection algorithms, the YOLOv5 network can obtain global semantic information, effectively reducing the probability of the model misclassifying the background as a target, and improving the detection effect of small targets.

[0042] The YOLOv5 network structure consists of three parts: Backbone network, Neck structure and Head structure. Backbone is responsible for feature extraction; Neck is responsible for feature fusion; Head contains three detection heads, which are responsible for outputting detection information. The detection information includes the prediction of the regression box and confidence of the text area of ​​the bill image. The prediction result divides the input image into several S*S (S=80,40,20) grid units, containing 5 data (x, y, w, h, confidence). Among them, (x, y) represents the displacement of the center of the regression box relative to the boundary of the grid unit, and (w, h) represents the size of the text area relative to the entire image. The confidence reflects the probability that the model believes that the regression box contains the target and the accuracy of the regression box, which is defined as If there is no target in the grid cell, the confidence is 0. Otherwise, it predicts the intersection of the regression box and the true box. In addition, when the grid cell determines that the current grid contains an object, it generates a conditional probability Pr (Class i |Object), as shown in formula (1). During testing, the model multiplies the confidence score and conditional probability to generate a confidence score for a specific class. The score reflects the probability of the class object appearing in the regression box and the degree of fit between the predicted box and the true box.

[0043]

[0044] (a) Hierarchical residual connections

[0045] For visual cognition tasks, it is necessary to design a network that can extract multi-scale features. Since the sizes of objects in nature vary, extracting multi-scale features helps retain the underlying physical features while obtaining high-level semantic features to better identify these objects. Moreover, if the network wants to accurately identify the objects in the image, contextual information is also indispensable. Multi-scale feature extraction helps to obtain background information related to the target to be detected to assist in target recognition. The C3 module is an important component of the YOLOv5 network. Its main function is to increase the depth and sensitivity of the network and improve the feature extraction capability.

[0046] In order to obtain a feature extraction network with stronger representation capability, the present invention introduces a hierarchical residual-like connection into the feature extraction module C3 to form a Res2C3 network. Figure 3 As shown in Figure 2, Res2C3 contains two branches, one is the feature extraction branch and the other is the shortcut branch. The feature extraction branch consists of a convolution layer and a stack of n residual blocks, while the shortcut branch contains a convolution layer. Res2C3 replaces the 3*3 convolution layer with n channels in the residual block with s groups of convolution groups with w channels. Res2C3 directly outputs the first convolution group, while each of the remaining convolution groups needs to perform a 3*3 convolution. Starting from the third convolution group, the network will add the convolution output of the previous group and the convolution input of the current group and then perform a 3*3 convolution. Finally, Res2C3 concatenates the grouped convolution output and the convolution output on the shortcut branch, and then uses 1*1 convolution to complete feature fusion. The definition of the layered residual-like connection is shown in formula (2).

[0047]

[0048] Among them, x iRepresents the input of the i-th convolution group, y i represents the output of the i-th convolution group, K i Represents the convolution operation performed by the i-th convolution group, and i represents the number of convolution groups, which is 4 here.

[0049] Res2C3 concatenates the output of the feature extraction branch and the output of the shortcut branch convolution, ensuring that the network retains more positional information while acquiring deep semantic information, which helps improve object detection accuracy. Furthermore, because Res2C3 replaces the 3*3 convolutional layer in the residual block with a convolution group with 1 channel group, this reduces the number of model parameters to a certain extent, improving the model's feasibility for commercial bill recognition.

[0050] (2) Bidirectional Feature Pyramid Network

[0051] The difficulty of target detection lies in how to extract and process multi-scale features. In order to better integrate the features extracted by convolutional neural networks at different scales, Tsung-Yi Lin et al. proposed a feature pyramid network called FPN (Feature Pyramid Networks), such as Figure 4 As shown in the figure, the lateral connection in FPN performs a 1x1 convolution on the feature map of the current layer's bottom-up path and adds it to the upsampling result of the previous layer's top-down path as the output of the current layer's top-down path. Because the semantic information extracted by FPN at different levels varies in strength, lateral connections ensure that rich semantic information is retained at all levels of the feature pyramid, effectively improving object detection accuracy.

[0052] Since the path from the bottom-layer features to the top-layer features of FPN is long, and the similarity between deep features and shallow features is low, directly combining them will cause the position information extracted by the network at the bottom layer to be lost. In order to solve the above problem, YOLOv5 introduces the path aggregation network of PANet (Path Aggregation Network). Figure 4 As shown in the figure, PANet uses a feature pyramid network to extract multi-scale features and then constructs a bottom-up path enhancement module. Compared to FPN, PANet shortens the path length of multi-scale connections and uses the precise position information extracted at lower layers to strengthen the entire feature pyramid network, achieving the aggregation of features at different scales.

[0053] Based on PANet, the network uses cross-scale connections in Neck to fuse high-level features containing rich semantic information with low-level features containing rich location information. However, PANet also faces the problems of large number of parameters and slow inference speed. To address this, the present invention introduces the Bi-directional Feature Pyramid Network BiFPN (Bi-directional Feature Pyramid Network) into YOLOV5 to construct the BiYOLOV5 network. Figure 4 As shown in the figure, compared to PANet, BiFPN removes nodes with only one input edge. Since these nodes have only one input edge, they contribute little to feature fusion. Removing them effectively simplifies the network and reduces the number of model parameters. Furthermore, BiFPN adds a connection path between the original input and output nodes, forming a bidirectional feature fusion network. This achieves better fusion of different semantic features without significantly increasing computational cost.

[0054] The feature pyramid extracted by YOLOv5 has a total of 5 layers. The present invention improves the 3rd to 5th layers of the feature pyramid. By adding a new connection path between the original input and output nodes and compressing the model channel, BiYOLOv5 effectively simplifies the model size and reduces the requirements for hardware resources while ensuring detection accuracy. The input features of BiYOLOv5 nodes come from different levels, and the semantic information they contain is different, which also leads to different contributions to multi-scale feature fusion. To address this problem, the present invention assigns a weight to each input feature. The weight is learnable, as shown in formula (3). The network can adaptively learn and calculate the weight based on the importance of the input feature.

[0055]

[0056] Among them, w i is the weight, I i is the feature of the node input. i It can be a scalar (assigning weights to each feature), a vector (assigning weights to each channel), or a multidimensional tensor (assigning weights to each pixel). Mingxing Tan et al. pointed out that when w i When w is a scalar, the model can achieve similar accuracy to other methods with the lowest computational cost. i is a scalar. Since the scalar w i This may lead to unstable training. The present invention uses Softmax to normalize the weights and map them to probabilities between [0, 1] to limit w i The value range of .

[0057]

[0058] The additional Softmax operation will cause the GPU calculation speed to slow down. To solve this problem, the present invention adopts a faster method, which is specifically implemented as shown in formula (5).

[0059]

[0060] In order to make the scalar w i >0, you need to use w i Before that, it is activated by Swish. ε=0.0001 is a smoothing coefficient to avoid the denominator being zero.

[0061] S3, uses an improved convolutional recurrent neural network (CRNN) algorithm to perform text recognition on the located bill text area and outputs the recognized bill text content; the improved CRNN algorithm uses the ResNet residual network as a feature extraction module, and introduces an attention module including two dimensions, channel and spatial, between the residual blocks of ResNet.

[0062] The present invention uses an improved convolutional recurrent neural network (CRNN) to achieve accurate recognition of the located bill text. Figure 5 As shown, CRNN consists of three parts: a feature extraction module CNN, a text feature sequence modeling module BiLSTM (Bi-directional Long Short-Term Memory), and a transcription and translation layer CTC (Connectionist Temporal Classification). The feature extraction module used by the classic CRNN is VGG (Visual Geometry Group), but as the number of network layers increases, VGG faces the problem of network degradation. For this reason, the present invention decides to use ResNet (Residual Network) as the feature extraction module. By using Identity connection in the network, ResNet can refer to the input of the current layer to learn the residual function, thereby extracting more effective feature representations. Identity connection neither introduces additional parameters nor increases the complexity of calculation. While ensuring that the network does not degenerate, it obtains a network depth several times that of VGG and extracts more effective representation features.

[0063] During the training process, ResNet can extract the feature representation required for the classification task from the mixed information of channels and spaces through convolution operations. However, due to the lack of explicit guidance, the model learns some unnecessary features. Figure 6As shown in the figure, in order to obtain more effective feature representation, the present invention introduces the CBAM (Convolutional Block Attention Module) attention module. By introducing the attention module between the residual blocks of ResNet, the network extracts more targeted features.

[0064] The CBAM module can sequentially learn the attention mapping of input features from the channel and spatial dimensions, and strengthen the input features accordingly. Based on the CBAM module, the model can calculate the attention weights in the channel dimension and the spatial dimension respectively, so that the network can pay more attention to the area to be detected in the bill image and ignore irrelevant areas, thereby enhancing the feature extraction capability of the backbone network. Figure 6 As shown in Figure 2, CBAM is mainly composed of two parts: channel attention module and spatial attention module. Assume that the input feature is F and the channel attention module is M c (·), the spatial attention module is M s (·), then

[0065]

[0066]

[0067] Among them, formula (6) F' and formula (7) F" represent the output of the channel attention module and the spatial attention module respectively, and This means element-wise multiplication.

[0068] The channel attention module uses the inter-channel relationship of features to generate channel attention maps. By compressing the spatial dimension of the input features, CBAM achieves the aggregation of spatial information. Considering that the maximum pooling can effectively retain the significant features of the input features, CBAM designs an attention module with two branches. Figure 7 As shown, by feeding the C-dimensional input feature Fc into the maximum pooling branch and the average pooling branch respectively, CBAM can obtain the maximum pooling feature and average pooling features CBAM then feeds the extracted features into a weight-sharing multi-layer perceptron (MLP) to generate two 1*1*C channel attention maps. The final channel attention map is obtained by element-wise addition of the two channel attention maps and sigmoid activation. The channel attention map is expressed as shown in Equation (8).

[0069] M c (F)=sigmoid(MLP(MaxPool(F))+MLP(AvgPool(F))) (8)

[0070] The spatial attention module uses the spatial relationship of features to generate a spatial attention map. Compared to the channel attention module that focuses on "what" the features are, the spatial attention module focuses on "where" the features are. Figure 8 As shown in , the spatial attention module performs maximum pooling and mean pooling along the channel dimension on the feature F' enhanced by the channel attention module to aggregate the spatial information of the input feature. Figure 8 As shown, by generating the maximum pooling feature and mean pooling features By concatenating the convolutional layers along the channel direction and performing a convolution, CBAM can aggregate spatial attention information. By performing a Sigmoid activation on the convolutional output, CBAM can generate the final spatial attention map. The spatial attention formula is shown in Equation (9).

[0071] M s (F) = sigmoid(f 3*3 ([MaxPool(F');AvgPool(F')])) (9)

[0072] In summary, the end-to-end bill recognition method provided by the embodiment of the present invention adopts the improved YOLOv5 to locate and detect the text target in the preprocessed bill image, and applies the hierarchical residual connection to the multi-scale feature extraction module C3 of YOLOv5, thereby enhancing the feature representation ability of the model and obtaining higher detection accuracy; at the same time, the multi-scale feature connection mode of YOLOv5 is improved from the path aggregation network PANet to the bidirectional feature pyramid network BiFPN, and the model channel compression and the assignment of learnable weights to the node input features reduce the number of model parameters and improve the detection speed; the text recognition of the located bill text area is performed by adopting the improved convolutional recurrent neural network CRNN algorithm, the feature extraction of the bill text area is realized by using the ResNet residual network, and the CBAM attention module is inserted between the ResNet residual blocks, thereby increasing the feature extraction ability of the backbone network. The attention module can learn the attention mapping of the input features from the two dimensions of channel and space in turn, and strengthen the input features accordingly. Based on the CBAM module, the model can only focus on necessary features and ignore irrelevant features, thereby enhancing the recognition ability of small characters. Compared to traditional bill recognition methods based on OCR character recognition, the present invention can adapt to end-to-end recognition of bills of different styles, has strong adaptability, and has higher recognition accuracy. Compared to previous bill recognition methods based on deep learning, the present invention improves the bill text detection rate and accuracy, and achieves good recognition results for text of different sizes. As can be seen, the method of the embodiment of the present invention can realize intelligent recognition of various types of bill images, has high versatility, adopts a small number of model parameters, has fast detection speed, high recognition accuracy, convenient engineering deployment, and strong practical feasibility.

[0073] The following experimental comparison results illustrate the bill recognition accuracy of the solution of the present invention.

[0074] 1) Comparison of text positioning detection results

[0075] First, we used the pre-trained YOLOv5 to detect text location, and employed the improved Intersection over Union (IoU) to verify the accuracy of text detection and positioning. IoU is the ratio of the intersection and union between the regression box and the GroundTruth box inferred by the target detection algorithm, and can be used to evaluate the algorithm's detection accuracy. Because many target detection algorithms use additional annotation information, we selected the results of four typical target detection algorithms for comparison. The experimental results are shown in Table 1. Table 1 shows that the YOLOv5 text location detection method can fuse high-level semantic features with low-level position information, achieving significantly better or comparable text location accuracy than other methods.

[0076] Table 1 Text positioning detection effect

[0077] method Positioning accuracy Recall Faster R-CNN 90.05 84.57 EfficientDet 91.96 86.35 CTPN 90.67 57.24 SAST 92.18 81.36 YOLOv5 92.82 86.12

[0078] To verify the effectiveness of the YOLOv5 localization detection algorithm in this model, the original bill image and the regional image detected using YOLOv5 were input into the CRNN for comparative experiments. The experimental results are shown in Table 2. The accuracy of the original image on the experimental set was 87.31%, while the recognition accuracy after YOLOv5 localization detection was 91.84%. Therefore, the YOLOv5 localization detection algorithm can effectively remove background interference, thereby improving recognition accuracy.

[0079] Table 2 verifies the impact of YOLOv5 text positioning on text recognition results

[0080] method Recognition accuracy CRNN 87.31 YOLOv5+CRNN 91.48 Proposed 92.56

[0081] 2) Comparison of text recognition results

[0082] Experiments compared the performance of the improved CRNN model with current mainstream text recognition algorithms for bill recognition. By replacing the classic VGG feature extraction network with a ResNet-18 with residual connections and inserting a CBAM module between residual blocks, the model focused on features that contribute most to character recognition while ignoring the influence of blank areas, thereby enhancing the feature extraction capability of the backbone network. Table 3 shows the recognition results of the proposed method.

[0083] Table 3 Verifies the text recognition results of the complete method of the embodiment of the present invention

[0084] algorithm Recognition accuracy VGG 91.48 ResNet 92.03 Proposed 92.56

[0085] The complete method of the embodiment of the present invention achieved a recognition accuracy rate of 92.56% on the dataset, indicating that introducing the attention mechanism of spatial and channel dimensions between network layers can enable the network to autonomously focus on important features in the bill image, thereby enhancing the network's ability to extract and detect deep semantic features.

[0086] In summary, the improved algorithm can significantly improve the recognition accuracy of bill images, overcome the shortcomings of manual processing of bill images, which is time-consuming, labor-intensive, and greatly affected by subjective factors, and achieve high-precision end-to-end intelligent bill recognition.

[0087] Example 2

[0088] According to the second aspect of the present invention, Figure 9 As shown, an embodiment of the present invention provides an end-to-end bill recognition device, including:

[0089] The image pre-processing unit 91 is used to perform pre-processing operations including denoising, grayscale conversion, and tilt correction on the input bill image;

[0090] The bill text localization unit 92 is configured to locate and detect text objects in the preprocessed bill image using an improved YOLOv5 algorithm to obtain the bill text area; the improved YOLOv5 algorithm applies a hierarchical residual-like connection to the multi-scale feature extraction module C3 of YOLOv5, and simultaneously improves the multi-scale feature connection mode of YOLOv5 from a path aggregation network PANet to a bidirectional feature pyramid network BiFPN;

[0091] The bill text recognition unit 93 is used to use an improved convolutional recurrent neural network (CRNN) algorithm to perform text recognition on the located bill text area and output the recognized bill text content; the improved CRNN algorithm uses the ResNet residual network as a feature extraction module and introduces an attention module including two dimensions, channel and space, between the residual blocks of ResNet.

[0092] It can be understood that the device embodiment 2 has the same inventive concept as the aforementioned method embodiment 1. Figure 9 The implementation of each unit in the device embodiment shown can be found in the aforementioned method embodiment 1 and will not be repeated here. In addition, it should be noted that the unit names described in device embodiment 2 do not, in some cases, constitute limitations on the units themselves.

[0093] Example 3

[0094] According to a third aspect of the present invention, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program executes the method described in the above-mentioned embodiment 1 when executed by a processor.

[0095] The computer-readable storage medium of the embodiment of the present invention may be any tangible medium containing a stored program. Furthermore, the computer-readable storage medium of the embodiment of the present invention may be located in any computer terminal in a computer terminal group in a computer network, or in any communication device in a communication device group.

[0096] Example 4

[0097] According to the fourth aspect of the present invention, an embodiment of the present invention provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of the present invention.

[0098] Reference below Figure 10 , which shows a schematic structural diagram of an electronic device suitable for implementing an embodiment of the present invention. The electronic devices in the embodiments of the present invention may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 10 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention.

[0099] like Figure 10 As shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). In the RAM, various programs and data required for the operation of the electronic device are also stored. The processing device, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.

[0100] Typically, the following systems can be connected to the I / O interface: input devices such as a touch screen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices such as a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices such as a magnetic tape, hard disk, etc.; and communication devices. The communication device can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figures show electronic devices with various systems, it should be understood that it is not required to implement or have all of the systems shown. More or fewer systems may be implemented or have instead.

[0101] In particular, according to embodiments of the present invention, the processes described in the flowcharts above can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-described functions defined in the methods of the embodiments of the present invention are performed.

[0102] Finally, it is necessary to explain:

[0103] The serial numbers of the embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of each embodiment. In the above embodiments of the present invention, the description of each embodiment has its own focus. For details not described in one embodiment, please refer to the relevant descriptions of other embodiments. The embodiments of the present invention may be implemented in hardware, software, firmware, or a combination thereof.

[0104] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the system embodiments described above are merely illustrative. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.

[0105] The units described as separate components may or may not be physically separate, and 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

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

[0107] In addition, the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit. Moreover, if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in the various embodiments of the present invention.

Claims

1. An end-to-end bill recognition method, characterized in that: include: S1, performing preprocessing operations including denoising, grayscale, and tilt correction on the input bill image; S2, using an improved YOLOv5 to locate and detect the text target in the preprocessed bill image to obtain the bill text area; the improved YOLOv5 applies a hierarchical residual connection to the multi-scale feature extraction module C3 of YOLOv5, and at the same time improves the multi-scale feature connection mode of YOLOv5 from a path aggregation network PANet to a bidirectional feature pyramid network BiFPN; S3, using an improved convolutional recurrent neural network CRNN algorithm to perform text recognition on the located bill text area, and output the recognized bill text content; the improved CRNN algorithm uses the ResNet residual network as a feature extraction module, and introduces an attention module including two dimensions of channel and space between the residual blocks of ResNet.

2. The method according to claim 1, characterized in that In step S2, the layered residual-like connection is applied to the multi-scale feature extraction module C3 of YOLOv5, including: The hierarchical residual-like connection is introduced into the multi-scale feature extraction module C3 of YOLOv5 to form a Res2C3 network; the Res2C3 network includes two branches, one is a feature extraction branch, and the other is a shortcut branch; wherein the feature extraction branch is composed of a convolutional layer and a stack of n residual blocks, and the shortcut branch includes a convolutional layer, so that the Res2C3 network replaces the n-channel 3*3 convolutional layer in the residual block with s groups of convolutional groups with w channels; When performing text location detection on bill images, the Res2C3 network directly outputs the first convolution group, while each of the remaining convolution groups needs to perform a 3*3 convolution. Starting from the third convolution group, the Res2C3 network adds the convolution output of the previous group and the convolution input of the current group and then performs a 3*3 convolution. Finally, the Res2C3 network concatenates the grouped convolution output and the convolution output on the shortcut branch, and then uses a 1*1 convolution to complete feature fusion.

3. The method according to claim 1, characterized in that In the step S2, the multi-scale feature connection mode of YOLOv5 is improved from the path aggregation network PANet to the bidirectional feature pyramid network BiFPN, including: Compared with the PANet network, the BiFPN network deletes nodes with only one input edge; The BiFPN network improves the 3rd to 5th layers of the 5-layer feature pyramid extracted by YOLOv5, adds a connection path between the original input and output nodes, and compresses the model channel to form a bidirectional feature fusion network.

4. The method according to claim 1, characterized in that: In the step S2, the multi-scale feature connection mode of YOLOv5 is improved from the path aggregation network PANet to the bidirectional feature pyramid network BiFPN, and further includes: The BiFPN network assigns a weight to each input feature, and the weight is adaptively calculated by the BiFPN network based on the importance of the input feature; The contribution O of each input feature to multi-scale feature fusion is calculated according to the following formula: Among them, w i is the weight, I i is the input feature of the node, ε=0.0001 is a smoothing coefficient to avoid the denominator being 0; the weight w i is a scalar, and the weight w is i Normalize it and map it to a probability between [0,1] to limit the weight w i The value range of , and in order to make the weight w as a scalar i > 0, when using the weight w i Before doing that, activate it by Swish.

5. The method according to claim 1, characterized in that The improved CRNN algorithm in step S3 uses the ResNet residual network as a feature extraction module, and introduces an attention module including two dimensions, channel and space, between the residual blocks of ResNet, including: By utilizing the Identity connection used by the ResNet residual network, the improved CRNN algorithm can learn the residual function with reference to the input of the current layer and extract more effective feature representation; By introducing an attention module between the residual blocks of ResNet, the attention module includes a channel attention module and a spatial attention module. The improved CRNN algorithm can learn the attention mapping of input features from the two dimensions of channel and space in a targeted manner, and strengthen the input features accordingly.

6. The method according to claim 5, characterized in that The channel attention module is used to generate a channel attention map using the inter-channel relationship of the feature, and the process of generating the channel attention map includes: By transforming the C-dimensional input feature F c Send them to the maximum pooling branch and the average pooling branch respectively to obtain the maximum pooling feature and the average pooling feature; The extracted features are fed into a weight-shared multi-layer perceptron MLP to obtain two 1*1*C channel attention maps; The final channel attention map is obtained by adding the two channel attention maps element-wise and using Sigmoid activation.

7. The method according to claim 5, characterized in that The spatial attention module uses the spatial relationship of features to generate a spatial attention map, and the process of generating the spatial attention map includes: The feature F' enhanced by the channel attention module is subjected to maximum pooling and mean pooling in sequence along the channel dimension to aggregate the spatial information of the input features; The generated maximum pooling features and mean pooling features are concatenated in the channel direction and convolved once to achieve the aggregation of spatial attention information. The final spatial attention map is generated by performing a Sigmoid activation on the convolution output.

8. An end-to-end bill recognition device, characterized in that: include: An image preprocessing unit, used to perform preprocessing operations including denoising, grayscale conversion, and tilt correction on the input bill image; The bill text positioning unit is used to use the improved YOLOv5 to locate and detect the text target in the preprocessed bill image to obtain the bill text area; the improved YOLOv5 applies the layered residual connection to the multi-scale feature extraction module C3 of YOLOv5, and at the same time improves the multi-scale feature connection mode of YOLOv5 from the path aggregation network PANet to the bidirectional feature pyramid network BiFPN; The bill text recognition unit is used to use an improved convolutional recurrent neural network (CRNN) algorithm to perform text recognition on the located bill text area and output the recognized bill text content; the improved CRNN algorithm uses the ResNet residual network as a feature extraction module, and introduces an attention module including two dimensions, channel and space, between the residual blocks of ResNet.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is executed.

10. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Sleep post identification method, device and equipment and medium

    CN114821647A

  • Road disease detection method and device based on multi-scale fusion strategy and improved YOLOv5

    CN117670791A

Cited By

  • Vote recognition method and system and vote counting system

    CN119169391A

  • Character position and content identification method based on AI

    CN119445589A

  • Secondary-circuit terminal image recognition method based on contrastive learning and improved crnn

    WO2026107870A1