Handwritten and printed text detection method and device based on deep learning

Using deep learning technology to perform multi-feature extraction and probability map processing on text images solves the problem of distinguishing and identifying handwritten and printed text in the existing technology, improves the recognition accuracy and detection effect, broadens the detection range, and reduces the computational complexity .

WO2024174726A1PCT designated stage expired Publication Date: 2024-08-29GRG BANKING EQUIPMENT CO LTD

Patent Information

Application Number
PCT/CN2023/142662
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-20
Filing Date
2023-12-28
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

Existing text detection technology is difficult to effectively distinguish and recognize handwritten and printed text, especially in the case of long text and densely packed text, resulting in low recognition accuracy and limited detection range.

Method used

Using a deep learning-based handwritten and printed text detection method, the fusion feature map is obtained by extracting multiple features from the initial text image, and based on these feature maps, the printed text area probability map, handwritten text area probability map and text area adaptive threshold are obtained Probability map, and then determine the target detection area, including the target text and its corresponding text box.

Benefits of technology

It improves the recognition accuracy and detection effect of handwritten and printed text, can effectively distinguish handwritten and printed text, broadens the detection range, reduces the computational complexity, and avoids the subjectivity of artificially setting candidate boxes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023142662_29082024_PF_FP_ABST
    Figure CN2023142662_29082024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, and relates to a handwritten and printed text detection method and device based on deep learning. The handwritten and printed text detection method based on deep learning comprises: performing multi-feature extraction on an initial text image to obtain a fused feature map; on the basis of the fused feature map, obtaining a printed text area probability map, a handwritten text area probability map, and a text area adaptive threshold probability map; on the basis of at least two of the printed text area probability map, the handwritten text area probability map, and the text area adaptive threshold probability map, obtaining a target detection area, the target detection area comprising target text and a text box corresponding to the target text.
Need to check novelty before this filing date? Find Prior Art

Description

Handwritten and printed text detection method and device based on deep learning

[0001] Related applications

[0002] This application claims priority to Chinese patent application number 202310149288.8, filed on February 20, 2023, entitled “Handwritten and printed text detection method and device based on deep learning”, the entire text of which is hereby incorporated by reference. Technical Field

[0003] The present application belongs to the field of image processing technology, and in particular relates to a method and device for detecting handwritten and printed text based on deep learning. Background Art

[0004] With the development of artificial intelligence, deep learning has been increasingly applied in technical fields such as image recognition and optical character recognition, such as license plate recognition, invoice recognition, and information extraction from scanned documents. Text detection, as a key branch of optical character recognition, directly affects the final recognition results. Text has characteristics such as multi-directionality, irregular shapes, extreme aspect ratios, and diverse fonts, colors, and backgrounds. Conventional text detection technologies are ineffective for long text and text with tightly packed lines. They also cannot distinguish between handwritten and printed text, resulting in a limited recognition range, which in turn affects the accuracy of subsequent text recognition.

[0005] Summary of the Invention

[0006] According to various embodiments disclosed in the present application, a method and apparatus for detecting handwritten and printed text based on deep learning are provided.

[0007] A method for detecting handwritten and printed text based on deep learning includes:

[0008] Perform multi-feature extraction on the initial text image to obtain a fused feature map;

[0009] Based on the fused feature map, a printed text area probability map, a handwritten text area probability map, and a text area adaptive threshold probability map are obtained; and

[0010] Based on at least two of the printed text area probability map, the handwritten text area probability map, and the text area adaptive threshold probability map, a target detection area is acquired, where the target detection area includes target text and a text box corresponding to the target text.

[0011] A handwritten and printed text detection device based on deep learning includes:

[0012] The first processing module is used to perform multi-feature extraction on the initial text image to obtain a fused feature map;

[0013] A second processing module is configured to obtain a printed text area probability map, a handwritten text area probability map, and a text area adaptive threshold probability map based on the fused feature map; and

[0014] The third processing module is used to obtain a target detection area based on at least two of the printed text area probability map, the handwritten text area probability map and the text area adaptive threshold probability map, where the target detection area includes target text and a text box corresponding to the target text.

[0015] A computer device includes a memory and one or more processors, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processors, the one or more processors perform the following steps:

[0016] Perform multi-feature extraction on the initial text image to obtain a fused feature map;

[0017] Based on the fused feature map, a printed text area probability map, a handwritten text area probability map, and a text area adaptive threshold probability map are obtained; and

[0018] Based on at least two of the printed text area probability map, the handwritten text area probability map, and the text area adaptive threshold probability map, a target detection area is acquired, where the target detection area includes target text and a text box corresponding to the target text.

[0019] One or more computer storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the following steps:

[0020] Perform multi-feature extraction on the initial text image to obtain a fused feature map;

[0021] Based on the fused feature map, a printed text area probability map, a handwritten text area probability map, and a text area adaptive threshold probability map are obtained; and

[0022] Based on at least two of the printed text area probability map, the handwritten text area probability map, and the text area adaptive threshold probability map, a target detection area is acquired, where the target detection area includes target text and a text box corresponding to the target text.

[0023] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.

[0025] FIG1 is a flowchart of a method for detecting handwritten and printed text based on deep learning according to one or more embodiments;

[0026] FIG2 is a schematic diagram showing one of the principles of a method for detecting handwritten and printed text based on deep learning according to one or more embodiments;

