A fast OCR recognition method for bank statements

By using technical means such as OCR identification model and overlap rate calculation in bank statement OCR identification, the problems of poor adaptability and low accuracy of bank statement table recognition are solved, and more efficient and accurate table data recognition is achieved.

CN117994790BActive Publication Date: 2025-03-14BEIJING ETOP SCI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410364233.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-28
Publication Date
2025-03-14
Estimated Expiration
2044-03-28

AI Technical Summary

Technical Problem

In the prior art, bank statement tables of different layouts do not have horizontal and vertical lines auxiliary forms for identification, resulting in poor adaptability and poor recognition accuracy for table recognition.

Method used

The OCR recognition model is used to identify the table text blocks of bank statements. The table data is accurately identified and processed by traversing the table header, dividing the table header subtext blocks, determining the table type, calculating the horizontal and vertical overlap rate.

Benefits of technology

It improves the accuracy and speed of bank statement forms identification, can better adapt to different document formats and identification needs, and ensures the completeness and accuracy of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117994790B_ABST
    Figure CN117994790B_ABST
Patent Text Reader

Abstract

The invention relates to the field of data processing technology, and in particular to a method for fast OCR recognition of bank flow, comprising: using an OCR recognition model to recognize text blocks of a table of bank flow to obtain sub-text blocks surrounded by text boxes, adding sub-text blocks of a table header to vec_head and segmenting the sub-text blocks of the table header or performing a primary determination on the sub-text blocks of the table header, adding sub-text blocks of a row below the table header to vec_head_double, determining a table type, and performing a secondary determination on sub-text blocks of a current row of details to determine whether a single sub-text block in the current row of details belongs to a single sub-text block in vec_head_double, determining whether a single sub-text block in the current row of details belongs to a single sub-text block in vec_head, and determining a division method for sub-text blocks of the current row of details. The invention overcomes the problem in the prior art that different formats of bank flow tables have no horizontal and vertical lines to assist the table in recognition, resulting in poor adaptability to table recognition and poor recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method for rapid OCR recognition of bank statements. Background Art

[0002] In the financial field, bank statements are important financial documents that record all transaction details of an account and are essential for the financial management of individuals and businesses. With the development of information technology, people are increasingly inclined to use electronic bank statements, which requires the text information in the statement to be accurately converted from images to editable and analyzable data formats. In order to achieve this conversion, optical character recognition (OCR) technology is usually used.

[0003] OCR technology can recognize and convert different types of documents, including printed text, handwritten text, and text in images. However, bank statements often contain complex tables and various formats, which places high demands on the accuracy and efficiency of OCR technology. Traditional OCR systems may have difficulty accurately processing data in tables, especially when the table layout is complex or the text format is irregular.

[0004] For OCR recognition of bank statements, a method that can accurately recognize and process table data is needed. This method should be able to recognize the structure of the table, including the table header and table body, and process data in different rows and columns. At the same time, for the text blocks in the table, it is necessary to be able to effectively segment and classify them to ensure the accuracy and completeness of the data.

[0005] Chinese patent application publication number: CN116152480A discloses a data extraction and structured processing system and implementation method, including five modules: file upload module, file recognition module, data analysis module, analysis result integration module, analysis result storage module, etc., with a total of ten functions: file upload, file conversion, file recognition, automatic verification of recognition results, manual verification of recognition results, positioning table type, parsing data, integrating analysis results, and storing analysis results.

[0006] It can be seen that the prior art has the following problems: since bank statement forms of different formats have no horizontal and vertical lines to assist in form recognition, the adaptability to form recognition and the recognition accuracy are poor. Summary of the invention

[0007] To this end, the present invention provides a bank statement OCR rapid recognition method to overcome the problem in the prior art that different formats of bank statement forms have no horizontal and vertical lines to assist the form in recognition, resulting in poor adaptability and poor recognition accuracy.

[0008] To achieve the above object, the present invention provides a bank flow OCR rapid recognition method, comprising:

[0009] The OCR recognition model is used to recognize the text block of the bank statement table to obtain the sub-text block surrounded by the text box;

