Image text line detection method, device, equipment and storage medium
Through the combination of fully convolutional network and recurrent neural network, the spatial and sequence features of the image are extracted, which solves the problem of poor text line detection in the existing technology, especially in complex backgrounds and low-quality images, achieving more accuracy and stability Text line boundary detection.
Patent Information
- Application Number
- CN202010221385.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-26
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-03-26
AI Technical Summary
Existing text line detection methods do not perform well in complex backgrounds and low image quality scenes. In particular, CNN-based methods have poor detection effects on long text lines, and the boundaries are not accurate and stable.
Use a fully convolutional network to extract spatial features of the image, combine the first and second recurrent neural networks (such as long short-term memory neural network) to extract horizontal and vertical sequence features, and perform feature screening through merging and convolution kernels to obtain text lines .
The effect of text line detection is improved, especially in long text line detection, the boundaries are more accurate and stable, the receptive field of the network is expanded, and the processing ability of complex backgrounds and low-quality images is enhanced.
Smart Images

Figure CN111444834B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer vision technology, and in particular to an image text line detection method, device, equipment and readable storage medium. Background Art
[0002] With the widespread application of deep learning technology in many fields, many related applications based on computer vision have also developed rapidly. Optical Character Recognition (OCR) is a typical example. The entire OCR process usually includes three steps: extracting text lines from the image, identifying the content of the text lines in the image, and finally structuring the content of the identified text lines. Among them, text line detection is the first step of the entire OCR process, and the quality of the detection will directly affect the final result of the entire OCR.
[0003] Some text line detection methods in related technologies include "row projection" plus "column projection" on binary images or grayscale images, and also analyzing the connected domain on binary images. These methods are greatly affected by the image background and image quality, resulting in poor detection results in some complex backgrounds or when the image quality is poor. In addition, it is necessary to know the approximate range of the width and length of the text line in the image before detection to set the threshold.
[0004] Some other related technologies' text line detection methods based on deep networks extract image features through convolutional neural networks (CNN). However, the detection effect of CNN networks on some long text lines is relatively poor, and the boundaries of the detected text lines are not accurate and stable.
[0005] As mentioned above, how to achieve better text line detection results in complex backgrounds and low image quality scenes through self-learning without setting many thresholds has become an urgent problem to be solved.
[0006] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0007] The purpose of the present disclosure is to provide an image text line detection method, device, equipment and readable storage medium, which at least to a certain extent overcome the technical problem that the text line detection effect of extracting image features by convolutional neural network in related technologies is poor.
[0008] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0009] According to one aspect of the present disclosure, a method for detecting text lines in an image is provided, comprising: acquiring an image to be detected, the image to be detected comprising text lines; extracting spatial features of the image to be detected through a fully convolutional network to obtain a spatial feature map; extracting horizontal sequence features of the image to be detected through a first recurrent neural network based on the spatial feature map to obtain a horizontal sequence feature map; extracting vertical sequence features of the image to be detected through a second recurrent neural network based on the spatial feature map to obtain a vertical sequence feature map; merging the horizontal sequence feature map and the vertical sequence feature map to obtain a merged sequence feature map; and performing feature screening on the merged sequence feature map after passing a convolution kernel to obtain the text line.
[0010] According to an embodiment of the present disclosure, the step of extracting horizontal sequence features of the image to be detected through a first recurrent neural network based on the spatial feature map to obtain a horizontal sequence feature map includes: dividing the spatial feature map into multiple horizontal sequences along the horizontal direction, and sequentially connecting the multiple horizontal sequences into a horizontal feature sequence; inputting the horizontal feature sequence into the first recurrent neural network, and extracting the horizontal sequence features through the first recurrent neural network to obtain the horizontal sequence feature map.
[0011] According to an embodiment of the present disclosure, the vertical sequence features of the image to be detected are extracted through a second recurrent neural network based on the spatial feature map to obtain a vertical sequence feature map, including: dividing the spatial feature map into multiple vertical sequences along the vertical direction, and connecting the multiple vertical sequences in sequence into a vertical feature sequence; inputting the vertical feature sequence into the second recurrent neural network, and extracting the vertical sequence features through the second recurrent neural network to obtain the vertical sequence feature map.
[0012] According to an embodiment of the present disclosure, the data structure of the horizontal sequence feature graph is the same as that of the spatial feature graph, and the data structure of the vertical sequence feature graph is the same as that of the spatial feature graph; the merging of the horizontal sequence feature graph and the vertical sequence feature graph to obtain a merged sequence feature graph includes: superimposing the horizontal sequence feature graph and the vertical sequence feature graph to obtain the merged sequence feature graph.
[0013] According to an embodiment of the present disclosure, the step of performing feature screening after passing the merged sequence feature map through a convolution kernel to obtain the text line includes: performing dimensionality reduction processing on the merged sequence feature map through a segmentation convolution kernel to obtain a segmentation feature map; performing dimensionality reduction processing on the merged sequence feature map through a position convolution kernel to obtain a position feature map; and performing feature screening based on the segmentation feature map and the position feature map to obtain the text line.
[0014] According to an embodiment of the present disclosure, the feature screening based on the segmentation feature map and the position feature map to obtain the text line includes: filtering out candidate feature points from the segmentation feature map through a segmentation function processing; obtaining a candidate text box based on the candidate feature points and the position feature map; and obtaining the text line from the candidate text box based on a non-maximum suppression algorithm.
[0015] According to an embodiment of the present disclosure, the first recurrent neural network is a long short-term memory neural network; the second recurrent neural network is a long short-term memory neural network.
[0016] According to another aspect of the present disclosure, there is provided an image text line detection device, comprising: an image acquisition module, used to acquire an image to be detected, wherein the image to be detected includes a text line; a fully convolutional network module, used to extract the spatial features of the image to be detected to obtain a spatial feature map; a first recurrent neural network module, used to extract the horizontal sequence features of the image to be detected according to the spatial feature map to obtain a horizontal sequence feature map; a second recurrent neural network module, used to extract the vertical sequence features of the image to be detected according to the spatial feature map to obtain a vertical sequence feature map; a sequence feature merging module, used to merge the horizontal sequence feature map and the vertical sequence feature map to obtain a merged sequence feature map; and a post-processing module, used to perform feature screening on the merged sequence feature map after passing the convolution kernel to obtain the text line.
[0017] According to another aspect of the present disclosure, a device is provided, comprising: a memory, a processor, and executable instructions stored in the memory and executable in the processor, wherein the processor implements any of the above methods when executing the executable instructions.
[0018] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, and when the executable instructions are executed by a processor, any of the above methods is implemented.
[0019] The image text line detection method provided by the embodiments of the present disclosure obtains the spatial features of the image to be detected including the text line through a fully convolutional network to obtain a spatial feature map, extracts the horizontal sequence features of the image to be detected through a first recurrent neural network according to the spatial feature map to obtain a horizontal sequence feature map, extracts the vertical sequence features of the image to be detected through a second recurrent neural network according to the spatial feature map to obtain a vertical sequence feature map, then merges the horizontal sequence feature map and the vertical sequence feature map to obtain a merged sequence feature map, passes the merged sequence feature map through a convolution kernel and performs feature screening to obtain the text line, thereby achieving a certain degree of improvement in the effect of image text line detection by the deep learning network.
[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail example embodiments thereof with reference to the attached drawings.
[0022] Figure 1 A schematic diagram showing an exemplary system architecture in an embodiment of the present disclosure.
[0023] Figure 2 A flowchart of a method for detecting text lines in an image in an embodiment of the present disclosure is shown.
[0024] Figure 3 A flowchart of another method for detecting text lines in an image in an embodiment of the present disclosure is shown.
[0025] Figure 4 A flowchart of another method for detecting text lines in an image in an embodiment of the present disclosure is shown.
[0026] Figure 5 A block diagram of an image text line detection device in an embodiment of the present disclosure is shown.
[0027] Figure 6 A block diagram of another image text line detection device in an embodiment of the present disclosure is shown.
[0028] Figure 7 A deep learning network structure diagram for image text line detection in an embodiment of the present disclosure is shown.
[0029] Figure 8 A schematic structural diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The accompanying drawings are only schematic illustrations of the disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0031] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, devices, steps, etc. may be adopted. In other cases, well-known structures, methods, devices, implementations or operations are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0032] In addition, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present disclosure, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. The symbol " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0033] In this disclosure, unless otherwise clearly specified and limited, terms such as "connection" should be understood in a broad sense, for example, it can be an electrical connection or can communicate with each other; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in this disclosure can be understood according to specific circumstances.
[0034] As mentioned above, because the text line detection methods in some related technologies are greatly affected by the image background and image quality, the detection effect is relatively poor. Although the text line detection methods based on CNN networks in other related technologies do not need to set thresholds, the detection effect for some long text lines is relatively poor, and the boundaries of the text lines are not accurate and stable. The present disclosure provides a text line detection method that integrates a full convolutional network and a recurrent neural network (RNN) to detect text lines in an image, expands the receptive field of the entire network, and thus has a better effect in long text line detection, and the boundaries of the detected text lines are more accurate and stable.
[0035] Figure 1 An exemplary system architecture 10 to which the image text line detection method or image text line detection apparatus of the present disclosure can be applied is shown.
[0036] like Figure 1 As shown, the system architecture 10 may include a terminal device 102, a network 104 and a server 106. The network 104 is used to provide a medium for a communication link between the terminal device 102 and the server 106. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0037] The user can use the terminal device 102 to interact with the server 106 through the network 104 to receive data or send commands to build and train a neural network, etc. The terminal device 102 can be various electronic devices with a display screen and supporting input and output, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc. The server 106 can be a server or server cluster that provides various services, such as a background processing server that supports users to use the terminal device 102 to build a neural network (only as an example). The background processing server can analyze and process the received environment configuration commands, and feed back the output of the neural network, etc. to the terminal device.
[0038] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0039] Figure 2 FIG. 1 is a flowchart of a method for detecting text lines in an image according to an exemplary embodiment. Figure 2 The method shown can be applied to the above-described system, for example.
[0040] refer to Figure 2 , the method 20 provided in the embodiment of the present disclosure may include the following steps.
[0041] In step S202, an image to be detected is obtained, where the image to be detected includes text lines.
[0042] In step S204, the spatial features of the image to be detected are extracted through a fully convolutional network to obtain a spatial feature map. Image features are extracted through a fully convolutional network (FCN). FCN replaces the fully connected layer in the CNN network with a convolutional layer. At the same time, by upsampling features of different scales and using a skip layer structure to fuse features at different scales, the final features of the network can be richer. At the same time, after discarding the fully connected layer, the position information of the object in the image is also retained, so it can be applied to object detection in the image.
[0043] In step S206, the horizontal sequence features of the image to be detected are extracted through a first recurrent neural network according to the spatial feature map to obtain a horizontal sequence feature map.
[0044] In step S208, the vertical sequence feature of the image to be detected is extracted by the second recurrent neural network according to the spatial feature map to obtain a vertical sequence feature map. The first recurrent neural network and the second recurrent neural network can be recurrent neural networks with the same structure. On the feature image extracted by FCN, the recurrent neural network (RNN) is used to extract the sequence features of the text in each direction in the image from the horizontal direction and the vertical direction. In some embodiments, for example, according to the actual characteristics of the image to be detected, the spatial feature map can be divided into multiple sequences along a direction close to the horizontal, and then connected end to end to form a horizontal sequence. After the spatial feature map is divided into multiple sequences along a direction perpendicular to the above direction, they are connected end to end to form a vertical sequence, and then the horizontal sequence and the vertical sequence are respectively extracted by the first recurrent neural network and the second recurrent neural network. After adding the recurrent neural network, the receptive field of the entire network is expanded, which is more conducive to the detection of long text lines, and the boundaries of the text lines can be better located, so that the detection results are more accurate.
[0045] In step S210, the horizontal sequence feature graph and the vertical sequence feature graph are merged to obtain a merged sequence feature graph. The sequence features obtained in the two directions are superimposed in each channel to obtain sequence feature graphs of multiple channels.
[0046] In step S212, the merged sequence feature map is passed through a convolution kernel and then feature screening is performed to obtain a text line. The sequence feature maps of multiple channels can be first processed through a convolution kernel to be used for screening feature points and feature maps with position information. The feature point screening is to filter out the pixels in the image that do not belong to the text line, and then the pixels belonging to the text line are passed through the feature map with position information to obtain the text box of the text line.
[0047] According to the image text line detection method provided by the embodiment of the present disclosure, the spatial features of the image to be detected including the text line are extracted by a fully convolutional network to obtain a spatial feature map, the horizontal sequence features of the image to be detected are extracted by a first recurrent neural network according to the spatial feature map to obtain a horizontal sequence feature map, the vertical sequence features of the image to be detected are extracted by a second recurrent neural network according to the spatial feature map to obtain a vertical sequence feature map, and then the horizontal sequence feature map and the vertical sequence feature map are merged to obtain a merged sequence feature map, and the merged sequence feature map is passed through a convolution kernel for feature screening to obtain the text line, thereby expanding the receptive field of the entire network, thereby achieving better effect in long text line detection, and the boundaries of the detected text lines are also more accurate and stable, thereby achieving a certain degree of improvement in the effect of image text line detection by the deep learning network.
[0048] Figure 3 FIG. 1 is a flowchart of a method for detecting text lines in an image according to an exemplary embodiment. Figure 3 The method shown can be applied to the above-described system, for example.
[0049] refer to Figure 3 , the method 30 provided in the embodiment of the present disclosure may include the following steps.
[0050] In step S302, an image to be detected is obtained, where the image to be detected includes text lines.
[0051] In step S304, the spatial features of the image to be detected are extracted through a full convolutional network to obtain a spatial feature map.
[0052] In step S306, the spatial feature map is divided into multiple horizontal sequences along the horizontal direction, and the multiple horizontal sequences are sequentially connected into a horizontal feature sequence.
[0053] In step S308, the horizontal feature sequence is input into the first recurrent neural network, and the horizontal sequence features are extracted by the first recurrent neural network to obtain a horizontal sequence feature map, and the data structure of the horizontal sequence feature map is the same as that of the spatial feature map. The output of the recurrent neural network is a sequence, and the output sequence is subjected to structural restoration processing to output a multi-channel sequence feature map with the same data structure as the spatial feature map.
[0054] In step S310, the spatial feature map is divided into a plurality of vertical sequences along the vertical direction, and the plurality of vertical sequences are sequentially connected into a vertical feature sequence.
[0055] In step S312, the vertical feature sequence is input into the second recurrent neural network, and the vertical sequence features are extracted by the second recurrent neural network to obtain a vertical sequence feature map, and the vertical sequence feature map has the same data structure as the spatial feature map. The output of the recurrent neural network is a sequence, and the output sequence is subjected to structural restoration processing to output a multi-channel sequence feature map with the same data structure as the spatial feature map.
[0056] In step S314, the horizontal sequence feature graph and the vertical sequence feature graph are superimposed to obtain a merged sequence feature graph. The sequence features in the horizontal direction and the vertical direction are integrated to obtain a multi-channel merged sequence feature graph.
[0057] In step S316, the merged sequence feature map is subjected to dimensionality reduction processing through a segmentation convolution kernel to obtain a segmentation feature map. The segmentation feature map is a feature map that integrates the features of each channel.
[0058] In step S318, the merged sequence feature graph is subjected to dimensionality reduction processing through a position convolution kernel to obtain a position feature graph. The position feature graph is a feature graph having position information of each feature point.
[0059] In step S320, feature screening is performed based on the segmentation feature map and the position feature map to obtain text lines. Further, the segmentation feature map is processed by a segmentation function to screen out candidate feature points; candidate text boxes are obtained based on the candidate feature points and the position feature map; based on the non-maximum suppression algorithm, the candidate boxes belonging to the same text line are merged to obtain the text line detection result from the candidate text boxes. Non-maximum suppression (NMS) is mainly used to delete highly redundant boxes. The working mechanism is: during the target detection process, multiple candidate boxes will be generated for each target during detection. The essence of NMS is to remove redundancy from multiple candidate boxes of each target to obtain the final detection result.
[0060] The image text line detection method provided by the disclosed embodiment integrates a fully convolutional network and a recurrent neural network to detect text lines in an image, thereby expanding the receptive field of the entire network, thereby achieving better results in long text line detection; at the same time, since the recurrent neural network extracts sequence features of the image to be detected, when detecting the area at the boundary of the text line, it can fully utilize the information of the adjacent sequences of the area for detection, so that the detected text line boundary is more accurate and stable.
[0061] Figure 4 FIG. 1 is a flowchart of a method for detecting text lines in an image according to an exemplary embodiment. Figure 4 The method shown can be applied to the above-described system, for example.
[0062] refer to Figure 4, the method 40 provided in the embodiment of the present disclosure may include the following steps.
[0063] In step S402, an image to be detected with a pixel size of 512*512 including text lines is obtained. Input images of other sizes can be scaled to 512*512 and then input into the network. When the input image is 512*512, the average processing time of a single image on an NVIDIA-1080Ti graphics card is 120ms, which can meet the requirements of real-time processing.
[0064] In step S404, the spatial features of the image to be detected are extracted by a full convolutional network with a skeleton of VGG-16 to obtain a spatial feature map, and the data structure of the spatial feature map is 128*128*32 (width*height*number of channels). VGGNet is a deep convolutional neural network developed by the Visual Geometry Group of the University of Oxford and Google DeepMind. It explores the relationship between the depth of the convolutional neural network and its performance. By repeatedly stacking 33 small convolution kernels and 22 maximum pooling layers, a 16-19-layer deep convolutional neural network is constructed. VGG-16 means that the deep convolutional neural network has 16 layers with parameters, and the network structure is very regular, with several convolutional layers followed by a pooling layer that can compress the image size. As the network deepens, the width and height of the image are reduced in a certain pattern, and each time after pooling, it is just reduced by half, and the number of channels increases.
[0065] In step S406, 128 rows of the spatial feature map of 32 channels with a data length of 128 are connected from top to bottom to form 32 horizontal feature sequences.
[0066] In step S408, 32 horizontal feature sequences are respectively input into the first long short-term memory neural network, and the horizontal sequence features are extracted by the long short-term memory neural network to obtain 32 horizontal sequence feature maps, and the data structure of each horizontal sequence feature map is 128*128 (width*height). The RNN network only has a short-term memory function, and the effect is not good for relatively long sequence information. The Long Short-Term Memory (LSTM) neural network solves the problem that RNN can only remember short-term states by adding a cell state to save long-term states. Here, LSTM is used to obtain the sequence features of text lines of various lengths in the image. Since the direction of the text lines in the image is uncertain, LSTM in the horizontal direction and vertical direction are used respectively to obtain the sequence features in the image. Here, the structures of the LSTM in the two directions can be the same, and the hidden layer size can be set to 32, for example.
[0067] In step S410, 128 columns of the spatial feature map of 32 channels with a data length of 128 are connected from left to right to form 32 vertical feature sequences.
[0068] In step S412, the 32 vertical feature sequences are respectively input into the second long short-term memory neural network, and the vertical sequence features are extracted by the long short-term memory neural network to obtain 32 vertical sequence feature graphs, and the data structure of each vertical sequence feature graph is 128*128 (width*height).
[0069] In step S414, the horizontal sequence feature graphs and the vertical sequence feature graphs of the 32 channels are respectively superimposed to obtain 32 merged sequence feature graphs.
[0070] In step S416, the 32 merged sequence feature maps are subjected to dimensionality reduction processing through a segmentation convolution kernel with a data structure of 32*1 to obtain a segmentation feature map with a data structure of 128*128*1.
[0071] In step S418, the 32 merged sequence feature maps are subjected to dimensionality reduction processing through a position convolution kernel with a data structure of 32*5 to obtain a position feature map with a data structure of 128*128*5. The 5 in the position feature map represents the position information of the feature point in the map, including four distances from the four sides of the image and angle information.
[0072] In step S420, the segmentation feature map is processed by the segmentation function to filter out candidate feature points whose feature values are not less than the preset threshold. In some embodiments, for example, the segmentation result value of the pixel point whose feature value is not less than the preset threshold can be recorded as 1, and the segmentation result value of the pixel point whose feature value is less than the preset threshold can be recorded as 0, and the pixel point whose segmentation result value is 1 is the candidate feature point.
[0073] In step S422, candidate text boxes are obtained from the candidate feature points in the position feature map.
[0074] In step S424, the candidate text boxes are merged based on the non-maximum suppression algorithm to obtain a text line detection result. The candidate boxes belonging to the same text line are merged based on the non-maximum suppression algorithm to obtain a text line detection result from the candidate text boxes.
[0075] The image text line detection method provided by the disclosed embodiment integrates a fully convolutional network with a VGG-16 skeleton and horizontal and vertical LSTM networks to detect text lines with uncertain directions in images, thereby expanding the receptive field of the entire network, thereby achieving better results in long text line detection, and at the same time, the boundaries of the detected text lines are more accurate and stable.
[0076] Figure 5FIG. 1 is a block diagram of an image text line detection device according to an exemplary embodiment. Figure 5 The device shown can be applied to the above-mentioned system, for example.
[0077] refer to Figure 5 The device 50 provided in the embodiment of the present disclosure may include an image acquisition module 502, a fully convolutional network module 504, a first recurrent neural network module 506, a second recurrent neural network module 508, a sequence feature merging module 510 and a post-processing module 512.
[0078] The image acquisition module 502 may be used to acquire an image to be detected, where the image to be detected includes a text line.
[0079] The full convolutional network module 504 can be used to extract the spatial features of the image to be detected to obtain a spatial feature map.
[0080] The first recurrent neural network module 506 may be used to extract horizontal sequence features of the image to be detected according to the spatial feature map to obtain a horizontal sequence feature map.
[0081] The second recurrent neural network module 508 may be used to extract vertical sequence features of the image to be detected according to the spatial feature map to obtain a vertical sequence feature map.
[0082] The sequence feature merging module 510 may be used to merge the horizontal sequence feature graph and the vertical sequence feature graph to obtain a merged sequence feature graph.
[0083] The post-processing module 512 may be used to perform feature screening on the merged sequence feature graph after passing it through a convolution kernel to obtain text lines.
[0084] According to the image text line detection method provided by the embodiment of the present disclosure, the spatial features of the image to be detected including the text line are extracted by a full convolutional network module to obtain a spatial feature map, the first recurrent neural network module extracts the horizontal sequence features of the image to be detected through the first recurrent neural network according to the spatial feature map to obtain a horizontal sequence feature map, the second recurrent neural network module extracts the vertical sequence features of the image to be detected through the second recurrent neural network according to the spatial feature map to obtain a vertical sequence feature map, and then the sequence feature merging module merges the horizontal sequence feature map and the vertical sequence feature map to obtain a merged sequence feature map, and the post-processing module performs feature screening on the merged sequence feature map after passing the convolution kernel to obtain the text line, thereby expanding the receptive field of the entire network, thereby achieving better effect in long text line detection, and the boundaries of the detected text lines are also more accurate and stable, thereby achieving a certain degree of improvement in the effect of image text line detection by the deep learning network.
[0085] Figure 6 FIG. 1 is a block diagram of an image text line detection device according to an exemplary embodiment. Figure 6 The device shown can be applied to the above-mentioned system, for example.
[0086] refer to Figure 6 The device 60 provided in the embodiment of the present disclosure may include an image acquisition module 602, a fully convolutional network module 604, a first recurrent neural network module 606, a second recurrent neural network module 608, a sequence feature merging module 610 and a post-processing module 612, wherein the post-processing module 612 includes a convolution kernel module 6121, a feature screening module 6122 and a text positioning module 6123.
[0087] The image acquisition module 602 may be used to acquire an image to be detected, where the image to be detected includes a text line.
[0088] The full convolutional network module 604 can be used to extract the spatial features of the image to be detected to obtain a spatial feature map.
[0089] The first recurrent neural network module 606 may be used to extract horizontal sequence features of the image to be detected according to the spatial feature map to obtain a horizontal sequence feature map.
[0090] The first recurrent neural network module 606 can also be used to divide the spatial feature map into multiple sequences along the horizontal direction, and connect the multiple sequences in sequence into a horizontal feature sequence; input the horizontal feature sequence, extract the horizontal sequence features to obtain a horizontal sequence feature map, and the data structure of the horizontal sequence feature map is the same as that of the spatial feature map.
[0091] The second recurrent neural network module 608 may be used to extract vertical sequence features of the image to be detected according to the spatial feature map to obtain a vertical sequence feature map.
[0092] The second recurrent neural network module 608 can also be used to divide the spatial feature map into multiple sequences along the vertical direction, and connect the multiple sequences in sequence into a vertical feature sequence; input the vertical feature sequence, extract the vertical sequence features to obtain a vertical sequence feature map, and the vertical sequence feature map has the same data structure as the spatial feature map.
[0093] The sequence feature merging module 610 may be used to merge the horizontal sequence feature graph and the vertical sequence feature graph to obtain a merged sequence feature graph.
[0094] The sequence feature merging module 610 may also be used to superimpose the horizontal sequence feature graph and the vertical sequence feature graph to obtain a merged sequence feature graph.
[0095] The post-processing module 612 may be used to perform feature screening on the merged sequence feature graph after passing it through a convolution kernel to obtain text lines.
[0096] The convolution kernel module 6121 can be used to perform dimensionality reduction processing on the merged sequence feature map through the segmentation convolution kernel to obtain a segmentation feature map; and perform dimensionality reduction processing on the merged sequence feature map through the position convolution kernel to obtain a position feature map.
[0097] The post-processing module 612 may also be used to perform feature screening according to the segmentation feature map and the position feature map to obtain text lines.
[0098] The feature screening module 6122 may be used to screen out candidate feature points from the segmentation feature map by processing the segmentation function.
[0099] The text positioning module 6123 may be used to obtain a candidate text box based on the candidate feature points and the position feature map.
[0100] The post-processing module 612 may also be configured to obtain text lines from the candidate text boxes based on a non-maximum suppression algorithm.
[0101] Figure 7 FIG. 1 is a diagram showing a deep learning network structure for image text line detection according to an exemplary embodiment. Figure 7 The network shown can be applied to the above-mentioned system, for example.
[0102] like Figure 7 As shown, the image to be detected is first input into the full convolution network 702 for feature extraction, and the feature map output by the full convolution network 702 is respectively input into the first recurrent neural network 704 and the second recurrent neural network 706 to extract the sequence features of the image to be detected from the horizontal and vertical directions, and then the output horizontal sequence features and vertical sequence features are superimposed, and then the superimposed sequence features are processed by the convolution kernel of CNN 708 for dimensionality reduction, and then the pixels that do not belong to the text line are filtered through the segmentation map 710 and the position feature map is obtained through the positioning map 712, and then the text box of the pixel points of the text line is obtained from the positioning map 712.
[0103] Figure 8 The following is a schematic diagram showing the structure of an electronic device in an embodiment of the present disclosure. It should be noted that: Figure 8 The device shown is only an example of a computer system, which should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0104] like Figure 8As shown, the device 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0105] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0106] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present disclosure are executed.
[0107] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0108] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0109] The modules involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a data acquisition module, a data preprocessing module, a recurrent network module, a convolutional network module, a data integration module and a state classification module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the data acquisition module may also be described as a "module for obtaining initial data from the connected server side."
[0110] As another aspect, the present disclosure also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining an image to be detected, the image to be detected includes a text line; extracting the spatial features of the image to be detected through a fully convolutional network to obtain a spatial feature map; extracting the horizontal sequence features of the image to be detected through a first recurrent neural network according to the spatial feature map to obtain a horizontal sequence feature map; extracting the vertical sequence features of the image to be detected through a second recurrent neural network according to the spatial feature map to obtain a vertical sequence feature map; merging the horizontal sequence feature map and the vertical sequence feature map to obtain a merged sequence feature map; passing the merged sequence feature map through a convolution kernel and performing feature screening to obtain a text line.
[0111] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A method for detecting text lines in an image, characterized in that: include: Acquire an image to be detected, wherein the image to be detected includes a text line; Extracting the spatial features of the image to be detected through a fully convolutional network to obtain a spatial feature map; Extracting horizontal sequence features of the image to be detected through a first recurrent neural network according to the spatial feature map to obtain a horizontal sequence feature map, so as to obtain sequence features of text lines in the horizontal direction in the image to be detected; Extracting vertical sequence features of the image to be detected by a second recurrent neural network according to the spatial feature map to obtain a vertical sequence feature map, so as to obtain sequence features of text lines in the vertical direction in the image to be detected; Merging the horizontal sequence feature graph and the vertical sequence feature graph to obtain a merged sequence feature graph; Passing the merged sequence feature graph through a convolution kernel and performing feature screening to obtain the text line; The step of performing feature screening on the merged sequence feature graph after passing it through a convolution kernel to obtain the text line includes: Performing dimensionality reduction processing on the merged sequence feature graph through a segmentation convolution kernel to obtain a segmentation feature graph; Performing dimensionality reduction processing on the merged sequence feature graph through a position convolution kernel to obtain a position feature graph, wherein the position feature graph has position information; The segmentation feature map is processed by a segmentation function to select candidate feature points, so as to filter out pixel points that do not belong to text lines in the image to be detected; Obtaining a candidate text box according to the candidate feature points and the position feature map; The text line is obtained from the candidate text box based on a non-maximum suppression algorithm.
2. The method according to claim 1, characterized in that The step of extracting the horizontal sequence features of the image to be detected through a first recurrent neural network according to the spatial feature map to obtain a horizontal sequence feature map comprises: Dividing the spatial feature map into a plurality of horizontal sequences along the horizontal direction, and sequentially connecting the plurality of horizontal sequences into a horizontal feature sequence; The horizontal feature sequence is input into the first recurrent neural network, and the horizontal sequence features are extracted through the first recurrent neural network to obtain the horizontal sequence feature graph.
3. The method according to claim 2, characterized in that The step of extracting the vertical sequence features of the image to be detected by a second recurrent neural network according to the spatial feature map to obtain a vertical sequence feature map comprises: Dividing the spatial feature map into a plurality of vertical sequences along a vertical direction, and sequentially connecting the plurality of vertical sequences into a vertical feature sequence; The vertical feature sequence is input into the second recurrent neural network, and the vertical sequence features are extracted by the second recurrent neural network to obtain the vertical sequence feature graph.
4. The method according to claim 1, characterized in that: The data structure of the horizontal sequence feature map is the same as that of the spatial feature map, and the data structure of the vertical sequence feature map is the same as that of the spatial feature map; The step of merging the horizontal sequence feature graph and the vertical sequence feature graph to obtain a merged sequence feature graph comprises: The horizontal sequence feature graph and the vertical sequence feature graph are superimposed to obtain the merged sequence feature graph.
5. The method according to any one of claims 1 to 4, characterized in that: The first recurrent neural network is a long short-term memory neural network; the second recurrent neural network is a long short-term memory neural network.
6. An image text line detection device, characterized in that: include: An image acquisition module, used to acquire an image to be detected, wherein the image to be detected includes a text line; A fully convolutional network module, used to extract the spatial features of the image to be detected to obtain a spatial feature map; A first recurrent neural network module is used to extract horizontal sequence features of the image to be detected according to the spatial feature map to obtain a horizontal sequence feature map, so as to obtain sequence features of text lines in the horizontal direction in the image to be detected; A second recurrent neural network module is used to extract the vertical sequence features of the image to be detected according to the spatial feature map to obtain a vertical sequence feature map, so as to obtain the sequence features of the text lines in the vertical direction in the image to be detected; A sequence feature merging module, used for merging the horizontal sequence feature graph and the vertical sequence feature graph to obtain a merged sequence feature graph; A post-processing module, used for performing feature screening on the merged sequence feature graph after passing it through a convolution kernel to obtain the text line; The post-processing module comprises: A convolution kernel module, used for performing dimensionality reduction processing on the merged sequence feature graph through a segmentation convolution kernel to obtain a segmentation feature graph; performing dimensionality reduction processing on the merged sequence feature graph through a position convolution kernel to obtain a position feature graph, wherein the position feature graph has position information; A feature screening module, used to screen out candidate feature points by processing the segmentation feature map through a segmentation function, so as to filter out pixel points that do not belong to text lines in the image to be detected; and A text positioning module, used for obtaining a candidate text box according to the candidate feature points and the position feature map; The post-processing module is used to obtain the text line from the candidate text box based on a non-maximum suppression algorithm.
7. A device comprising: A memory, a processor, and executable instructions stored in the memory and executable in the processor, wherein the processor implements the method according to any one of claims 1 to 5 when executing the executable instructions.
8. A computer-readable storage medium having computer-executable instructions stored thereon, characterized in that: When the executable instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.