[0027] FIG3 is a second schematic diagram of the principle of a method for detecting handwritten and printed text based on deep learning according to one or more embodiments;

[0028] FIG4 is a third schematic diagram of the principle of a method for detecting handwritten and printed text based on deep learning according to one or more embodiments;

[0029] FIG5 is a fourth schematic diagram of the principle of a method for detecting handwritten and printed text based on deep learning according to one or more embodiments;

[0030] FIG6 is a second flow chart of a method for detecting handwritten and printed text based on deep learning according to one or more embodiments;

[0031] FIG7 is a third flow chart of a method for detecting handwritten and printed text based on deep learning according to one or more embodiments;

[0032] FIG8 is a fifth schematic diagram of the principle of a method for detecting handwritten and printed text based on deep learning according to one or more embodiments;

[0033] FIG9 is a block diagram of a handwritten and printed text detection apparatus based on deep learning according to one or more embodiments;

[0034] FIG10 is a block diagram of an electronic device according to one or more embodiments. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0036] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.

[0037] The following describes the handwritten and printed text detection method based on deep learning in an embodiment of the present application with reference to Figures 1 to 8.

[0038] It should be noted that the executor of the deep learning-based handwriting and printed text detection method can be a server, or a deep learning-based handwriting and printed text detection device, or a user's terminal, including but not limited to mobile terminals and non-mobile terminals.

[0039] For example, mobile terminals include but are not limited to mobile phones, PDA smart terminals, tablet computers, and vehicle-mounted smart terminals; non-mobile terminals include but are not limited to PC terminals.

[0040] As shown in FIG1 , the handwritten and printed text detection method based on deep learning includes: step 110 , step 120 and step 130 .

[0041] Step 110: Perform multi-feature extraction on the initial text image to obtain a fused feature map.

[0042] In this step, the initial text image may be an initial image input by the user.

[0043] The content of the initial text image may include at least one of content corresponding to printed text and content corresponding to handwritten text.

[0044] During the actual execution process, the initial text image may be downloaded from the server; or the initial text image may be retrieved from a local or cloud server; or the initial text image may be received from the peer end.

[0045] For example, in some embodiments, printed text images can be obtained through crawlers, and the final handwritten text image can be obtained through open source handwriting recognition datasets through synthesis methods such as splicing and overlaying, and through image degradation and other processing.

[0046] The fused feature map is an image obtained after performing multi-feature extraction on the initial text image, and contains image information corresponding to multiple features.

[0047] During the application process, multiple features can be extracted from the initial text image through the network model, and some of them can be selected for fusion; or a fused feature map can be obtained based on mean fusion; or a fused feature map can be obtained based on weighted fusion, which is not limited in this application.

[0048] The following describes the implementation of step 110 by taking the example of obtaining a fused feature map based on weighted fusion:

[0049] In some embodiments, step 110 may include:

[0050] Perform multi-feature extraction on the initial text image to obtain multiple types of features;

[0051] Based on multiple types of features and the attention weights corresponding to the features, a fused feature map is generated.

[0052] In this embodiment, the multiple types of features may include features such as texture, edges, corners, and semantic information of the initial text image.

[0053] Multiple types of features may include 4 sets of multi-channel feature maps of different sizes.

[0054] Attention weights are used to represent the importance of features to the fusion feature map.

[0055] According to the deep learning-based handwritten and printed text detection method provided in the embodiment of the present application, multiple features are extracted from the initial text image to obtain multiple types of features, and then a fused feature map is generated based on the multiple types of features and the attention weights corresponding to the features. This can fuse different types of features in practical applications, thereby fully describing the text instance and improving the accuracy of the final text recognition.

[0056] In some embodiments, step 110 may further include:

[0057] Inputting the initial text image into the feature extraction model to obtain multiple types of features corresponding to the initial text image;

[0058] Perform convolution operations on multiple types of features to obtain intermediate feature sequences;

[0059] Input the intermediate feature sequence into the spatial attention mechanism module to obtain the attention weight sequence corresponding to each intermediate feature sequence output by the spatial attention mechanism module, wherein the attention weight sequence includes multiple attention weights, and the multiple attention weights correspond one-to-one to multiple types of features;

[0060] Based on multiple attention weights, multiple types of features are weighted and calculated to obtain a fused feature map.

[0061] In this embodiment, the feature extraction module may include a residual network ResNet50, or may include a residual network ResNet50 and a feature pyramid network FPN (Feature Pyramid Networks), wherein the output of the residual network is connected to the input of the feature pyramid network. Figure 3 illustrates a schematic diagram of the network structure of the residual network ResNet50 and the feature pyramid network FPN.

[0062] The residual network ResNet50 may include multiple residual blocks as shown in FIG2 , wherein the residual block may include one or more modules such as convolution operation, batch normalization processing, pooling operation and skip connection.

[0063] The residual network ResNet50 can extract features such as texture, edges, corners and semantic information from the initial text image.

[0064] The feature pyramid network FPN can further extract multiple types of features from the image output by the residual network ResNet50 to increase the types of extracted features, thereby further enhancing the effect of feature extraction.

[0065] The feature pyramid network FPN may include one or more modules such as convolution operation, batch normalization processing, and interpolation upsampling.

[0066] An intermediate feature sequence includes a plurality of intermediate features.

[0067] The spatial attention mechanism module is used to calculate the attention weight sequence corresponding to the intermediate feature sequence.