[0010] Traverse the header, add the sub-text block of the header to vec_head and split the sub-text block of the header;

[0011] Or make an initial determination of the sub-text block of the table header;

[0012] Add the sub-text block of the next row of the table header to vec_head_double, and determine the table type based on whether the sub-text block in vec_head_double overlaps horizontally with the sub-text block in vec_head;

[0013] Or determine the table type based on the number of the first sub-text blocks of any row of details;

[0014] Determine a secondary determination of the sub-text blocks in the current row of details according to the number of the second sub-text blocks in the current row of details, so as to determine whether the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double according to the first horizontal overlap ratio between the single sub-text block in the current row of details and the single sub-text block in vec_head_double;

[0015] Determine whether the single sub-text block in the current line of details belongs to the single sub-text block in vec_head according to the second horizontal overlap ratio between the single sub-text block in the current line of details and the single sub-text block in vec_head;

[0016] Determine a first vertical overlap ratio between the sub-text block of the current row of details and the row where the previous date is located, and a second vertical overlap ratio between the sub-text block of the current row of details and the row where the next date is located, so as to determine a division method for the sub-text block of the current row of details based on a comparison result of the first vertical overlap ratio and the second vertical overlap ratio.

[0017] Furthermore, the adding the sub-text block of the table header to vec_head and segmenting the sub-text block of the table header includes segmenting the sub-text block of the table header under the condition that the interval between characters in the sub-text block of the table header is greater than or equal to a second preset interval;

[0018] Or, the sub-text block of the header is initially determined under the condition that the interval between characters in the text block of the header is greater than the first preset interval and less than the second preset interval.

[0019] Furthermore, the initial determination of the sub-text block of the header includes deleting the remaining characters under the condition that the number of characters remaining after the sub-text block in vec_head is segmented is less than or equal to a preset number.

[0020] Further, determining the table type according to whether the sub-text block in vec_head_double and the sub-text block in vec_head overlap horizontally includes determining the table type as a single data multiple-row type when there is horizontal overlap;

[0021] Or, when there is no horizontal overlap, add the subtext block in vec_head_double to vec_head.

[0022] Further, determining the table type according to the number of first sub-text blocks of any row of details includes determining the table type as a single-column data multi-row type under the condition that the number of first sub-text blocks of any row of details is less than the number of sub-text blocks of the previous row of details;

[0023] Or, the table type is determined to be a single-data single-row type under the condition that the number of the first sub-text blocks in each row of details is equal to the number of sub-text blocks in the previous row of details.

[0024] Further, the determining of the secondary determination of the sub-text blocks of the current row of details according to the number of second sub-text blocks of the current row of details includes performing secondary determination of the sub-text blocks of the current row of details under the condition that the number of second sub-text blocks of the current row of details is less than the number of sub-text blocks of the previous row of details.

[0025] Furthermore, the first horizontal overlap ratio is calculated according to the following formula:

[0026] ;

[0027] Wherein, D1 represents the first horizontal overlap rate, A2 represents the abscissa of the lower right corner of the text box of a single sub-text block in vec_head_double, A1 represents the abscissa of the lower left corner of the text box of a single sub-text block in vec_head_double, and B1 represents the abscissa of the lower left corner of the text box of a single sub-text block in the current row of details;

[0028] The determining whether the single sub-text block in the current line of details belongs to the single sub-text block in vec_head_double includes determining that the single sub-text block in the current line of details does not belong to the single sub-text block in vec_head_double under the condition that the first horizontal overlap ratio is less than or equal to the first preset horizontal overlap ratio;

[0029] Or, under the condition that the first horizontal overlap ratio is less than or equal to 1 and greater than a first preset horizontal overlap ratio, it is determined that the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double.

[0030] Furthermore, the second horizontal overlap ratio is calculated according to the following formula:

[0031] ;

