Chinese character detection method in document images based on single-word connection
Through the combination of deep convolutional neural network and graph neural network, the problem of Chinese character detection is solved, efficient positioning of Chinese characters and text line detection are achieved, and it is suitable for character detection of Chinese document materials in complex backgrounds.
Patent Information
- Application Number
- CN202210407860.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-19
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-04-19
AI Technical Summary
The existing technology has difficulties in Chinese character detection, especially due to the particularity of Chinese text and the poor detection effect of Chinese text lines in complex backgrounds, and there is less research on character-level detection models, resulting in low Chinese character detection efficiency and Poor accuracy.
The single-word connection method based on deep convolutional neural network is adopted, and the ResNet backbone network is combined with skip connection and bilinear interpolation to predict the character center point, size and offset, and the graph neural network is used to construct the single-word connection relationship to realize Chinese character detection.
This method achieves efficient positioning of Chinese characters and text line detection in any scenario, improves the accuracy and efficiency of Chinese character detection, and is suitable for character positioning of Chinese document materials in complex backgrounds.
Smart Images

Figure CN114708591B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Chinese text detection, and in particular to a method for detecting Chinese characters in a document image based on single-word connection. Background Art
[0002] Scene text detection has attracted increasing attention in academia and industry due to its various applications such as scene understanding, autonomous driving, and instant translation. Benefiting from the rapid development of deep learning in object detection and semantic segmentation, scene text detection has made significant progress.
[0003] Currently, most text detection methods are designed based on text lines. Although previous works have made a lot of modifications to text line detection models, the research on character-level detection models is not enough. Due to the difficulty of modeling character-level context, the research on character-level scene text detection has decreased after the emergence of deep networks and synthetic data. On the one hand, manual annotation at the character level is very time-consuming, and so far, the number of training scene images with real character-level labels is limited. On the other hand, the text line setting is suitable for languages composed of letters, such as English. The written appearance of Chinese text is very different from that of English. Chinese text lines are composed of characters, and there is no extra space between two characters. A Chinese character is roughly one word, while most English words are composed of several letters. In addition, Chinese has thousands of characters, while English has only 26 letters. It is challenging to extract Chinese text lines in complex backgrounds and various directions.
[0004] In recent years, great progress has been made in detecting text from scene images using deep learning methods. One type of method is the implicit anchor regression method, which treats scene text as a general object and relies on the object detection framework using box regression with word-level and line-level prior knowledge. For example: by modifying the size of the convolution kernel and the anchor box, SSD is extended to effectively capture various text shapes; the rotation of anchors and RoI-Pooling is introduced in Faster R-CNN to detect scene text in any direction; but the implicit anchor regression method usually uses additional information, such as angle, to better fit the text area, which results in additional computation; since the angle deviation is sensitive to long text, the anchor regression method does not predict long text well. Another type is the segmentation-based method, which draws inspiration from the semantic segmentation method and detects text by estimating the word boundary area; first, pixel-level text instance segmentation is performed, and then the bounding box is generated based on the segmentation result. At the same time, the FCN attention mechanism is proposed to greatly suppress the background interference in the feature map and achieve accurate detection of words; but the segmentation-based method often requires time-consuming post-processing.
[0005] In addition, there are also methods for detecting individual text parts or characters, some of which use concatenation or post-processing methods to generate text line results. For example, YOLO and SSD are used to detect individual characters; the improved Faster R-CNN is used to extract horizontal text proposals with fixed widths, and horizontal text lines are generated through recurrent neural networks. However, due to the particularity of Chinese, it does not appear in the form of words like English. Character detection based on text lines often distinguishes whether it belongs to an instance based on the spacing between characters. This discrimination method is not applicable in certain cases, such as when Chinese is arranged vertically. Summary of the invention
[0006] In view of the deficiencies of the above-mentioned prior art, the main purpose of the present invention is to solve the problem of Chinese character detection and provide a method for Chinese character detection in document images based on single-word connection. The Chinese character detection technology of the present invention is based on deep convolutional neural network technology and can perform single-word detection or text line detection on natural scene images.
[0007] The technical solution of the present invention is specifically described as follows.
[0008] A method for detecting Chinese characters in a document image based on single-word connection comprises the following steps:
[0009] (1) inputting a number of data images with single-word annotations into a single-word detection network for training, so that the single-word detection network learns the characteristics of the single words, and performing network tuning through a back propagation algorithm to obtain a single-word detection model; wherein the characteristics of the single word include center point coordinates, character size, and center point offset;
[0010] The single-word detection network uses ResNet as the backbone network, which fuses deep features and shallow features through skip connections to share high-level semantic information and low-level fine detail information, and upsamples deep features to the same size as shallow features through bilinear interpolation. The upsampled feature map is reconstructed through a 3×3 convolution layer. For an input image, after extracting image features through the ResNet basic network, a separate 3×3 convolution, ReLU and another 1×1 convolution are used to obtain the center point coordinates, character size and center point offset prediction results respectively;
[0011] The single word detection network predicts three heat maps, namely, the center point probability map, the character size, and the center point offset; for the center point probability map, a Gaussian kernel with an object size-adaptive standard deviation is used to convert all text center points p into probability maps Y, Y p =1 corresponds to the center point, Y p = 0 means p is in the background. If two Gaussians of the same class overlap, the maximum value is taken as the value of the point.
[0012] (2) Inputting the document image to be detected into the trained single-word detection model to perform single-word detection, obtaining the center point position, center point offset and character size of the character, and obtaining the single-word detection result;
[0013] (3) Predictively concatenate the single-word detection results obtained in step (2) to obtain text line detection results.
[0014] In the present invention, in step (1), the data image with single word annotation is obtained by a digital enhancement method.
[0015] In the present invention, in step (1), an undirected graph is generated with the marked single words as nodes, the node information is the feature output of the single word detection network, and the edge feature is the distance between two nodes and the feature concatenation of the two nodes.
[0016] In the present invention, in step (2), when detecting a single word, the input document image to be detected obtains a center point probability map through the network, and the center point probability is used as a measure of its detection confidence. The point whose detection value is greater than or equal to 8 connected neighbors is taken as the peak value in the center point probability map.
[0017] In the present invention, in step (2), when detecting single words, the document image with detection is adjusted to a resolution of 768×768 and then input into the trained single word detection model; and a non-maximum suppression algorithm is applied to remove repeated detections.
[0018] In the present invention, in step (3), the single-word detection results are constructed into a graph, and the connection relationship of each node is predicted by a graph neural network to obtain the text line detection result.
[0019] Further, in the present invention, in step (1), the single word detection network is replaced by a single word detection and splicing network; step (3) is omitted, and the document image to be detected is directly input into the trained single word detection model in step (2) to perform single word detection and splicing, and obtain the text line detection result; wherein:
[0020] In step (1), the features learned by the single word detection and concatenation network include center point coordinates, character size, center point offset and connection center point coordinates;
[0021] The single-word detection and concatenation network uses ResNet as the backbone network, which connects deep features and shallow features to share high-level semantic information and low-level fine detail information, and upsamples deep features to the same size as shallow features through bilinear interpolation. The upsampled feature map is reconstructed through a 3×3 convolution layer. For an input image, after extracting image features through the ResNet basic network, a separate 3×3 convolution, ReLU and another 1×1 convolution are used to obtain the center point coordinates, character size, center point offset and connection center point prediction results respectively;
[0022] The single word detection and splicing network predicts four heat maps, namely the center point probability map, character size, center point offset and connection probability map; for the center point probability map, a Gaussian kernel with object size adaptive standard deviation is used to convert the center points p of all characters into a probability map Y; Y p =1 corresponds to the center point, Y p = 0 means that p is in the background. If two Gaussians of the same class overlap, the maximum value is taken as the value of the point. For the connection probability map, the midpoint of the two adjacent single-word center points belonging to the same text area is taken as the center of the connection probability map. The corresponding probability map L is obtained by using the Gaussian kernel. The value of the probability map L at point p is L p =1 means two words are connected, L p =0 means the two words are not connected.
[0023] Furthermore, in the present invention, when performing text line detection on vertically arranged text, only single-word detection is required without splicing; that is, step (3) is omitted, and the corresponding connection module is removed from the existing structure to directly obtain the single-word detection result.
[0024] Compared with the prior art, the beneficial effect of the present invention is that the present invention can be applied to Chinese character positioning in any scenario, character positioning of document materials, and has good effects on whole text line detection or single word detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a flow chart of a method for detecting Chinese characters in document images based on single-word connections.
[0026] Figure 2 It is the first network architecture for Chinese character detection system in document images based on single-word connections.
[0027] Figure 3 It is the second network architecture of the document image Chinese character detection system based on single-word connection.
[0028] Figure 4 This is the case where a single word needs to be detected.
[0029] Figure 5 It is the third network architecture of the document image Chinese character detection system based on single-word connection.
[0030] Figure 6 It is the detection result in the embodiment. DETAILED DESCRIPTION
[0031] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings and embodiments.
[0032] The technical solution flow chart of the present invention is as follows: Figure 1As shown, the specific implementation steps include:
[0033] 1) Through a series of character detection networks with single-word annotated data, the network learns the features of single words and single-word connection features, including the center point position, center point offset, character size and character connection status.
[0034] 2) For the input image, the trained model is used to obtain the center point position, center point offset and character size, and the single word detection result is obtained after integration.
[0035] 3) Using the single word detection results, input the corresponding connection network to obtain the question bank detection results.
[0036] Example 1
[0037] This embodiment uses Chinese character detection in document images based on single-word connections, with the goal of quickly extracting the text area. This example includes data preparation, network structure, and reasoning process. The main process includes:
[0038] Input the image into the single word detection network for training, and perform network optimization according to the back propagation algorithm to obtain a single word detection model;
[0039] Train the single-word splicing network, use the single-word information to build a graph, and use the graph neural network to train the single-word splicing model.
[0040] The single-word detection model is used to predict the position of single words in the test data, and the single-word splicing model is used to obtain the final detection result.
[0041] The specific implementation details are as follows:
[0042] 1. Data preparation
[0043] Due to the huge variations in Chinese characters, using only real-world images may not be enough to build a strong model. Therefore, we employ data augmentation to enrich the training data. We randomly select cropped regions of training images, generate synthetic Chinese characters, and paste them into the regions. During character synthesis, we also consider the number of instances of each character category to avoid overfitting the model to some specific characters.
[0044] The network needs to predict three heat maps, namely the probability map representing the character center point, the bounding box, and the center point offset. For the center point probability map, we use a Gaussian kernel with an object size-adaptive standard deviation to convert all text center points p into a probability map Y. p =1 corresponds to the center point, Y p = 0 means p is in the background. If two Gaussians of the same class overlap, we take the maximum value as the value of that point.
[0045] An undirected graph is generated with the annotated words as nodes. The node information is the feature output of the single-word network, and the edge feature is the distance between two nodes and the feature concatenation of the two nodes. The connection network finally outputs the connection status of each node.
[0046] (II) Network structure
[0047] Figure 2 The detection network architecture is shown. The input image first passes through a backbone network. In this patent, we use ResNet as the backbone network. In order to maintain the spatial resolution and make full use of multi-level feature information, we combine deep and shallow layers through connections to share high-level semantic information and low-level fine detail information. Here, we first upsample the deep features to the same size as the shallow features through bilinear interpolation. The upsampled feature map is reconstructed through a 3×3 convolutional layer.
[0048] To represent character bounding boxes, we use three branches at the head of the network: center point coordinates Character size and center point offset Where K represents the category, W represents the width of the input image, H represents the height of the input image, and R represents the scale ratio of the prediction result and the original image. A single network is used to predict the center point Y, the center point offset O, and the character size S. For an input image, after extracting image features through the ResNet basic network, a separate 3×3 convolution, ReLU, and another 1×1 convolution are used to obtain the center point coordinates, character size, and center point offset prediction results respectively;
[0049] The overall loss function is as follows:
[0050] L=L cp +λ size L size +λ off L off +λ connect L graph
[0051] Where L cp Represents the loss of the center point probability map, L size Indicates the loss of character size, L off Indicates the loss of center point offset, L graph represents the loss of the connection between characters, λ size ,λ off and λ connect Indicates the weight values of the three losses.
[0052] (III) Reasoning Process
[0053] In the single word detection stage, the input image first passes through the network to obtain the center point coordinate Y, character size S and center point offset O, and obtain the center point probability map. We use the center point probability As a measure of its detection confidence. The points whose detection values are greater than or equal to its 8 connected neighbors are taken as the peaks in the center point probability map. In the connection stage, the results of single word detection and the features of the last layer are used as input to predict the connection of single words.
[0054] To be consistent with model training and considering that the size of text can vary greatly, a multi-scale scheme is performed during inference. All images are resized to a resolution of 768×768 before being fed into the framework. Finally, non-maximum suppression is applied to remove duplicate detections.
[0055] In the network connection stage, single-word results are used to form a graph, and the final text detection result is obtained by predicting the connection relationship of each node through the graph neural network.
[0056] Example 2
[0057] This embodiment uses document image Chinese character detection based on single-word connection, which is different from the method of using graph neural network for single-word connection in Example 1. This example uses a method of directly predicting connection relationships. It mainly includes three steps: data preparation, network structure, and reasoning process. The main process is as follows:
[0058] The image is input into the network for training, and the network is tuned according to the back-propagation algorithm to obtain a single-word detection and splicing model.
[0059] In the prediction stage, the final result is obtained by combining the single word detection results and the splicing prediction results.
[0060] The specific implementation details are as follows:
[0061] 1. Data preparation
[0062] The network needs to predict four heat maps, namely the probability map representing the center point of the character, the bounding box, the center point offset, and the connection probability map. For the center point probability map, we use a Gaussian kernel with an object size-adaptive standard deviation to convert the center point p of all text into a probability map Y. The value Y of the probability map p point p =1 corresponds to the center point, Y p = 0 means p is in the background. If two Gaussians of the same class overlap, we take the maximum value as the value of that point.
[0063] For the connection probability map, we take the midpoint of the two adjacent single-word center points belonging to the same text area as the center of the connection probability map, and also use the Gaussian kernel to obtain the corresponding probability map L. The value of the probability map at point p is L p =1 means two words are connected, Lp =0 The two words are not connected.
[0064] (II) Network structure
[0065] Figure 3 The detection network architecture is shown. Similar to Example 1, the input image first passes through a backbone network. In this patent, we use ResNet as the backbone network. In order to maintain spatial resolution and make full use of multi-level feature information, we combine deep and shallow layers through connections to share high-level semantic information and low-level fine detail information. Here, we first upsample the deep features to the same size as the shallow features through bilinear interpolation. The upsampled feature map is reconstructed through a 3×3 convolutional layer.
[0066] To represent character bounding boxes, we use four branches at the head of the network: center point coordinates Character size Center point offset and connect the center point W represents the width of the input image, H represents the height of the input image, and R represents the scale of the predicted result and the original image. A single network is used to predict the center point Y, local offset O, character size S, and connection center point C. We use a single network to predict the center point, center point offset, character size, and connection center point. All outputs share a common fully convolutional network. For each prediction result, the backbone feature is obtained through a separate 3×3 convolution, ReLU, and another 1×1 convolution.
[0067] The overall loss function is as follows:
[0068] L=L cp +λ size L size +λ off L off +λ connect L connect
[0069] Where L cp Represents the loss of the center point probability map, L size Indicates the loss of character size, L off Indicates the loss of center point offset, L connect represents the loss of the connection between characters, λ size ,λ off and λ connect Indicates the weight values of the three losses.
[0070] (III) Reasoning Process
[0071] The input image passes through the network and obtains the center point coordinates, character size, center point offset probability map and connection center probability map. We use the center point probability as a measure of its detection confidence.
[0072] During training, we used a dataset with single-word annotations. For datasets without single-word annotations, we divided the text area according to the number of annotated characters and extracted the center point of each character. We used a multi-scale solution. Three scales with fixed stride values were cropped and adjusted to a resolution of 768×768, and then fed into the network as input. Finally, the detection results were obtained using the splicing information and single-word information.
[0073] Example 3
[0074] This example is mainly for the case where only single words need to be detected, such as Figure 4 As shown, most vertical texts only need single word detection, and no splicing is required. The corresponding connection module is removed from the existing structure to directly obtain the single word detection result. The main steps include:
[0075] Predict the center point, width, height and offset of each character.
[0076] The single word detection result is obtained using the three prediction information.
[0077] The specific implementation details are as follows:
[0078] 1. Data preparation
[0079] We conducted corresponding experiments and comparisons on the public dataset CTW. The CTW dataset mainly contains 32,285 images, a total of 1,018,402 Chinese characters, 3,850 Chinese character categories, and the image size is 2048*2048. The ratio of training set: detection test set: recognition test set is 8:1:1. This dataset is mainly street scene photography, which can be used for the two tasks of natural scene text detection and recognition.
[0080] Since characters are usually relatively small compared to the entire scene image, we apply cropped regions from the original image for training. Specifically, we resize the image to have a long side of 2048 pixels and then use a dense sampling strategy with a stride of 24 to obtain a cropped image of size 672×672.
[0081] Due to the huge variations in Chinese characters, we believe that using only real-world images may not be enough to build a strong model. Therefore, we employ data augmentation to enrich the training data. We randomly select cropped regions of training images, generate synthetic Chinese characters, and paste them into the regions. During character synthesis, we also consider the number of instances of each character category to avoid biasing the model towards certain specific characters.
[0082] The network needs to predict three heatmaps, namely the probability map representing the character center point, the bounding box, and the center point offset. For the center point probability map, we use a Gaussian kernel with object size adaptive standard deviation to convert all ground truth center points p into a probability map Y. p =1 corresponds to the center point, Y p = 0 means p is in the background. If two Gaussians of the same class overlap, we take the maximum value as the value of that point.
[0083] (II) Network structure
[0084] Figure 5 The detection network architecture is shown. Similar to Example 1, the input image first passes through a backbone network. In this patent, we use ResNet as the backbone network. In order to maintain spatial resolution and make full use of multi-level feature information, we combine deep and shallow layers through connections to share high-level semantic information and low-level fine detail information. Here, we first upsample the deep features to the same size as the shallow features through bilinear interpolation. The upsampled feature map is reconstructed through a 3×3 convolutional layer.
[0085] To represent character bounding boxes, we use three branches at the head of the network: center point coordinates Character size and center point offset We use a single network to predict the center point Y, the center point offset O, and the character size S. All outputs share a common fully convolutional network. For each prediction result, the backbone features pass through a single 3×3 convolution, ReLU, and another 1×1 convolution.
[0086] The overall loss function is as follows:
[0087] L=L cp +λ size L size +λ off L off
[0088] Where L cp Represents the loss of the center point probability map, L size Indicates the loss of character size, L off Indicates the loss of center point offset.
[0089] (III) Reasoning Process
[0090] In the process of single word detection, the input image first passes through the network and obtains the coordinates of the center point Character size and center point offset We use the center point probability As a measure of its detection confidence, points with detection values greater than or equal to those of its 8 connected neighbors are taken as peaks in the center point probability map.
[0091] Cropping is used in the training set to handle the size difference between the entire image and individual characters. To be consistent with model training and considering that the size of character instances can vary greatly, a multi-scale scheme is performed during inference. Cropped regions at three scales with fixed stride values are resized to a resolution of 768×768 and then fed into the framework as input. Finally, non-maximum suppression is applied to remove duplicate detections.
[0092] (IV) Results and presentation
[0093] The average detection accuracy of the method proposed in this embodiment reaches 76.3%, and a good balance is achieved in terms of recall rate and accuracy. At the same time, the method achieves a detection speed of 6-10FPS on a single Nvidia GTX1080 GPU. From left to right: the results of the original image annotation, the results of YOLO, and the results of the method proposed in this patent are shown as follows Figure 6 shown.
Claims
1. A method for detecting Chinese characters in document images based on single-word connections, characterized in that: The following steps are involved: (1) inputting a number of data images with single-word annotations into a single-word detection network for training, so that the single-word detection network learns the characteristics of the single words, and performing network tuning through a back propagation algorithm to obtain a single-word detection model; wherein the characteristics of the single word include center point coordinates, character size, and center point offset; The single-word detection network uses ResNet as the backbone network, which fuses deep features and shallow features through skip connections to share high-level semantic information and low-level fine detail information, and upsamples deep features to the same size as shallow features through bilinear interpolation. The upsampled feature map is reconstructed through a 3×3 convolution layer. For an input image, after the image features are extracted by the ResNet basic network, the center point coordinates, character size, and center point offset prediction results are obtained through a separate 3×3 convolution, ReLU, and another 1×1 convolution respectively. The single word detection network predicts three heat maps, namely the center point probability map, character size, and center point offset; for the center point probability map, a Gaussian kernel with an object size adaptive standard deviation is used to convert all text center points p into a probability map Y, and the value Y of the probability map Y at point p is p =1 corresponds to the center point, Y p = 0 means p is in the background. If two Gaussians of the same class overlap, the maximum value is taken as the value of the point. (2) Inputting the document image to be detected into the trained single-word detection model to perform single-word detection, obtaining the center point position, center point offset and character size of the character, and obtaining the single-word detection result; (3) Predictively concatenate the single-word detection results obtained in step (2) to obtain text line detection results.
2. The method for detecting Chinese characters in a document image according to claim 1, characterized in that: In step (1), the data image with single word annotation is obtained by digital enhancement method.
3. The method for detecting Chinese characters in a document image according to claim 1, characterized in that: In step (1), an undirected graph is generated with the marked words as nodes, the node information is the feature output of the word detection network, and the edge feature is the distance between two nodes and the feature concatenation of the two nodes.
4. The method for detecting Chinese characters in a document image according to claim 1, characterized in that: In step (2), when detecting a single word, the input document image to be detected is passed through the network to obtain a center point probability map, and the center point probability is used as a measure of its detection confidence. The point with a detection value greater than or equal to 8 connected neighbors is taken as the peak in the center point probability map.
5. The method for detecting Chinese characters in a document image according to claim 1, characterized in that: In step (2), when detecting a single word, the document image with detection is adjusted to a resolution of 768×768 and then input into the trained single word detection model; and non-maximum suppression is applied to remove duplicate detections.
6. The method for detecting Chinese characters in a document image according to claim 1, characterized in that: In step (3), the single-word detection results are constructed into a graph, and the connection relationship of each node is predicted by the graph neural network to obtain the text line detection result.
7. The method for detecting Chinese characters in a document image according to claim 1, characterized in that: In step (1), the single word detection network is replaced by a single word detection and splicing network; step (3) is omitted, and the document image to be detected is directly input into the trained single word detection model in step (2) to perform single word detection and splicing to obtain the text line detection result; wherein: In step (1), the features learned by the single word detection and concatenation network include center point coordinates, character size, center point offset and connection center point coordinates; The single-word detection and concatenation network uses ResNet as the backbone network, which connects deep features and shallow features to share high-level semantic information and low-level fine detail information, and upsamples deep features to the same size as shallow features through bilinear interpolation. The upsampled feature map is reconstructed through a 3×3 convolution layer. For an input image, after extracting image features through the ResNet basic network, a separate 3×3 convolution, ReLU and another 1×1 convolution are used to obtain the center point coordinates, character size, center point offset and connection center point prediction results respectively; The single word detection and splicing network predicts four heat maps, namely the center point probability map, character size, center point offset and connection probability map; for the center point probability map, a Gaussian kernel with an object size adaptive standard deviation is used to convert the center point p of all characters into a probability map Y; the value Y of the probability map Y at point p p =1 corresponds to the center point, Y p = 0 means that p is in the background. If two Gaussians of the same class overlap, the maximum value is taken as the value of the point. For the connection probability map, the midpoint of the two adjacent single-word center points belonging to the same text area is taken as the center of the connection probability map. The corresponding probability map L is obtained by using the Gaussian kernel. The value of the probability map L at point p is L p =1 means two words are connected, L p =0 means the two words are not connected.