[0068] The attention weight sequence includes multiple attention weights, and the multiple attention weights correspond one-to-one to multiple types of features.

[0069] It is understandable that different types of features may have different corresponding attention weights. In the actual implementation process, the user can adjust the parameters of the spatial attention mechanism module based on the extraction scenario or actual needs to adjust the attention weight accordingly.

[0070] Multiple types of features are weighted, that is, multiple types of features are multiplied by the attention weights corresponding to the features to obtain a fused feature map.

[0071] In the actual implementation process, the initial text image can be set to X, where X can include N feature maps, namely:

[0072] Among them, X is the initial text image, N is the number of feature maps, C is the number of channels of the image, H is the width of the image, W is the height of the image, and R represents the operation of upsampling feature maps of different sizes to the same size.

[0073] N can be user-defined, for example, N can be 4, 5, or 6, etc. In this application, N can be set to 4.

[0074] As shown in Figure 4, the scaled N feature maps can be connected and then passed through a 3×3 convolution layer to obtain the intermediate feature sequence S∈R C×H×W Specifically, the calculation process of the intermediate feature sequence can be expressed as follows: S = Conv(concat([X0,X1,...,X N-1 ])

[0075] Where S is the intermediate feature sequence, concat is the concatenation operator, Conv is the 3×3 convolution operator, X is the initial text image, and N is the number of feature maps;

[0076] Input the intermediate feature sequence into the spatial attention mechanism module and obtain the attention weight sequence A∈R corresponding to each intermediate feature sequence output by the spatial attention mechanism module N×H×W Specifically, the calculation process of the attention weight sequence can be expressed as follows: A = Spatial_Attention(S)

[0077] Where A is the attention weight sequence, S is the intermediate feature sequence, and Spatial_Attention is the spatial attention mechanism in the Adaptive Scale Fusion module (ASF) shown in Figure 4.

[0078] Specifically, the specific execution process of the spatial attention mechanism is shown in Figure 5:

[0079] Spatial Average Pooling is performed on the intermediate feature sequence of the C×H×W input dimension to reduce its dimension to 1×H×W dimensional data. The data is then input into the Conv+ReLU layer with a convolution kernel size of 3×3, and then through the 1×1 Conv+Sigmoid layer to obtain 1×H×W data of the same dimension.

[0080] After adding the same-dimensional data obtained by the above operation to the original C×H×W-dimensional intermediate feature sequence, an expand dim operation is performed on the first dimension. Then, the attention weight sequence corresponding to each intermediate feature sequence is calculated through a 3×3 Conv+Sigmoid layer. The dimension of the attention weight sequence is N×1×H×W.

[0081] The attention weight sequence is divided into N parts according to the channel dimension, and multiple types of features corresponding to the attention weights are weighted to obtain the fused feature map F∈R N×C×H×WSpecifically, the calculation process of the fusion feature map can be expressed as follows: F = concat([E0X0, E1X1, ..., E N-1 X N-1 ])

[0082] Among them, F is the fused feature map, concat is the concatenation operator, X is the initial text image, and E is the attention weight sequence.

[0083] During their research and development, the inventors discovered that features of different scales have different perceptual and receptive fields, and that different types of features focus on describing text instances of different scales. For example, shallow or large features can perceive details of small text instances but fail to capture the global view of large text instances, while deep or small features do the opposite. Prior art approaches for semantic segmentation use feature pyramids or U-Net structures.

[0084] In this application, a fusion feature map is obtained based on the adaptive spatial attention scale fusion module ASF, which can dynamically fuse features of different scales.

[0085] According to the deep learning-based handwritten and printed text detection method provided in the embodiment of the present application, by inputting the initial text image into the feature extraction model, multiple types of features corresponding to the initial text image are obtained, which can enhance feature extraction; then, convolution operations are performed on the multiple types of features to obtain intermediate feature sequences, and then the intermediate feature sequences are input into the spatial attention mechanism module to obtain attention weight sequences corresponding to each intermediate feature sequence, and then weighted calculations are performed on the multiple types of features to obtain a fused feature map, which can dynamically fuse features of different scales, strengthen the characterization of multi-scale changing features, and thus obtain a better feature fusion effect.

[0086] Step 120: Based on the fused feature map, obtain a printed text area probability map, a handwritten text area probability map, and a text area adaptive threshold probability map.

[0087] In this step, printing the text region probability map includes printing text information of the text.

[0088] The handwritten text region probability map includes text information of the handwritten text.

[0089] The adaptive threshold is used to binarize the printed text area probability map and the handwritten text area probability map. The local binarization threshold corresponding to the printed text area probability map and the handwritten text area probability map can be adaptively adjusted according to the characteristic information such as brightness, contrast and texture of the local image area.

[0090] During the actual execution process, the neural network model can be used to obtain the printed text area probability map, the handwritten text area probability map and the text area adaptive threshold probability map respectively.

[0091] Referring now to FIG. 6 , in some embodiments, step 120 may include:

[0092] Input the fused feature map into the first channel of the text detection model to obtain the printed text area probability map output by the first channel;

[0093] The first channel is trained with the sample feature map as the sample and the sample printed text area probability map corresponding to the sample feature map as the sample label;

[0094] Input the fused feature map into the second channel of the text detection model to obtain the handwritten text area probability map output by the second channel;

[0095] The second channel is trained with the sample feature map as the sample and the sample handwritten text area probability map corresponding to the sample feature map as the sample label;

[0096] Input the fused feature map into the third channel of the text detection model to obtain the text area adaptive threshold probability map output by the third channel;

[0097] Among them, the third channel is trained with the sample feature map as the sample and the sample text area adaptive threshold probability map corresponding to the sample feature map as the sample label.

[0098] In this embodiment, a text detection model is used to classify handwritten text lines and printed text lines.

[0099] The text detection model may include a first channel, a second channel, and a third channel. The first channel, the second channel, and the third channel may be set in parallel and may be processed in parallel during actual execution.

[0100] The first channel is used to receive the fused feature map, perform print text feature extraction on the fused feature map, and output a print text area probability map;

[0101] The second channel is used to receive the fused feature map, extract handwritten text features from the fused feature map, and output a handwritten text area probability map;

[0102] The third channel is used to receive the fused feature map and output the text area adaptive threshold probability map.

[0103] The sample feature map is a fusion feature map obtained after performing multi-feature extraction on the sample initial text image.

[0104] The sample printed text area probability map is the printed text area probability map corresponding to the sample feature map.

[0105] The sample handwritten text region probability map is the handwritten text region probability map corresponding to the sample feature map.

[0106] The sample text region adaptive threshold probability map is the text region adaptive threshold probability map corresponding to the sample feature map.

[0107] During the application process, the first channel, the second channel, and the third channel in the text detection model are trained in advance. The output layer of the text detection model may include a convolutional layer. Specifically, the convolutional layer may include a 3×3 Conv+BN+ReLU layer, a 2×2 Conv+BN+ReLU layer, and a 2×2 ConvTranspose+BN+Sigmoid layer.

[0108] Among them, the output of the Conv+BN+ReLU layer is connected to the input of the Conv+BN+ReLU layer, and the output of the Conv+BN+ReLU layer is connected to the input of the ConvTranspose+BN+Sigmoid layer.

[0109] The above convolution operation is performed on the fused feature map to obtain the printed text area probability map output by the first channel, the handwritten text area probability map output by the second channel, and the text area adaptive threshold probability map output by the third channel.

[0110] The following is a detailed description of the training process of the first channel, second channel, and third channel in the text detection model.

[0111] During the training process, the binary cross entropy loss function (BCE Loss) can be used as the target loss function to train the first channel and the second channel respectively to output the sample printed text area probability map and the sample handwritten text area probability map. BCE Loss can be expressed by the following formula: L(pt,target)=-w×(target×ln(pt)+(1-target)×ln(1-pt))

[0112] Among them, L is the final loss value output by the binary cross entropy loss function, pt is the output result after model inference, target is the label of the dataset, and w is the weight value. For example, w can be 1.

[0113] The third channel can be trained using the L1 distance function (L1Loss) to output a sample text area adaptive threshold probability map, where L1Loss can be expressed by the following formula:

[0114] Among them, Loss is the final loss value output by the L1 distance function, x is the data sample (i.e., the sample fusion feature map), y is the label of the data sample (i.e., the sample text area adaptive threshold probability map), n is the total number of data samples, i is the index of the current data sample, f(x i ) is the predicted value of the i-th data sample.

[0115] During the training process, the data volume of the printed text area probability map and the handwritten text area probability map in the target data set can be set to 1:1, and the data set can be divided into a training set and a test set based on the target ratio. The target ratio can be 8:2 or 9:1, etc., which is not limited in this application.

[0116] According to the deep learning-based handwriting and printed text detection method provided in an embodiment of the present application, by inputting the fused feature map into the first channel, the second channel and the third channel of the text detection model, the printed text area probability map output by the first channel, the handwritten text area probability map output by the second channel and the text area adaptive threshold probability map output by the third channel are respectively obtained. When constructing the text detection model, the output layer is set to three prediction probability maps, thereby realizing the classification and detection of handwritten text lines and printed text lines.

[0117] In some embodiments, the sample printed text region probability map is determined as follows:

[0118] Performing print text area feature extraction on the sample feature map to obtain a first print text area;

[0119] performing a reduction process on the first printed text area to obtain a sample printed text area probability map;

[0120] The probability map of the sample handwritten text area is determined as follows:

[0121] Perform handwritten text region feature extraction on the sample feature map to obtain a first handwritten text region;

[0122] The first handwritten text region is reduced to obtain a sample handwritten text region probability map.

[0123] In this embodiment, the first printed text area is obtained after performing printed text area feature extraction on the sample feature map, and the first printed text area contains printed text information.

[0124] The first handwritten text region is obtained after handwritten text region feature extraction is performed on the sample feature map, and the first handwritten text region contains handwritten text information.

[0125] During the actual execution process, a binary map of the sample feature map size can be drawn, and then the first printed / handwritten text area can be reduced. The first printed / handwritten text area can be reduced to a custom value, for example, it can be reduced to 0.4, 0.5 or 0.6, etc. In this application, the first printed / handwritten text area can be reduced to 0.4 and then drawn in the area corresponding to the above binary map to obtain a sample printed / handwritten text area probability map.

[0126] According to the deep learning-based handwriting and printed text detection method provided in the embodiment of the present application, by extracting the print / handwritten text area features from the sample feature map, a first print / handwritten text area is obtained, and then the first print / handwritten text area is reduced to obtain a sample print / handwritten text area probability map. This can prevent text adhesion during actual execution, thereby improving the tight text detection effect and broadening the detection range.

[0127] The following is a detailed description of the training process of the text detection model.

[0128] As shown in Figure 6, the initial text image is first input into the residual network ResNet50, which outputs multiple types of features corresponding to the initial text image;

[0129] Then, multiple types of features are input into the Feature Pyramid Network (FPN) for processing, and the features corresponding to the initial text image are extracted again;

[0130] Then all feature maps are upsampled to 1 / 4 of the original image size, and the reduced feature maps are input into the adaptive spatial attention scale fusion module ASF to obtain the ASF module output fusion feature map;

[0131] The fused feature map is then subjected to one convolution operation and two deconvolution operations, and finally a feature map with three feature map channels is obtained, where the first channel outputs the printed text area probability map, the second channel outputs the handwritten text area probability map, and the third channel outputs the text area adaptive threshold probability map.

[0132] During the application process, the loss of the training results can be calculated to backpropagate the training parameters, and the training model can be corrected based on the training parameters to obtain a more accurate training model, thereby improving the accuracy of the final text detection.

[0133] Step 130 : Based on at least two of the printed text area probability map, the handwritten text area probability map, and the text area adaptive threshold probability map, a target detection area is obtained, where the target detection area includes the target text and a text box corresponding to the target text.

[0134] In this step, the target detection area is the area ultimately used to detect printed text and handwritten text.

[0135] The target text may include one or more of printed text and handwritten text.

[0136] The text box corresponding to the target text is the outer rectangular box of the target text.

[0137] During the research and development process, the inventors discovered that in the related art, a large number of candidate boxes are set, and the candidate boxes are used as sliding windows to traverse the feature map of the image after the convolution operation, and then the positioning area on the feature map is mapped to the text box area of ​​the original image. This method has high computational complexity and consumes a lot of hardware computing resources. In addition, the size of the candidate box is artificially set, and the generalization and robustness are relatively poor.

[0138] Related technologies also exist in which feature maps are obtained based on calculation of connected domains and convolution operations, and then the feature maps are binarized to obtain binary maps, and then the final text box area information is output through post-processing. The post-processing of this method is relatively complicated, involving a large number of calculations and adjustments in the post-processing stage, and the feature binarization process involves artificially defined thresholds, which has a significant impact on the overall performance of the algorithm, thereby affecting the detection effect.

[0139] In this application, we first perform multi-feature extraction on the initial text image to obtain a fused feature map, which can fuse different types of features in practical applications to fully describe the text instance and improve the accuracy of the final text recognition;

[0140] Then, based on the fused feature map, we obtain the printed text area probability map, the handwritten text area probability map, and the text area adaptive threshold probability map, which facilitates the subsequent acquisition of the target detection area, thereby achieving the classification and detection of handwritten text lines and printed text lines;

[0141] Finally, based on at least two of the printed text area probability map, the handwritten text area probability map and the text area adaptive threshold probability map, the target detection area is obtained, which can realize adaptive threshold map training, avoid the subjective problem, and thus improve the final detection effect; in addition, it can also automatically generate text boxes corresponding to the printed text area and the handwritten text area without traversing the image, significantly reducing the computational complexity and saving computing resources; it also avoids the subjectivity of manually setting candidate boxes, thereby improving the final text detection accuracy and having high universality.

[0142] According to the deep learning-based handwriting and printed text detection method provided in the embodiment of the present application, multiple features are extracted from the initial text image to obtain a fused feature map, and then based on the fused feature map, a printed text area probability map, a handwritten text area probability map and a text area adaptive threshold probability map are obtained. Then, based on at least two of the printed text area probability map, the handwritten text area probability map and the text area adaptive threshold probability map, the target detection area is obtained. In practical applications, different types of features can be fused to fully describe the text instance, and printed text, handwritten text and background areas can be effectively distinguished, thereby improving the accuracy of the final text recognition and the text detection effect.

[0143] Referring now to FIG. 7 , in some embodiments, step 130 may include:

[0144] Obtaining a binary image of the printed text area based on the printed text area probability map and the text area adaptive threshold probability map;

[0145] Obtaining a binary image of the handwritten text area based on the handwritten text area probability map and the text area adaptive threshold probability map;

[0146] At least one of connected domain calculation, bounding rectangle calculation, and expansion processing is performed on the printed text area binary image and the handwritten text area binary image respectively to obtain a target detection area.

[0147] In this embodiment, the printed text area binary map is a binary map obtained by binarizing the printed text area probability map and the text area adaptive threshold probability map.

[0148] The handwritten text area binary map is a binary map obtained by binarizing the handwritten text area probability map and the text area adaptive threshold probability map.

[0149] A connected component is a set of adjacent pixels with the same pixel value.

[0150] The target detection area includes the target text and the text box corresponding to the target text. As shown in Figure 8, A1 and A2 are printed text information, A3 is handwritten text information, and the rectangular box around the text information is the text box corresponding to the target text.

[0151] During the application process, the pixel value of the printed / handwritten text area in the printed / handwritten text area binary map is 1, and the pixel value of the background area in the printed / handwritten text area binary map is 0. Then, based on the connected domain calculation, the connected pixel values ​​are set to the same mark.

[0152] The bounding rectangle of the printed / handwritten text area binary image can be calculated based on programming languages ​​such as Matlab, Python and C++ to obtain a text box corresponding to the printed / handwritten text area in the printed / handwritten text area binary image.

[0153] The expansion process is used to enlarge the reduced printed / handwritten text area to restore it to the normal text box size.

[0154] In some embodiments, obtaining a printed text area binary map based on the printed text area probability map and the text area adaptive threshold probability map may further include: performing a differentiable binarization operation on the printed text area probability map and the text area adaptive threshold probability map to obtain a printed text indentation prediction map;

[0155] A differentiable binarization operation is performed on the printed text indentation probability map to obtain a binary map of the printed text area.

[0156] In some embodiments, obtaining a handwritten text area binary map based on the handwritten text area probability map and the text area adaptive threshold probability map may further include:

[0157] Perform differentiable binarization operations on the handwritten text area probability map and the text area adaptive threshold probability map to obtain a handwritten text indentation prediction map;

[0158] A differentiable binarization operation is performed on the handwritten text indentation prediction map to obtain a binary map of the handwritten text area.

[0159] In the present application, based on the differentiable binarization operation, the threshold at each position of the printed text area probability map and the handwritten text area probability map can be adaptively predicted, which can realize the threshold adaptation of the printed text area probability map and the handwritten text area probability map, avoiding the subjective problem.

[0160] In some embodiments, performing a differentiable binarization operation on the printed text area probability map and the text area adaptive threshold probability map to obtain a printed text shrinkage prediction map may include:

[0161] The printed text area probability map and the text area adaptive threshold probability map are input into the first layer of the target neural network model to obtain the printed text shrinkage prediction map output by the first layer.

[0162] In this embodiment, the first layer of the target neural network model is trained in advance.

[0163] The first layer of the target neural network can be trained using the sample printed text area probability map and the sample text area adaptive threshold probability map as samples, and the sample printed text indentation prediction map as sample labels.

[0164] In some embodiments, performing a differentiable binarization operation on the handwritten text area probability map and the text area adaptive threshold probability map to obtain a handwritten text indentation prediction map may include:

[0165] The handwritten text area probability map and the text area adaptive threshold probability map are input into the second layer of the target neural network model to obtain the handwritten text indentation prediction map output by the second layer.

[0166] In this embodiment, the second layer of the target neural network model is trained in advance.

[0167] The second layer of the target neural network can be trained using the sample handwritten text area probability map and the sample text area adaptive threshold probability map as samples, and the sample handwritten text indentation prediction map as sample labels.

[0168] The following is a detailed description of the training process of the first and second layers of the target neural network.

[0169] During the training process, the intersection-over-union loss function (Dice Loss) can be used to train the first and second layers of the target neural network to output sample printed text indentation prediction maps and sample handwritten text indentation prediction maps, respectively. Dice Loss can be expressed by the following formula:

[0170] Among them, DiceLoss is the final loss value output by the intersection-over-union loss function, X is the pixel label of the real segmented image (i.e., the sample label), and Y is the pixel category of the segmented image predicted by the model (i.e., the output value corresponding to the first or second layer of the target neural network).

[0171] In practical applications, the printed text area probability map and the text area adaptive threshold probability map can be input into the first layer of the target neural network model to obtain the printed text indentation probability map output by the first layer;

[0172] The handwritten text area probability map and the text area adaptive threshold probability map can be input into the second layer of the target neural network model, and the handwritten text indentation probability map output by the second layer can be obtained;

[0173] Then, the printed text indentation probability map and the handwritten text indentation probability map are binarized to obtain a printed text region binary map and a handwritten text region binary map.

[0174] According to the deep learning-based handwriting and printed text detection method provided in the embodiment of the present application, a binary map of the printed / handwritten text area is obtained based on the printed / handwritten text area probability map and the text area adaptive threshold probability map, and then the printed text area binary map and the handwritten text area binary map are respectively subjected to at least one of connected domain calculation, circumscribed rectangle calculation and expansion processing to obtain the target detection area. The corresponding text line position can be accurately located, and the printed and handwritten text boxes can be accurately distinguished, thereby improving the text detection effect.

[0175] In some embodiments, as shown in FIG7 , the fused feature map may be input into the first channel, the second channel, and the third channel of the text detection model, respectively, to obtain a printed text area probability map output by the first channel, a handwritten text area probability map output by the second channel, and a text area adaptive threshold probability map output by the third channel;

[0176] Then, the printed text area probability map and the text area adaptive threshold probability map are input into the first layer of the target neural network model to obtain the printed text indentation probability map output by the first layer;

[0177] Input the handwritten text area probability map and the text area adaptive threshold probability map into the second layer of the target neural network model to obtain the handwritten text indentation probability map output by the second layer;

[0178] Performing differentiable binarization operations on the printed text indentation probability map and the handwritten text indentation probability map respectively to obtain a printed text area binary map and a handwritten text area binary map;

[0179] Finally, at least one of connected domain calculation, bounding rectangle calculation, and expansion processing is performed on the binary image of the printed text area and the binary image of the handwritten text area to obtain the target detection area.

[0180] The handwriting and printed text detection device based on deep learning provided in this application is described below. The handwriting and printed text detection device based on deep learning described below and the handwriting and printed text detection method based on deep learning described above can be referenced to each other.

[0181] The deep learning-based handwriting and printed text detection method provided in the embodiments of the present application can be executed by a deep learning-based handwriting and printed text detection device. In the embodiments of the present application, the deep learning-based handwriting and printed text detection device executing the deep learning-based handwriting and printed text detection method is used as an example to illustrate the deep learning-based handwriting and printed text detection device provided in the embodiments of the present application.

[0182] An embodiment of the present application also provides a handwritten and printed text detection device based on deep learning.

[0183] As shown in FIG9 , the handwritten and printed text detection device based on deep learning includes: a first processing module 910 , a second processing module 920 and a third processing module 930 .

[0184] The first processing module 910 is used to perform multi-feature extraction on the initial text image to obtain a fused feature map;

[0185] The second processing module 920 is used to obtain a printed text area probability map, a handwritten text area probability map, and a text area adaptive threshold probability map based on the fused feature map;

[0186] The third processing module 930 is configured to obtain a target detection area based on at least two of the printed text area probability map, the handwritten text area probability map, and the text area adaptive threshold probability map. The target detection area includes the target text and a text box corresponding to the target text.

[0187] According to the deep learning-based handwriting and printed text detection device provided in the embodiment of the present application, multiple features are extracted from the initial text image to obtain a fused feature map, and then based on the fused feature map, a printed text area probability map, a handwritten text area probability map and a text area adaptive threshold probability map are obtained. Then, based on at least two of the printed text area probability map, the handwritten text area probability map and the text area adaptive threshold probability map, the target detection area is obtained. In actual applications, different types of features can be fused to fully describe the text instance, and printed text, handwritten text and background areas can be effectively distinguished, thereby improving the accuracy of the final text recognition and the text detection effect.

[0188] In some embodiments, the third processing module 930 may also be used to:

[0189] Obtaining a binary image of the printed text area based on the printed text area probability map and the text area adaptive threshold probability map;

[0190] Obtaining a binary image of the handwritten text area based on the handwritten text area probability map and the text area adaptive threshold probability map;

[0191] At least one of connected domain calculation, bounding rectangle calculation, and expansion processing is performed on the printed text area binary image and the handwritten text area binary image respectively to obtain a target detection area.

[0192] In some embodiments, the first processing module 910 may also be used to:

[0193] Perform multi-feature extraction on the initial text image to obtain multiple types of features;

[0194] Based on multiple types of features and the attention weights corresponding to the features, a fused feature map is generated.

[0195] In some embodiments, the first processing module 910 may also be used to:

[0196] Inputting the initial text image into the feature extraction model to obtain multiple types of features corresponding to the initial text image;

[0197] Perform convolution operations on multiple types of features to obtain intermediate feature sequences;

[0198] Input the intermediate feature sequence into the spatial attention mechanism module to obtain the attention weight sequence corresponding to each intermediate feature sequence output by the spatial attention mechanism module, wherein the attention weight sequence includes multiple attention weights, and the multiple attention weights correspond one-to-one to multiple types of features;

[0199] Based on multiple attention weights, multiple types of features are weighted and calculated to obtain a fused feature map.

[0200] In some embodiments, the second processing module 920 may also be used to:

[0201] Input the fused feature map into the first channel of the text detection model to obtain the printed text area probability map output by the first channel;

[0202] The first channel is trained with the sample feature map as the sample and the sample printed text area probability map corresponding to the sample feature map as the sample label;

[0203] Input the fused feature map into the second channel of the text detection model to obtain the handwritten text area probability map output by the second channel;

[0204] The second channel is trained with the sample feature map as the sample and the sample handwritten text area probability map corresponding to the sample feature map as the sample label;

[0205] Input the fused feature map into the third channel of the text detection model to obtain the text area adaptive threshold probability map output by the third channel;

[0206] Among them, the third channel is trained with the sample feature map as the sample and the sample text area adaptive threshold probability map corresponding to the sample feature map as the sample label.

[0207] In some embodiments, the deep learning-based handwritten and printed text detection apparatus may further include a fourth processing module configured to:

[0208] The sample printed text area probability map is determined as follows:

[0209] Performing print text area feature extraction on the sample feature map to obtain a first print text area;

[0210] performing a reduction process on the first printed text area to obtain a sample printed text area probability map;

[0211] The probability map of the sample handwritten text area is determined as follows:

[0212] Perform handwritten text region feature extraction on the sample feature map to obtain a first handwritten text region;

[0213] The first handwritten text region is reduced to obtain a sample handwritten text region probability map.

[0214] The handwriting and printed text detection device based on deep learning in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplary, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, a vehicle-mounted electronic device, a mobile internet device (Mobile Internet Device, MID), augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) equipment, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.