[0032] Wherein, D2 represents the second horizontal overlap ratio, A02 represents the horizontal coordinate of the lower right corner of the text box of a single sub-text block in vec_head, A01 represents the horizontal coordinate of the lower left corner of the text box of a single sub-text block in vec_head, and B01 represents the horizontal coordinate of the lower left corner of the text box of a single sub-text block in the current row of details;

[0033] The determining whether the single sub-text block in the current line of details belongs to the single sub-text block in vec_head includes determining that the single sub-text block in the current line of details does not belong to the single sub-text block in vec_head_double under the condition that the second horizontal overlap ratio is less than or equal to the second preset horizontal overlap ratio;

[0034] Or, under the condition that the second horizontal overlap ratio is less than or equal to 1 and greater than a second preset horizontal overlap ratio, it is determined that the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double.

[0035] Furthermore, the first vertical overlap ratio is calculated according to the following formula:

[0036] ;

[0037] Wherein, C1 represents the first vertical overlap ratio, F1 represents the ordinate of the lower right corner of the text box of the previous date, F2 represents the ordinate of the upper right corner of the text box of the previous date, and G2 represents the ordinate of the upper left corner of the text box of the sub-text block in the current row of details;

[0038] The second vertical overlap ratio is calculated according to the following formula:

[0039] ;

[0040] Among them, C2 represents the second vertical overlap rate, H2 represents the vertical coordinate of the upper right corner of the text box of the next date, H1 represents the vertical coordinate of the lower right corner of the text box of the next date, and J1 represents the vertical coordinate of the lower left corner of the text box of the sub-text block in the current row of details.

[0041] Furthermore, the method of determining the division of the sub-text block of the current row of details includes determining the division of the sub-text block of the current row of details to the row where the next date is located under the condition that the first vertical overlap ratio is less than the second vertical overlap ratio;

[0042] Or, under the condition that the first vertical overlap ratio is greater than or equal to the second vertical overlap ratio, it is determined that the sub-text block of the current row of details is divided into the row where the previous date is located.

[0043] Compared with the prior art, the beneficial effect of the present invention lies in that the present invention can more accurately judge whether the text block should be segmented according to the comparison result between the interval between characters in the text block and the preset interval, which helps to distinguish closely arranged characters and independent column headers, thereby improving the overall recognition accuracy and recognition speed, and better adapting to different document formats and recognition requirements.

[0044] Furthermore, the present invention can accurately identify and extract important information in bank statements, including but not limited to date, amount, and transaction type, through preset keyword matching, thereby ensuring the relevance and accuracy of the data, removing irrelevant or incomplete characters, thereby reducing noise in the data, improving the efficiency and accuracy of subsequent processing, deleting remaining characters to avoid further processing of irrelevant characters, saving computing resources and shortening processing time.

[0045] Furthermore, the present invention accurately identifies the single data multiple-row type of the table according to whether the sub-text block in vec_head_double overlaps horizontally with the sub-text block in vec_head, so as to ensure that the information will not be incorrectly divided or merged, and maintain the integrity and accuracy of the data.

[0046] Furthermore, the present invention determines the table type by comparing the number of sub-text blocks in adjacent rows, thereby ensuring that information will not be incorrectly segmented or merged, thereby maintaining the integrity and accuracy of the data.

[0047] Furthermore, the present invention determines whether to perform a secondary judgment on the sub-text blocks of the current row of details based on the comparison result of the number of second sub-text blocks of the current row of details with the number of sub-text blocks of the previous row of details, which helps to determine whether the current row of details crosses rows to avoid erroneously merging information belonging to different headers into one part.

[0048] Furthermore, the present invention calculates the first horizontal overlap rate to quickly and accurately identify which sub-text blocks belong to the header field in vec_head_double, thereby correctly aligning the data with its corresponding column header. Incorrectly classifying the sub-text blocks may lead to data extraction errors. By using the horizontal overlap rate as the basis for judgment to reduce the risk of misclassification, the degree of automation of the entire data extraction process is improved, the accuracy of data extraction is improved, and the extracted data is ensured to be complete and reliable.

