Deep Learning Optimization Method for Fiscal and Tax Text Analysis and Business Association Verification
By calculating the vertical and horizontal periodicity and length deviation of the text string in fiscal and tax text analysis, determining the confidence, distinguishing between table and non-table areas, the problem of inaccurate character segmentation in fiscal and tax text analysis is solved, and higher parsing and verification accuracy is achieved.
Patent Information
- Application Number
- CN202510751766.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-06-06
AI Technical Summary
In the process of fiscal and taxation text analysis in the prior art, inaccurate character segmentation leads to poor accuracy of business association verification results, making it difficult to effectively distinguish between table areas and non-table areas of text strings.
By obtaining the coordinates, text height and text length of each text string in the fiscal and tax text image, calculate the vertical and horizontal periodicity, combined with the text length deviation, determine the confidence that the text string is in the table area, and use the character segmentation model to segment the table area and the non-table area respectively to obtain the accurate fiscal and tax text analysis results.
It improves the accuracy of fiscal and tax text analysis and business association verification results, ensures that text strings in table areas and non-table areas are accurately extracted and classified, reduces the occurrence of character segmentation errors, and improves work efficiency.
Smart Images

Figure CN120318844B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology. More specifically, the present invention relates to a deep learning optimization method for financial and tax text parsing and business relevance verification. Background Art
[0002] Financial and tax data is the core quantitative reflection of a company's business activities and plays a vital role in business decision-making, tax risk prevention and control, and strategic planning. Financial and tax documents (such as accounting vouchers, invoices, tax returns, and contracts) are the carriers of this data. By analyzing these documents and performing business relevance verification, we can verify the authenticity and legitimacy of transactions, eliminate accounting discrepancies, and ensure the consistency of financial and tax data.
[0003] Financial and tax documents are often complex and contain extensive legal, financial, and tax knowledge. Traditional financial and tax text parsing involves processing and analyzing financial and tax-related documents. After manually extracting key data from the parsed documents, the parsed text information needs to be associated with and verified for specific business needs. However, manual parsing relies on the individual experience of staff, resulting in low efficiency and prone to errors.
[0004] Advances in deep learning and natural language processing technologies are providing new directions for financial and tax text parsing and business relevance verification. Related models first segment financial and tax texts and then identify and match key information based on the segmented characters to achieve business relevance verification. However, during the character segmentation process, financial and tax texts have complex formats, including multi-level headers, merged cells, and varying column widths and row heights. This can lead models to mistakenly identify text in different cells as belonging to the same row, resulting in poorly accurate business relevance verification results.
[0005] Therefore, how to accurately implement character segmentation in the process of financial and tax text parsing and thus accurately obtain business association verification results is a problem that needs to be solved urgently. Summary of the Invention
[0006] To solve the above-mentioned technical problem of how to accurately implement character segmentation during the financial and tax text parsing process and thus accurately obtain business relevance verification results, the present invention proposes a deep learning optimization method for financial and tax text parsing and business relevance verification, which includes the following steps:
[0007] Get the coordinates, text height and text length of each text string in the financial and tax text image, determine the vertical and horizontal distances between the text string and other text strings based on the coordinates; calculate the vertical periodicity of the text string in the i-th row of the financial and tax text image :
[0008] ;
[0009] is the number of text sequences in the tax text image, The text string of line i and the text string of line i except itself The vertical distance between lines of text, is the average text height of all text strings in the tax text image, is a cosine function; the horizontal periodicity of each line of text string is calculated according to the horizontal distance between the text string and other text strings except itself and the mean text length of all text strings; the text length deviation of the text string is determined according to the difference between the text length of each text string and the mean text length of all text strings; the confidence that the text string is in the table area is determined, and the confidence that the text string is in the table area is positively correlated with the vertical periodicity and horizontal periodicity of the text string, and negatively correlated with the text length deviation; in response to the comparison result of the confidence that the text string is in the table area with the confidence threshold, the text strings in the table area and the non-table area in the financial and tax text image are determined to obtain the financial and tax text parsing and business association verification results.
[0010] The present invention can effectively improve the accuracy of the business association verification results obtained based on the financial and tax text analysis results extracted from the financial and tax text images by distinguishing the text strings in the table area and the non-table area. In the process of distinguishing the text strings in the table area and the non-table area, the present invention takes into account that the size and distribution of the text strings in the table area are periodic, while the text strings in the non-table area do not have this feature. Therefore, the present invention can obtain the confidence that the text string is in the table area by obtaining the periodic distribution degree of each text string in the vertical and horizontal directions, thereby achieving accurate extraction of text strings in the table area and the non-table area, and effectively improving the accuracy of the financial and tax text analysis and business association verification results. When obtaining the confidence that the text string is in the table area, the present invention also takes into account that the length of the text string in the non-table area will be greater than the length of the text string in the table area. Therefore, by further combining the periodic distribution degree of the text string in the vertical and horizontal directions and the degree of deviation of the text string compared to other text strings, the confidence that the text string is in the table area can be accurately obtained, effectively improving the accuracy of the financial and tax text analysis and business association verification results.
[0011] According to the deep learning optimization method for financial and tax text parsing and business association verification provided by the present invention, the coordinates, text height and text length of each text string in the financial and tax text image are obtained, and the method also includes: obtaining a financial and tax text photo and preprocessing it to obtain a financial and tax text image.
[0012] Before processing the financial and tax text image, the present invention takes into account that seals and noise in the financial and tax text do not belong to the substantive content of the financial and tax text. Therefore, the photo is pre-processed before processing the image to reduce the influence of irrelevant factors on the final result.
[0013] According to the deep learning optimization method for financial and tax text parsing and business association verification provided by the present invention, the coordinates, text height and text length of each text string in the financial and tax text image are obtained, including: recording the upper left corner of the financial and tax text image as the origin, the horizontal right direction as the horizontal axis, and the vertical downward direction as the vertical axis; obtaining the coordinates of each text string according to the text detection model, and taking the coordinates of the minimum circumscribed rectangle of the text string as the coordinates of the text string, the coordinates of each text string include at least the upper left corner coordinate and the lower right corner coordinate; determining the text height of the text string according to the difference in the vertical coordinate between the upper left corner coordinate and the lower right corner coordinate of the text string; determining the text length of the text string according to the difference in the horizontal coordinate between the upper left corner coordinate and the lower right corner coordinate of the text string.
[0014] According to the deep learning optimization method for fiscal and taxation text parsing and business association verification provided by the present invention, the vertical distance and horizontal distance between a text string and other text strings are determined based on coordinates, including: if the text string is above the other text strings in the fiscal and taxation text image, the vertical distance between the text string and the other text strings is determined based on the difference in vertical coordinates between the lower right corner of the text string and the upper left corner of the other text strings; if the text string is below the other text strings in the fiscal and taxation text image, the vertical distance between the text string and the other text strings is determined based on the difference in vertical coordinates between the upper left corner of the text string and the lower right corner of the other text strings; and the horizontal distance between the text string and the other text strings is determined based on the difference in horizontal coordinates between the upper left corners of the text string and the other text strings.
[0015] According to the deep learning optimization method for financial and tax text parsing and business association verification provided by the present invention, the horizontal periodicity of each line of text string is calculated, including: calculating the horizontal periodicity of the i-th line of text string in the financial and tax text image :
[0016] ;
[0017] is the number of text sequences in the tax text image, The text string of line i and the text string of line i except itself The horizontal distance between lines of text, is the mean text length of all text strings in the tax text image, is the cosine function.
[0018] The present invention provides an accurate formula for calculating the horizontal periodicity of a text string. By analyzing the horizontal distance between a text string and other text strings except itself, the periodic distribution degree of the text string in the horizontal direction can be accurately obtained.
[0019] According to the deep learning optimization method for financial and tax text parsing and business association verification provided by the present invention, the text length deviation of the text string is determined based on the difference between the text length of each text string and the average text length of all text strings, including: obtaining the absolute value of the difference between the text length of the text string and the average text length of all text strings as the first indicator of the text string, and recording the ratio of the first indicator to the average text length of all text strings as the text length deviation of the text string.
[0020] According to the deep learning optimization method for financial and tax text parsing and business association verification provided by the present invention, determining the confidence that a text string is in a table area includes: subtracting the text length deviation from the sum of the vertical periodicity and horizontal periodicity of the text string to obtain the confidence that the text string is in the table area.
[0021] According to the deep learning optimization method for financial and tax text parsing and business association verification provided by the present invention, the text strings in the tabular area and the non-tabular area in the financial and tax text image are determined in response to the comparison result of the confidence that the text string is in the tabular area and the confidence threshold, including: if the confidence that the text string is in the tabular area is greater than the confidence threshold, then the text string is in the tabular area; otherwise, the text string is in the non-tabular area.
[0022] According to the deep learning optimization method for fiscal and taxation text parsing and business association verification provided by the present invention, the text strings in the tabular area and non-tabular area in the fiscal and taxation text image are determined to obtain the fiscal and taxation text parsing and business association verification results, including: using a character segmentation model to perform character segmentation on the text strings in the tabular area and non-tabular area respectively, and determining the character segmentation results of each line of text string; composing the character segmentation results of the text string into text information, mapping it to a predefined data structure model, determining the type corresponding to each text information, and obtaining the fiscal and taxation text parsing result; and obtaining the business association verification result according to the verification rules of the type corresponding to each text information.
[0023] The present invention takes into account that in the financial and tax text image, the periodic regularity of the table area may cause missing character segmentation results in the non-table area, and the randomness of the non-table area may cause errors in the character segmentation results in the table area. Therefore, when using the character segmentation model for segmentation, character segmentation is performed on the text strings in the table area and the non-table area respectively, which can effectively improve the accuracy of the character segmentation results of the financial and tax text image and prepare for subsequent business association verification.
[0024] According to the deep learning optimization method for financial and tax text parsing and business-related verification provided by the present invention, the business-related verification result is obtained according to the verification rules of the type corresponding to each text information, including: pre-defining verification rules for various types of text information, the types of verification rules include at least format verification, logic verification, duplication verification, and business rule matching; if the text information all meets the verification rules of the corresponding type, the business-related verification result is output as passed verification; otherwise, the business-related verification result is output as failed verification, and the types of verification rules that the text information does not meet are obtained for classification.
[0025] The present invention classifies text information that does not conform to the verification rules, so that when submitting financial and tax documents later, the text information that does not conform to the verification rules can be reviewed in detail, thereby improving work efficiency.
[0026] The present invention has the following beneficial effects:
[0027] Based on the above technical solution, the deep learning optimization method for fiscal and tax text parsing and business association verification provided by the present invention can effectively improve the accuracy of the business association verification results obtained based on this by distinguishing text strings in table areas and non-table areas when obtaining business association verification results. In the process of distinguishing text strings in table areas and non-table areas, the present invention takes into account that the size and distribution of text strings in table areas are periodic, while text strings in non-table areas do not have this feature. Therefore, by obtaining the degree of periodic distribution of each text string in the vertical and horizontal directions, the present invention can obtain the confidence that the text string is in the table area, realize the accurate extraction of text strings in table areas and non-table areas, and effectively improve the accuracy of fiscal and tax text parsing and business association verification results. When obtaining the confidence that the text string is in the table area, the present invention also takes into account that the length of the text string in the non-table area will be greater than the length of the text string in the table area. Therefore, by further combining the degree of periodic distribution of the text string in the vertical and horizontal directions and the degree of deviation of the text string compared to other text strings, the confidence that the text string is in the table area can be accurately obtained, effectively improving the accuracy of fiscal and tax text parsing and business association verification results. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a step flow chart of a deep learning optimization method for financial and tax text parsing and business association verification provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, but not all of the embodiments.
[0030] An embodiment of the present invention discloses a deep learning optimization method for financial and tax text parsing and business association verification. The method determines the text strings in the table area and non-table area by analyzing the text distribution characteristics in the financial and tax text, accurately performs character segmentation to obtain the financial and tax text parsing results, and effectively improves the accuracy of the financial and tax business association verification results.
[0031] See also Figure 1 , Figure 1 This is a flowchart of a deep learning optimization method for financial and tax text parsing and business association verification provided by an embodiment of the present invention. The method includes the following steps:
[0032] S1: Get the text string in the finance and taxation text image.
[0033] Specifically, in an embodiment of the present invention, when collecting photos of financial and tax texts, a high-resolution camera can be used to take photos of the financial and tax texts under uniform light without shadow interference.
[0034] Among them, when photographing financial and tax texts, for A4-sized financial and tax texts, the resolution of the photographed photo needs to be at least greater than or equal to 2000×1500 pixels; different resolutions can be set for financial and tax texts of different sizes, and the specific settings can be made according to actual needs. The embodiment of the present invention does not impose too many restrictions on this.
[0035] It is understandable that the photos of financial and tax texts usually contain factors unrelated to the financial and tax texts, such as seals, text ghosting and misalignment, and noise from electronic components inside the camera. Therefore, after taking photos of financial and tax texts, the photos of financial and tax texts can be pre-processed to obtain financial and tax text images, thereby improving the quality of the financial and tax text images.
[0036] For example, during preprocessing, a color threshold segmentation algorithm can be used to remove the seal area, and the financial and tax text photo after the seal is removed can be grayscaled to obtain a grayscale image of the financial and tax text; the deep CNN convolution module in the DeepSeek-R1 large model can be used to remove text ghosting in the grayscale image of the financial and tax text, and image registration technology (such as affine transformation) can be used to correct text misalignment; a size normalization algorithm can be used to unify the size of texts of different sizes, and finally the text string in the financial and tax text image can be obtained.
[0037] The specific steps of the above-mentioned various pre-processing methods can be obtained through existing technologies and will not be described in detail in the embodiments of the present invention.
[0038] Specifically, we can finally obtain the text string set in the tax text image, which can be recorded as {1,2,…,i,… }, Indicates the total number of text lines in the finance and taxation text image.
[0039] It should be noted that fiscal and tax texts typically use fixed templates, and text elements (such as titles, project names, and amounts) are typically arranged in a structured layout with clear line spacing rules. Therefore, embodiments of the present invention can implement character segmentation and fiscal and tax parsing in fiscal and tax text images based on the regularity of the distribution of text strings within the images.
[0040] S2: Obtain the coordinates, text height, and text length of each text string in the finance and taxation text image, and determine the vertical and horizontal distances between the text string and other text strings based on the coordinates.
[0041] For example, in an embodiment of the present invention, the coordinate information of each line of text string can be obtained through the CTPN text detection model in the DeepSeek-R1 large model.
[0042] For example, in an embodiment of the present invention, the coordinates, text height and text length of each text string in the financial and tax text image are obtained, including: recording the upper left corner of the financial and tax text image as the origin, the horizontal right direction as the horizontal axis, and the vertical downward direction as the vertical axis; obtaining the coordinates of each text string according to the text detection model, and taking the coordinates of the minimum circumscribed rectangle of the text string as the coordinates of the text string, and the coordinates of each text string include at least the coordinates of the upper left corner and the lower right corner.
[0043] The coordinate unit is pixel. The coordinates of the text string may also include the upper right corner coordinates, the lower left corner coordinates, the center coordinates, etc.
[0044] For example, the coordinates of the text string are as follows: the coordinates of the i-th line of the text string in the tax text image include at least the coordinates of the upper left corner and the lower right corner coordinates , where 1 represents the upper left corner and 2 represents the lower right corner.
[0045] It can be understood that i is the serial number of the character string in the finance and taxation text image, and the character string in the i-th row can be any character string in the finance and taxation text image.
[0046] For example, after obtaining the coordinates of each text string, the text height of the text string can be determined based on the vertical coordinate difference between the upper left corner coordinate and the lower right corner coordinate of the text string; the text length of the text string can be determined based on the horizontal coordinate difference between the upper left corner coordinate and the lower right corner coordinate of the text string.
[0047] The vertical axis difference is the absolute value of the vertical axis difference; the horizontal axis difference is the absolute value of the horizontal axis difference.
[0048] For example, the text height and text length of a text string are as follows: The coordinates of the i-th line of the string are and , then the text height of the i-th line string , the length of the text in the i-th row , among which, is the absolute value symbol.
[0049] For example, in an embodiment of the present invention, the vertical distance between a text string and other text strings is determined based on coordinates, including: if the text string is above the other text strings in the finance and taxation text image, the vertical distance between the text string and the other text strings is determined based on the difference in vertical coordinates between the lower right corner of the text string and the upper left corner of the other text strings; if the text string is below the other text strings in the finance and taxation text image, the vertical distance between the text string and the other text strings is determined based on the difference in vertical coordinates between the upper left corner of the text string and the lower right corner of the other text strings.
[0050] The embodiment of the present invention obtains the i-th line text string and the i-th line text string except itself. The vertical distance between the lines of text is used as an example for explanation, but it does not mean that the embodiment of the present invention is limited to this. It is understandable that the vertical distance between the lines of text is used as an example for explanation, but it does not mean that the embodiment of the present invention is limited to this. The text string of the first line is the text string of the first line except the text string of the first line. The upper left corner coordinates and lower right corner coordinates of the i-th text string are and , No. The upper left corner coordinates and lower right corner coordinates of the text string are , represents the horizontal axis, Indicates the vertical coordinate.
[0051] Example to get the text string of line i and the The step of determining the vertical distance between text strings includes the following two possible situations:
[0052] In one possible case, the i-th line of text is in the The top of the line text string, at this time the i-th line text string and the The vertical distance between lines of text is .
[0053] In another possible case, the i-th line of text is in the Below the line of text, the i-th line of text is now The vertical distance between lines of text .
[0054] For example, in an embodiment of the present invention, determining the horizontal distance between a text string and another text string based on coordinates includes: determining the horizontal distance between the text string and another text string based on the difference between the upper left corner horizontal coordinates of the text string and the other text string.
[0055] The horizontal axis difference is the absolute value of the horizontal axis difference.
[0056] For example, the text string in line i is compared with the text string in line ii except itself. Horizontal distance between lines of text .
[0057] For example, when obtaining the horizontal distance between a text string and other text strings, it can also be obtained through the difference between the lower right corner horizontal coordinates of the text string and the other text strings. The specific implementation steps are similar to the above-mentioned steps of obtaining by the difference between the upper left corner horizontal coordinates, and the embodiments of the present invention are not repeated here.
[0058] After obtaining the size and specific distribution of each text string in the fiscal and tax text image based on the above steps, character segmentation can be achieved based on the size and specific distribution of the text string. However, fiscal and tax text images include both tabular and non-tabular areas. The tabular areas are arranged more neatly, and the content distribution in the table is periodic, with similar spacing between character strings, such as column headings such as invoice number, date, and amount. The non-tabular areas have more discrete row and column spacing, and a less regular and uniform distribution, usually containing longer paragraphs or explanatory text, such as tabulation instructions.
[0059] Before character segmentation, it's necessary to distinguish text strings in tabular areas from text strings in non-tabular areas within the tax text image. This helps mitigate the impact of strong periodicity in tabular text on non-tabular text segmentation, such as character truncation caused by using fixed row heights, and the randomness of non-tabular text that disrupts the regularity of table segmentation. This ensures accurate extraction and proper classification of tabular data and non-tabular text, and avoids misidentifying text strings in different areas as text from the same area. This involves performing the following steps.
[0060] S3: Calculate the vertical periodicity of the text string in the financial and tax text image based on the vertical distance between the text string and other text strings except itself and the average text height of all text strings; calculate the horizontal periodicity of each line of text string based on the horizontal distance between the text string and other text strings except itself and the average text length of all text strings.
[0061] It is understandable that the text strings in the table are usually arranged neatly, and the column width and row height are set relatively regularly, that is, on the financial and tax text image, the text strings in the table area have good periodicity in both the horizontal and vertical directions.
[0062] Based on this, the embodiment of the present invention can obtain the horizontal periodicity and vertical periodicity of each line of text string to evaluate the periodicity and regularity of its distribution. The cosine function is a periodic function with a period of , the embodiment of the present invention can capture the periodicity of the text string through the cosine function.
[0063] For example, in an embodiment of the present invention, the vertical periodicity of a text string is calculated, and specific reference may be made to the following relationship: ;
[0064] is the vertical periodicity of the i-th line text string, is the number of text sequences in the tax text image, The text string of line i and the text string of line i except itself The vertical distance between lines of text, is the average text height of all text strings in the tax text image, is the cosine function.
[0065] Indicates the The text string of the first line is the text string of the first line except the text string of the first line. Line text string.
[0066] is to combine the i-th line of text with the The vertical distance between text strings in a row is normalized to the ratio of the row height, eliminating the influence of different text string heights and allowing comparison of the vertical spacing between different text strings. When this value is an integer, the cosine function reaches its maximum value of 1. If the vertical distance between the text string in the i-th row and all other text strings except itself is close to 1, it indicates that the vertical distances between the text string in the i-th row and the other text strings are highly similar. The more regular the vertical arrangement, the more likely it is to belong to the table area.
[0067] Based on the above steps, the vertical periodicity of each line of text string can be obtained.
[0068] For example, in an embodiment of the present invention, the horizontal periodicity of each line of text string is calculated, and the details can be seen in the following relationship:
[0069] ;
[0070] is the horizontal periodicity of the text string in line i, is the number of text sequences in the tax text image, The text string of line i and the text string of line i except itself The horizontal distance between lines of text, is the mean text length of all text strings in the tax text image, is the cosine function.
[0071] Similarly, in the above formula, is to combine the i-th line of text with the The horizontal distances between text strings in a row are normalized to a ratio of their lengths, eliminating the influence of varying text string lengths and allowing for comparison of horizontal distances between different text strings. When this value is an integer, it indicates that the horizontal distances between the text string in row i and other text strings are highly similar. The more regular the horizontal arrangement, the more likely it is to belong to a table area.
[0072] Based on the above steps, the horizontal periodicity of each line of text string can be obtained.
[0073] S4: Determine the text length deviation of each text string based on the difference between the text length of each text string and the average text length of all text strings, and calculate the confidence level that the text string is in the table area.
[0074] The confidence level of a text string being in a table area is positively correlated with the vertical periodicity and horizontal periodicity of the text string, and negatively correlated with the text length deviation of the text string.
[0075] It should be noted that, based on the above steps, the horizontal periodicity and vertical periodicity of each line of text string can be obtained respectively. In addition, the non-table area usually contains longer paragraphs or explanatory text, while the text in the table area is shorter. Therefore, the embodiment of the present invention can further combine the difference between the length of the text string and the length mean, and jointly determine the confidence level that the text string is in the table area based on the vertical periodicity, horizontal periodicity and text length deviation of the text string.
[0076] For example, in an embodiment of the present invention, the text length deviation of the text string is determined based on the difference between the text length of each text string and the average text length of all text strings, including: obtaining the absolute value of the difference between the text length of the text string and the average text length of all text strings as the first indicator of the text string, and recording the ratio of the first indicator to the average text length of all text strings as the text length deviation of the text string.
[0077] The first indicator for a text string is the absolute difference between the text string and the mean text length. By normalizing this first indicator with the mean text length of all text strings, the resulting text length deviation can be converted to a dimensionless value, facilitating comparison of text strings in fiscal and tax text images across different text length distributions. The greater the text length deviation of a text string, the longer it exceeds the average text length of the fiscal and tax text image, and the more likely it is to be in a non-tabular area.
[0078] For example, in an embodiment of the present invention, determining the confidence that a text string is in a table area includes: subtracting a text length deviation from the sum of a vertical periodicity and a horizontal periodicity of the text string to obtain the confidence that the text string is in a table area.
[0079] It is understandable that for some financial and tax text images, the length of the text string in the table area may be close to the length of the text string in the non-table area. In order to reduce the misrecognition of text strings in such table areas, when calculating the confidence that the text string is in the table area, weights can be set for the vertical periodicity, horizontal periodicity and text length deviation of the text string, among which the weight of the text length deviation needs to be smaller than the weights of the vertical periodicity and horizontal periodicity of the text string.
[0080] For example, the weights of the vertical periodicity and horizontal periodicity of the text string can be set to 0.4, and the weight of the text length deviation of the text string can be set to 0.2; the weights can be adjusted according to the actual needs of the distribution of text strings in the financial and tax text image, and the embodiments of the present invention do not impose too many restrictions on this.
[0081] After accurately obtaining the confidence that each line of text string is in the table area based on the above steps, the text string in the table area and the text string in the non-table area can be accurately distinguished based on the confidence that the text string is in the table area, thereby accurately performing character segmentation and obtaining the financial and tax text analysis and business association verification results, that is, continuing to execute the following steps.
[0082] S5: In response to the comparison result of the confidence that the text string is in the table area and the confidence threshold, the text strings in the table area and the non-table area in the financial and tax text image are determined to obtain the financial and tax text parsing and business association verification results.
[0083] The confidence threshold may be set to 0.6; the value of the confidence threshold may be set according to actual needs.
[0084] For example, in an embodiment of the present invention, in response to the comparison result of the confidence that the text string is in the table area and the confidence threshold, the text strings in the table area and the non-table area in the financial and tax text image are determined, including: if the confidence that the text string is in the table area is greater than the confidence threshold, then the text string is in the table area; otherwise, the text string is in the non-table area.
[0085] Understandably, in fiscal and tax text images, tabular text is distributed in a grid-like pattern with aligned rows and columns. Within each column, character spacing, line height, and font size are highly consistent, and character distribution exhibits strict spatial periodicity. Non-tabular text (such as notes and clauses) is often free-form, with large variations in character and line spacing and less pronounced periodicity. To avoid segmentation errors caused by cross-region feature confusion, text strings in tabular and non-tabular areas must be segmented separately.
[0086] For example, in an embodiment of the present invention, the text strings in the tabular area and non-tabular area in the financial and tax text image are determined to obtain the financial and tax text parsing and business association verification results, including: using a character segmentation model to perform character segmentation on the text strings in the tabular area and non-tabular area respectively, and determining the character segmentation results of each line of text string; the character segmentation results of the text string are organized into text information, mapped to a predefined data structure model, and the type corresponding to each text information is determined to obtain the financial and tax text parsing results.
[0087] The types of text information may include invoice number, date, amount, cell content, etc., and may be set according to actual needs.
[0088] Specifically, when using the character segmentation model to perform character segmentation on text strings in the table area and non-table area respectively, the character segmentation model in the DeepSeek-R1 large model can be used to segment the text string in the table area using horizontal and vertical alignment methods, and the text string in the non-table area can be segmented by dynamically adjusting the segmentation strategy according to the text string in the non-table area, and finally the coordinates and content of each character in each line of the text string can be obtained.
[0089] For example, after the character segmentation results of the text string are formed into text information, the text information can also be converted into a format acceptable to the model, such as JSON, XML format, etc.
[0090] Specifically, when predefining the data structure model, a set of financial and tax text images can be obtained, and the corresponding types of text information in the financial and tax text image set can be manually labeled to obtain a labeled financial and tax text image set; the labeled financial and tax text image set is input into the Qwen2.5 model for training to obtain a data structure model for determining the type of text information.
[0091] By inputting the character segmentation results of the text string extracted from the latest financial and tax text image into the data structure model, the financial and tax text parsing results of the financial and tax text image can be obtained.
[0092] Among them, the specific steps of pre-training the data structure model and character segmentation can be achieved through existing technologies, and the embodiments of the present invention will not be described in detail here.
[0093] After accurately extracting the financial and tax text parsing results of the financial and tax text image based on the above steps, the business association verification results can be obtained according to the verification rules of the types corresponding to each text information in the financial and tax text parsing results.
[0094] For example, in an embodiment of the present invention, a business-related verification result is obtained based on the verification rules of the type corresponding to each text message, including: pre-defining verification rules for various types of text messages, the types of verification rules include at least format verification, logic verification, duplication verification, and business rule matching; if the text information all meets the verification rules of the corresponding type, the business-related verification result is output as passed verification; otherwise, the business-related verification result is output as failed verification, and the types of verification rules that the text information does not meet are obtained for classification.
[0095] Among them, format verification can be performed through regular expressions, logical verification can be performed through financial and tax-related numerical formulas, duplication verification can be performed through hash value comparison methods, and business rule matching can be performed through conditional judgment methods.
[0096] Specifically, when pre-defining verification rules for various types of text information, format verification can be for example whether the invoice number format is qualified; logical verification can be for example whether the tax rate calculation is correct; duplication verification can be for example checking whether the same invoice number, code, amount appears repeatedly; business rule matching can be for example whether the invoice tax rate complies with the corresponding tax rate type.
[0097] The specific steps of predefining verification rules for various types of text information and obtaining service-related verification results can be implemented by existing technologies and will not be described in detail in the embodiment of the present invention.
[0098] It can be seen that in the embodiment of the present invention, when obtaining the results of the financial and tax text parsing and business association verification, the coordinates, text height and text length of each text string in the financial and tax text image can be obtained, and the vertical and horizontal distances between the text strings are determined according to the coordinates; the vertical periodicity of the i-th line text string in the financial and tax text image is calculated. :
[0099] ;
[0100] is the number of text sequences in the tax text image, The text string of line i and the text string of line i except itself The vertical distance between lines of text, is the average text height of all text strings in the tax text image, is a cosine function; the horizontal periodicity of each line of text string is calculated according to the horizontal distance between the text string and other text strings except itself and the mean text length of all text strings; the text length deviation of the text string is determined according to the difference between the text length of each text string and the mean text length of all text strings; the confidence that the text string is in the table area is determined, and the confidence that the text string is in the table area is positively correlated with the vertical periodicity and horizontal periodicity of the text string, and negatively correlated with the text length deviation; in response to the comparison result of the confidence that the text string is in the table area with the confidence threshold, the text strings in the table area and the non-table area in the financial and tax text image are determined to obtain the financial and tax text parsing and business association verification results, which effectively improves the accuracy of the financial and tax text parsing and business association verification.
[0101] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A deep learning optimization method for financial and tax text parsing and business relevance verification, characterized by: include: Get the coordinates, text height and text length of each text string in the financial and tax text image, determine the vertical and horizontal distances between the text string and other text strings based on the coordinates; calculate the vertical periodicity of the text string in the i-th row of the financial and tax text image : ; is the number of text sequences in the tax text image, The text string of line i and the text string of line i except itself The vertical distance between lines of text, is the average text height of all text strings in the tax text image, is a cosine function; the horizontal periodicity of each line of text string is calculated according to the horizontal distance between the text string and other text strings except itself and the mean text length of all text strings; the text length deviation of the text string is determined according to the difference between the text length of each text string and the mean text length of all text strings; the confidence that the text string is in the table area is determined, and the confidence that the text string is in the table area is positively correlated with the vertical periodicity and horizontal periodicity of the text string, and negatively correlated with the text length deviation; in response to the comparison result of the confidence that the text string is in the table area with the confidence threshold, the text strings in the table area and the non-table area in the financial and tax text image are determined to obtain the financial and tax text parsing and business association verification results.
2. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 1 is characterized in that: The step of obtaining the coordinates, text height, and text length of each text string in the tax text image also includes: Obtain financial and tax text photos and preprocess them to obtain financial and tax text images.
3. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 1 is characterized in that: The step of obtaining the coordinates, text height, and text length of each text string in the finance and taxation text image includes: The upper left corner of the tax text image is recorded as the origin, the horizontal right direction is the horizontal axis, and the vertical downward direction is the vertical axis; the coordinates of each text string are obtained according to the text detection model, and the coordinates of the minimum circumscribed rectangle of the text string are used as the coordinates of the text string. The coordinates of each text string include at least the coordinates of the upper left corner and the lower right corner; The text height of the text string is determined based on the vertical coordinate difference between the upper left corner coordinate and the lower right corner coordinate of the text string; the text length of the text string is determined based on the horizontal coordinate difference between the upper left corner coordinate and the lower right corner coordinate of the text string.
4. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 1 is characterized in that: Determining the vertical distance and the horizontal distance between the text string and the other text string according to the coordinates includes: If a text string is above other text strings in the finance and taxation text image, the vertical distance between the text string and the other text strings is determined based on the difference in vertical coordinates between the lower right corner of the text string and the upper left corner of the other text strings; if a text string is below other text strings in the finance and taxation text image, the vertical distance between the text string and the other text strings is determined based on the difference in vertical coordinates between the upper left corner of the text string and the lower right corner of the other text strings; The horizontal distance between the text string and the other text string is determined according to the difference between the upper left corner horizontal coordinates of the text string and the other text string.
5. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 1 is characterized in that: The step of calculating the horizontal periodicity of each line of text string includes: Calculate the horizontal periodicity of the i-th line of text in the tax text image : ; is the number of text sequences in the tax text image, The text string of line i and the text string of line i except itself The horizontal distance between lines of text, is the mean text length of all text strings in the tax text image, is the cosine function.
6. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 1 is characterized in that: Determining the text length deviation of each text string based on the difference between the text length of each text string and the average text length of all text strings includes: The absolute value of the difference between the text length of the text string and the average text length of all text strings is obtained as the first index of the text string, and the ratio of the first index to the average text length of all text strings is recorded as the text length deviation of the text string.
7. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 1 is characterized in that: Determining the confidence level that the text string is in the table area includes: The confidence level that the text string is in the table area is obtained by subtracting the text length deviation from the sum of the vertical periodicity and the horizontal periodicity of the text string.
8. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 1 is characterized in that: The step of determining the text strings in the table area and the non-table area in the tax text image in response to a comparison result of the confidence level of the text string being in the table area with the confidence threshold comprises: If the confidence level that the text string is in the table area is greater than a confidence threshold, the text string is in the table area; otherwise, the text string is in the non-table area.
9. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 1 is characterized in that: The step of determining text strings in the tabular area and the non-tabular area of the finance and taxation text image to obtain the finance and taxation text parsing and business association verification results includes: Use the character segmentation model to perform character segmentation on the text strings in the table area and the non-table area respectively, and determine the character segmentation results of each line of text string; The character segmentation results of the text string are combined into text information, mapped to a predefined data structure model, and the type corresponding to each text information is determined to obtain the financial and tax text parsing results; according to the verification rules corresponding to the type of each text information, the business association verification results are obtained.
10. The deep learning optimization method for fiscal and tax text parsing and business association verification according to claim 9 is characterized in that: The business association verification result is obtained according to the verification rules of the types corresponding to the text information, including: Predefine verification rules for various types of text information. The types of verification rules include at least format verification, logic verification, duplication verification, and business rule matching. If the text information complies with the corresponding type of verification rules, the business-related verification result is output as passed verification; otherwise, the business-related verification result is output as failed verification, and the type of verification rule that the text information does not comply with is obtained for classification.
Citation Information
Patent Citations
Quota invoice self-service getting method
CN106373299A
Structured text recognition method and system
CN113537227A