[0215] The handwritten and printed text detection device based on deep learning in the embodiment of the present application can be a device with an operating system. The operating system can be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0216] The deep learning-based handwriting and printed text detection device provided in the embodiment of the present application can implement each process implemented in the method embodiments of Figures 1 to 8. To avoid repetition, they will not be described here.

[0217] In some embodiments, as shown in Figure 10, an embodiment of the present application also provides an electronic device 1000, including a processor 1001, a memory 1002, and computer-readable instructions stored on the memory 1002 and executable on the processor 1001. When the program is executed by the processor 1001, each process of the above-mentioned embodiment of the handwriting and printed text detection method based on deep learning is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0218] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0219] On the other hand, the present application also provides a computer-readable instruction product, which includes computer-readable instructions stored on a non-transitory computer-readable storage medium, and the computer-readable instructions include program instructions. When the program instructions are executed by a computer, the computer can execute the various processes of the above-mentioned deep learning-based handwriting and printed text detection method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0220] On the other hand, the present application also provides a non-transitory computer-readable storage medium having computer-readable instructions stored thereon. When the computer-readable instructions are executed by a processor, the various processes of the above-mentioned embodiment of the deep learning-based handwriting and printed text detection method are implemented, and the same technical effect can be achieved. To avoid repetition, they will not be repeated here.