[0049] Furthermore, the present invention calculates a second horizontal overlap rate and determines whether a single sub-text block in the current row of details belongs to a single sub-text block in vec_head based on a comparison result of the second horizontal overlap rate and a second preset horizontal overlap rate, determines that a single sub-text block in the current row of details is aligned with a corresponding column header in the table header, ensures that the data matches the correct column header, so as to reduce errors in the data extraction process, improve the overall data quality, speed up data processing, reduce costs, and improve the reliability and accuracy of data analysis.

[0050] Furthermore, the present invention calculates the first vertical overlap ratio of the sub-text block of the current row of details and the row where the previous date is located, as well as the second vertical overlap ratio of the sub-text block of the current row of details and the row where the next date is located, according to a formula, and determines the division method of the sub-text block of the current row of details according to the comparison result of the first vertical overlap ratio and the second vertical overlap ratio, thereby ensuring that the data is correctly attributed to the corresponding date or time period, avoiding the problem of data attribution confusion, and helping to improve the accuracy and speed of data extraction, because it determines the correct division of data by calculating and comparing the vertical overlap ratios, thereby improving the reliability of data analysis results. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 This is a flow chart of a method for rapid OCR recognition of bank statements according to an embodiment of the present invention;

[0052] Figure 2 It is a flow chart of the process of segmenting the header subtext block of the bank statement OCR rapid recognition method according to an embodiment of the present invention;

[0053] Figure 3 The present invention is a flowchart of a process for determining a table type in a method for rapid OCR recognition of bank statements according to an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0055] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0056] See also Figure 1-3 As shown, Figure 1 This is a flow chart of a method for rapid OCR recognition of bank statements according to an embodiment of the present invention; Figure 2 It is a flow chart of the process of segmenting the header subtext block of the bank statement OCR rapid recognition method according to an embodiment of the present invention; Figure 3 The present invention is a flowchart of a process for determining a table type in a method for rapid OCR recognition of bank statements according to an embodiment of the present invention.

[0057] The bank statement OCR rapid recognition method according to the embodiment of the present invention comprises:

[0058] Step S1, using an OCR recognition model to recognize a text block in a bank statement table to obtain a sub-text block surrounded by a text box;

[0059] Step S2, traverse the header, add the sub-text block of the header to vec_head and split the sub-text block of the header;

[0060] Or make an initial determination of the sub-text block of the table header;

[0061] Step S3, adding the sub-text block of the next row of the table header to vec_head_double, and determining the table type according to whether the sub-text block in vec_head_double overlaps horizontally with the sub-text block in vec_head;

[0062] Or determine the table type according to the number Z1 of the first sub-text block of any row of details;

[0063] Step S4, determining a secondary determination of the sub-text blocks in the current row of details according to the second sub-text block quantity Z2 of the current row of details, so as to determine whether the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double according to the first horizontal overlap ratio D1 of the single sub-text block in the current row of details and the single sub-text block in vec_head_double;

[0064] Step S5, determining whether the single sub-text block in the current line of details belongs to the single sub-text block in vec_head according to the second horizontal overlap ratio D2 between the single sub-text block in the current line of details and the single sub-text block in vec_head;

[0065] Step S6, determining the first vertical overlap ratio C1 between the sub-text block of the current row of details and the row where the previous date is located, and the second vertical overlap ratio C2 between the sub-text block of the current row of details and the row where the next date is located, so as to determine the division method of the sub-text block of the current row of details according to the comparison result of the first vertical overlap ratio C1 and the second vertical overlap ratio C2.

[0066] In the embodiment of the present invention, the OCR recognition model is preferably a PP-StructureV2 model.

[0067] Specifically, when the sub-text block of the table header is segmented, whether to segment the sub-text block is determined according to the comparison result between the interval J between characters in the text block of the table header and the preset interval, wherein the preset interval includes a first preset interval J1 and a second preset interval J2, J1<J2;

[0068] When J≤J1, it is determined that the sub-text block of the header is not segmented;

[0069] When J1<J<J2, it is determined that the sub-text block of the header is initially judged;

[0070] When J≥J2, the sub-text block of the segmentation table header is determined;

