Method and system for extracting key information of non-performing asset contracts using OCR technology
Patent Information
- Application Number
- CN202410828792.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-25
AI Technical Summary
不良资产合同往往是多页文档,直接对每一页识别提取的关键信息可能是不完整的
[0085] The present invention effectively improves the quality of contract images through the image preprocessing stage, including denoising, local adaptive binarization, rotation correction and geometric correction. The acquisition of high-quality images is the basis for the accuracy of subsequent information extraction. In particular, through local segmentation and content subdomain classification, different areas in the image can be processed in more detail to ensure accurate identification and extraction of key content.
Smart Images

Figure CN118379753B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of optical character recognition, and more specifically, to a method and system for extracting key information of a non-performing asset contract by using OCR technology. Background Art
[0002] The contract documents of non-performing assets contain a lot of key information, such as contract number, signing date, counterparty, transaction amount, guarantee method, etc. Timely and accurate extraction of this key information is of great significance for the management and disposal of non-performing assets.
[0003] Traditional extraction of non-performing asset contract information mainly relies on manual processing, which has problems such as heavy workload, low efficiency and low accuracy. Chen et al. (Chen G, Liu M, Zhang YX, et al. Using images to detect, plan, analyze, and coordinate a smart contract in construction[J]. Journal of Management in Engineering, 2023, 39(2): 04023002.) proposed a method to automatically manage and execute smart contracts by combining images with blockchain technology. Although this study demonstrated the potential of image analysis in contract information management, it mainly focused on the field of engineering construction and lacked specialized research on non-performing asset contracts in the financial field. Guo et al. (Guo Q, Hu Z, Li C, et al. Key-Region and Layout Learning for Contract Intelligent Identification[C] / / 2021 IEEE International Conference on Emergency Science and Information Technology (ICESIT). IEEE, 2021: 57-61.) introduced a multimodal learning method combining key region detection and document layout learning for intelligent identification of contract information. Although this study has achieved good results in contract information extraction tasks, it ignores the cross-page association problem of contract content. Non-performing asset contracts are often multi-page documents, and directly identifying and extracting key information from each page may be incomplete.
[0004] In summary, traditional non-performing asset contract information extraction usually only recognizes the overall image, lacks local segmentation of the contract image and classification of content subdomains, cannot effectively distinguish different types of text areas, and ignores the cross-page correlation problem of contract content for long and multi-page contract texts. Summary of the invention
[0005] In order to overcome the above-mentioned defects of the prior art, the present invention provides a method and system for extracting key information of non-performing asset contracts using OCR technology.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] Methods for extracting key information of non-performing asset contracts using OCR technology include:
[0008] Step S1000, obtaining a contract image of a non-performing asset contract, performing denoising, local adaptive binarization, rotation correction and geometric correction on the contract image to obtain a high-quality contract image;
[0009] Step S2000, locally segmenting the high-quality contract image, calculating the local density and aspect ratio of each local image, dividing the high-quality contract image into different content subdomains according to the local density and aspect ratio, collecting domain features of the content subdomains, and classifying the content subdomains according to the domain features of the content subdomains;
[0010] Step S3000, designing a contract key information extraction rule, and extracting the contract key information from the content subdomain according to the contract key information extraction rule;
[0011] Step S4000, associating the contract key information on different pages across pages to generate complete cross-page key information;
[0012] Step S5000, storing the complete cross-page key information in a structured database, and establishing a mapping relationship between the complete cross-page key information and the non-performing asset contract document.
[0013] Furthermore, the step S1000 includes:
[0014] Step S1100, obtaining the electronic document of the non-performing asset contract according to the original non-performing asset contract document, and converting the electronic document into a contract image;
[0015] Step S1200, denoising the contract image to obtain a clear contract image;
[0016] Step S1300, performing local adaptive binarization processing on the clear contract image to obtain a pure contract image;
[0017] Step S1400, correcting the tilt and deformation of the pure contract image to obtain a high-quality contract image;
[0018] The step S1300 includes:
[0019] Step S1310, dividing the clear contract image into a plurality of sub-images;
[0020] Step S1320, calculating the local features of each sub-image, and obtaining a local adaptive binarization threshold according to the local features of each sub-image;
[0021] Step S1330, performing binarization processing on each sub-image according to the local adaptive binarization threshold to obtain a binarized sub-image;
[0022] Step S1340: merge all the binarized sub-images to form a pure contracted image.
[0023] Furthermore, the method for obtaining a local adaptive binarization threshold according to the local features of each sub-image includes:
[0024] ;
[0025] in:
[0026] : Local adaptive binarization threshold;
[0027] : The average gray value of the sub-image in the i-th row and j-th column;
[0028] : Grayscale standard deviation of the sub-image in the i-th row and j-th column;
[0029] : adjustment coefficient;
[0030] : row index of the sub-image;
[0031] : column index of the sub-image;
[0032] The method of performing binarization processing on each sub-image according to the local adaptive binarization threshold includes:
[0033] ;
[0034] in:
[0035] : Binarized pixel value of the i-th row and j-th column sub-image at position (x, y);
[0036] : The pixel value of the i-th row and j-th column sub-image at position (x, y).
[0037] Furthermore, the step S1400 includes:
[0038] Step S1410, detecting straight lines in the pure contract image, calculating the average tilt angle of the pure contract image, performing rotation correction on the pure contract image according to the average tilt angle, and obtaining a positive posture contract image;
[0039] Step S1420, calculating the perspective transformation matrix according to the coordinates of the four corner points of the normal posture contract image, and performing geometric correction on the normal posture contract image;
[0040] Step S1430, cropping and normalizing the geometrically corrected positive pose contract image, retaining the effective area of the contract, and adjusting the image size to a uniform size to obtain a high-quality contract image.
[0041] Furthermore, the method for calculating the tilt angle of the pure contract image includes:
[0042] ;
[0043] in:
[0044] : Average tilt angle of clean contract image;
[0045] N: the number of selected lines;
[0046] : The length of the gth straight line;
[0047] : The angle between the gth straight line and the horizontal axis;
[0048] Methods for rotation correction of images according to the average tilt angle include:
[0049] ;
[0050] in:
[0051] : The horizontal coordinate of the pixel in the pure contract image;
[0052] : The vertical coordinate of the pixel in the clean contract image;
[0053] : The horizontal coordinate of the pixel in the clean contract image after rotation correction;
[0054] : The vertical coordinate of the pixel in the clean contract image after rotation correction.
[0055] Further, the step S2000 includes:
[0056] Step S2100: Locally segment the high-quality contract image, calculate the local density and aspect ratio of each local image; set the initial region division rule according to the local density and aspect ratio, and perform initial region division on the high-quality contract image according to the initial region division rule to obtain different types of initial regions; merge the initial regions with the same type and adjacent in space to form content sub-domains;
[0057] The method for setting the initial region division rule according to the local density and aspect ratio includes:
[0058] Title region: Local density D > 0.8 and aspect ratio R > 5;
[0059] Text region: Local density 0.2 < D < 0.8 and aspect ratio 1 < R < 3;
[0060] Table region: Local density D > 0.5 and aspect ratio 0.8 < R < 1.2;
[0061] Signature and seal region: Local density D > 0.8 and aspect ratio 0.5 < R < 2;
[0062] Step S2200: Collect the domain appearance features of the content sub-domains, and classify the content sub-domains according to the domain appearance features of the content sub-domains;
[0063] Step S2300: Calculate the accuracy threshold for the classification of the content sub-domains, and determine whether the classification result of the content sub-domains is greater than or equal to the accuracy threshold. If it is greater than or equal to the accuracy threshold, go to step S3000; if it is less than the accuracy threshold, adjust the initial region division rule, return to step S2100, and re-divide the content sub-domains;
[0064] Further, the step S3000 includes:
[0065] Step S3100: Perform OCR recognition on each content sub-domain respectively according to the classification result of the content sub-domains to obtain the text information within the content sub-domains;
[0066] Step S3200: Design the contract key information extraction rule, and extract the contract key information from the text information recognized within the content sub-domains according to the contract key information extraction rule;
[0067] Step S3300: Set the contract key information integrity standard, and determine whether the contract key information is complete according to the contract key information integrity standard. If it is complete, go to step S4000; if it is not complete, adjust the contract key information extraction rule, transfer to step S3200, and re-extract the contract key information;
[0068] The step S4000 includes:
[0069] Step S4100, judging the context and attribution relationship between the various pages according to the header and footer information of the contract;
[0070] Step S4200, designing a cross-page association rule, and determining whether the key contract information on different pages belongs to the same key contract information according to the cross-page association rule;
[0071] Step S4300, designing cross-page merging rules, and generating cross-page complete key information from the contract key information on different pages according to the cross-page merging rules;
[0072] Step S4400, performing consistency check and continuity check on the cross-page complete key information, and marking and processing the cross-page complete key information that fails the check.
[0073] The system for extracting key information of non-performing asset contracts using OCR technology is used to implement the above-mentioned method for extracting key information of non-performing asset contracts using OCR technology, including:
[0074] Contract image acquisition module: used to acquire the electronic document of the non-performing asset contract and convert the electronic document into a contract image;
[0075] Contract image preprocessing module: used to perform denoising, binarization, rotation correction and geometric correction on the contract image collected by the image acquisition module to obtain high-quality contract images;
[0076] Contract image segmentation module: used to perform local segmentation on high-quality contract images, calculate the local density and aspect ratio of each local image, and divide the high-quality contract images into different content subdomains according to the local density and aspect ratio;
[0077] Content subdomain classification module: used to collect content subdomain features and classify content subdomains according to the content subdomain features;
[0078] Accuracy verification module: used to calculate the accuracy threshold of content subdomain classification and determine whether the content subdomain classification result meets the accuracy requirement;
[0079] Key information extraction module: used to design contract key information extraction rules and extract contract key information from content subdomains according to the contract key information extraction rules;
[0080] Cross-page information association module: used to associate the contract key information on different pages across pages and generate complete cross-page key information;
[0081] Data storage and management module: used to store complete key information across pages into a structured database, and establish a mapping relationship between complete key information across pages and non-performing asset contract documents.
[0082] An electronic device includes a memory, a central processing unit, and a computer program stored in the memory and executable on the central processing unit. When the central processing unit executes the computer program, the method for extracting key information of non-performing asset contracts using OCR technology is implemented.
[0083] A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed, the method for extracting key information of a non-performing asset contract using OCR technology is implemented.
[0084] Compared with the prior art, the present invention has the following beneficial effects:
[0085] The present invention effectively improves the quality of the contract image through the image preprocessing stage, including denoising, local adaptive binarization, rotation correction and geometric correction. The acquisition of high-quality images is the basis for the accuracy of subsequent information extraction. In particular, through local segmentation and content subdomain classification, different areas in the image can be processed more carefully to ensure accurate recognition and extraction of key content.
[0086] Traditional contract information extraction usually relies on manual operations, which is time-consuming and prone to errors. The present invention can greatly reduce manual participation and quickly and accurately extract key contract information through automated OCR technology and preset extraction rules. This not only saves a lot of human resources, but also significantly improves processing speed and efficiency.
[0087] Contracts usually span multiple pages. This invention introduces cross-page association technology. Through header and footer information and cross-page association rules, it can accurately determine whether the information on different pages belongs to the same contract and integrate it into complete contract key information. This technology effectively solves the problem of scattered contract information and ensures the integrity and continuity of data.
[0088] Each module in the present invention is implemented in a programmed manner, which reduces the manual operation links and thus reduces the risk of manual errors. In particular, in the process of information extraction and cross-page association, the accuracy and reliability of the extracted information are ensured by setting the accuracy threshold and consistency check.
[0089] The extracted key contract information is stored in a structured database and a mapping relationship is established with the original contract file, which not only helps to efficiently manage and query data, but also provides convenient conditions for subsequent data analysis and processing. Through structured storage, the operability and utilization of data are greatly improved.
[0090] The method and system design of the present invention have strong scalability. The extraction rules and classification standards can be adjusted and expanded according to the specific contract types and requirements to meet the processing requirements of different types of non-performing asset contracts. The modular design of the system also facilitates the expansion and upgrading of subsequent functions. In addition to the processing of non-performing asset contracts, the method and system of the present invention can also be extended to other types of contract or document processing fields, such as financial contracts, insurance contracts, legal documents, etc., and have broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0091] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0092] Figure 1 A flowchart of the method for extracting key information of non-performing asset contracts using OCR technology in the present invention;
[0093] Figure 2 A flow chart of a method for generating complete key information across pages in a method for extracting key information of a non-performing asset contract using OCR technology in the present invention;
[0094] Figure 3 This is a functional module diagram of the system for extracting key information of non-performing asset contracts using OCR technology in the present invention. DETAILED DESCRIPTION
[0095] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Example 1
[0096] See also Figure 1 As shown, this embodiment provides a method for extracting key information of non-performing asset contracts using OCR technology, including:
[0097] Step S1000, obtaining a contract image of a non-performing asset contract, performing denoising, local adaptive binarization, rotation correction and geometric correction on the contract image to obtain a high-quality contract image;
[0098] Furthermore, step S1000 includes:
[0099] Step S1100, obtaining the electronic document of the non-performing asset contract according to the original non-performing asset contract document, and converting the electronic document into a contract image;
[0100] Specifically, the process of obtaining electronic documents of non-performing asset contracts needs to consider the source and format of the contract. For paper contracts, it is necessary to use devices such as scanners or digital cameras to digitize and convert them into electronic documents, such as PDF, TIFF and other formats; for original electronic contracts, such as WORD, PDF, etc., the electronic documents can be read directly. In order to facilitate subsequent image processing and OCR recognition, electronic documents need to be converted into commonly used image formats, such as JPEG, PNG, etc. During the conversion process, it is necessary to set appropriate resolution and color mode to ensure image quality and OCR recognition effect. At the same time, it is also necessary to consider the storage and management of image files, and adopt appropriate file naming and directory structure to facilitate subsequent batch processing and retrieval.
[0101] Step S1100 ensures digital management of documents and improves processing efficiency by converting the original non-performing asset contract file into an electronic document and then converting the electronic document into a contract image. The electronic document acquisition and image conversion steps can retain the content and format of the original contract, reduce information loss and format errors, and provide high-quality original data for subsequent image processing and analysis.
[0102] Step S1200, denoising the contract image to obtain a clear contract image;
[0103] Further, step S1200 includes:
[0104] Step S1210, using a median filter algorithm to smooth the contract image;
[0105] Step S1220, using a Gaussian filtering algorithm to blur the contract image, smooth the image edge, and reduce background interference;
[0106] Step S1230, corroding and dilating the contract image to remove small noise points and breakpoints in the image;
[0107] Specifically, the contract image will inevitably introduce some noise and interference information during the conversion process, such as scanner noise, background texture, etc. These noises will affect the subsequent OCR recognition effect. In order to improve the image quality, the image needs to be denoised. Commonly used denoising algorithms include median filtering, Gaussian filtering, morphological operations, etc. Median filtering can effectively remove isolated noise by selecting the median in the neighborhood to replace the current pixel value; Gaussian filtering can reduce background interference by smoothing the image through weighted averaging; morphological operations can remove small noise and breakpoints by corroding and dilating the image.
[0108] Step S1300, performing local adaptive binarization processing on the clear contract image to obtain a pure contract image;
[0109] Further, step S1300 includes:
[0110] Step S1310, dividing the clear contract image into a plurality of sub-images;
[0111] Step S1320, calculating the local features of each sub-image, and obtaining a local adaptive binarization threshold according to the local features of each sub-image;
[0112] According to the local features of each sub-image, the method of obtaining the local adaptive binarization threshold includes:
[0113] ;
[0114] in:
[0115] : Local adaptive binarization threshold;
[0116] : The average gray value of the sub-image in the i-th row and j-th column;
[0117] : Grayscale standard deviation of the sub-image in the i-th row and j-th column;
[0118] : Adjustment coefficient, which controls the offset of the threshold and is adjusted according to the specific image;
[0119] : row index of the sub-image;
[0120] : column index of the sub-image;
[0121] Step S1330, performing binarization processing on each sub-image according to the local adaptive binarization threshold to obtain a binarized sub-image;
[0122] The method of performing binarization processing on each sub-image according to the local adaptive binarization threshold includes:
[0123] ;
[0124] in:
[0125] : Binarized pixel value of the i-th row and j-th column sub-image at position (x, y);
[0126] : The pixel value of the i-th row and j-th column sub-image at position (x, y);
[0127] Step S1340, merging all the binary sub-images to form a pure contract image;
[0128] Specifically, after the contract image is denoised, in order to reduce the amount of image data and improve the efficiency of subsequent processing, the grayscale image needs to be converted into a black and white image, that is, binarization processing. Local features are image features obtained from the image, including the average grayscale value, grayscale standard deviation, and pixel density; binarization processing can divide image pixels into two categories: foreground (text) and background, which is convenient for subsequent sub-domain division and OCR recognition. Through this local adaptive binarization processing method, it can ensure that the contract image can maintain a high recognition quality under different lighting and noise conditions, enhancing the overall image processing effect.
[0129] Step S1400, correcting the tilt and deformation of the pure contract image to obtain a high-quality contract image;
[0130] Further, step S1400 includes:
[0131] Step S1410, detecting straight lines in the pure contract image, calculating the average tilt angle of the pure contract image, performing rotation correction on the pure contract image according to the average tilt angle, and obtaining a positive posture contract image;
[0132] Methods for calculating the tilt angle of a clean contract image include:
[0133] ;
[0134] in:
[0135] : Average tilt angle of clean contract image;
[0136] N: the number of selected lines;
[0137] : The length of the gth straight line;
[0138] : The angle between the gth straight line and the horizontal axis;
[0139] Methods for rotation correction of images according to the average tilt angle include:
[0140] ;
[0141] in:
[0142] : The horizontal coordinate of the pixel in the pure contract image;
[0143] : The vertical coordinate of the pixel in the clean contract image;
[0144] : The horizontal coordinate of the pixel in the clean contract image after rotation correction;
[0145] : The vertical coordinate of the pixel in the clean contract image after rotation correction;
[0146] Step S1410 performs rotation correction on the image by detecting the straight lines in the pure contract image and calculating their average tilt angle. This process not only effectively corrects the tilt of the image during scanning or shooting, improves the neatness and readability of the image, but also provides more accurate basic data for subsequent geometric correction and OCR recognition. Specifically, the calculation formula of the average tilt angle comprehensively considers the length of multiple straight lines and their angles with the horizontal axis, ensuring the accuracy and reliability of the calculation results. This step greatly enhances the overall effect of contract image processing and improves the accuracy and efficiency of key information extraction.
[0147] Step S1420, calculating the perspective transformation matrix according to the coordinates of the four corner points of the normal posture contract image, and performing geometric correction on the normal posture contract image;
[0148] Step S1430, cropping and normalizing the geometrically corrected positive pose contract image, retaining the effective area of the contract, and adjusting the image size to a uniform size to obtain a high-quality contract image;
[0149] Specifically, during the scanning or shooting process, the contract image will inevitably have some geometric distortions such as tilt and deformation, which will affect the subsequent content subdomain division and OCR recognition effect. In order to correct these distortions, the image needs to be corrected. Commonly used correction algorithms include Hough transform and perspective transform. Hough transform detects the straight lines in the image, calculates the tilt angle of the image, and then rotates the image; perspective transform calculates the perspective transformation matrix according to the coordinates of the four corner points of the image, performs geometric correction on the image, and restores the original shape of the contract. After correction, the image needs to be cropped and normalized to retain the effective area of the contract and adjust the image size to a uniform size for batch processing and feature extraction. Correction processing can effectively correct the geometric distortion of the contract image, improve the accuracy of content subdomain division and OCR recognition, and also simplify the subsequent processing flow and improve processing efficiency.
[0150] Step S2000, locally segmenting the high-quality contract image, calculating the local density and aspect ratio of each local image, dividing the high-quality contract image into different content subdomains according to the local density and aspect ratio, collecting domain features of the content subdomains, and classifying the content subdomains according to the domain features of the content subdomains;
[0151] Furthermore, step S2000 includes:
[0152] In step S2100, perform local segmentation on the high-quality contract image, calculate the local density and aspect ratio of each local image; set the initial region division rule according to the local density and aspect ratio, and perform initial region division on the high-quality contract image according to the initial region division rule to obtain different types of initial regions; merge the initial regions with the same type and adjacent in space to form content sub-domains;
[0153] The method for setting the initial region division rule according to the local density and aspect ratio includes:
[0154] Title region: local density D > 0.8 and aspect ratio R > 5;
[0155] Body text region: local density 0.2 < D < 0.8 and aspect ratio 1 < R < 3;
[0156] Table region: local density D > 0.5 and aspect ratio 0.8 < R < 1.2;
[0157] Signature and seal region: local density D > 0.8 and aspect ratio 0.5 < R < 2;
[0158] Local density is a measure used to describe the density of pixels in a local area. High-density areas usually contain a lot of text or lines, while low-density areas may be blank or have fewer images. Based on the usage and visual characteristics of different areas, the local density range of different types of areas can be roughly estimated. Aspect ratio is used to describe the geometric shape characteristics of the area. Different types of content subdomains usually have certain regularities in their layout and shape on the page. For example, titles are generally wide and low, while tables are usually close to square. The aspect ratio can better identify these different types of areas. Titles are usually composed of large and bold fonts, which make the pixel density of the title area high. Local density greater than 0.8 reflects this high density feature. Titles are usually one or several short lines of text, occupying the width of the page and a small height, so the aspect ratio is usually large. This setting reflects the horizontal stretching characteristics of titles. The text area has more text and a more uniform density. Local density between 0.2 and 0.8 indicates that the text area is neither too sparse nor too dense, reflecting the characteristics of the text area. The text area is generally rectangular or close to a square, with an aspect ratio between 1 and 3, which covers the common text paragraph layout. Since the table area contains a large number of lines and text, the pixel density is usually higher. The local density greater than 0.5 reflects this feature of the table area. The width and height of the table are usually close, and the aspect ratio is close to 1. This setting reflects the regularity and compactness of the table area. The seal area usually includes a signature and a seal, and these elements make the pixel density of this area higher. The local density greater than 0.8 reflects the high-density characteristics of the seal area. The shapes of the seal area are various, sometimes rectangular, sometimes close to a square, and the aspect ratio range is wide. This setting takes into account the diversity of the shapes of the seal area. The method for calculating the local density of an image is common knowledge in the field and will not be repeated in this embodiment.
[0159] Step S2100 divides the high-quality contract image into different content subdomains by calculating the local density and aspect ratio of each local image. Local segmentation makes it possible to initially structure the image, and different content subdomains such as title, text, table, signature and other areas can be effectively identified and extracted. This step lays the foundation for subsequent information classification and feature extraction, and improves processing efficiency and accuracy.
[0160] Step S2200, collecting content subdomain features, and classifying content subdomains according to the content subdomain features; the content subdomain features include position features, size features, and shape features;
[0161] After the high-quality contract image is divided into different content subdomains, each content subdomain needs to be marked and classified to determine its type, such as title subdomain, text subdomain, table subdomain, signature subdomain, etc. Subdomain classification can provide more accurate regional type information for subsequent OCR recognition and key information extraction, and improve the accuracy of recognition and extraction. Subdomain classification usually adopts the method of pattern recognition, extracts various domain features of content subdomains, such as position, size, shape, etc., constructs feature vectors, and then uses classification algorithms for classification. Common domain features include position features (such as upper left corner coordinates, lower right corner coordinates, center coordinates, etc.), size features (such as width, height, area, etc.), shape features (such as edge direction histograms, Hu invariant moments, etc.). Common classification algorithms include decision trees, support vector machines, neural networks, etc., and appropriate algorithms can be selected according to the dimension of the features and the amount of data. Step S2200 collects domain features such as position, size and shape of content subdomains, and classifies based on these features. Detailed feature extraction and classification can accurately distinguish different types of content areas, such as titles, text, tables, signatures, etc., thereby improving the accuracy of OCR recognition and key information extraction.
[0162] Step S2300, calculating the accuracy threshold of the content subdomain classification, determining whether the content subdomain classification result is greater than or equal to the accuracy threshold, if greater than or equal to the accuracy threshold, proceeding to step S3000; if less than the accuracy threshold, adjusting the initial area division rule, returning to step S2100, and re-dividing the content subdomain;
[0163] Methods for calculating the accuracy threshold of content subdomain classification include:
[0164] Set an initial accuracy threshold ;
[0165] Collect statistics on the results of each classification, and record the number of correctly classified content subdomains and the total number of content subdomains;
[0166] Divide the number of correctly classified content subdomains by the total number of content subdomains to obtain the accuracy rate A of the current classification;
[0167] According to the current classification accuracy A and the initial accuracy threshold , obtain the accuracy threshold of the next round of classification;
[0168] ;
[0169] in:
[0170] : The accuracy threshold of the next round of classification;
[0171] : Adjustment coefficient of accuracy threshold;
[0172] The accuracy threshold of the current classification is calculated by the accuracy of the previous round and the accuracy threshold. The accuracy threshold of the next round of classification is used to judge the accuracy of the next round of classification process.
[0173] Specifically, due to the diversity and complexity of contract formats, the results of the initial content subdomain classification may not be ideal, and there may be problems such as misclassification and missed classification, which will affect the subsequent OCR recognition and key information extraction. In order to improve the accuracy of content subdomain classification, it is necessary to set an accuracy threshold. The initial accuracy threshold can be set according to the requirements of the system and the specific application scenario, and is usually set to a higher value, such as 90%. In each iteration, the accuracy of the current regional classification result is evaluated, and the proportion of the number of correctly classified content subdomains to the total number of content subdomains is calculated. If it is lower than the threshold, it is necessary to adjust the initial regional division rule, and then return to step S2100 to re-divide the high-quality contract image into different content subdomains. Step S2300 helps to gradually improve the accuracy of content subdomain classification and ensure the reliability of the final classification result by dynamically adjusting the accuracy threshold and the initial regional division rule. Through cyclic adjustment and re-division, the complexity and diversity of different types of contract images can be effectively dealt with, and the robustness and adaptability of the system can be enhanced. Reduce the situation of misclassification, optimize the subsequent OCR recognition and key information extraction process, and improve the overall processing efficiency and effect.
[0174] Step S3000, designing a contract key information extraction rule, and extracting the contract key information from the content subdomain according to the contract key information extraction rule;
[0175] Furthermore, step S3000 includes:
[0176] Step S3100, performing OCR recognition on each content subdomain according to the classification result of the content subdomain, and obtaining text information in the content subdomain;
[0177] Step S3200, designing a contract key information extraction rule, and extracting the contract key information from the text information identified in the content subdomain according to the contract key information extraction rule;
[0178] Step S3300, setting the integrity standard of the key contract information, judging whether the key contract information is complete according to the integrity standard of the key contract information, if it is complete, proceeding to step S4000, if it is incomplete, adjusting the key contract information extraction rules, proceeding to step S3200, and re-extracting the key contract information;
[0179] The completeness standards of the key contract information include: the first standard, the second standard and the third standard. If the first standard, the second standard and the third standard are met at the same time, the key contract information extracted from the text information is complete; if any one of the standards is not met, the extracted key contract information is incomplete;
[0180] The first criterion: pre-define a key information list to list all the key contract information items that need to be extracted, and check whether the extracted key contract information contains all the pre-defined key information items;
[0181] Second standard: verify whether the format and content of key information items meet the predetermined standards;
[0182] The third criterion: Each key information item is unique in the contract and there is no conflict;
[0183] Specifically, OCR recognition is to perform text recognition on each content subdomain in the contract image according to the classification results of the content subdomain, obtain the text information in the content subdomain, and convert the image information into a text format that can be processed by a computer. OCR recognition can use different recognition methods according to the font, style, size and other characteristics of the text. For standardized texts such as printed text and standard fonts, a template matching-based method can be used to match and recognize predefined character templates; for non-standardized texts such as handwriting and artistic fonts, a feature extraction-based method can be used to extract the direction, topological structure and other features of the text, and use a classifier for recognition; for complex text images, a deep learning-based method can be used, using models such as convolutional neural networks and recurrent neural networks to perform end-to-end recognition of text images and automatically extract and recognize text information.
[0184] Key contract information includes contract number, signing date, contract amount, debtor information, etc. Key information extraction requires the design of a series of extraction rules and algorithms based on the business logic and domain knowledge of the contract. Common extraction methods include keyword matching, regular expression matching, semantic analysis, etc. Keyword matching uses predefined keywords, such as "contract number:" and "signing date:", to match in the OCR recognition results, and extract the information after the keywords as key information; regular expression matching uses predefined regular expressions, such as date format, amount format, etc., to match in the OCR recognition results, and extract information that conforms to the format as key information; semantic analysis uses natural language processing technology, such as dependency parsing and named entity recognition, to analyze the semantic structure and entity type of the OCR recognition results, and extract key entity information, such as the debtor's name, ID number, etc.
[0185] Predefine a key information list to list all the key information items of the contract that need to be extracted, such as contract number, contract date, names of both parties to the contract, amount, signature and seal, etc. Check whether the extracted contract key information contains all the predefined key information items. And verify whether the format and content of each information item meet the predetermined standards. For example, whether the date format is correct, whether the amount is a valid number, whether the contract number meets the prescribed format, etc. Ensure that each key information item is unique in the contract and there is no conflict. For example, a contract should not have multiple different contract numbers. If all the above conditions are met, the contract key information is considered complete.
[0186] Step S3000 first performs OCR recognition on different content subdomains separately, which can improve the accuracy of text recognition and reduce recognition errors caused by mixed processing of different content types. Secondly, design extraction rules and extract information based on the rules to ensure that the extracted key contract information has high accuracy and consistency. Finally, by setting integrity standards to verify the extraction results, omissions or errors in the extraction process can be discovered and corrected in a timely manner, ensuring that the final extracted key contract information is complete and reliable. The combination of this series of steps improves the accuracy and efficiency of key information extraction.
[0187] Step S4000, associating the contract key information on different pages across pages to generate complete cross-page key information;
[0188] For further information, see Figure 2 , step S4000 includes:
[0189] Step S4100, judging the context and attribution relationship between the various pages according to the header and footer information of the contract;
[0190] Step S4200, designing a cross-page association rule, and determining whether the key contract information on different pages belongs to the same key contract information according to the cross-page association rule;
[0191] Step S4300, designing cross-page merging rules, and generating cross-page complete key information from the contract key information on different pages according to the cross-page merging rules;
[0192] Step S4400, performing consistency check and continuity check on the cross-page complete key information, marking and processing the cross-page complete key information that fails the check;
[0193] Cross-page association rules include, but are not limited to, association based on contract number, association based on contract title, association based on page number, association based on signing date, association based on contract subject, and association based on content context;
[0194] Association rule based on contract number: Find the contract number at the top or bottom of each page. If the contract numbers on different pages are the same, the information on these pages belongs to the same contract.
[0195] Association rules based on contract titles: Find the contract title on each page. If the contract titles on different pages are the same, the information on these pages belongs to the same contract.
[0196] Association rules based on page numbers: Look for page number information at the bottom of each page. If consecutive page numbers are found, the information on these pages may belong to the same contract.
[0197] Association rule based on signing date: Find the signing date on each page. If the signing dates on different pages are the same, the information on these pages may belong to the same contract.
[0198] Association rules based on the subject of the contract: Find the subject of the contract (such as the names of the two parties to the contract) on each page. If the subject of the contract on different pages is the same, the information on these pages may belong to the same contract.
[0199] Association rules based on content context: Analyze the content context on different pages. If the content is logically continuous (such as a continuation of a paragraph), the information on these pages may belong to the same contract.
[0200] Specifically, for a long contract text, key information may be distributed on multiple pages. For example, important information such as the contract amount and payment method may appear in different chapters of the contract. In order to obtain complete and accurate key information, cross-page association and merging processing is required. Cross-page association first needs to determine the context and attribution relationship between each page based on the header and footer information of the contract, such as page number, contract number, etc., to determine the order of the pages and the contract to which they belong. Then, it is necessary to design cross-page association rules to determine whether the information on different pages belongs to the same key information. This can be determined based on the semantic coherence of the paragraphs, the repeated appearance of keywords, and other features. Finally, it is necessary to design cross-page merging rules to splice and remove duplicates of the same key information on multiple pages to generate complete key information. For example, the contract amount information may be distributed on multiple pages of the contract. The amount information on these pages needs to be summarized and calculated to obtain the final total contract amount. For another example, the debtor information may appear multiple times in different chapters of the contract. These repeated information needs to be removed and integrated to obtain the complete information of the debtor. Through cross-page association and merging processing, the information fragmentation and incompleteness caused by page separation can be overcome, and the accuracy and completeness of key information extraction can be improved.
[0201] Due to the cross-page distribution of the contract text and the errors in OCR recognition, the key information extracted across pages may be inconsistent or discontinuous, affecting the accuracy and completeness of the information. In order to ensure the consistency and continuity of key information between different pages, a series of verification rules need to be designed. The consistency verification rules are mainly aimed at key information that appears repeatedly on multiple pages, such as contract number, contract amount, etc., requiring that these information must be consistent on different pages and cannot have obvious differences, otherwise manual review and correction are required. The continuity verification rules are mainly aimed at key information with a sequential relationship, such as the number of contract clauses, requiring that these information should be continuous on different pages, without missing or repeating, otherwise automatic completion or manual verification is required. Through consistency and continuity verification, errors and omissions in the process of extracting key information across pages can be discovered, the accuracy and completeness of key information can be improved, and a reliable data basis can be provided for subsequent business processing. At the same time, problems found during the verification process can also be fed back to the previous steps, such as OCR recognition, content subdomain division, etc., to help optimize and improve the algorithm model and improve the robustness and accuracy of the entire process.
[0202] Step S5000, storing the cross-page complete key information in a structured database, and establishing a mapping relationship between the cross-page complete key information and the non-performing asset contract document;
[0203] Specifically, the complete key information across pages needs to be stored in a structured form to facilitate subsequent query, statistics and analysis. Relational databases, such as MySQL, Oracle, etc., can be used to store structured key information. The storage process needs to first design a database model for key information, define table structure, field type, constraints, etc. Then convert the key information's JSON, XML and other structured data into corresponding SQL statements, such as INSERT statements for adding new data, UPDATE statements for updating data, etc., and write the data into the corresponding tables and fields by executing database operations. At the same time, in order to facilitate subsequent file retrieval and viewing, it is necessary to establish a mapping relationship between key information and the original contract file in the database, such as storing the path, file name and other information of the contract file. The corresponding original file can be quickly located through the retrieval of key information. By storing data in the database, unstructured contract texts can be converted into structured data, providing efficient and convenient data support for subsequent business applications. Example 2
[0204] This embodiment, based on the first embodiment, provides a system for extracting key information of non-performing asset contracts using OCR technology, such as Figure 3 As shown, including:
[0205] Contract image acquisition module: used to acquire the electronic document of the non-performing asset contract and convert the electronic document into a contract image;
[0206] Contract image preprocessing module: used to perform denoising, binarization, rotation correction and geometric correction on the contract image collected by the image acquisition module to obtain high-quality contract images;
[0207] Contract image segmentation module: used to perform local segmentation on high-quality contract images, calculate the local density and aspect ratio of each local image, and divide the high-quality contract images into different content subdomains according to the local density and aspect ratio;
[0208] Content subdomain classification module: used to collect content subdomain features and classify content subdomains according to the content subdomain features;
[0209] Accuracy verification module: used to calculate the accuracy threshold of content subdomain classification and determine whether the content subdomain classification result meets the accuracy requirement;
[0210] Key information extraction module: used to design contract key information extraction rules and extract contract key information from content subdomains according to the contract key information extraction rules;
[0211] Cross-page information association module: used to associate the contract key information on different pages across pages and generate complete cross-page key information;
[0212] Data storage and management module: used to store complete key information across pages into a structured database, and establish a mapping relationship between complete key information across pages and non-performing asset contract documents. Example 3
[0213] This embodiment discloses an electronic device, including a memory, a central processing unit, and a computer program stored in the memory and executable on the central processing unit. When the central processing unit executes the computer program, the method for extracting key information of non-performing asset contracts using OCR technology provided above is implemented.
[0214] Since the electronic device introduced in this embodiment is an electronic device used to implement the method of extracting key information of non-performing asset contracts using OCR technology in the embodiment of this application, based on the method of extracting key information of non-performing asset contracts using OCR technology introduced in the embodiment of this application, a person skilled in the art can understand the specific implementation of the electronic device of this embodiment and its various variations, so how the electronic device implements the method in the embodiment of this application is not introduced in detail here. As long as the electronic device used by a person skilled in the art to implement the method of extracting key information of non-performing asset contracts using OCR technology in the embodiment of this application, it belongs to the scope of protection of this application. Example 4
[0215] This embodiment discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed, the method for extracting key information of non-performing asset contracts using OCR technology is implemented.
[0216] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters, weights and thresholds in the formula are set by technicians in this field according to actual conditions.
[0217] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired network or a wireless network. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media sets. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD) or a semiconductor medium. The semiconductor medium may be a solid-state hard disk.
[0218] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0219] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0220] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic, for example, the division of the units is only one, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0221] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0222] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0223] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0224] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for extracting key information of non-performing asset contracts using OCR technology, characterized in that: include: Step S1000, obtaining a contract image of a non-performing asset contract, performing denoising, local adaptive binarization, rotation correction and geometric correction on the contract image to obtain a high-quality contract image; Step S2000, locally segmenting the high-quality contract image, calculating the local density and aspect ratio of each local image, dividing the high-quality contract image into different content subdomains according to the local density and aspect ratio, collecting domain features of the content subdomains, and classifying the content subdomains according to the domain features of the content subdomains; Step S3000, designing a contract key information extraction rule, and extracting the contract key information from the content subdomain according to the contract key information extraction rule; Step S4000, associating the contract key information on different pages across pages to generate complete cross-page key information; Step S5000, storing the cross-page complete key information in a structured database, and establishing a mapping relationship between the cross-page complete key information and the non-performing asset contract document; The step S1000 includes: Step S1100, obtaining the electronic document of the non-performing asset contract according to the original non-performing asset contract document, and converting the electronic document into a contract image; Step S1200, denoising the contract image to obtain a clear contract image; Step S1300, performing local adaptive binarization processing on the clear contract image to obtain a pure contract image; Step S1400, correcting the tilt and deformation of the pure contract image to obtain a high-quality contract image; The step S1300 includes: Step S1310, dividing the clear contract image into a plurality of sub-images; Step S1320, calculating the local features of each sub-image, and obtaining a local adaptive binarization threshold according to the local features of each sub-image; Step S1330, performing binarization processing on each sub-image according to the local adaptive binarization threshold to obtain a binarized sub-image; Step S1340, merging all the binary sub-images to form a pure contract image; The method for obtaining a local adaptive binarization threshold according to the local features of each sub-image includes: ; in: : Local adaptive binarization threshold; : The average gray value of the sub-image in the i-th row and j-th column; : Grayscale standard deviation of the sub-image in the i-th row and j-th column; : adjustment coefficient; : row index of the sub-image; : column index of the sub-image; The method of performing binarization processing on each sub-image according to the local adaptive binarization threshold includes: ; in: : Binarized pixel value of the i-th row and j-th column sub-image at position (x, y); : The pixel value of the i-th row and j-th column sub-image at position (x, y); The step S1400 includes: Step S1410, detecting straight lines in the pure contract image, calculating the average tilt angle of the pure contract image, performing rotation correction on the pure contract image according to the average tilt angle, and obtaining a positive posture contract image; Step S1420, calculating the perspective transformation matrix according to the coordinates of the four corner points of the normal posture contract image, and performing geometric correction on the normal posture contract image; Step S1430, cropping and normalizing the geometrically corrected positive pose contract image, retaining the effective area of the contract, and adjusting the image size to a uniform size to obtain a high-quality contract image; The method for calculating the tilt angle of the pure contract image includes: ; in: : Average tilt angle of clean contract image; N: the number of selected lines; : The length of the gth straight line; : The angle between the gth straight line and the horizontal axis; Methods for rotation correction of images according to the average tilt angle include: ; in: : The horizontal coordinate of the pixel in the pure contract image; : The vertical coordinate of the pixel in the clean contract image; : The horizontal coordinate of the pixel in the clean contract image after rotation correction; : The vertical coordinate of the pixel in the clean contract image after rotation correction; The step S2000 includes: Step S2100: Locally segment the high-quality contract image, calculate the local density and aspect ratio of each local image; set the initial region division rules according to the local density and aspect ratio, and perform initial region division on the high-quality contract image according to the initial region division rules to obtain different types of initial regions; merge the initial regions with the same type and adjacent in space to form content sub-domains; The method for setting the initial region division rules according to the local density and aspect ratio includes: Title region: local density D > 0.8 and aspect ratio R > 5; Body text region: local density 0.2 < D < 0.8 and aspect ratio 1 < R < 3; Table region: local density D > 0.5 and aspect ratio 0.8 < R < 1.2; Signature region: local density D > 0.8 and aspect ratio 0.5 < R < 2; Step S2200: Collect the domain appearance features of the content sub-domains, and classify the content sub-domains according to the domain appearance features of the content sub-domains; the domain appearance features of the content sub-domains include position features, size features, and shape features; the method for classifying the content sub-domains uses pattern recognition, constructs a feature vector according to the domain appearance features of the content sub-domains, and then uses a classification algorithm for classification; Step S2300: Calculate the accuracy threshold for the classification of the content sub-domains, and determine whether the classification result of the content sub-domains is greater than or equal to the accuracy threshold. If it is greater than or equal to the accuracy threshold, go to step S3000; if it is less than the accuracy threshold, adjust the initial region division rules, return to step S2100, and re-divide the content sub-domains; The method for calculating the accuracy threshold for the classification of the content sub-domains includes: Set an initial accuracy threshold ; Statistical analysis is performed on the results of each classification, and the number of correctly classified content sub-domains and the total number of content sub-domains are recorded; Divide the number of correctly classified content sub-domains by the total number of content sub-domains to obtain the accuracy A of the current classification; According to the current classification accuracy A and the initial accuracy threshold , obtain the accuracy threshold of the next round of classification; ; Among them: : The accuracy threshold of the next round of classification; : Adjustment coefficient of accuracy threshold; The accuracy threshold for the current classification is calculated from the accuracy and accuracy threshold of the previous round, and the accuracy threshold for the next round of classification is used for the accuracy judgment in the next round of classification process.
2. The method for extracting key information of non-performing asset contracts using OCR technology according to claim 1, characterized in that: The said step S3000 includes: Step S3100: Perform OCR recognition on each content sub-domain respectively according to the classification result of the content sub-domain to obtain the text information within the content sub-domain; Step S3200: Design contract key information extraction rules, and extract contract key information from the text information recognized within the content sub-domain according to the contract key information extraction rules; Step S3300: Set the contract key information integrity standard, and determine whether the contract key information is complete according to the contract key information integrity standard. If it is complete, go to step S4000; if it is not complete, adjust the contract key information extraction rules, transfer to step S3200, and re-extract the contract key information; The said step S4000 includes: Step S4100: Judge the front-back relationship and attribution relationship between each page according to the header and footer information of the contract; Step S4200: Design cross-page association rules, and judge whether the contract key information on different pages belongs to the same contract key information according to the cross-page association rules; Step S4300, designing cross-page merging rules, and generating cross-page complete key information from the contract key information on different pages according to the cross-page merging rules; Step S4400, performing consistency check and continuity check on the cross-page complete key information, and marking and processing the cross-page complete key information that fails the check.
3. A system for extracting key information of non-performing asset contracts using OCR technology, which is used to implement the method for extracting key information of non-performing asset contracts using OCR technology as described in any one of claims 1-2, characterized in that it includes: Contract image acquisition module: used to acquire the electronic document of the non-performing asset contract and convert the electronic document into a contract image; Contract image preprocessing module: used to perform denoising, binarization, rotation correction and geometric correction on the contract image collected by the image acquisition module to obtain high-quality contract images; Contract image segmentation module: used to perform local segmentation on high-quality contract images, calculate the local density and aspect ratio of each local image, and divide the high-quality contract images into different content subdomains according to the local density and aspect ratio; Content subdomain classification module: used to collect content subdomain features and classify content subdomains according to the content subdomain features; Accuracy verification module: used to calculate the accuracy threshold of content subdomain classification and determine whether the content subdomain classification result meets the accuracy requirement; Key information extraction module: used to design contract key information extraction rules and extract contract key information from content subdomains according to the contract key information extraction rules; Cross-page information association module: used to associate the contract key information on different pages across pages and generate complete cross-page key information; Data storage and management module: used to store complete key information across pages into a structured database, and establish a mapping relationship between complete key information across pages and non-performing asset contract documents.
4. An electronic device comprising a memory, a central processing unit, and a computer program stored in the memory and executable on the central processing unit, characterized in that: When the central processing unit executes the computer program, it implements the method of extracting key information of non-performing asset contracts using OCR technology as described in any one of claims 1-2.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed, implements the method for extracting key information of non-performing asset contracts using OCR technology as described in any one of claims 1-2.