[0221] On the other hand, an embodiment of the present application further provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned deep learning-based handwriting and printed text detection method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0222] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0223] The device embodiments described above are merely illustrative. 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 network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0224] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0225] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0226] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A handwritten and printed text detection method based on deep learning, comprising: Perform multi-feature extraction on the initial text image to obtain a fused feature map; Based on the fused feature map, a printed text area probability map, a handwritten text area probability map and a text area adaptive threshold probability map are obtained; and Based on at least two of the printed text area probability map, the handwritten text area probability map and the text area adaptive threshold probability map, a target detection area is acquired, where the target detection area includes a target text and a text box corresponding to the target text.

2. The method according to claim 1, wherein: The acquiring the target detection area based on at least two of the printed text area probability map, the handwritten text area probability map and the text area adaptive threshold probability map comprises: Based on the printed text area probability map and the text area adaptive threshold probability map, obtaining a printed text area binary map; Based on the handwritten text area probability map and the text area adaptive threshold probability map, obtaining a handwritten text area binary map; and At least one of connected domain calculation, circumscribed rectangle calculation and expansion processing is performed on the printed text area binary image and the handwritten text area binary image respectively to obtain the target detection area.

3. The method according to claim 1, wherein: The step of extracting multiple features from the initial text image to obtain a fused feature map includes: Performing multi-feature extraction on the initial text image to obtain multiple types of features; and The fused feature map is generated based on the multiple types of features and the attention weights corresponding to the features.