[0071] In an embodiment of the present invention, the first preset interval J1 is 105% of the minimum interval between characters in the sub-text block, and the second preset interval J2 is 120% of the minimum interval between characters in the sub-text block. Those skilled in the art may adjust the first preset interval J1 and the second preset interval J2 according to specific circumstances.

[0072] Specifically, the present invention more accurately determines whether a sub-text block should be split based on the comparison result of the interval between characters in the text block and the preset interval, which helps to distinguish closely arranged characters and independent column headers, thereby improving the overall recognition accuracy and recognition speed, and better adapting to different document formats and recognition requirements.

[0073] Specifically, when it is determined to make an initial judgment on the sub-text block, the sub-text block in vec_head is matched with a preset keyword. When the sub-text block in vec_head matches the preset keyword, the part of the sub-text block in vec_head that matches the preset keyword is segmented, and it is determined whether to delete the remaining characters according to the comparison result between the number L of characters remaining after the segmentation of the sub-text block in vec_head and the preset number L0;

[0074] When L≤L0, it is determined to delete the remaining characters;

[0075] When L>L0, it is determined not to delete the remaining characters;

[0076] In the embodiment of the present invention, the preset keywords are words that appear in common types of bank statements, including but not limited to date, amount, and transaction type. The preset number L0 is the number of words in the shortest word in the preset keywords. Those skilled in the art can adjust the preset number L0 according to specific circumstances.

[0077] Specifically, the present invention can accurately identify and extract important information in bank statements, including but not limited to date, amount, and transaction type, through preset keyword matching, thereby ensuring the relevance and accuracy of the data, removing irrelevant or incomplete characters, thereby reducing noise in the data, improving the efficiency and accuracy of subsequent processing, deleting remaining characters to avoid further processing of irrelevant characters, saving computing resources and shortening processing time.

[0078] Specifically, when the next line of the table header is all text, the sub-text block of the next line of the table header is added to vec_head_double, and the table type is determined based on whether the sub-text block in vec_head_double overlaps horizontally with the sub-text block in vec_head;

[0079] When there is horizontal overlap, the table type is determined to be a single data multiple-row type;

[0080] When there is no horizontal overlap, add the subtext block in vec_head_double to vec_head.

[0081] Specifically, the present invention accurately identifies the single data multiple-row type of the table according to whether the sub-text block in vec_head_double overlaps horizontally with the sub-text block in vec_head, so as to ensure that the information will not be incorrectly divided or merged, and maintain the integrity and accuracy of the data.

[0082] Specifically, when the next line of the table header is not all text or it is determined to add the sub-text blocks in vec_head_double to vec_head, if there is any row of details where the number of first sub-text blocks Z1 is less than the number of sub-text blocks Z0 of the previous row of details, then the table type is determined to be a single-column data multi-row type; if the number of first sub-text blocks Z1 of each row of details is equal to the number of sub-text blocks Z0 of the previous row of details, then the table type is determined to be a single-row data single-row type.

[0083] Specifically, the present invention determines the table type by comparing the number of sub-text blocks of adjacent rows to ensure that information will not be wrongly divided or merged, thereby maintaining the integrity and accuracy of the data.

[0084] Specifically, when it is determined that the table type is a single data multiple-row type, it is determined whether to perform a secondary determination on the sub-text blocks of the current row of details according to the comparison result of the second sub-text block quantity Z2 of the current row of details and the sub-text block quantity Z0 of the previous row of details;

[0085] When Z2≥Z0, it is determined that the sub-text block of the current line of details will not be subjected to secondary judgment;

[0086] When Z2<Z0, it is determined to perform a secondary judgment on the sub-text block of the current line of details.

[0087] Specifically, the present invention determines whether to perform a secondary judgment on the sub-text blocks of the current row of details based on the comparison result of the number of second sub-text blocks of the current row of details with the number of sub-text blocks of the previous row of details, which helps to determine whether the current row of details crosses rows to avoid erroneously merging information belonging to different headers into one part.

