A text image structured processing method and device
By identifying and merging multi-line print item text boxes in medical invoice images, the multi-line printing problem in the structured output of medical invoice data is solved, the output quality is improved and manual participation is reduced, automated processing is realized, and human resources are solved High cost issue.
Patent Information
- Application Number
- CN202111230230.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-21
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-10-21
AI Technical Summary
The complex layout of medical invoices leads to multiple lines of printing when the project name characters are too long, making it difficult to achieve standard structured data output, and the existing solutions have high manual participation, resulting in high labor costs.
By determining the text box in the text image, including the project text box, the header text box and the attribute name text box, establishing a structured relationship based on the orientation relationship of these text boxes, and combining multiple lines to print the project text box to achieve the text image Structured output.
It improves the structured output quality of text images, reduces the degree of manual participation, reduces labor costs, and realizes an automated structured processing process.
Smart Images

Figure CN114120340B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image recognition, and in particular, relates to a method, device, computer equipment and computer-readable storage medium for structured processing of text images. Background Art
[0002] In the field of medical imaging, the main purpose of the optical character recognition (OCR) project for invoice images is to use the text recognition content and text coordinate information of the image to format the item name detail field of the medical invoice in a standard output.
[0003] In the prior art, customers upload multiple medical invoices, which contain a lot of text information. When claims workers make claims, they need to accurately enter all the medical item names and their corresponding attribute items on the expense list.
[0004] However, in the current solution, due to the relatively complex layout of medical invoices, if the characters of the item name are too long, it will result in multiple lines of printing, making it difficult to achieve standard structured output of data. In addition, the current solution has a high degree of manual participation, resulting in high labor costs. Summary of the invention
[0005] In view of this, the present invention provides a structured processing method, device, computer equipment and computer-readable storage medium for text images, which to a certain extent solves the problem in the current solution that when the project name characters are too long, it will cause multiple lines to be printed, making it difficult to achieve standard structured output of data, and the current solution has a high degree of manual participation, resulting in high labor costs.
[0006] According to a first aspect of the present invention, a method for structurally processing a text image is provided, comprising:
[0007] Determine the text boxes in the text image, and the item text boxes in all text boxes;
[0008] Confirm the header text box and attribute name text box in all text boxes;
[0009] According to the positional relationship among the header text box, the item text box and the attribute name text box, determining the attribute value text boxes respectively corresponding to the item text box and the attribute name text box from all the text boxes, and determining the multi-line printing item text boxes from all the item text boxes;
[0010] When the structural relationship of the text image is established according to the correspondence between the item text box, the attribute name text box, and the attribute value text box, the multi-line printing item text box is merged with the text boxes of adjacent lines.
[0011] According to a second aspect of the present invention, a text image structured processing device is provided, which may include:
[0012] A recognition module for determining text boxes in a text image and item text boxes in all text boxes;
[0013] The first determination module is used to determine the header text box and the attribute name text box among all the text boxes;
[0014] A second determination module is used to determine, from all text boxes, attribute value text boxes corresponding to the item text box and the attribute name text box, respectively, and to determine a multi-line printing item text box in all item text boxes according to the positional relationship among the header text box, the item text box and the attribute name text box;
[0015] A merging module is used to merge the multi-line printed item text box with the text boxes of adjacent lines when establishing the structural relationship of the text image according to the correspondence between the item text box, the attribute name text box and the attribute value text box.
[0016] In a third aspect, an embodiment of the present invention provides a computer device, the computer device comprising:
[0017] A memory for storing program instructions;
[0018] The processor is used to call the program instructions stored in the memory, and execute the steps included in the text image structured processing method as described in the first aspect according to the obtained program instructions.
[0019] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the structured processing method of text images as described in the first aspect are implemented.
[0020] Compared with the prior art, the present invention has the following advantages:
[0021] The present invention provides a method for structural processing of text images, comprising: targeting the orientation relationship between the header text box, the project text box and the attribute name text box in the preliminary OCR recognition result of the text image, while determining the structural correspondence between the project text box, the attribute name text box and the attribute value text box and outputting it, further determining the multi-line printing project text boxes in all the project text boxes through the above orientation relationship and merging them, thereby solving the multi-line printing problem in the structural output of the text image and improving the quality of the structural output of the text image. In addition, the whole process can be automatically realized by a machine algorithm, reducing the degree of human participation and thus reducing labor costs.
[0022] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0024] Figure 1 It is a flowchart of the steps of a text image structured processing method provided by an embodiment of the present invention;
[0025] Figure 2 is a text image provided by an embodiment of the present invention;
[0026] Figure 3 is a flowchart of another method for structurally processing text images provided by an embodiment of the present invention;
[0027] Figure 4 is a schematic diagram of a local area of a text image provided by an embodiment of the present invention;
[0028] Figure 5 It is a block diagram of a text image structured processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0030] Figure 1 is a flowchart of a method for structurally processing text images provided by an embodiment of the present invention. Figure 1 As shown, the method may include:
[0031] Step 101: determine the text boxes in the text image and the project text boxes in all the text boxes.
[0032] In the embodiment of the present invention, the text image may be an image containing text content, such as a medical invoice image uploaded by a customer, a scanned certificate image, and the like.
[0033] In practical applications, the text content in a text image has a corresponding structured format. Specifically, the text content in a text image exists in respective corresponding text boxes, and the positions of the text boxes are restricted by the structured format. For example, there are project text boxes for representing project names, attribute value text boxes for representing attribute values of project names, etc. in a text image. Different types of text boxes are located in different positions, and there are also certain position constraints between text boxes, such as the row and column relationship. The attribute value text box corresponding to the project text box must be in an area horizontally adjacent to the project text box. These are all things that need to be considered in the structural processing of text images.
[0034] Furthermore, in addition to text boxes for specific fields (such as medical projects) in the text image, there are also text boxes related to other contents. For example, there are text boxes corresponding to some other information in the medical invoice, such as text boxes for the collection unit, the reviewer, the payee, etc. In the text image structuring processing process of the embodiment of the present invention, it is necessary to identify the text boxes for specific fields and determine these text boxes as project text boxes. The project text boxes are used to represent the project content under the specific field. Identifying the project text boxes can be achieved by identifying and classifying the text content in the text boxes.
[0035] Step 102: Determine the header text box and the attribute name text box in all text boxes.
[0036] In the text image structured processing process of the embodiment of the present invention, the more important text boxes include the header text box and the attribute name text box. Figure 2, which shows a text image provided by an embodiment of the present invention, wherein multiple text boxes 10 are identified, and a header text box 11 is used to represent the project information at the header position, such as the content of the header text box 11 can be "project name", and the multiple project text boxes 12 identified in step 101 are used to represent specific project content, and the content contained therein may include: "treatment fee", "the following is the list item [Guoji] Lidong (Lactulose Oral Solution)", "Febi Bran (Wheat Cellulose Granules)", "Mucosal Anti-Infection Treatment 4 (Active Silver Ion Antibacterial Liquid (Yinertong))", etc. The project text box 12 can be used as a subordinate text box of the header text box 11, and is arranged vertically in an area vertically adjacent to the header text box 11. The attribute name text box 13 is used to represent the attribute name, and the content contained therein is: "Quantity / Unit", "Amount (Yuan)", etc.
[0037] Furthermore, the header text box and the attribute name text box can be matched by preset keywords. For example, the header text box can be matched by the keyword "project name", and the attribute name text box can be matched by the keywords "quantity" and "amount".
[0038] Step 103, according to the orientation relationship between the header text box, the item text box and the attribute name text box, determine the attribute value text box corresponding to the item text box and the attribute name text box respectively from all text boxes, and determine the multi-line printing item text box in all item text boxes.
[0039] Specifically, refer to Figure 2 Due to the current OCR recognition problem, the item text box 12 has a problem of multi-line printing, that is, a complete item text box 12 is mistakenly recognized as multiple multi-line printed item text boxes 121. For example, a complete item text box 12: "The following is a list item [Guoji] Lidong (Lactulose Oral Solution)" is mistakenly recognized as multiple multi-line printed item text boxes 121, including: "The following is a list item", "liquid)". This incorrect recognition greatly affects the accuracy of the structured output of the text image.
[0040] In an embodiment of the present invention, the problem of printing multiple lines of project text boxes in a project text box can be further solved on the basis of realizing the structured output of text images through the orientation relationship between the header text box, the project text box and the attribute name text box. The basis of the structured output of the text image is to determine the attribute value text box corresponding to the project text box. The attribute value text box is used to represent the specific attribute value of the project text box for a certain attribute name. For example, the project text box can be treatment fee. Then, for the amount attribute name, the content of the attribute value text box corresponding to the treatment fee project text box can be an amount, such as 60.
[0041] Reference Figure 2 It can be seen that there is an orientation characteristic of arranging in a horizontal row between the project text box 12 and the corresponding attribute value text box 14; there is an orientation characteristic of arranging in a vertical column between the project text box 12 and the header text box 11; there is an orientation characteristic of arranging in a horizontal row between the header text box 11 and the attribute name text box 13, and the header text box 11 is at the header position at the end, and there is an orientation characteristic of arranging in a vertical column between the attribute name text box 13 and the attribute value text box 14. According to these orientation relationships, the project text box 12 can be first used as the starting point to set a horizontal straight line 21 (the slope of the straight line 21 is calculated by the slope of the text file in the text image), so that the text box 10 overlapping with the horizontal straight line 21 is determined as the attribute value text box 14 corresponding to the project text box 12. By traversing all project text boxes 12 in the above manner, and determining the attribute value text box 14 corresponding to each project text box 12 in turn, the preliminary structured output of the text image can be obtained.
[0042] In addition, since the attribute name text box 13 and the attribute value text box 14 are arranged in a vertical column, a downward vertical straight line 22 can be made for the attribute name text box 13 (the slope of the straight line 22 is calculated by the slope of the text file in the text image), so that the text box selected by the straight line 22 can be used as the attribute value text box 14 under the attribute name text box 13.
[0043] Further, see Figure 2 It can be seen that the horizontal straight line 23 set with the multi-line printing item text box 121 as the starting point does not overlap with any attribute value text box 14. Therefore, the multi-line printing item text box 121 in all item text boxes 12 can be determined based on this orientation relationship.
[0044] Step 104: when establishing the structural relationship of the text image according to the correspondence between the item text box, the attribute name text box, and the attribute value text box, the multi-line printing item text box is merged with the text boxes of adjacent lines.
[0045] In an embodiment of the present invention, after performing OCR recognition on the text image and determining the structured correspondence between the project text box, the attribute name text box, and the attribute value text box, the multi-line printed project text box can be merged with the text boxes of the upper and lower adjacent lines, thereby solving the multi-line printing problem in the structured output and improving the quality of the structured output.
[0046] For example, refer to Figure 2, the incorrectly identified multiple multi-line printing item text boxes 121: "The following are the list items", "liquid)" and the upper and lower adjacent text boxes "
Guoji
Guoji
[0047] In summary, a structured processing method for text images provided by an embodiment of the present invention can target the orientation relationship between the header text box, project text box and attribute name text box in the preliminary OCR recognition results of the text image. While determining and outputting the structured correspondence between the project text box, attribute name text box and attribute value text box, it further provides the above-mentioned orientation relationship, determines the multi-line printing project text boxes in all project text boxes and merges them, thereby solving the multi-line printing problem in the structured output of the text image and improving the quality of the structured output of the text image. In addition, the entire process can be automatically implemented through machine algorithms, reducing the degree of manual participation and thus reducing labor costs.
[0048] Figure 3 is a flowchart of another method for structurally processing text images provided by an embodiment of the present invention. Figure 3 As shown, the method may include:
[0049] Step 201: Determine a text box in the text image and the text content contained in the text box.
[0050] In an embodiment of the present invention, the text boxes in the text image can be detected by a text box detection model, and then a set of text boxes box_set is output, each text box in the set contains 8 data [x0, y0, x1, y1, x2, y2, x3, y3], which respectively represent the coordinates of the four vertices of the upper left, upper right, lower left and lower right of the text box.
[0051] Step 202: input the text content of the text box into a text classification model to obtain project text content of the project name type, and determine the project text box corresponding to the project text content.
[0052] In this step, after identifying the text box, the area where the text box is located can be further input into the project name text classification model. The project name text classification model can first identify the text content in the text box to obtain a text content set info_set, and then perform semantic classification on the text content to obtain a collection of project text contents pro_info_set whose classification result is the project name. Finally, the text box corresponding to the project text content can be determined as the project text box to obtain a project text box set pro_box_set.
[0053] Step 203: Match the text content of the text box with a preset keyword to determine the header text box and the attribute name text box.
[0054] In this step, the header text box may be determined by matching a preset header keyword with the text content of the text box, and the header text box may be determined by matching a preset attribute name keyword with the text content of the text box.
[0055] For example, refer to Figure 2 , through the keyword "project name", you can match the header text box 11, and through the keywords "quantity" and "amount", you can match the attribute name text box 13.
[0056] Step 204, based on the orientation relationship between the header text box, the item text box and the attribute name text box, determine the attribute value text box corresponding to the item text box and the attribute name text box respectively from all text boxes, and determine the multi-line printing item text box in all item text boxes.
[0057] This step may specifically refer to the above step 103, which will not be described in detail here.
[0058] Optionally, in order to determine the attribute value text box corresponding to the attribute name text box, step 204 may specifically include:
[0059] Sub-step 2041: Determine the vertical slope according to the horizontal slope of the first straight line formed from the table header text box to the attribute name text box.
[0060] Optionally, the first straight line is: a straight line formed by the center point of the header text box to the center point of the attribute name text box.
[0061] In the embodiment of the present invention, in order to determine the attribute value text box corresponding to the attribute name text box, refer to Figure 4 , which shows a schematic diagram of a local area of a text image provided by an embodiment of the present invention. A first straight line 31 can be first formed from the center point of the header text box to the center point of the attribute name text box. The first straight line 31 reflects the horizontal slope k in the horizontal direction of the text file in the entire text image. Further, through the horizontal slope k, the longitudinal slope k' of the text file in the longitudinal direction can be obtained, k'=-1 / k.
[0062] Specifically, according to the text box set box_set, each text box contains 8 vertex coordinate data [x0, y0, x1, y1, x2, y2, x3, y3]. The center point of the header text box and the center point of the attribute name text box can be calculated. The x and y axis coordinates of the center point are calculated as follows:
[0063] x center =(x0+x1+x2+x3) / 4
[0064] y center =(y0+y1+y2+y3) / 4
[0065] The calculation results include the center point coordinates of the header text box (x cc ,y cc ), and the center point coordinates (x pc ,y pc .
[0066] The first straight line 31 is calculated as follows:
[0067] (yy pc )(x cc -x pc )-(xx pc )(y cc -y pc )=0;
[0068] The horizontal slope k is calculated as follows:
[0069] The longitudinal slope k' is calculated as follows:
[0070] Sub-step 2042: according to the longitudinal slope, set a second longitudinal straight line on both sides of the attribute name text box.
[0071] In this step, refer to Figure 4 Since the attribute name text box 13 and the attribute value text box 14 are arranged in a vertical column, the boundary points on both sides of the attribute name text box 13 can be taken as (x3, y3) and (x2, y2), and two downward vertical second straight lines 32 are made for the attribute name text box 13 from the boundary point positions, and the slope of the second straight line 32 is the vertical slope k'.
[0072] Sub-step 2043: determining the item box overlapping the second straight line as the attribute value text box corresponding to the attribute name text box.
[0073] In this step, refer to Figure 4 According to the constraint relationship between the attribute name text box 13 and the attribute value text box 14 arranged in a vertical column, the text box selected by the second straight line 32 can be used as the attribute value text box 14 under the attribute name text box 13. The attribute value text box 14 is used to represent the specific attribute value of the item text box 12 for a certain attribute name.
[0074] Specifically, for each text box, whether the second straight line overlaps the text box can be determined in the following manner:
[0075] a. The equation for calculating the intersection of two straight lines is:
[0076]
[0077] Among them, h(x) and f(x) represent the equations of two straight lines, and the intersection point (x, y) can be obtained by solving a system of two linear equations.
[0078] b. Calculate the equation of the straight line at the bottom of the text box:
[0079] (y-y0)(x1-x0)-(x-x0)(y1-y0)=0;
[0080] c. Calculate the intersection point (x tl ,y tl ), x tr ,y tr );
[0081] d. Determine whether the text box is the attribute value text box under the attribute name text box based on the following judgment conditions:
[0082] If x3<x tr <x2, the text box is the attribute value text box under the attribute name text box;
[0083] If x3<x lr <x2, the text box is the attribute value text box under the attribute name text box;
[0084] If satisfied The text box is the attribute value text box under the attribute name text box.
[0085] Optionally, in order to determine the multi-line printing item text box in the item text box, step 204 may further specifically include:
[0086] Sub-step 2044: construct a third horizontal straight line based on the horizontal slope and taking the project text box as a starting point.
[0087] In this step, refer to Figure 4 In order to determine the multi-line printed item text box 121 in the item text box 12, a third horizontal straight line 33 can be constructed based on the horizontal slope with the item text box 12 as the starting point. The starting point of the third straight line 33 can be the center point of the item text box 12.
[0088] Sub-step 2045: when the third straight line does not overlap with the attribute value text box, determine that the item text box corresponding to the third straight line is the multi-line printing item text box.
[0089] Reference Figure 4 It can be seen that the third horizontal straight line 33 set with the multi-line printing item text box 121 as the starting point does not overlap with any attribute value text box 14. Therefore, the multi-line printing item text box 121 in all item text boxes 12 can be determined based on this orientation relationship.
[0090] For example, for a correct and complete item text box: "The following is a list item [Guoji] Lidong (Lactulose Oral Solution)", the above method can be used to identify a multi-line printed item text box 121: "The following is a list item", "Liquid)".
[0091] Optionally, in order to determine the attribute value text box corresponding to the item text box, step 204 may further specifically include:
[0092] Sub-step 2046: determine the attribute value text box overlapping with the third straight line as the attribute value text box corresponding to the item text box corresponding to the third straight line.
[0093] Further references Figure 4 Since the project text box 12 and the corresponding attribute value text box 14 are arranged in a horizontal row, the project text box 12 can be used as the starting point to set the third horizontal straight line 33, so that the text box 10 overlapping the third horizontal straight line 33 is determined as the attribute value text box 14 corresponding to the project text box 12. By traversing all project text boxes 12 in the above manner and determining the attribute value text box 14 corresponding to each project text box 12 in turn, the preliminary structured output of the text image can be obtained. Finally, combined with the structured output of sub-steps 2041 to 2045, the complete structured output of the text image can be obtained.
[0094] Step 205: When establishing the structural relationship of the text image according to the correspondence between the item text box, the attribute name text box, and the attribute value text box, the multi-line printing item text box is merged with the text boxes of adjacent lines.
[0095] This step may specifically refer to the above step 104, which will not be described in detail here.
[0096] In summary, a structured processing method for text images provided by an embodiment of the present invention can target the orientation relationship between the header text box, project text box and attribute name text box in the preliminary OCR recognition results of the text image. While determining and outputting the structured correspondence between the project text box, attribute name text box and attribute value text box, it further provides the above-mentioned orientation relationship, determines the multi-line printing project text boxes in all project text boxes and merges them, thereby solving the multi-line printing problem in the structured output of the text image and improving the quality of the structured output of the text image. In addition, the entire process can be automatically implemented through machine algorithms, reducing the degree of manual participation and thus reducing labor costs.
[0097] Figure 5 is a block diagram of a text image structured processing device provided by an embodiment of the present invention, such as Figure 5 As shown, the device may include:
[0098] The recognition module 301 is used to determine the text boxes in the text image and the item text boxes in all the text boxes;
[0099] The first determination module 302 is used to determine the header text box and the attribute name text box among all the text boxes;
[0100] A second determining module 303 is used to determine, from all text boxes, attribute value text boxes corresponding to the item text box and the attribute name text box, respectively, and to determine a multi-line printing item text box in all item text boxes according to the positional relationship among the header text box, the item text box and the attribute name text box;
[0101] The merging module 304 is used to merge the multi-line printing item text box with the text boxes of adjacent lines when establishing the structural relationship of the text image according to the correspondence between the item text box, the attribute name text box and the attribute value text box.
[0102] Optionally, the identification module 301 includes:
[0103] A first determination submodule, used to determine a text box in the text image, and text content contained in the text box;
[0104] The classification submodule is used to input the text content of the text box into a text classification model to obtain project text content of the project name type, and determine the project text box corresponding to the project text content.
[0105] Optionally, the first determining module 302 includes:
[0106] The second determination submodule is used to match the text content of the text box with a preset keyword to determine the header text box and the attribute name text box.
[0107] Optionally, the second determining module 303 includes:
[0108] A third determination submodule is used to determine a longitudinal slope according to a horizontal slope of a first straight line formed from the table header text box to the attribute name text box;
[0109] A fourth determining submodule is used to set a second longitudinal straight line on both sides of the attribute name text box according to the longitudinal slope;
[0110] The fifth determining submodule is used to determine the item box overlapping the second straight line as the attribute value text box corresponding to the attribute name text box.
[0111] Optionally, the first determining module 302 includes:
[0112] A sixth determination submodule is used to construct a third horizontal straight line with the project text box as a starting point according to the horizontal slope;
[0113] The seventh determination submodule is used to determine that the item text box corresponding to the third straight line is the multi-line printing item text box when the third straight line does not overlap with the attribute value text box.
[0114] Optionally, the second determining module 303 includes:
[0115] The eighth determining submodule is used to determine the attribute value text box overlapping with the third straight line as the attribute value text box corresponding to the item text box corresponding to the third straight line.
[0116] Optionally, the first straight line is: a straight line formed by the center point of the header text box to the center point of the attribute name text box.
[0117] In summary, a text image structured processing device provided by an embodiment of the present invention can determine the structured correspondence between the header text box, the item text box and the attribute name text box in the preliminary OCR recognition result of the text image and output it, while further providing the above-mentioned orientation relationship, determining the multi-line printing item text boxes in all the item text boxes and merging them, thereby solving the multi-line printing problem in the structured output of the text image and improving the quality of the structured output of the text image. In addition, the entire process can be automatically implemented through machine algorithms, reducing the degree of manual participation and thus reducing labor costs.
[0118] As for the above-mentioned device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0119] Preferably, an embodiment of the present invention further provides a computer device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned structured processing method for text images are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0120] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned text image structured processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0121] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0122] It is easy for a person skilled in the art to think that any combination of the above embodiments is feasible, so any combination of the above embodiments is an implementation scheme of the present invention. However, due to space limitations, this specification will not describe them in detail here.
[0123] The structured processing method of text image provided here is not inherently related to any specific computer, virtual system or other equipment. Various general systems can also be used together with the teaching based on this. According to the above description, it is obvious to construct the required structure of the system with the scheme of the present invention. In addition, the present invention is not directed to any specific programming language yet. It should be understood that various programming languages can be utilized to realize the content of the present invention described here, and the description of the above specific language is for disclosing the best mode of the present invention.
[0124] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0125] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in less than all of the features of the individual embodiments previously disclosed. Therefore, the claims that follow the detailed description are hereby expressly incorporated into the detailed description, with each claim itself serving as a separate embodiment of the present invention.
[0126] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0127] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.
[0128] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the structured processing method for text images according to an embodiment of the present invention. The present invention may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program for implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0129] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
Claims
1. A text image structured processing method, characterized in that: The method comprises: Determine the text boxes in the text image, and the item text boxes in all text boxes; Confirm the header text box and attribute name text box in all text boxes; According to the positional relationship among the header text box, the item text box and the attribute name text box, determining the attribute value text boxes respectively corresponding to the item text box and the attribute name text box from all the text boxes, and determining the multi-line printing item text boxes from all the item text boxes; When establishing the structural relationship of the text image according to the correspondence between the item text box, the attribute name text box, and the attribute value text box, merging the multi-line printing item text box with the text boxes of adjacent lines; Wherein, according to the positional relationship between the header text box, the item text box and the attribute name text box, determining the multi-line printing item text box in all the item text boxes includes: According to the horizontal slope of the first straight line formed by the header text box to the attribute name text box, a third horizontal straight line is constructed with the item text box as the starting point; In the case that the third straight line does not overlap with the attribute value text box, it is determined that the item text box corresponding to the third straight line is the multi-line printing item text box.
2. The method according to claim 1, characterized in that The determining of the text boxes in the text image and the item text boxes in all the text boxes includes: Determine a text frame in the text image, and text content contained in the text frame; The text content of the text box is input into a text classification model to obtain project text content of a project name type, and determine a project text box corresponding to the project text content.
3. The method according to claim 1, characterized in that The header text box and the attribute name text box in all the text boxes are determined, including: The table header text box and the attribute name text box are determined by matching preset keywords with the text content of the text box.
4. The method according to claim 1, characterized in that: The determining of the attribute value text box corresponding to the attribute name text box from all text boxes according to the positional relationship among the header text box, the item text box and the attribute name text box comprises: Determining a longitudinal slope based on the horizontal slope; According to the longitudinal slope, second longitudinal straight lines are respectively set on both sides of the attribute name text box; The item box overlapping the second straight line is determined as the attribute value text box corresponding to the attribute name text box.
5. The method according to claim 1, characterized in that The determining of the attribute value text box corresponding to the item text box according to the positional relationship among the header text box, the item text box and the attribute name text box comprises: The attribute value text box overlapping with the third straight line is determined as the attribute value text box corresponding to the item text box corresponding to the third straight line.
6. The method according to claim 4, characterized in that The first straight line is a straight line formed by the center point of the header text box to the center point of the attribute name text box.
7. A text image structured processing device, characterized in that: The device comprises: A recognition module for determining text boxes in a text image and item text boxes in all text boxes; The first determination module is used to determine the header text box and the attribute name text box among all the text boxes; A second determination module is used to determine, from all text boxes, attribute value text boxes corresponding to the item text box and the attribute name text box, respectively, and to determine a multi-line printing item text box in all item text boxes according to the positional relationship among the header text box, the item text box and the attribute name text box; A merging module, configured to merge the multi-line printed item text box with text boxes in adjacent lines when establishing a structural relationship of the text image according to the correspondence between the item text box, the attribute name text box, and the attribute value text box; Wherein, the second determining module includes: A sixth determination submodule, configured to construct a third horizontal straight line with the item text box as a starting point according to a horizontal slope of a first straight line formed from the table header text box to the attribute name text box; The seventh determination submodule is used to determine that the item text box corresponding to the third straight line is the multi-line printing item text box when the third straight line does not overlap with the attribute value text box.
8. A computer device, characterized in that: The computer device comprises: A memory for storing program instructions; The processor is used to call the program instructions stored in the memory, and execute the steps included in the text image structured processing method described in any one of claims 1 to 6 according to the obtained program instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for structurally processing a text image according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Text image line dividing method and device, computer equipment and readable storage medium
CN111626250A
Information extraction method and, device and , equipment and storage medium
CN111652176A
OCR and information extraction method applied to documents in medical field
CN111985306A
Image processing method, electronic circuit, visual impairment assistance equipment, and medium
CN113139537A
Image data structuring method and device, electronic equipment and computer readable medium
CN113239227A