4. The method according to any one of claims 1 to 3, wherein: The step of extracting multiple features from the initial text image to obtain a fused feature map includes: Inputting the initial text image into a feature extraction model to obtain multiple types of features corresponding to the initial text image; Performing a convolution operation on the multiple types of features to obtain an intermediate feature sequence; Inputting the intermediate feature sequence into a spatial attention mechanism module, obtaining an attention weight sequence corresponding to each of the intermediate feature sequences output by the spatial attention mechanism module, wherein the attention weight sequence includes a plurality of attention weights, and the plurality of attention weights correspond one-to-one to the plurality of types of features; and Based on the multiple attention weights, weighted calculation is performed on the multiple types of features to obtain the fused feature map.

5. The method according to any one of claims 1 to 3, wherein: The method of obtaining a printed text area probability map, a handwritten text area probability map and a text area adaptive threshold probability map based on the fused feature map includes: Inputting the fused feature map into the first channel of the text detection model, and obtaining the printed text area probability map output by the first channel; Wherein, the first channel is obtained by training with the sample feature map as a sample and the sample printed text area probability map corresponding to the sample feature map as a sample label; Inputting the fused feature map into the second channel of the text detection model, and obtaining the handwritten text area probability map output by the second channel; The second channel is obtained by training with the sample feature map as a sample and the sample handwritten text area probability map corresponding to the sample feature map as a sample label; and Input the fused feature map to the third channel of the text detection model, and obtain the text area adaptive threshold probability map output by the third channel; The third channel is obtained by training with a sample feature map as a sample and a sample text area adaptive threshold probability map corresponding to the sample feature map as a sample label.