[0088] Specifically, when it is determined to perform a secondary determination on the sub-text block of the current line of details, the first horizontal overlap ratio D1 of a single sub-text block in the current line of details and a single sub-text block in vec_head_double is calculated according to the following formula, and is set:

[0089] ;

[0090] Among them, A2 represents the horizontal coordinate of the lower right corner of the text box of a single sub-text block in vec_head_double, A1 represents the horizontal coordinate of the lower left corner of the text box of a single sub-text block in vec_head_double, and B1 represents the horizontal coordinate of the lower left corner of the text box of a single sub-text block in the current row of details.

[0091] Specifically, when the first horizontal overlap ratio D1 is calculated, it is determined whether a single sub-text block in the current row of details belongs to a single sub-text block in vec_head_double according to the comparison result between the first horizontal overlap ratio D1 and the first preset horizontal overlap ratio D01;

[0092] When D1≤D01, it is determined that the single sub-text block in the current row of details does not belong to the single sub-text block in vec_head_double;

[0093] When 1≥D1>D01, it is determined that the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double;

[0094] In the embodiment of the present invention, the first preset horizontal overlap ratio D01 is 0.6, and those skilled in the art may adjust the first preset horizontal overlap ratio D01 according to specific circumstances.

[0095] Specifically, the present invention calculates the first horizontal overlap rate to quickly and accurately identify which sub-text blocks belong to the header field in vec_head_double, so as to correctly align the data with its corresponding column header. Incorrectly classifying sub-text blocks may lead to data extraction errors. By using the horizontal overlap rate as the basis for judgment to reduce the risk of misclassification, the degree of automation of the entire data extraction process is improved, the accuracy of data extraction is improved, and the extracted data is ensured to be complete and reliable.

[0096] Specifically, when it is determined that no secondary determination is performed on the sub-text block of the current row of details or the table type is determined to be a single-column data multi-row type or the table type is determined to be a single-row data single-line type, the second horizontal overlap rate D2 of a single sub-text block in the current row of details and a single sub-text block in vec_head is calculated according to the following formula, and is set:

[0097] ;

[0098] Among them, A02 represents the horizontal coordinate of the lower right corner of the text box of a single sub-text block in vec_head, A01 represents the horizontal coordinate of the lower left corner of the text box of a single sub-text block in vec_head, and B01 represents the horizontal coordinate of the lower left corner of the text box of a single sub-text block in the current row of details.

[0099] Specifically, when the second horizontal overlap ratio D2 is calculated, it is determined whether a single sub-text block in the current row of details belongs to a single sub-text block in vec_head according to the comparison result between the second horizontal overlap ratio D2 and the second preset horizontal overlap ratio D02;

[0100] When D2≤D02, it is determined that the single sub-text block in the current row of details does not belong to the single sub-text block in vec_head_double;

[0101] When 1≥D2>D02, it is determined that the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double;

[0102] In the embodiment of the present invention, the second preset horizontal overlap ratio D02 may be adjusted by those skilled in the art according to specific circumstances.

[0103] Specifically, the present invention calculates the second horizontal overlap rate and determines whether a single sub-text block in the current row of details belongs to a single sub-text block in vec_head based on the comparison result of the second horizontal overlap rate and the second preset horizontal overlap rate, determines that the single sub-text block in the current row of details is aligned with the corresponding column title in the table header, ensures that the data matches the correct column title, so as to reduce errors in the data extraction process, improve the overall data quality, speed up data processing, reduce costs, and improve the reliability and accuracy of data analysis.

[0104] Specifically, the first vertical overlap ratio C1 of the sub-text block of the current row of details and the row where the previous date is located is calculated according to the following formula:

[0105] ;

[0106] Among them, F1 represents the vertical coordinate of the lower right corner of the text box of the previous date, F2 represents the vertical coordinate of the upper right corner of the text box of the previous date, and G2 represents the vertical coordinate of the upper left corner of the text box of the sub-text block in the current row of details.

[0107] Specifically, the second vertical overlap ratio C2 of the sub-text block of the current row of details and the row where the next date is located is calculated according to the following formula:

