Text detail graph as a supervised approach for end-to-end text detection and recognition
By using the text detail map as a supervision signal and the ResNet18 backbone network in the end-to-end text detection and recognition model, combined with the text attention head and feature pyramid enhanced fusion module, the problems of slow inference speed and incomplete detection of the existing model are solved. Efficient and accurate text detection and recognition performance is achieved.
Patent Information
- Application Number
- CN202410266715.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-08
- Publication Date
- 2024-08-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing end-to-end text detection and recognition models have too many parameters or complex pipelines, low inference speed, and are difficult to apply to real scenarios. They also lack complementarity between text detection and recognition, resulting in incomplete detection and inaccurate recognition.
Designed an end-to-end text detection and recognition method based on text detail map as supervision, using ResNet18 as the backbone network, combined with the text attention head and feature pyramid to enhance the fusion module, extract and fuse local features and global position information, and predict text Position, texture and boundary, improve detection and recognition performance through text detail maps.
It achieves efficient and accurate arbitrary-shaped text detection and recognition, has good real-time speed and generalization ability, improves the accuracy and reasoning speed of text detection and recognition, and is suitable for real-life scenario applications.
Smart Images

Figure CN118053150B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of text processing and relates to a supervision method for end-to-end text detection and recognition based on a text detail graph. Background Art
[0002] Understanding text content in natural scenes is a basic task in computer vision applications in the era of deep learning, such as image retrieval, visual question answering, image understanding, etc. Due to the powerful representation ability of deep neural networks, scene text detection based on deep learning algorithms such as Figure 1 As shown in the figure, the comparison between text detection only and end-to-end text detection and recognition. The first row is the result of text detection only. The second row is the result of end-to-end text detection and recognition. The recognition model has developed rapidly in the past few years. But there are still many problems. First, many works treat text detection and recognition as separate tasks, either focusing only on text detection or only on text recognition.
[0003] For the current common text detectors, a convolutional neural network is first used to extract the feature map of the input image, and then a designed decoder is used to generate a rectangular or polygonal bounding box of the scene text. On the other hand, most text recognition methods are based on a sequence prediction network based on the text in the text image. Some previous works divide text detection and recognition into two steps, lacking the complementarity between text detection and recognition, such as Figure 1 As shown, only text detection has great defects, end-to-end text recognition ( Figure 1 The second line makes up for the lack of detection). Although some research progress in recent years has improved the accuracy of end-to-end arbitrary shape text recognition, its inference speed is low due to too many model parameters or complex model pipelines, making it difficult to apply to real scenarios. Therefore, how to design an efficient and accurate end-to-end arbitrary shape text detection and recognition method is still an urgent problem to be solved.
[0004] In recent years, many scholars have proposed to integrate text detection and recognition tasks into one network and proposed different strategies. MaskTextSpotter (MTS) may be the first arbitrary shape text detection and recognition algorithm that uses character-level supervised annotations for simultaneous detection and recognition of text lines and characters. Fourier transform is used on the contours of text instances to model highly curved text. FOTS is an end-to-end learnable text detection and recognition model. The model introduces RoIRotate, which can generate oriented text regions from convolutional feature maps to support the recognition of tilted text. ABCNet adapts to arbitrary shape text by parameterizing Bezier curves and designs a new BezierAlign layer to accurately extract convolutional features of text instances of arbitrary shapes, thereby improving certain accuracy. PAN++ is an arbitrary shape text representation method based on the text core (i.e., the central area), which can better distinguish adjacent texts and achieve real-time detection and recognition accuracy. Mask TextSpotterv3 introduces an anchor-free segmentation proposal network and gives an accurate polygonal representation of the proposal, which solves the shortcomings of RPN-based technology. Transformer is increasingly used in image processing. Transformer is considered to be better at capturing global feature information than traditional convolutional structures. However, it is difficult to obtain global feature information. Transformer requires more computing resources than traditional convolutional structures to capture long-term dependencies, which also weakens local feature information. Therefore, designers combine convolution and Transformer to model local and global dependencies of sequences. Many studies have proposed using Transformer instead of RCNN backbone network for text recognition tasks. For example, SwinTextSpotter, for the first time, uses Transformer-based methods and ensemble prediction schemes for end-to-end scene text detection and recognition. These techniques demonstrate the effectiveness of Transformer for text detection and recognition. However, in addition to calculating the text target of interest, Transformer also calculates additional non-essential background areas, which makes the model pipeline of the Transformer structure complex and the computing resources huge, making it difficult to apply to real industrial scenarios.
[0005] When only the text detection algorithm is used, the text line detection cannot completely surround the text line, and the text detection cannot recognize the text content. In the STDC-Seg semantic segmentation algorithm, the image detail edge is used as a supervisory signal, which makes the model very accurate and fast. Inspired by the STDC-Seg model, the text detail map (text texture and boundary) is added to the model as a new supervisory signal. Inspired by the PAN++ algorithm, an end-to-end text detection and recognition algorithm DiZNet based on the text detail map is designed. Based on the representation advantage of the text detail map, the model proposed in this paper can effectively detect and recognize text of any shape and has a high real-time speed. The following designs are adopted in the model:
[0006] 1) First, the model uses ResNet18 as the backbone network for feature extraction. The model has few parameters and a simple pipeline, while having good feature representation capabilities.
[0007] 2) To enhance the representation ability of the model, extract and fuse the local features of the text image and the global text position information, a text attention head TAH is proposed. The function of the text attention head TAH is to extract the key features of the four feature maps of different pixel sizes (1 / 32, 1 / 16, 1 / 8 and 1 / 4) extracted by the backbone network, that is, to extract the required text features.
[0008] 3) In order to fuse the local features of the text image extracted by the text attention head TAH and the global text position information, a low-computation feature enhancement fusion network composed of stackable feature pyramid enhancement fusion modules (FPEFM) is proposed. Self-enhance shallow backbone features and fuse the text features extracted by the text attention head TAH. The FPEFM module is a stackable structure. This allows FPEFM to be superimposed on a lightweight backbone, combined with the residual structure fusion design of the text attention head TAH, effectively enhancing the representation ability of the backbone network feature extraction and the depth of the model, so that the model can adaptively extract and enhance feature representation.
[0009] 4) Based on the advantages of text detail graph representation, the text detail graph predicted by the model is integrated into the text detection head and recognition head, which can effectively improve the detection and recognition performance of the model. Through the above design, the model effectively improves the accuracy of text detection and recognition and achieves a good inference speed.
[0010] This paper proposes a novel and efficient end-to-end natural scene text detection and recognition framework, called DiZNet (i.e., Arbitrary Shape Text Detector and Recognizer based on Text Details). Unlike previous end-to-end text detectors and recognizers that use complex, hand-crafted network architectures resulting in low inference speed, DiZNet's innovative design uses text detail maps as representations. This model is a lightweight text detection and recognition model based on ResNet18 as the backbone. The model extracts local features of text images and global text location information through text attention heads TAH. The extracted features are integrated into the stackable feature enhancement fusion module FPEFM. Under the supervision of the text detail truth map label, the model predicts the text detail map and fuses the text detail map into the text detection head and recognition head. Through testing on public scene text detection benchmark datasets, the method has strong generalization ability and real-time detection speed.
[0011] Because previous text detection and recognition models have too many parameters or complex model pipelines, their inference speed is low and difficult to apply to real scenarios. Therefore, how to design an efficient and accurate end-to-end arbitrary shape text detection and recognition method remains an urgent problem to be solved. Summary of the invention
[0012] In view of this, the object of the present invention is to provide a supervised method for end-to-end text detection and recognition based on text detail graph.
[0013] In order to achieve the above object, the present invention provides the following technical solutions:
[0014] The text detail graph is used as a supervision method for end-to-end text detection and recognition. The method includes the following steps:
[0015] Given an input image containing text of arbitrary shape, the input image is processed by two independent processing branches;
[0016] The first processing branch extracts text texture and boundary information from the input image and generates a text detail map;
[0017] The second processing branch uses deep learning neural networks to learn and infer the location and content of text in different contexts;
[0018] Under the supervision of text detail graph as new label, an end-to-end natural scene text detection and recognition model is proposed;
[0019] In the second processing branch, during the deep learning branch processing, a lightweight feature extraction network ResNet18 is used as the backbone network of DiZNet; the backbone network extracts shallow feature maps with different resolutions of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 from the input image, corresponding to the conv2, conv3, conv4, and conv5 layers, respectively; the shallow feature maps are processed using 1x1 convolution, and the number of channels is unified to 128;
[0020] Design the text attention head TAH and the feature pyramid enhancement fusion module FPEFM; FPEFM performs feature self-enhancement at different scales, fuses the local features of the text image extracted by the text attention head TAH module and the global text position information, and fuses the features extracted by the text attention head TAH from feature maps of different scales; by stacking multiple FPEFMs, the feature representation ability and depth of the model are continuously enhanced; the feature map is upsampled to a uniform size to obtain the final enhanced feature map;
[0021] The enhanced feature map predicts three components:
[0022] The detection head is responsible for predicting the text location; the detection head predicts text cores, text regions, and text vectors, and predicts text lines by pixel aggregation;
[0023] The detail head uses the text detail map as a supervisory signal to predict text texture and boundaries;
[0024] The recognition head recognizes the text content by integrating the text detail graph and obtains the recognition result;
[0025] During the model inference stage, there is no need to use the ground-truth text detail map as a supervision label; instead, the model predicts text texture and boundaries, and then the predicted text detail map is fused into the detection head to infer the text location; the predicted text detail map is fused into the recognition head to recognize the text content.
[0026] Furthermore, in the second processing branch, during the deep learning branch processing, a lightweight feature extraction network ResNet18 is used as the backbone network of DiZNet; the backbone network extracts shallow feature maps with different resolutions of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 from the input image, corresponding to the conv2, conv3, conv4, and conv5 layers, respectively; the shallow feature maps are processed using 1x1 convolution, and the number of channels is unified to 128; a text attention head TAH is designed, and a feature pyramid enhancement fusion module FPEFM is designed; FPEFM performs feature self-enhancement at different sizes, fuses the local features of the text image extracted by the text attention head TAH module and the global text position information, and fuses the features extracted by the text attention head TAH from feature maps of different sizes; by stacking multiple FPEFMs, the feature representation capability of the model and the depth of the model are continuously enhanced; the feature map is upsampled to a uniform size to obtain the final enhanced feature map, specifically:
[0027] Step 1: Input the original image into the ResNet18 feature extraction backbone network. The ResNet18 feature extraction backbone network will input the original image for feature extraction and obtain feature maps of 128 channels with 4 resolution sizes. The obtained shallow feature maps have resolution sizes of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original image size respectively.
[0028] Step 2: Take the 128-channel feature map of 4 resolutions obtained in the first step as input and send it to the text attention head TAH. Each feature map of 128 channels will be sent to the text attention head TAH for calculation, extract the information of the shallow feature map, and obtain the local feature information of the text image and the global text position information. The mathematical calculation process of the shallow feature map is as follows. Assume that the number of input channels is C, C is set to 128 in this experiment, W is the width of the feature map, H is the height of the feature map, and the input shallow feature map is expressed as C×W×H; use a pooling kernel of size (H, 1) or (1, W) to encode each channel along the horizontal X-axis and vertical Y-axis coordinates; the vertical direction expression is written as:
[0029]
[0030] The horizontal expression is written as:
[0031]
[0032] The shallow feature map is encoded in the horizontal and vertical directions and then aggregated to obtain feature maps that are sensitive to text areas in the horizontal and vertical directions; these feature maps are represented in the horizontal and vertical directions respectively as and Subsequently, the text region-sensitive feature map is fused with the feature maps in two directions through a 1×1 convolution kernel, and the channel dimension is reduced through a convolution operation. A Sigmod activation function is then used to obtain a feature map f, which represents the fusion of text region-sensitive features in two directions.
[0033] f=δ(F1([z h ,z w ]))
[0034] To enforce text region-sensitive features, a TA threshold activation operation is used to enhance important text region features; 0.1 (f) indicates that the pixel is activated, and the pixel value greater than the threshold value of 0.1 is retained in the reduced C / r×1×(W+H) feature map. r represents the scaling factor for reducing the number of channels. The threshold activation operation enhances and retains the important information of the text area. Finally, the activated feature map t and the feature map before activation are added pixel by pixel, and the feature map of the text area is re-weighted to retain important shallow feature information and strengthen the representation of the text area. The default value of the TA threshold activation operation is set to 0.1 in the experiment.
[0035] t=TA 0.1 (f)+f
[0036] For the feature map t, we get the intermediate feature map encoding the spatial information along the X-axis and Y-axis, and get the attention weight g of the X-axis respectively. h and the attention weight g on the Y axis w ;
[0037] g h =σ(F h (t h ))
[0038] g w =σ(F w (t w ))
[0039] The original input C×W×H shallow feature map is recorded as x c (i, j), and obtain the reweighted feature map; the expression representing the reweighted output feature map is denoted by r c (i,j), written as:
[0040]
[0041] In order to ensure the robustness of the feature map after re-weighting, the features are sent to the spatial attention and channel attention, and the outputs of the two are summed. The channel attention effectively enhances the context information in the channel dimension and improves the text detection and recognition performance. The sum of the outputs of the dual attention mechanism is fused to obtain the final feature. Then the processing of the text attention head TAH module is completed, and the output of the text attention head TAH module becomes part of the input of the feature pyramid enhancement fusion module FPEFM. The text attention head TAH module is connected to the model backbone through a residual structure, which is conducive to adaptive feature extraction and prevents the feature extraction ability from decreasing.
[0042] Step 3: The feature maps of 128 channels with 4 resolutions obtained in the first step and the local feature information of the text image and the global text position information extracted in the second step are sent as input to the feature enhancement fusion module FPEFM;
[0043] The 128 feature maps of the four shallow layers are subjected to the self-enhancement stage of the feature enhancement fusion module FPEFM. In the first stage of the self-enhancement stage, the feature map sizes of the feature enhancement fusion module input are 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the original image pixels, respectively, to form a feature pyramid structure; iterative enhancement is performed from 1 / 4 pixel step to 1 / 32 pixel step; iterative enhancement is continued from 1 / 32 pixel step to 1 / 4 pixel step; the enhanced feature pyramid point elements after self-enhancement are sequentially added to obtain the output feature pyramid;
[0044] In the second stage, the fusion stage, the output of the shallow feature map self-enhancement pyramid is fused with the local features of the text image and the global text position information extracted by the text attention head TAH; the corresponding pixels are concat together, and feature fusion is achieved through 1x1 convolution. The feature map after fusion maintains the same number of input feature channels; the output feature map of the enhanced feature pyramid enhancement fusion module becomes part of the input of the next round of feature pyramid enhancement fusion module; the other part of the input comes from the local features of the text and the global text position information that the text attention head TAH module continues to extract; the text attention head TAH module extracts features from the backbone network and uses the residual design structure for fusion, allowing the feature pyramid enhancement fusion module to adaptively fuse the required features, thereby enhancing the representation ability and depth of the model;
[0045] Step 4: The shallow feature maps of 4 resolutions are fused through two layers of stacked text attention heads and feature pyramid enhancement connected by residual structures to obtain the final 512 enhanced feature maps. The 512 enhanced feature maps are uniformly upsampled to a resolution of 1 / 4 size; the 512 enhanced feature maps enter the post-processing of end-to-end text detection and recognition;
[0046] In the post-processing stage, the enhanced feature map predicts three components: detection head, detail head, and recognition head;
[0047] The detection head is responsible for predicting the text position; the detection head predicts the text core, text area and text vector, and finally predicts the text line through pixel aggregation; the detection head predicts the text area through three loss functions, and the loss of text detection is expressed as Among them, Lregion represents the loss of text region segmentation, and Lkernel represents the loss of text kernel; hyperparameters α and β are used to balance and The weights are set to 0.6 and 0.25 in all experiments respectively; Dice loss is used to supervise the text region segmentation result Pregion, as well as the point-wise element addition of the text kernel and the text activation map Pkernel;
[0048]
[0049] and The mathematical expression is as follows:
[0050]
[0051]
[0052] P region and G region (i) respectively represent the predicted value and true value of the text area of the i-th pixel in the segmentation result; similarly, P kernel and G kernel (i) represents the predicted value of the text kernel of the i-th pixel and the true value of the text kernel; aggregation loss Used to minimize the distance between pixels in the same text line and between text kernels;
[0053]
[0054] N represents the number of text lines; T i represents the text area of the i-th text line, K i represents the text kernel of the i-th text line; D1(p,Ki) represents the relationship between text pixel p and text kernel K i To distinguish different text kernels and non-text areas of text pixels, the following equation is used:
[0055]
[0056] D b (Ki) represents the text kernel K iThe distance between the kernel and the background; D2(Ki,Kj) represents the distance between different text kernels;
[0057] The detail head utilizes the text detail map as a supervisory signal to predict text texture and boundaries.
[0058] Further, the detail head uses the text detail map as a supervisory signal to predict text texture and boundaries, including the following steps:
[0059] Text detail truth map processing;
[0060] In the DiZNet model, the original image input in the first step is processed in advance and processed into a text detail truth map. The DiZNet model uses the text detail truth map as the supervision signal of the model; first, the original image is cropped according to the marked text position label, and only the text area is cropped, and the pixel values of other non-text areas are filled with 0, that is, the text area of the cropped image; then the Canny edge extraction algorithm of openCV is used to extract the text texture and boundary in the cropped image; the good text texture and boundary map are extracted as the text detail truth map; the processing process of two sets of text detail truth maps is demonstrated: the ICDAR2015 dataset of multi-directional straight text and the TotalText dataset of arbitrary shape curved text;
[0061] Prediction of text detail graph:
[0062] In the DiZNet model, the prediction process of the detail map mainly predicts the texture and boundary of the text on the input image based on the text detail map label. First, the original text image is cropped and edge extracted to obtain the true value map of the text texture and boundary as the label. After processing according to the steps of the text detail true value map processing process, the white pixels are text information; the black pixels are non-text areas.
[0063] In the first step, the original image is sent to the ResNet18 backbone network for feature extraction. In the second step, the text attention head extracts the local features of the text image and the global text position information. In the third step, feature enhancement and fusion are performed to obtain an enhanced feature map of 512 channels.
[0064] Through the CBR operation, which is a collection of 3x3 convolution, normalization, and ReLU activation function operations, the enhanced feature map is further divided into two small steps;
[0065] 1) Under the optimization of text fire kernel loss, the minimum description area of the text is predicted through the text header;
[0066] 2) Obtain the feature map of 6 channels through 1x1 convolution fusion feature, and predict the text detail map of 1 channel through the detail head. The detail head is composed of three CBR operations and finally through the Sigmod activation function. The obtained detail map pays more attention to the text position information and texture information; the obtained text kernel is subjected to 1x1 convolution, normalization, ReLU activation function, and finally threshold activation to retain the 1-channel feature map of the pixel area with pixel points greater than 0.1; add the two 1-channel feature maps point by point element to fuse the text kernel and text details; under the supervision of the detail truth map label, use the detail loss function to simultaneously optimize the text kernel and text detail map; the algorithm prediction process of the text detail map; with the fusion of the text detail map, the text detection capability is continuously improved;
[0067] Text detail map loss L detail_loss The text detail map and text kernel are optimized simultaneously based on the text detail truth map supervision label. The calculation expression is as follows:
[0068] L detail_loss ={l1,,,,,l N},l n
[0069] =-[y n ·log(σ(x n ))+1-y n ·log(1-σx n )]
[0070] The predicted text detail map and the predicted text kernel are flattened into a one-dimensional vector. Then, BCEWithLogitsLoss is used to calculate the loss of each pixel under the supervision of the text detail truth map. σ represents the Sigmoid activation function. Finally, the flattened one-dimensional vector is restored to the size of the input image. Under the supervision of the text detail truth map, the predicted text detail map is fused with the detection head and the recognition head to improve the performance of end-to-end text detection and recognition.
[0071] The recognition head recognizes the text content by integrating the text detail graph and obtains the recognition result;
[0072] Loss function for text recognition as follows:
[0073]
[0074] Where w is a true record containing the EOS symbol; |w| represents the number of characters; |w|i represents the i-th character;
[0075] The total loss of the model is:
[0076]
[0077] Text Detection Loss Text recognition loss Text detail map loss sum.
[0078] The beneficial effect of the present invention is that the present invention is designed based on the text detail truth map as a supervision label, and the processing process of the text detail truth map is designed. Thanks to the advantages of the text detail map representation, DiZNet achieves a good trade-off between accuracy and efficiency on challenging datasets. For example, DiZNet obtains 91.2% accuracy (Precision) and 85.9% F-measure at a speed of 38.4FPS on Total-Text, and 83.8% F-measure at a speed of 30.0FPS on ICDAR2015. The code and model will be made public at: https: / / github.com / DiZ-gogogo / DiZNet. The DiZNet model has real-time inference speed, efficient text detection and recognition accuracy, recall rate, F-measure and FPS.
[0079] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0081] Figure 1 Comparison between text detection only and end-to-end text detection and recognition;
[0082] Figure 2 DiZNet is an end-to-end text detection and recognition method based on text detail graph;
[0083] Figure 3 It is the text attention head TAH;
[0084] Figure 4 It is the feature pyramid enhancement fusion module FPEFM;
[0085] Figure 5 It is the process of processing the truth value map of text details;
[0086] Figure 6 Prediction process for text details;
[0087] Figure 7 Visualize the results of the text attention head TAH;
[0088] Figure 8 Detect visualization results for the Total-Text dataset;
[0089] Fig. 9 Detection visualization results for the ICDAR15 dataset;
[0090] Fig.10 Comparative experiments on Total-Text and IC15 datasets;
[0091] Fig.11 Visualize the end-to-end detection and recognition results for the Total-Text dataset;
[0092] Fig.12 Visualize the end-to-end detection and recognition results for the ICDAR15 dataset;
[0093] Fig.13 End-to-end recognition results for the Total-Text dataset;
[0094] Fig.14 End-to-end recognition results for the ICDAR15 dataset. DETAILED DESCRIPTION
[0095] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0096] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0097] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is 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 orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0098] See also Figure 1 to Figure 14 , the end-to-end text detection and recognition method DiZNet based on text detail map is as follows: given an input image containing text of arbitrary shape, the image is processed by two independent branches. First, the first processing branch extracts text texture and boundary information from the image and generates a text detail map (such as Figure 2 The second processing branch uses deep learning neural networks to learn and infer the location and content of text in different contexts. Under the supervision of the text detail graph as a new label, a novel end-to-end natural scene text detection and recognition model is proposed. In the text detail truth graph processing branch, the specific steps are as follows Figure 5 shown.
[0099] During the deep learning branch processing, a lightweight feature extraction network ResNet18 is used as the backbone network of DiZNet. The backbone network extracts shallow feature maps with different resolutions (1 / 4, 1 / 8, 1 / 16, 1 / 32) from the input image, corresponding to the conv2, conv3, conv4 and conv5 layers respectively. Subsequently, 1x1 convolution is used to process these feature maps, unifying the number of channels to 128. ResNet18 has good feature representation capabilities, few parameters, and low model complexity. In order to extract important local features of text images, global position information, and further enhance the representation ability of the model, a text attention head TAH is designed, such as Figure 2 As shown in D in the figure, the text attention head TAH can effectively extract the local features of the text image and the global text position information. How to effectively fuse the extracted text features to enhance the robustness of the model. To this end, the feature pyramid enhanced fusion module (FPEFM) is designed, as shown in Figure 2FPEFM further fuses the local features of the text image and the global text position information extracted by the text attention head TAH module by performing feature self-enhancement at different scales, which allows the model to effectively fuse the features extracted by the text attention head TAH from feature maps of different scales. FPEFM is stackable. By stacking multiple FPEFMs, the feature representation ability and depth of the model are continuously enhanced. Finally, the feature map is upsampled to a uniform size to obtain the final enhanced feature map, as shown in Figure 2 In the post-processing stage of the model, the enhanced feature map predicts three components:
[0100] The detection head is mainly responsible for predicting the text location. The detection head predicts the text core, text region and text vector. Figure 2 The text line is finally predicted by pixel aggregation.
[0101] The detail head uses the text detail map as a supervisory signal to predict text texture and boundaries. Figure 2 ).
[0102] The recognition head recognizes the text content by integrating the text detail graph and obtains the recognition result. Figure 2 ).
[0103] In the model inference stage, there is no need to use the ground truth text detail map as a supervision label. Instead, the model predicts the text detail map (text texture and boundaries), and then the predicted text detail map is fused into the detection head to infer the text location. The predicted text detail map is fused into the recognition head to recognize the text content.
[0104] The first step: input the original image into the ResNet18 feature extraction backbone network. The ResNet18 feature extraction backbone network will input the original image for feature extraction and obtain feature maps of 128 channels with 4 resolution sizes, and obtain shallow feature maps with resolution sizes of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original image size respectively.
[0105] Step 2: Take the 128-channel feature map of 4 resolution sizes obtained in the first step as input and send it to the text attention head TAH. Each 128-channel feature map will be sent to the text attention head TAH for calculation, extract the information of the shallow feature map, and obtain the local feature information of the text image and the global text position information. The mathematical calculation process of the shallow feature map is as follows. Assume that the number of input channels is C, C is set to 128 in this experiment, W is the width of the feature map, and H is the height of the feature map. Therefore, the input shallow feature map is expressed as C×W×H. Use a pooling kernel of size (H, 1) or (1, W) to encode each channel along the X-axis (horizontal) and Y-axis (vertical) coordinates. The vertical expression can be written as:
[0106]
[0107] The horizontal expression can be written as:
[0108]
[0109] The shallow feature map is encoded in the horizontal and vertical directions and then aggregated to obtain feature maps that are sensitive to text areas in the horizontal and vertical directions. These feature maps are represented as and Subsequently, the text area sensitive feature map is fused with the feature maps in two directions through a 1×1 convolution kernel, the channel dimension is reduced through the convolution operation, and a feature map f is obtained by using the Sigmod activation function. The feature map f represents the fusion of the text area sensitive features in two directions.
[0110] f=δ(F1([z h ,z w ]))
[0111] To further enforce text region-sensitive features, a TA threshold activation operation is used to enhance important text region features. 0.1 (f) indicates that the pixel is activated, and the pixel values greater than the threshold of 0.1 are retained in the reduced C / r×1×(W+H) feature map. r represents the scaling factor for reducing the number of channels. The threshold activation operation enhances and retains the important information of the text area. Finally, the activated feature map t and the feature map before activation are added pixel by pixel, and the text area feature map is re-weighted, thereby retaining important shallow feature information and strengthening the representation of the text area. The default value of the TA threshold activation operation is set to 0.1 in the experiment.
[0112] t=TA 0.1 (f)+f
[0113] Next, for the feature map t, we get the intermediate feature map encoding the spatial information along the X-axis and Y-axis directions, and get the attention weights g of the X-axis respectively. h and the attention weight g on the Y axis w .
[0114] g h =σ(F h (t h ))
[0115] g w =σ(F w (t w ))
[0116] In addition, the original input C×W×H shallow feature map is recorded as x c (i, j), and obtain the reweighted feature map. The expression representing the reweighted output feature map is denoted by r c (i,j), can be written as:
[0117]
[0118] In order to ensure the robustness of the feature map after re-weighting, the features are sent to the spatial attention and channel attention, and the outputs of the two are summed. The channel attention effectively enhances the context information in the channel dimension and improves the text detection and recognition performance. Finally, the sum of the outputs of the dual attention mechanism is fused to obtain the final feature. Then the processing of the text attention head TAH module is completed, and the output of the text attention head TAH module becomes part of the input of the feature pyramid enhancement fusion module (FPEFM). The text attention head TAH module is connected to the model backbone through a residual structure, which is conducive to adaptive feature extraction and prevents the degradation of feature extraction ability.
[0119] The function of the text attention head TAH: The main function of the text attention head TAH is to adaptively extract the local features of the text image and the global text position information. Figure 1As shown in the figure, assuming that the input feature size of the text attention head TAH module is CxHxW, the feature map is average pooled along the X and Y axes, and then the pooled features are concatenated and then convolved to reduce the channel dimension. The final channel size is C / r×1×(W+H), where r is a channel reduction factor. Subsequently, threshold activation (TA) is applied, which effectively captures the sensitive information in the feature map, namely the local text features or global text position information extracted along the X and Y axes of the input feature map. The activated features are element-wise added to the feature map before activation, followed by normalization and nonlinear operations along the X and Y axes, convolution to increase the channel dimension, and finally the Sigmoid activation function. The extracted features are then fused with the original input feature map to obtain the fused re-weighted feature map.
[0120] The re-weighted feature map is further enhanced with dual attention to ensure the robustness of the feature. Position attention continuously captures the position information of text of any shape, and channel attention effectively enhances the context information in the channel dimension to improve text detection and recognition performance. Finally, the sum of the outputs of the dual attention mechanism is fused to obtain the final feature. The text attention head TAH module is connected to the model backbone through a residual structure, which is conducive to adaptive feature extraction and prevents the degradation of feature extraction capability.
[0121] Step 3: The feature map of 128 channels with 4 resolution sizes obtained in the first step and the local feature information of the text image and the global text position information extracted in the second step are sent as input to the feature enhancement fusion module (FPEFM).
[0122] The 128 feature maps of the four shallow layers are subjected to the self-enhancement stage of the feature enhancement fusion module FPEFM. In the first stage of the self-enhancement stage, the feature map sizes of the feature enhancement fusion module input are 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the original image pixels, forming a feature pyramid structure. Then, iterative enhancement is performed from 1 / 4 pixel step to 1 / 32 pixel step. Iterative enhancement is continued from 1 / 32 pixel step to 1 / 4 pixel step. Finally, the enhanced feature pyramid point elements after self-enhancement are added in sequence to obtain the output feature pyramid.
[0123] In the second stage, the fusion stage, the output of the shallow feature map self-enhancement pyramid is fused with the local features of the text image and the global text position information extracted by the text attention head TAH. The corresponding pixels are concat together, and feature fusion is achieved through 1x1 convolution. The fused feature map maintains the same number of input feature channels. The output feature map of the enhanced feature pyramid enhancement fusion module becomes part of the input of the next round of feature pyramid enhancement fusion module. The other part of the input comes from the local features of the text and the global text position information that the text attention head TAH module continues to extract. The text attention head TAH module extracts features from the backbone network and fuses them using a residual design structure, allowing the feature pyramid enhancement fusion module to adaptively fuse the required features, thereby enhancing the representation ability and depth of the model.
[0124] Function of Feature Pyramid Enhanced Fusion (FPEFM): The Feature Pyramid Enhanced Fusion module is stackable. Stacking experiments were conducted on the ICDAR2015 and Total-Text datasets, where the short side of TotalText was set to 640 pixels and the short side of ICDAR2015 was set to 896 pixels. On Total-Text, when stacked in two layers, the highest Precision, Recall, and F-measure of 88.8%, 81.2, and 84.8 were achieved, and the model's inference speed was 60.9FPS. On ICDAR2015, when stacked in two layers, the highest Recall, 78.4, and F-measure of 83.2 were achieved, and the Precision was only 0.1% lower than that of the Feature Pyramid Enhanced Fusion module with one layer stacked, and the model's inference speed was 30.0FPS. Comprehensive analysis of the experimental results shows that setting the Feature Pyramid Enhanced Fusion module to two layers can achieve a good balance between text detection and recognition accuracy and real-time speed.
[0125] Step 4: The shallow feature maps of 4 resolution sizes are fused through two layers of stacked, residual structure-connected text attention heads and feature pyramid enhancement to obtain the final 512 enhanced feature maps ( Figure 2 F), the 512 enhanced feature maps are uniformly upsampled to a resolution of 1 / 4 size ( Figure 2 The 512 enhanced feature maps enter the post-processing of end-to-end text detection and recognition.
[0126] In the post-processing stage, the enhanced feature map predicts three components: detection head, detail head, and recognition head.
[0127] The detection head is mainly responsible for predicting the text location. The detection head predicts the text core, text region and text vector. Figure 2The detection head predicts the text area through three loss functions, so the loss of text detection is expressed as Among them, Lregion represents the loss of text region segmentation, and Lkernel represents the loss of text kernel. Hyperparameters α and β are used to balance and The weights of , are set to 0.6 and 0.25 in all experiments. Dice loss is used to supervise the text region segmentation result Pregion, as well as the point-wise element addition of the text kernel and the text activation map Pkernel.
[0128]
[0129] therefore, and The mathematical expression is as follows:
[0130]
[0131]
[0132] In these equations, P region and G region (i) respectively represent the predicted value and true value of the text area of the i-th pixel in the segmentation result. Similarly, P kernel and G kernel (i) represents the predicted value of the text kernel of the i-th pixel and the true value of the text kernel. Aggregation loss Used to minimize the distance between pixels in the same text line and between text kernels.
[0133]
[0134] N represents the number of text lines. i represents the text area of the i-th text line, K i represents the text kernel of the ith text line. D1(p,Ki) represents the relationship between text pixel p and text kernel K i In order to distinguish different text kernels of text pixels and non-text areas, the following equation can be used:
[0135]
[0136] D b (Ki) represents the text kernel K i The distance between the kernel and the background. D2(Ki,Kj) represents the distance between different text kernels.
[0137] The detail head uses the text detail map as a supervisory signal to predict text texture and boundaries. Figure 2 ).
[0138] The detail head predicts the text detail map, which includes two steps. The text detail map is also the core idea of this paper.
[0139] The first step of the detail head is: text detail truth map processing.
[0140] In the DiZNet model, the original image input in the first step is processed in advance to become a text detail truth map. The DiZNet model uses the text detail truth map (text texture and boundary) as the supervision signal of the model. The method for extracting the text detail map label is as follows: Figure 5 As shown in the figure. First, crop the original image according to the marked text location label, crop only the text area, and fill the pixel values of other non-text areas with 0, that is, crop the text area of the image. Then use the Canny edge extraction algorithm of openCV to extract the text texture and boundary in the cropped image. The extracted text texture and boundary map is used as the text detail truth map.
[0141] The processing process of two sets of text detail truth maps is demonstrated: the ICDAR2015 dataset of multi-oriented straight text and the TotalText dataset of arbitrarily shaped curved text.
[0142] The second step of the detail head is: prediction of text detail map.
[0143] In the DiZNet model, the prediction process of the detail map mainly involves predicting the texture and boundary of the text in the input image based on the text detail map label. Figure 6 As shown in the figure, firstly, the original text image needs to be cropped and edge extracted to obtain the truth map of text texture and boundary as the label. After processing according to the steps of the text detail truth map processing process, the white pixels are text information. The black is the non-text area.
[0144] In the first step, the original image is sent to the ResNet18 backbone network for feature extraction, in the second step, the text attention head extracts the local features of the text image and the global text position information, and in the third step, feature enhancement and fusion are performed to obtain an enhanced feature map of 512 channels.
[0145] The specific steps of predicting the text detail map are as follows: through the CBR operation, which is a collection of 3x3 convolution, normalization, and ReLU activation function operations, the enhanced feature map is further divided into two small steps.
[0146] 1) The first step is to predict the minimum description area of the text through the text header under the optimization of the text fire kernel loss.
[0147] 2) Another step is to obtain a 6-channel feature map through 1x1 convolution fusion feature, and predict a 1-channel text detail map through the detail head. The detail head is composed of three CBR operations and finally through the Sigmod activation function. The obtained detail map pays more attention to the text position information and texture information. The obtained text kernel is subjected to 1x1 convolution, normalization, ReLU activation function, and finally threshold activation to retain the 1-channel feature map of the pixel area with pixel points greater than 0.1. The two 1-channel feature maps are added point by point element to fuse the text kernel and text details. Under the supervision of the detail truth map label, the detail loss function is used to simultaneously optimize the text kernel and text detail map. With the fusion of text detail maps, the text detection capability continues to improve.
[0148] Text detail map loss L detail_loss The text detail map and text kernel are optimized simultaneously based on the text detail truth map supervision label. The calculation expression is as follows:
[0149] L detail_loss ={l1,,,,,l N},l n
[0150] =-[y n ·log(σ(x n ))+1-y n ·log(1-σx n )]
[0151] The predicted text detail map and the predicted text kernel are flattened into a one-dimensional vector. Then, BCEWithLogitsLoss is used to calculate the loss of each pixel under the supervision of the text detail truth map. σ represents the Sigmoid activation function. Finally, the flattened one-dimensional vector is restored to the size of the input image. Under the supervision of the text detail truth map, the predicted text detail map is fused into the detection head and recognition head to improve the performance of end-to-end text detection and recognition.
[0152] The recognition head recognizes the text content by integrating the text detail graph and obtains the recognition result. Figure 2 (as indicated by O in the figure)
[0153] Loss function for text recognition as follows:
[0154]
[0155] Where w is the truth record (text content) containing the EOS (End of Sentence) symbol. |w| represents the number of characters. |w|i represents the i-th character.
[0156] The total loss of the model is:
[0157]
[0158] Text Detection Loss Text recognition loss Text detail map loss sum.
[0159] Describe the effects of this solution in comparison with the background technology.
[0160] Effectiveness of the text attention head: Four shallow feature maps of different resolution sizes of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 are generated from the conv2, conv3, conv4, and conv5 layers of the backbone network. The shallow feature map is sent to the text attention head TAH module to extract local text features and global position information, and the extracted features are sent to the feature pyramid enhanced fusion module to fuse the shallow feature map with the text information. The feature mapping of the text attention head TAH module to feature maps of different resolution sizes is visualized. It can be seen that the 1 / 4 feature map focuses on local information and continuously extracts image information, while the 1 / 8 feature map pays more attention to the features required by the model and begins to focus on the text area. The 1 / 16 feature map pays more attention to text position information, and the 1 / 32 feature map pays more attention to the most important global information and only pays attention to global text position information, such as Figure 7 shown.
[0161] This effect corresponds to the problem in the background art.
[0162] Curved text detection: Experiments were conducted on the challenging Total-Text dataset with arbitrary curved text. Our method achieved 91.2% Precision, 85.9%, F-measure, and 38.4FPS on the Total-Text dataset when the short side pixel size was 736. Compared with the PSND method, the Precision of our method was improved by 3.9% and the F-measure value was improved by 1.6%. When the short side pixel size was 640, 60.6FPS could be achieved. Our method has efficient detection performance on curved text, such as Figure 8 shown.
[0163] Multi-Oriented Text Detection: The model is further evaluated on the multi-oriented text ICDAR2015 dataset. Fig.10 As shown in , when the short side pixel size is 896, our model improves the precision by 1.6% and the F-measure by 0.6% compared with PSND, and achieves a good detection speed of 30.0FPS. The text detection speed of the method on the ICDAR2015 dataset is slightly slower than that of DBNet, but it has good performance, such as Fig. 9shown.
[0164] like Figure 11 to Figure 14 As shown, curved text recognition: In the end-to-end text localization results on the Total-Text dataset, when the short side is 736 pixels, the end-to-end text recognition F-measure is 77.7% and 18.9FPS when using a dictionary. It is 0.2% higher than PAN++ using joint training with larger data (77.7% vs. 77.5%). It is worth noting that the method achieves the best end-to-end text recognition Fmeasure 67.1% without using a dictionary, which is 0.4% higher than PAN++. The recognition speed is as high as 26.1FPS, which is higher than all methods. The results show that this method achieves good performance in text recognition tasks, especially in inference speed.
[0165] Multi-oriented straight text recognition: In the end-to-end text detection results on the IC15 dataset. The F-measure with common vocabulary (labeled as 'G') is the most important metric. When the short side is 896 pixels, the method achieves a 'G' F-measure of 66.9% at a recognition speed of 30.0FPS, surpassing other algorithms, including PAN++ (66.9% vs. 66.4%), an improvement of 0.5%. It is 3.4% higher than the jointly trained MaskTextSpotterV2 (66.9% vs. 63.5%). When the short side is 736 pixels, the model's FPS can reach a higher 19.4, while the 'G' F-measure still performs well. These results show that in addition to its excellent detection performance on arbitrary-shaped, multi-oriented text, the DiZNet model also has good recognition capabilities and achieves a good balance between accuracy and real-time performance.
[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution 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 solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A supervised method for end-to-end text detection and recognition based on text detail graphs, Features: The method comprises the following steps: Given an input image containing text of arbitrary shape, the input image is processed by two independent processing branches; The first processing branch extracts text texture and boundary information from the input image and generates a text detail map; The second processing branch uses deep learning neural networks to learn and infer the location and content of text in different contexts; Under the supervision of the text detail map as a new label, an end-to-end natural scene text detection and recognition model (An End-to-End Text Detection and Recognition Algorithm with Detail in text Zone, DiZNet) is proposed; In the second processing branch, during the deep learning branch processing, a lightweight feature extraction network ResNet18 is used as the backbone network of DiZNet; the backbone network extracts shallow feature maps with different resolutions of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 from the input image, corresponding to the conv2, conv3, conv4, and conv5 layers, respectively; the shallow feature maps are processed using 1x1 convolution, and the number of channels is unified to 128; Design a text attention head (TAH) and a feature pyramid enhancement fusion module (FPEFM); FPEFM performs feature self-enhancement at different scales, fuses the local features of the text image extracted by the TAH module and the global text position information, and fuses the features extracted by the TAH from feature maps of different scales; by stacking multiple FPEFMs, the feature representation capability and depth of the model are continuously enhanced; the feature map is upsampled to a uniform size to obtain the final enhanced feature map; The enhanced feature map predicts three components: The detection head is responsible for predicting the text location; the detection head predicts text kernels, text regions, and text vectors, and predicts text lines by pixel aggregation; The detail head uses the text detail map as a supervisory signal to predict text texture and boundaries; The recognition head recognizes the text content by integrating the text detail graph and obtains the recognition result; During the model inference stage, there is no need to use the ground-truth text detail map as a supervision label; instead, the model predicts text texture and boundaries, and then the predicted text detail map is fused into the detection head to infer the text location; the predicted text detail map is fused into the recognition head to recognize the text content.
2. The supervised method for end-to-end text detection and recognition based on text detail graph according to claim 1, Features: In the second processing branch, during the deep learning branch processing, a lightweight feature extraction network ResNet18 is used as the backbone network of DiZNet; the backbone network extracts shallow feature maps with different resolutions of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 from the input image, corresponding to the conv2, conv3, conv4, and conv5 layers, respectively; the shallow feature maps are processed using 1x1 convolution, and the number of channels is unified to 128; a text attention head TAH is designed, and a feature pyramid enhancement fusion module FPEFM is designed; FPEFM performs feature self-enhancement at different sizes, fuses the local features of the text image extracted by the text attention head TAH module and the global text position information, and fuses the features extracted by the text attention head TAH from feature maps of different sizes; by stacking multiple FPEFMs, the feature representation capability of the model and the depth of the model are continuously enhanced; the feature map is upsampled to a uniform size to obtain the final enhanced feature map, specifically: Step 1: Input the original image into the ResNet18 feature extraction backbone network. The ResNet18 feature extraction backbone network will input the original image for feature extraction and obtain feature maps of 128 channels with 4 resolution sizes. The obtained shallow feature maps have resolution sizes of 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original image size respectively. Step 2: Take the 128-channel feature map of 4 resolutions obtained in the first step as input and send it to the text attention head TAH. Each feature map of 128 channels will be sent to the text attention head TAH for calculation, extract the information of the shallow feature map, and obtain the local feature information of the text image and the global text position information. The mathematical calculation process of the shallow feature map is as follows. Assume that the number of input channels is C, C is set to 128 in this experiment, W is the width of the feature map, H is the height of the feature map, and the input shallow feature map is expressed as C×W×H; use a pooling kernel of size (H, 1) or (1, W) to encode each channel along the horizontal X-axis and vertical Y-axis coordinates; the vertical direction expression is written as: The horizontal expression is written as: The shallow feature map is encoded in the horizontal and vertical directions and then aggregated to obtain feature maps that are sensitive to text areas in the vertical and horizontal directions; these feature maps are represented in the vertical and horizontal directions respectively as and Subsequently, the text region-sensitive feature map is fused with the feature maps in two directions through a 1×1 convolution kernel, and the channel dimension is reduced through a convolution operation. A Sigmod activation function is then used to obtain a feature map f, which represents the fusion of text region-sensitive features in two directions. f=δ(F 1 ([z h ,z w ])) To enforce text region-sensitive features, a TA threshold activation operation is used to enhance important text region features; TA 0.1 (f) indicates that the pixels are activated, and the pixel values greater than the threshold value of 0.1 are retained in the reduced C / r×1×(W+H) feature map. r represents the scaling factor for reducing the number of channels. The threshold activation operation enhances and retains the important information of the text area. Finally, the activated feature map t and the feature map before activation are added pixel by pixel, and the feature map of the text area is re-weighted to retain important shallow feature information and strengthen the representation of the text area. The default value of the TA threshold activation operation was set to 0.1 in the experiment; t=TA 0.1 (f)+f For the feature map t, we get the intermediate feature map encoding the spatial information along the X-axis and Y-axis, and get the attention weight g of the X-axis respectively. h and the attention weight g on the Y axis w ; g h =σ(F h (t h )) g w =σ(F w (t w )) The original input C×W×H shallow feature map is recorded as x c (i, j), and obtain the reweighted feature map; the expression representing the reweighted output feature map is denoted by r c (i,j), written as: In order to ensure the robustness of the feature map after re-weighting, the features are sent to the spatial attention and channel attention, and the outputs of the two are summed. The channel attention effectively enhances the context information in the channel dimension and improves the text detection and recognition performance. The sum of the outputs of the dual attention mechanism is fused to obtain the final feature. Then the processing of the text attention head TAH module is completed, and the output of the text attention head TAH module becomes part of the input of the feature pyramid enhancement fusion module FPEFM. The text attention head TAH module is connected to the model backbone through a residual structure, which is conducive to adaptive feature extraction and prevents the feature extraction ability from decreasing. Step 3: The feature maps of 128 channels with 4 resolutions obtained in the first step and the local feature information of the text image and the global text position information extracted in the second step are sent as input to the feature enhancement fusion module FPEFM; The 128 feature maps of the four shallow layers are subjected to the self-enhancement stage of the feature enhancement fusion module FPEFM. In the first stage of the self-enhancement stage, the input feature map sizes of the feature enhancement fusion module are 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the original image pixels, respectively, forming a feature pyramid structure. Iterative enhancement from 1 / 4 pixel step to 1 / 32 pixel step; Continue to iterate and enhance from 1 / 32 pixel step size to 1 / 4 pixel step size; add the enhanced feature pyramid point elements from the enhanced feature pyramid in sequence to obtain the output feature pyramid; In the second stage, the fusion stage, the output of the shallow feature map self-enhancement pyramid is fused with the local features of the text image and the global text position information extracted by the text attention head TAH; the corresponding pixels are concat together, and feature fusion is achieved through 1x1 convolution. The feature map after fusion maintains the same number of input feature channels; the output feature map of the enhanced feature pyramid enhancement fusion module becomes part of the input of the next round of feature pyramid enhancement fusion module; the other part of the input comes from the local features of the text and the global text position information that the text attention head TAH module continues to extract; the text attention head TAH module extracts features from the backbone network and uses the residual design structure for fusion, allowing the feature pyramid enhancement fusion module to adaptively fuse the required features, thereby enhancing the representation ability and depth of the model; Step 4: The shallow feature maps of 4 resolutions are fused through two layers of stacked text attention heads and feature pyramid enhancement connected by residual structures to obtain the final 512 enhanced feature maps. The 512 enhanced feature maps are uniformly upsampled to a resolution of 1 / 4 size; the 512 enhanced feature maps enter the post-processing of end-to-end text detection and recognition; In the post-processing stage, the enhanced feature map predicts three components: detection head, detail head, and recognition head; The detection head is responsible for predicting the text position; the detection head predicts the text core, text area and text vector, and finally predicts the text line through pixel aggregation; the detection head predicts the text area through three loss functions, and the loss of text detection is expressed as in, represents the loss of text region segmentation, Represents the loss of the text kernel; hyperparameters α and β are used to balance and The weights are set to 0.6 and 0.25 in all experiments respectively; Dice loss is used to supervise the text region segmentation result Pregion, as well as the point-wise element addition of the text kernel and the text activation map Pkernel; and The mathematical expression is as follows: P region and G region (i) respectively represent the predicted value and true value of the text area of the i-th pixel in the segmentation result; similarly, P kernel and G kernel (i) represents the predicted value of the text kernel of the i-th pixel and the true value of the text kernel; aggregation loss Used to minimize the distance between pixels in the same text line and between text kernels; N represents the number of text lines; T i represents the text area of the i-th text line, K i represents the text kernel of the i-th text line; D 1 (p, Ki) represents the text pixel p and the text kernel K i To distinguish different text kernels and non-text areas of text pixels, the following equation is used: D b (Ki) represents the text kernel K i Distance from the background; D 2 (Ki, Kj) represents the distance between different text kernels; The detail head utilizes the text detail map as a supervisory signal to predict text texture and boundaries.
3. The supervised method for end-to-end text detection and recognition based on text detail graph according to claim 1, Features: The detail head uses the text detail map as a supervisory signal to predict text texture and boundaries, including the following steps: Text detail truth map processing; In the DiZNet model, the original image input in the first step is processed in advance and processed into a text detail truth map. The DiZNet model uses the text detail truth map as the supervision signal of the model; first, the original image is cropped according to the marked text position label, and only the text area is cropped, and the pixel values of other non-text areas are filled with 0, that is, the text area of the cropped image; then the Canny edge extraction algorithm of openCV is used to extract the text texture and boundary in the cropped image; the good text texture and boundary map are extracted as the text detail truth map; the processing process of two sets of text detail truth maps is demonstrated: the multi-directional straight text ICDAR2015 dataset and the Total-Text dataset of arbitrary shape curve text; Prediction of text detail graph: In the DiZNet model, the prediction process of the detail map mainly predicts the texture and boundary of the text on the input image based on the text detail map label. First, the original text image is cropped and edge extracted to obtain the true value map of the text texture and boundary as the label. After processing according to the steps of the text detail true value map processing process, the white pixels are text information; the black pixels are non-text areas. In the first step, the original image is sent to the ResNet18 backbone network for feature extraction. In the second step, the text attention head extracts the local features of the text image and the global text position information. In the third step, feature enhancement and fusion are performed to obtain an enhanced feature map of 512 channels. Through the set of 3x3 convolution, normalization, and ReLU activation function operations (Convolution Batch Normalization and Rectified Linear Unit, CBR) operations, the enhanced feature map is further divided into two small steps; 1) Under the optimization of text kernel loss, the minimum description area of the text is predicted through the text header; 2) Obtain the feature map of 6 channels through 1x1 convolution fusion feature, and predict the text detail map of 1 channel through the detail head. The detail head is composed of three CBR operations and finally through the Sigmod activation function. The obtained detail map pays more attention to the text position information and texture information; the obtained text kernel is subjected to 1x1 convolution, normalization, ReLU activation function, and finally threshold activation to retain the 1-channel feature map of the pixel area with pixel points greater than 0.1; add the two 1-channel feature maps point by point element to fuse the text kernel and text details; under the supervision of the detail truth map label, use the detail loss function to simultaneously optimize the text kernel and text detail map; the algorithm prediction process of the text detail map; with the fusion of the text detail map, the text detection capability is continuously improved; Text detail map loss L detail_loss The text detail map and text kernel are optimized simultaneously based on the text detail truth map supervision label. The calculation expression is as follows: L detail_loss ={l 1 ,...,l N},l n =-[y n ·log(σ(x n ))+1-y n ·log(1-σx n )] The predicted text detail map and the predicted text kernel are flattened into a one-dimensional vector. Then, BCEWithLogitsLoss is used to calculate the loss of each pixel under the supervision of the text detail truth map. σ represents the Sigmoid activation function. Finally, the flattened one-dimensional vector is restored to the size of the input image. Under the supervision of the text detail truth map, the predicted text detail map is fused with the detection head and the recognition head to improve the performance of end-to-end text detection and recognition. The recognition head recognizes the text content by integrating the text detail graph and obtains the recognition result; Loss function for text recognition as follows: Where w is the truth record containing the End Of Sentence (EOS); |w| represents the number of characters; w i Represents the i-th character; The total loss of the model is: Text Detection Loss Text recognition loss Text detail map loss sum.