6. The method according to claim 5, wherein: The sample printed text area probability map is determined by: Performing print text area feature extraction on the sample feature map to obtain a first print text area; Performing a reduction process on the first printed text area to obtain a probability map of the sample printed text area; The sample handwritten text area probability map is determined by: Extracting handwritten text region features from the sample feature map to obtain a first handwritten text region; and The first handwritten text area is reduced to obtain the sample handwritten text area probability map.

7. A handwritten and printed text detection device based on deep learning, comprising: The first processing module is used to extract multiple features from the initial text image to obtain a fused feature map; A second processing module is used to obtain a printed text area probability map, a handwritten text area probability map and a text area adaptive threshold probability map based on the fused feature map; and The third processing module is used to obtain a target detection area based on at least two of the printed text area probability map, the handwritten text area probability map and the text area adaptive threshold probability map, wherein the target detection area includes a target text and a text box corresponding to the target text.

8. An electronic device comprising a memory and one or more processors, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the one or more processors execute the steps of the method described in any one of claims 1 to 6.

9. One or more non-transitory computer-readable storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the method of any one of claims 1 to 6.

10. A computer-readable instruction product comprising computer-readable instructions, wherein: When the computer readable instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Topic recognition method and device, electronic equipment and computer storage medium

    CN112597999A

  • Text detection model training method and device and electronic equipment

    CN114359927A

  • Text detection method based on CNN and Transform hybrid model

    CN115019143A

  • Handwritten and printed text detection method and device based on deep learning

    CN116311290A

Cited By

  • Image-text separation method and device, electronic equipment and storage medium

    CN120876893A

  • Text-separation method and device, electronic equipment and storage medium

    CN120876893B

  • Handwritten Chinese character recognition and error correction method based on artificial intelligence

    CN120954019A