[0108] ;

[0109] Among them, H2 represents the vertical coordinate of the upper right corner of the text box of the next date, H1 represents the vertical coordinate of the lower right corner of the text box of the next date, and J1 represents the vertical coordinate of the lower left corner of the text box of the sub-text block in the current row of details.

[0110] Specifically, when the calculation of the first vertical overlap ratio C1 and the second vertical overlap ratio C2 is completed, the division method of the sub-text blocks of the current line of details is determined according to the comparison result of the first vertical overlap ratio C1 and the second vertical overlap ratio C2;

[0111] When C1<C2, the sub-text block of the current row of details is divided into the row where the next date is located;

[0112] When C1≥C2, it is determined that the sub-text block of the current row of details is divided into the row where the previous date is located.

[0113] Specifically, the present invention calculates the first vertical overlap rate between the sub-text block of the current row of details and the row where the previous date is located, as well as the second vertical overlap rate between the sub-text block of the current row of details and the row where the next date is located, according to a formula, and determines the division method of the sub-text block of the current row of details according to the comparison result of the first vertical overlap rate and the second vertical overlap rate, thereby ensuring that the data is correctly attributed to the corresponding date or time period, avoiding the problem of data attribution confusion, and helping to improve the accuracy and speed of data extraction, because it determines the correct division of data by calculating and comparing the vertical overlap rates, thereby improving the reliability of data analysis results.

[0114] The embodiment of the present invention also provides another implementation method, including: after completing the above steps 1-6, manually re-selecting the bank statement form, and repeating the above steps 1-6 to identify the selected bank statement form.

[0115] Specifically, after completing the above steps 1-6, the present invention manually re-selects the bank statement form, and repeats the above steps 1-6 to identify the selected bank statement form, so as to quickly select and accurately identify the part of the bank statement form that needs to be identified.

[0116] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

[0117] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for rapid OCR recognition of bank statements, characterized in that: include: The OCR recognition model is used to recognize the text block of the bank statement table to obtain the sub-text block surrounded by the text box; Traverse the header, add the sub-text block of the header to vec_head and split the sub-text block of the header; Or make an initial determination of the sub-text block of the table header; Add the sub-text block of the next row of the table header to vec_head_double, and determine the table type based on whether the sub-text block in vec_head_double overlaps horizontally with the sub-text block in vec_head; Or determine the table type based on the number of the first sub-text blocks of any row of details; Determine a secondary determination of the sub-text blocks in the current row of details according to the number of the second sub-text blocks in the current row of details, so as to determine whether the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double according to the first horizontal overlap ratio between the single sub-text block in the current row of details and the single sub-text block in vec_head_double; Determine whether the single sub-text block in the current line of details belongs to the single sub-text block in vec_head according to the second horizontal overlap ratio between the single sub-text block in the current line of details and the single sub-text block in vec_head; Determine a first vertical overlap ratio between a sub-text block of a current row of details and a row where a previous date is located, and a second vertical overlap ratio between a sub-text block of a current row of details and a row where a next date is located, so as to determine a division method of the sub-text block of the current row of details according to a comparison result of the first vertical overlap ratio and the second vertical overlap ratio; The adding the sub-text block of the table header to vec_head and dividing the sub-text block of the table header includes dividing the sub-text block of the table header under the condition that the interval between characters in the sub-text block of the table header is greater than or equal to a second preset interval; Or, the sub-text block of the table header is initially determined under the condition that the interval between characters in the text block of the table header is greater than the first preset interval and less than the second preset interval; The initial determination of the sub-text block of the header includes deleting the remaining characters under the condition that the number of characters remaining after the sub-text block in vec_head is less than or equal to a preset number; Determining the table type according to the number of first sub-text blocks of any row of details includes determining the table type as a single-column data multi-row type under the condition that the number of first sub-text blocks of any row of details is less than the number of sub-text blocks of the previous row of details; Or, the table type is determined to be a single-data single-row type under the condition that the number of the first sub-text blocks in each row of details is equal to the number of sub-text blocks in the previous row of details.

