A wireless form recognition method, device, computer equipment and storage medium
Recognizing wireless tables through deep residual convolutional neural networks and convolutional recurrent neural networks, combined with position information processing, solves the problem of low wireless table recognition accuracy and achieves more accurate cell information extraction and table reconstruction.
Patent Information
- Application Number
- CN202111345146.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-11-15
AI Technical Summary
Existing OCR technology has the problem of low recognition accuracy when identifying wireless tables. In particular, due to the lack of table line information, it is difficult to accurately extract cell information.
The deep residual convolutional neural network is used to extract the binary segmentation image of the text area, and the convolutional recurrent neural network is used for text recognition. The absolute position coordinate information is combined to determine the merged text area, and the relative position coordinate information is obtained to arrange the cells to form a complete wireless form.
The recognition accuracy of wireless tables is improved, and complete table information is reconstructed by predicting the relative position between cells.
Smart Images

Figure CN114155544B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software technology, and in particular to a wireless form recognition method, device, computer equipment and storage medium. Background Art
[0002] The existing OCR technology still has some defects in the recognition of structured table data. Although in theory, wired tables can use table lines to accurately recognize table structure information, wireless tables lack table line information, so it is difficult to recognize cell information in the table. Therefore, how to accurately recognize and extract wireless tables is a problem that technicians in this field need to solve. Summary of the invention
[0003] The embodiments of the present invention provide a wireless form recognition method, apparatus, computer equipment and storage medium, aiming to improve the recognition accuracy of wireless forms.
[0004] In a first aspect, an embodiment of the present invention provides a wireless form recognition method, comprising:
[0005] Get the input text image containing the wireless form;
[0006] Extracting binary segmented images of different text areas from the input text image using a deep residual convolutional neural network;
[0007] Extracting edge information of the binary segmented image to obtain absolute position coordinate information of different text areas in the input text image;
[0008] Using the convolutional recurrent neural network to perform text recognition on each of the text regions to obtain corresponding text information;
[0009] Determine whether to merge different text areas according to the absolute position coordinate information to obtain corresponding cell information;
[0010] Relative position coordinate information between adjacent cells is acquired based on the absolute position coordinate information, and each cell is arranged according to the relative position coordinate information, and then the arrangement result is used as a wireless table.
[0011] In a second aspect, an embodiment of the present invention provides a wireless form recognition device, comprising:
[0012] An image acquisition unit, used for acquiring an input text image containing a wireless form;
[0013] An image extraction unit, used for extracting binary segmentation images of different text areas from the input text image using a deep residual convolutional neural network;
[0014] An edge information extraction unit, used to extract edge information of the binary segmented image to obtain absolute position coordinate information of different text areas in the input text image;
[0015] A text recognition unit, used to perform text recognition on each of the text regions using the convolutional recurrent neural network to obtain corresponding text information;
[0016] A region merging unit, used to determine whether to merge different text regions according to the absolute position coordinate information, and obtain corresponding cell information;
[0017] The first cell arrangement unit is used to obtain relative position coordinate information between adjacent cells based on the absolute position coordinate information, arrange each cell according to the relative position coordinate information, and then use the arrangement result as a wireless table.
[0018] In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the wireless form recognition method as described in the first aspect when executing the computer program.
[0019] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the wireless form recognition method as described in the first aspect is implemented.
[0020] The embodiment of the present invention provides a wireless table recognition method, device, computer equipment and storage medium, the method comprising: obtaining an input text image containing a wireless table; using a deep residual convolutional neural network to extract binary segmented images of different text areas from the input text image; extracting edge information of the binary segmented image to obtain absolute position coordinate information of different text areas in the input text image; using the convolutional recurrent neural network to perform text recognition on each of the text areas to obtain corresponding text information; judging whether to merge different text areas according to the absolute position coordinate information to obtain corresponding cell information; obtaining relative position coordinate information between adjacent cells based on the absolute position coordinate information, and arranging each cell according to the relative position coordinate information, and then using the arrangement result as a wireless table. The embodiment of the present invention can improve the recognition accuracy of wireless tables by predicting the relative position relationship between cells in a table based on the text position information of structured wireless table data, and further reconstructing complete table information. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of a flow chart of a wireless form recognition method provided by an embodiment of the present invention;
[0023] Figure 2 A schematic diagram of a sub-process of a wireless form recognition method provided by an embodiment of the present invention;
[0024] Figure 3 A schematic block diagram of a wireless form recognition device provided by an embodiment of the present invention;
[0025] Figure 4 A sub-schematic block diagram of a wireless form recognition device provided by an embodiment of the present invention;
[0026] Figure 5 A schematic diagram of a relative position prediction network structure in a wireless table recognition method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0029] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0030] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0031] See below Figure 1 , Figure 1 A schematic flow chart of a wireless form recognition method provided by an embodiment of the present invention specifically includes: steps S101 to S106.
[0032] S101, obtaining an input text image containing a wireless form;
[0033] S102, extracting binary segmented images of different text areas from the input text image using a deep residual convolutional neural network;
[0034] S103, extracting edge information of the binary segmented image to obtain absolute position coordinate information of different text areas in the input text image;
[0035] S104, using the convolutional recurrent neural network to perform text recognition on each of the text regions to obtain corresponding text information;
[0036] S105, judging whether to merge different text areas according to the absolute position coordinate information, and obtaining corresponding cell information;
[0037] S106. Obtain relative position coordinate information between adjacent cells based on the absolute position coordinate information, arrange each cell according to the relative position coordinate information, and then use the arrangement result as a wireless table.
[0038] In this embodiment, for the input text image that needs to identify the wireless table, the binary segmentation image corresponding to each text area is first extracted by a deep residual convolutional neural network, and then the edge information is extracted for each binary segmentation image to obtain the absolute position coordinate information of each text area in the input text image. At the same time, the convolutional recurrent neural network is used to perform text recognition on each text area to obtain the text information corresponding to each text area. Then, according to the absolute position coordinate information, it is determined whether to merge each text area into the same cell, that is, to merge the text information in the text area into the same cell. For example, according to the absolute position coordinate information, if the distance between two adjacent text areas is less than a preset distance threshold, the two text areas are merged into the same cell. Further, the relative position coordinate information between each cell is obtained, and then each cell is arranged according to the relative position coordinate information, so that the final wireless table can be obtained.
[0039] This embodiment predicts the relative position relationship between cells in a table based on text position information of structured wireless table data, and further reconstructs complete table information, thereby improving the recognition accuracy of wireless tables.
[0040] In one embodiment, the step S102 includes:
[0041] Inputting the input text image into the ResNet50 deep residual convolutional neural network, and performing downsampling and channel expansion processing on the input text image in sequence through the ResNet50 deep residual convolutional neural network to obtain different feature maps corresponding to the input text image;
[0042] Each feature map is compressed through a convolution operation, and each feature map is upsampled to obtain a single-channel image with the same size as the input text image, and the single-channel image is output as the binary segmentation image.
[0043] In this embodiment, a deep residual convolutional neural network trained end-to-end is used to replace the traditional manual feature extraction method, thereby improving the text detection performance. In practical applications, the deep network can extract richer image feature information. Therefore, this embodiment uses a deep residual convolutional neural network ResNet50 as a backbone to extract image features, wherein ResNet50 is composed of a series of residual units including convolution, nonlinear transformation and residual connection operations. After the input text image is downsampled and the channel is expanded by the ResNet50 network, different feature maps can be obtained, which provide rich feature information for subsequent more accurate prediction of binary segmentation images. After the ResNet50 deep residual convolutional neural network extracts the input text image features to obtain the feature map, the image channel is compressed by the convolution operation and upsampled to obtain a single-channel image of the same size as the input text image. In addition, in the model training stage, a normal wireless table image is used as the model input, and a binary image is used as the model label. The model training is guided by the segmentation idea. After the model is fitted, the input wireless table image can be realized in the reasoning stage to predict the binary segmentation image.
[0044] In one embodiment, if Figure 2 As shown, the step S103 includes: steps S201 to S204.
[0045] S201, using a double threshold method to perform edge extraction on the binary segmented image to obtain a high threshold image;
[0046] S202, connecting the edges in the high threshold image into a contour, and when reaching the contour endpoint, obtaining a target point that meets the low threshold based on an 8-neighborhood point method;
[0047] S203, collecting remaining edges according to the target point until the edge of the binary segmented image is closed, thereby obtaining edge information of the binary segmented image;
[0048] S204: Obtain absolute position coordinate information corresponding to different text regions from the edge information.
[0049] In this embodiment, when edge information is extracted from a binary segmented image to obtain the absolute position coordinate information, a double threshold method is first used to extract edges, and then the extracted edges are connected into contours, and target points that can meet the low threshold are searched in the contours according to the 8-neighborhood point method. Based on the obtained target points, the remaining edges of the binary segmented image can be collected to obtain complete edge information. Further, based on the obtained complete edge information, relatively accurate absolute position coordinate information can be correspondingly extracted.
[0050] In one embodiment, the step S104 includes:
[0051] For any of the text regions, extract a feature sequence with a width of a single pixel from the text region using a convolutional layer in the convolutional recurrent neural network;
[0052] The recurrent layer in the convolutional recurrent neural network is used to predict characters for the feature sequence, and the prediction results are used as the text information.
[0053] In this embodiment, a convolutional recurrent neural network (CRNN) is used to realize the recognition of line text. The CRNN model is mainly composed of a convolutional layer (CNN) and a recurrent layer (RNN), wherein the convolutional layer is responsible for extracting a feature sequence with a width of a single pixel from the input line text image, and the recurrent layer uses the feature sequence output by the convolutional layer as input and outputs the predicted characters. In the training stage, the convolutional recurrent neural network takes the line text image as input and the text content of the image as the label. After convergence at a certain stage of training, the line text can be recognized in the reasoning stage.
[0054] In one embodiment, the step S105 includes:
[0055] Calculating the distance between the text areas according to the absolute position coordinate information;
[0056] When the distance between two adjacent text areas does not exceed a preset distance threshold, merging the two text areas into one cell;
[0057] When the distance between two adjacent text areas exceeds a preset distance threshold, the two text areas are respectively regarded as a cell.
[0058] In this embodiment, the absolute coordinate position information and text content of the row text area in the wireless table can be obtained through the text detection and recognition model, but each text area is not necessarily a cell. Multiple row text areas may be detected in a cell. In this case, the row text areas need to be merged to obtain the cell. Usually, the text areas belonging to the same cell are adjacent to each other and close to each other. Therefore, by calculating the distance between each text area to determine whether fusion is needed, the information of each cell can be obtained.
[0059] In one embodiment, the step S106 includes:
[0060] Based on the seq2seq network structure, the absolute position coordinate information is encoded and the encoding result is used as the target feature information;
[0061] The target feature information is decoded using a decoder, and the decoding result is used as the relative position coordinate information.
[0062] In this embodiment, after obtaining the cell information, it is necessary to obtain the row and column relationship between cells to obtain a complete table structure. The relative position prediction network predicts the relative position relationship information (output) between cells through the absolute position information (input) of the cells. The relative position relationship between cells includes whether they belong to the same row and the same column. The relative position prediction model is a network structure based on seq2seq, such as Figure 5 As shown, it consists of two parts: an encoder and a decoder. The encoder extracts the feature information of the absolute position coordinates of the input cell, and the decoder uses the feature information extracted by the encoder to predict the relative position information between cells.
[0063] In one embodiment, the step S106 further includes:
[0064] Arrange each text area in order from left to right and from top to bottom according to the absolute position coordinate information;
[0065] Each cell is arranged in order from left to right and from top to bottom according to the relative position coordinate information.
[0066] In this embodiment, when sorting cells to obtain the final wireless table, the text areas are first arranged so that the text areas in a cell (including more than one text area) can be distributed in an orderly manner, and then the cells are arranged according to the relative position coordinate information.
[0067] Figure 3A schematic block diagram of a wireless form recognition device 300 provided in an embodiment of the present invention, the device 300 includes:
[0068] An image acquisition unit 301 is used to acquire an input text image including a wireless form;
[0069] An image extraction unit 302 is used to extract binary segmented images of different text regions from the input text image using a deep residual convolutional neural network;
[0070] An edge information extraction unit 303 is used to extract edge information of the binary segmented image to obtain absolute position coordinate information of different text areas in the input text image;
[0071] A text recognition unit 304 is used to perform text recognition on each of the text regions using the convolutional recurrent neural network to obtain corresponding text information;
[0072] A region merging unit 305 is used to determine whether to merge different text regions according to the absolute position coordinate information to obtain corresponding cell information;
[0073] The first cell arrangement unit 306 is used to obtain relative position coordinate information between adjacent cells based on the absolute position coordinate information, arrange each cell according to the relative position coordinate information, and then use the arrangement result as a wireless table.
[0074] In one embodiment, the image extraction unit 302 includes:
[0075] A feature map acquisition unit is used to input the input text image into a ResNet50 deep residual convolutional neural network, and obtain different feature maps corresponding to the input text image after downsampling and channel expansion processing are performed on the input text image in sequence by the ResNet50 deep residual convolutional neural network;
[0076] The binary segmentation image output unit is used to compress each feature map channel through a convolution operation, and to upsample each feature map to obtain a single-channel image with the same size as the input text image, and output the single-channel image as the binary segmentation image.
[0077] In one embodiment, if Figure 4 As shown, the edge information extraction unit 303 includes:
[0078] The edge extraction unit 401 is used to extract the edge of the binary segmented image by using a double threshold method to obtain a high threshold image;
[0079] A target point acquisition unit 402 is used to connect the edges in the high threshold image into contours, and when reaching the contour endpoint, acquire a target point that meets the low threshold based on an 8-neighborhood point method;
[0080] An edge information acquisition unit 403 is used to collect the remaining edges according to the target point until the edge of the binary segmented image is closed, so as to obtain the edge information of the binary segmented image;
[0081] The coordinate information acquisition unit 404 is used to acquire the absolute position coordinate information corresponding to different text areas in the edge information.
[0082] In one embodiment, the text recognition unit 304 includes:
[0083] A feature sequence extraction unit, configured to extract a feature sequence with a width of a single pixel from any of the text regions using a convolutional layer in the convolutional recurrent neural network;
[0084] A character prediction unit is used to predict characters for the feature sequence using the recurrent layer in the convolutional recurrent neural network, and use the prediction results as the text information.
[0085] In one embodiment, the region merging unit 305 includes:
[0086] A distance calculation unit, used for calculating the distance between each text area according to the absolute position coordinate information;
[0087] A first determination unit, configured to merge two adjacent text areas into one cell when the distance between the two adjacent text areas does not exceed a preset distance threshold;
[0088] The second determination unit is configured to, when the distance between two adjacent text regions exceeds a preset distance threshold, regard the two text regions as a single cell respectively.
[0089] In one embodiment, the first cell arrangement unit 306 includes:
[0090] An encoding unit, used for encoding the absolute position coordinate information based on a seq2seq network structure, and using the encoding result as target feature information;
[0091] The decoding unit is used to use a decoder to decode the target feature information and use the decoding result as the relative position coordinate information.
[0092] In one embodiment, the first cell arrangement unit 306 further includes:
[0093] A region arrangement unit, used to arrange each text region in a sequence from left to right and from top to bottom according to the absolute position coordinate information;
[0094] The second cell arrangement unit is used to arrange each cell in a sequence from left to right and from top to bottom according to the relative position coordinate information.
[0095] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0096] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0097] The embodiment of the present invention also provides a computer device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the computer device may also include various network interfaces, power supplies and other components.
[0098] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0099] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A wireless form recognition method, It is characterized in that include: Get the input text image containing the wireless form; Extracting binary segmented images of different text areas from the input text image using a deep residual convolutional neural network; Extracting edge information of the binary segmented image to obtain absolute position coordinate information of different text areas in the input text image; Using a convolutional recurrent neural network to perform text recognition on each of the text regions to obtain corresponding text information; Determine whether to merge different text areas according to the absolute position coordinate information to obtain corresponding cell information; Relative position coordinate information between adjacent cells is acquired based on the absolute position coordinate information, and each cell is arranged according to the relative position coordinate information, and then the arrangement result is used as a wireless table.
2. The wireless form recognition method according to claim 1, It is characterized in that The method of extracting binary segmented images of different text areas from the input text image using a deep residual convolutional neural network includes: Inputting the input text image into the ResNet50 deep residual convolutional neural network, and performing downsampling and channel expansion processing on the input text image in sequence through the ResNet50 deep residual convolutional neural network to obtain different feature maps corresponding to the input text image; Each feature map is compressed through a convolution operation, and each feature map is upsampled to obtain a single-channel image with the same size as the input text image, and the single-channel image is output as the binary segmentation image.
3. The wireless form recognition method according to claim 1, It is characterized in that The step of extracting edge information of the binary segmented image to obtain absolute position coordinate information of different text regions in the input text image includes: Using a double threshold method to extract edges from the binary segmented image to obtain a high threshold image; Connecting the edges in the high threshold image into contours, and when reaching the contour endpoint, obtaining a target point that meets the low threshold based on an 8-neighborhood point method; Collecting the remaining edges according to the target point until the edge of the binary segmentation image is closed, thereby obtaining edge information of the binary segmentation image; The absolute position coordinate information corresponding to different text areas is obtained from the edge information.
4. The wireless form recognition method according to claim 1, It is characterized in that The method of using a convolutional recurrent neural network to perform text recognition on each of the text regions to obtain corresponding text information includes: For any of the text regions, extract a feature sequence with a width of a single pixel from the text region using a convolutional layer in the convolutional recurrent neural network; The recurrent layer in the convolutional recurrent neural network is used to predict characters for the feature sequence, and the prediction results are used as the text information.
5. The wireless form recognition method according to claim 1, It is characterized in that The step of determining whether to merge different text areas according to the absolute position coordinate information to obtain corresponding cell information includes: Calculating the distance between the text areas according to the absolute position coordinate information; When the distance between two adjacent text areas does not exceed a preset distance threshold, merging the two text areas into one cell; When the distance between two adjacent text areas exceeds a preset distance threshold, the two text areas are respectively regarded as a cell.
6. The wireless form recognition method according to claim 1, It is characterized in that The step of acquiring relative position coordinate information between adjacent cells based on the absolute position coordinate information, arranging each cell according to the relative position coordinate information, and then using the arrangement result as a wireless table includes: Based on the seq2seq network structure, the absolute position coordinate information is encoded and the encoding result is used as the target feature information; The target feature information is decoded using a decoder, and the decoding result is used as the relative position coordinate information.
7. The wireless form recognition method according to claim 1, It is characterized in that The method of acquiring relative position coordinate information between adjacent cells based on the absolute position coordinate information, arranging each cell according to the relative position coordinate information, and then using the arrangement result as a wireless table, further includes: Arrange each text area in order from left to right and from top to bottom according to the absolute position coordinate information; Each cell is arranged in order from left to right and from top to bottom according to the relative position coordinate information.
8. A wireless form recognition device, It is characterized in that include: An image acquisition unit, used for acquiring an input text image containing a wireless form; An image extraction unit, used for extracting binary segmentation images of different text areas from the input text image using a deep residual convolutional neural network; An edge information extraction unit, used to extract edge information of the binary segmented image to obtain absolute position coordinate information of different text areas in the input text image; A text recognition unit, used to perform text recognition on each of the text regions using a convolutional recurrent neural network to obtain corresponding text information; A region merging unit, used to determine whether to merge different text regions according to the absolute position coordinate information, and obtain corresponding cell information; The first cell arrangement unit is used to obtain relative position coordinate information between adjacent cells based on the absolute position coordinate information, arrange each cell according to the relative position coordinate information, and then use the arrangement result as a wireless table.
9. A computer device, It is characterized in that The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the wireless form recognition method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the wireless form recognition method according to any one of claims 1 to 7 is implemented.