2. The bank flow OCR rapid recognition method according to claim 1 is characterized in that: Determining the table type according to whether the sub-text block in vec_head_double and the sub-text block in vec_head overlap horizontally includes determining the table type as a single data multiple-row type when there is horizontal overlap; Or, when there is no horizontal overlap, add the subtext block in vec_head_double to vec_head.

3. The bank flow OCR rapid recognition method according to claim 2 is characterized in that: Determining the secondary determination of the sub-text blocks of the current row of details according to the number of second sub-text blocks of the current row of details includes secondary determination of the sub-text blocks of the current row of details under the condition that the number of second sub-text blocks of the current row of details is less than the number of sub-text blocks of the previous row of details.

4. The bank flow OCR rapid recognition method according to claim 3 is characterized in that: The first horizontal overlap ratio is calculated according to the following formula: ; Wherein, D1 represents the first horizontal overlap rate, A2 represents the abscissa of the lower right corner of the text box of a single sub-text block in vec_head_double, A1 represents the abscissa of the lower left corner of the text box of a single sub-text block in vec_head_double, and B1 represents the abscissa of the lower left corner of the text box of a single sub-text block in the current row of details; The determining whether the single sub-text block in the current line of details belongs to the single sub-text block in vec_head_double includes determining that the single sub-text block in the current line of details does not belong to the single sub-text block in vec_head_double under the condition that the first horizontal overlap ratio is less than or equal to the first preset horizontal overlap ratio; Or, under the condition that the first horizontal overlap ratio is less than or equal to 1 and greater than a first preset horizontal overlap ratio, it is determined that the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double.

5. The bank flow OCR rapid recognition method according to claim 4 is characterized in that: The second horizontal overlap ratio is calculated according to the following formula: ; Wherein, D2 represents the second horizontal overlap ratio, A02 represents the horizontal coordinate of the lower right corner of the text box of a single sub-text block in vec_head, A01 represents the horizontal coordinate of the lower left corner of the text box of a single sub-text block in vec_head, and B01 represents the horizontal coordinate of the lower left corner of the text box of a single sub-text block in the current row of details; The determining whether the single sub-text block in the current line of details belongs to the single sub-text block in vec_head includes determining that the single sub-text block in the current line of details does not belong to the single sub-text block in vec_head_double under the condition that the second horizontal overlap ratio is less than or equal to the second preset horizontal overlap ratio; Or, under the condition that the second horizontal overlap ratio is less than or equal to 1 and greater than a second preset horizontal overlap ratio, it is determined that the single sub-text block in the current row of details belongs to the single sub-text block in vec_head_double.

6. The bank flow OCR rapid recognition method according to claim 5 is characterized in that: The first vertical overlap ratio is calculated according to the following formula: ; Wherein, C1 represents the first vertical overlap ratio, F1 represents the ordinate of the lower right corner of the text box of the previous date, F2 represents the ordinate of the upper right corner of the text box of the previous date, and G2 represents the ordinate of the upper left corner of the text box of the sub-text block in the current row of details; The second vertical overlap ratio is calculated according to the following formula: ; Among them, C2 represents the second vertical overlap rate, H2 represents the vertical coordinate of the upper right corner of the text box of the next date, H1 represents the vertical coordinate of the lower right corner of the text box of the next date, and J1 represents the vertical coordinate of the lower left corner of the text box of the sub-text block in the current row of details.

7. The bank flow OCR rapid recognition method according to claim 6 is characterized in that: The method of determining the division of the sub-text block of the current row of details includes determining the division of the sub-text block of the current row of details to the row where the next date is located under the condition that the first vertical overlap ratio is less than the second vertical overlap ratio; Or, under the condition that the first vertical overlap ratio is greater than or equal to the second vertical overlap ratio, it is determined that the sub-text block of the current row of details is divided into the row where the previous date is located.

Citation Information

Patent Citations

  • Data extraction and structured processing system and implementation method

    CN116152480A

  • Bank statement table extraction method and device, computer equipment and storage medium

    CN114463763A