A contract document processing method, device, computer equipment and storage medium
By identifying and cutting contract pictures, extracting features and generating marking information, the problem of low efficiency in contract file photo classification and marking in contract management is solved, and efficient management of contract pictures is achieved.
Patent Information
- Application Number
- CN202411322504.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-20
AI Technical Summary
In the contract management scenario, the original contract documents are difficult to directly manage, resulting in low efficiency in classification and labeling of contract documents after taking photos, and it is impossible to manage quickly and accurately.
By obtaining the contract picture collection, identifying and extracting the characteristics of each contract picture, determining the page category and contract type, cutting the contract picture group, extracting target text information, adjusting the picture position, generating sub-documents marked with contract type and directory information, using The trained image processing model is used for feature extraction and classification.
Automatic classification and marking of multiple contract pictures is realized, the efficiency of contract management is improved, and the contract picture groups under each contract type can be accurately obtained.
Smart Images

Figure CN118840084B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a contract document processing method, apparatus, computer equipment and storage medium. Background Art
[0002] In some contract management scenarios, it is not possible to directly manage the original contract documents. Instead, you can take a photo of the original contract documents to obtain the contract document photos, and then manage the contract document photos. Usually, the contract document photos taken after taking a photo of the original contract documents are usually gathered together. It is difficult to quickly classify and mark the contract document photos manually, resulting in low efficiency in the management of contract document photos. Summary of the invention
[0003] The embodiments of the present disclosure at least provide a contract document processing method, apparatus, computer equipment and storage medium.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for processing a contract document, including:
[0005] Acquire a contract image set corresponding to a single contract document; the contract document is formed by integrating multiple original contracts; the contract image set includes at least one contract image of each of the multiple original contracts; each of the contract images corresponds to a contract page;
[0006] Identify each contract image in the contract image set to obtain image features of each contract image;
[0007] Based on the image features of each of the contract images, determine the page category of each of the contract images and the contract type to which each of the contract images belongs;
[0008] According to the page categories of the contract images and the contract types to which the contract images belong, the contract image collection is cut according to the order of the contract images in the contract document to obtain cut contract image groups, and the processed contract information is determined based on the contract image groups; each contract image group includes contract images of multiple page categories under the same contract type.
[0009] In an optional implementation, before identifying each contract image in the contract image set and obtaining image features of each contract image, the method further includes:
[0010] Performing angle detection on each of the contract pictures to obtain content angle information of each of the contract pictures;
[0011] When the content angle information of the contract image indicates that the content arrangement direction in the contract image is not in the standard arrangement direction, the contract image is subjected to angle rotation processing so that the content arrangement direction is consistent with the standard arrangement direction.
[0012] In an optional implementation, after obtaining the cut contract image group and before determining each processed contract information based on the contract image group, the method further includes:
[0013] Extracting target text information of each contract picture in each contract picture group;
[0014] Based on the target text information of each of the contract images, determining whether there is a first contract image containing seal information and signature information among the contract images;
[0015] If it does not exist, then determine the first contract picture that contains the seal information and signature information and is located closest to the last contract picture among the other contract pictures after the last contract picture based on the order of the contract pictures in the contract picture set and the position information of the last contract picture in the contract picture group, and adjust the first contract picture to the contract picture group.
[0016] In an optional implementation, the adjacent contract picture groups after cutting include contract picture groups with the same contract type;
[0017] After obtaining the cut contract image group, and before determining each processed contract information based on the contract image group, the method further includes:
[0018] For each contract picture group with the same contract type, extract the first key text information in each contract picture group, and compare whether the first key text information in each contract picture group is consistent;
[0019] If they are inconsistent, then determine the second key text information missing from the target contract image group;
[0020] Determining a target page category of the contract image missing from the target contract image group based on the second key text information missing from the target contract image group and the contract type of the target contract image group;
[0021] From other contract picture groups adjacent to the target contract picture group and of the same contract type, search to see whether there is a second contract picture of the target page category adjacent to the target contract picture group; if so, adjust the second contract picture to the target contract picture group.
[0022] In an optional implementation, determining each processed contract information based on the contract image group includes:
[0023] For each contract picture group, extracting the contract information in each contract picture in the contract picture group;
[0024] Based on the contract information, and the contract type and each page category corresponding to the contract image group, a sub-document in a target format is generated to obtain a contract marked with the contract type and directory information; the directory information is obtained based on each page category.
[0025] In an optional implementation, identifying each contract image in the contract image set to obtain image features of each contract image includes:
[0026] The contract picture set is input into a trained picture processing model, and each contract picture in the contract picture set is identified using a feature extraction module in the picture processing model to obtain picture features of each contract picture; the network structure of the picture processing model includes: a convolutional layer and a full pooling average layer, and the feature extraction module is a convolutional layer in the network structure.
[0027] In an optional implementation, based on the image features of each contract image, determining the page category of each contract image and the contract type to which each contract image belongs includes:
[0028] The image features of each contract image and the page category information under each contract type are input into the image classification module in the image processing model, and the page category of each contract image and the contract type to which each contract image belongs are determined using the image classification module; the image classification module is the full pooling averaging layer in the network structure.
[0029] In an optional implementation, the trained image processing model is determined according to the following steps:
[0030] Obtain a sample contract image set corresponding to a single sample contract document; the sample contract document is formed by integrating multiple original sample contracts; the sample contract image set includes at least one sample contract image of each sample contract in the multiple sample contracts; each sample contract image corresponds to a contract page; each sample contract image is marked with a page category and a contract type to which it belongs;
[0031] Inputting the sample contract image set into a feature extraction module of the image processing model to be trained to obtain image features of each sample contract image;
[0032] Inputting the image features of each sample contract image into the image classification module of the image processing model to obtain the page category prediction results of each sample contract image and the contract type prediction results to which each sample contract image belongs;
[0033] Based on the page category prediction results of each sample contract image and the contract type prediction results of each sample contract image, the image processing model is adjusted until the trained image processing model is obtained.
[0034] In a second aspect, the present disclosure also provides a contract document processing device, including:
[0035] An acquisition module, used to acquire a contract image set corresponding to a single contract document; the contract document is formed by integrating multiple original contracts; the contract image set includes at least one contract image of each of the multiple original contracts; each of the contract images corresponds to a contract page;
[0036] An identification module, used to identify each contract image in the contract image set to obtain image features of each contract image;
[0037] A first determination module, configured to determine, based on the image features of each contract image, the page category of each contract image and the contract type to which each contract image belongs;
[0038] A cutting module is used to cut the contract image collection in the order of the contract images in the contract document according to the page categories of the contract images and the contract types to which the contract images belong, to obtain cut contract image groups, and determine the processed contract information based on the contract image groups; each contract image group includes contract images of multiple page categories under the same contract type.
[0039] In a third aspect, an embodiment of the present disclosure further provides a computer device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are performed.
[0040] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are executed.
[0041] The contract document processing method provided by the embodiment of the present disclosure can obtain the image features of each contract image in the contract image collection after obtaining the contract image collection corresponding to a single contract document, and then can determine the page category of each contract image and the contract type to which each contract image belongs based on the image features of each contract image, and then can cut the contract image collection according to the order of the contract images in the contract document according to the page category of each contract image and the contract type to which each contract image belongs, and obtain the cut contract image group, and then determine the processed contract information according to the contract image group. Through the above method, based on the image features of the obtained contract images, the contract images in the contract image collection can be quickly classified and marked, and the contract image groups under each contract type can be accurately obtained, and then the processed contract information can be obtained, thereby improving the efficiency of contract management.
[0042] For a description of the effects of the above-mentioned contract document processing apparatus, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned contract document processing method, which will not be repeated here.
[0043] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0045] Figure 1 A flowchart of a contract document processing method provided by an embodiment of the present disclosure is shown;
[0046] Figure 2 A schematic diagram showing the structure of an image classification module in an image processing model provided in an embodiment of the present disclosure is shown;
[0047] Figure 3 A schematic diagram showing a cut contract picture group provided by an embodiment of the present disclosure is shown;
[0048] Figure 4 A schematic diagram of the structure of a contract document processing device provided by an embodiment of the present disclosure is shown;
[0049] Figure 5A schematic diagram of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0051] According to research, in some contract management scenarios, for example, when a project contract reviewer reviews a contract in a construction project, it is not possible to directly take away the original contract documents in the construction project for review. Instead, the original contract documents can be photographed to obtain photos of the contract documents, and then the photos of the contract documents can be reviewed. Usually, the photos of the contract documents taken after the original contract documents are photographed are gathered together, and the classification and marking of these photos of contract documents is often done manually. When there are many photos of contract documents, it is difficult to quickly classify and mark the photos of contract documents manually, resulting in low management efficiency of the photos of contract documents.
[0052] Based on this, the present disclosure provides a contract document processing method, including: obtaining a contract image set corresponding to a single contract document; the contract document is integrated from multiple original contracts; the contract image set includes at least one contract image of each contract in the multiple original contracts; each of the contract images corresponds to a contract page; identifying each contract image in the contract image set to obtain the image features of each contract image; based on the image features of each contract image, determining the page category of each contract image and the contract type to which each contract image belongs; according to the page category of each contract image and the contract type to which each contract image belongs, cutting the contract image set according to the order of the contract images in the contract document to obtain the cut contract image group, determining the processed contract information based on the contract image group; each contract image group includes contract images of multiple page categories under the same contract type. Through the above method, the contract image set corresponding to the integrated multiple original contracts can be accurately and automatically classified, and the contract image groups under each contract type can be quickly obtained, thereby improving the management efficiency of the contract.
[0053] The defects existing in the above schemes and the proposed solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0054] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0055] To facilitate understanding of this embodiment, a contract document processing method disclosed in the embodiment of the present disclosure is first introduced in detail. The executor of the contract document processing method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities.
[0056] See also Figure 1 FIG. 1 is a flowchart of a contract document processing method provided by an embodiment of the present disclosure, wherein the method includes S101 to S104, wherein:
[0057] S101: Obtain a contract image set corresponding to a single contract document; the contract document is integrated from multiple original contracts; the contract image set includes at least one contract image of each of the multiple original contracts; each of the contract images corresponds to a contract page.
[0058] S102: Identify each contract image in the contract image set to obtain image features of each contract image.
[0059] S103: Based on the image features of each contract image, determine the page category of each contract image and the contract type to which each contract image belongs.
[0060] S104: According to the page categories of the contract images and the contract types to which the contract images belong, the contract image collection is cut according to the order of the contract images in the contract document to obtain cut contract image groups, and the processed contract information is determined based on the contract image groups; each contract image group includes contract images of multiple page categories under the same contract type.
[0061] In the disclosed embodiments, the original contract may include an electronic contract or a paper contract. A single contract document may be formed by integrating multiple original contracts. Exemplarily, multiple original contracts may be integrated together in the order in which the original contracts were obtained, in the order in which the original contracts were signed, or randomly. The integration method of the original contracts may not be specifically limited.
[0062] At least one contract page of each original contract in a single contract document may be photographed or scanned in any feasible manner to obtain a contract image corresponding to each contract page. The set of these contract images is the contract image set corresponding to the single contract document.
[0063] In order to improve the accuracy of the classification of contract pictures, in some embodiments, the contract pictures in the contract picture set may be subjected to denoising. For example, a bilateral filtering algorithm and a deep learning algorithm may be used to remove noise from the contract pictures and enhance the details in the contract pictures. Grayscale conversion, color space conversion, edge enhancement technology, etc. may also be used to improve the contrast, brightness, and color value of the contract pictures.
[0064] In actual situations, there may be contract pictures with deflected shooting angles, resulting in the content in the contract picture not being in the same arrangement direction as the content in other contract pictures. Therefore, in order to improve the accuracy of the classification of contract pictures, in some embodiments, the angle of the contract picture can also be corrected.
[0065] In one embodiment, before identifying each contract image in a contract image set and obtaining the image features of each contract image, it may also include: performing angle detection on each contract image to obtain content angle information of each contract image; when the content angle information of the contract image indicates that the content arrangement direction of the contract image is not in the standard arrangement direction, performing angle rotation processing on the contract image to make the content arrangement direction of the contract image consistent with the standard arrangement direction.
[0066] In the above implementation, the trained angle detection model can be used to perform angle detection on the contract image. The trained angle detection model can be obtained by training using sample contract images annotated with content angle information. The trained angle detection model can predict the content angle information in each contract image. The content angle information may include the angle information between the content arrangement direction in the contract image and the standard arrangement direction. Among them, the standard arrangement direction may include the direction in which the content in the contract image should be arranged when the contract image is identified.
[0067] Exemplarily, for example, when identifying a contract image, the content in the contract image should be arranged from top to bottom. If the content angle information in the contract image is 0 degrees, the content angle information can indicate that the content arrangement direction in the contract image is in the standard arrangement direction. If the content angle information in the contract image is 90 degrees, the content angle information can indicate that the content arrangement direction in the contract image is perpendicular to the standard arrangement direction. In the case where the content angle information of the contract image indicates that the content arrangement direction in the contract image is not in the standard arrangement direction, the contract image needs to be rotated to make the content arrangement direction of the contract image consistent with the standard arrangement direction.
[0068] After identifying each contract image in the contract image set, the image features of each contract image can be obtained.
[0069] In the disclosed embodiment, the image features may include font size, number of characters, area of blank area, arrangement of characters, seal information, signature information, key text information, etc.
[0070] After obtaining the image features of each contract image, the page category of each contract image and the contract type to which each contract image belongs can be determined based on the image features.
[0071] In the disclosed embodiment, the page categories of the contract image may include a cover page, a home page, a directory page, a content page, and a last page.
[0072] Here, the contract image with larger font, fewer words and larger blank area can be determined as the cover; the contract image containing a text list can be determined as the directory page; the contract image containing seal information and signature information can be determined as the last page; the contract image containing keywords such as Party A, Party B, project name, etc. can be determined as the last page; and the contract image with more text content can be determined as the content page.
[0073] The contract type to which the contract image belongs may be a preset contract type, for example, may include a project construction contract, an equipment purchase contract, and a real estate contract.
[0074] In a specific implementation, the page category of each contract image can be determined according to the image features. According to the page category of each contract image, the contract type to which each contract image belongs can be determined.
[0075] The page categories included in contracts of different contract types may be different. For example, a project construction contract may include a cover page, a directory page, a first page, a content page, and a last page; an equipment purchase contract may include a cover page, a first page, a content page, and a last page; and a real estate contract may include a first page, a content page, and a last page.
[0076] In the disclosed embodiment, the contract images in the contract image collection are arranged according to the order of the contract images in the contract document, and during identification, they are also identified according to the order of the contract images in the contract document. In this way, which contract images belong to the same contract is fixed, and the contract type to which each contract image belongs can be determined based on the page categories contained in the contracts of each contract type and the page categories of each contract image.
[0077] In the disclosed embodiment, the image processing model may be used to obtain the image features of each contract image, the page category, and the contract type to which each contract image belongs.
[0078] In one embodiment, a contract picture set can be input into a trained picture processing model, and a feature extraction module in the picture processing model is used to identify each picture in the contract picture set to obtain picture features of each contract picture; the network structure of the picture processing model includes a convolutional layer and a full pooling average layer; the feature extraction module includes a convolutional layer in the network structure.
[0079] In the disclosed embodiment, the feature extraction module, i.e., the convolution layer in the network structure, may include multiple convolution kernels, each of which may extract different features. Through the multiple convolution kernels, all features of the contract image may be extracted. The number of convolution kernels may not be specifically limited here.
[0080] In one implementation, the image features of each contract image and the page category information under each contract type can be input into an image classification module in an image processing model. The image classification module is used to determine the page category of each contract image and the contract type to which each contract image belongs. The image classification module includes a fully pooled averaging layer in the network structure.
[0081] like Figure 2 A structural schematic diagram of the image classification module in the image processing model is shown. Figure 2The image classification module includes an embedding unit, an encoder unit, a pooling unit, and a decoder unit. The embedding unit is used to convert the image features of the input contract image into a feature vector through an embedding layer. The encoder unit may include a bidirectional long short-term memory network and a self-attention mechanism. The bidirectional long short-term memory network can obtain the context information in the feature vector. The self-attention mechanism can calculate the correlation (or weight) between each feature vector and all other feature vectors in the feature vector sequence, thereby obtaining the key feature vector in the feature vector. The pooling unit can be used to average pool the output of the self-attention mechanism to generate a key feature vector of a fixed length. The decoder unit may include a multilayer perceptron, which can be used to convert the key feature vector of a fixed length into a feature vector of a label size (here, the size of the label), and finally output a label (page category or contract type).
[0082] In one implementation, the trained image processing model may be determined according to the following steps:
[0083] Step 1: Obtain a set of sample contract images corresponding to a single sample contract document; the sample contract document is integrated from multiple sample contracts; the sample contract image set includes at least one sample contract image of each of the multiple sample contracts; each sample contract image corresponds to a contract page; each sample contract image is marked with a page category and the contract type to which it belongs.
[0084] Step 2: Input the sample contract image set into the feature extraction module of the image processing model to be trained to obtain the image features of each sample contract image.
[0085] Step 3: Input the image features of each sample contract image into the image classification module of the image processing model to obtain the page category prediction results of each sample contract image and the contract type prediction results to which each sample contract image belongs.
[0086] Step 4: Based on the page category prediction results of each sample contract image and the contract type prediction results of each sample contract image, adjust the parameters of the image processing model until a trained image processing model is obtained.
[0087] In the above process, the page category and the contract type in each sample contract image may be manually marked or marked by other means, and no specific limitation is made here.
[0088] The above-mentioned image processing model can be obtained after a preset number of rounds of training, or when the page category prediction results of the sample contract images and the contract type prediction results to which each sample contract image belongs meet preset requirements.
[0089] After obtaining the page category of each contract image and the contract type to which each contract image belongs, the contract image collection can be cut according to the order of the contract images in the contract document according to the page category of each contract image and the contract type to which each contract image belongs, and consecutive contract image groups belonging to the same contract type can be divided together to obtain the cut contract image groups.
[0090] In the disclosed embodiment, each contract image in the contract image set is arranged in the order of the contract pages of each contract in the contract document. Here, by cutting the contract images according to the order in the contract document, the contract images contained in the obtained contract image group are the contract images corresponding to the contract pages in the same contract. Each contract image group includes contract images of multiple page categories under the same contract type. That is, each contract image group includes contract images corresponding to the contract pages of a contract. For example, a contract image group may include the cover, directory page, first page, content page and last page under the project construction contract.
[0091] Under normal circumstances, the last contract image of each contract image group should be the last page, indicating that the contract has ended. However, in actual situations, there may be contract images with incorrect cutting in the contract image groups, for example, the last page in the current contract image group is cut into the next contract image group. This may be caused by the image processing model's incorrect identification and classification of contract images. Based on this, the contract images in each contract image group can be verified to ensure that each contract image group contains the last page.
[0092] In one embodiment, after obtaining the cut contract image group and before determining the processed contract information based on the contract image group, it may also include: extracting the target text information of each contract image in each contract image group; judging whether there is a first contract image containing seal information and signature information in each contract image based on the target text information of each contract image; if not, determining the first contract image containing seal information and signature information among other contract images that are located after the last contract image and are closest to the last contract image according to the order of each contract image in the contract image collection and the position information of the last contract image in the contract image group in the contract image collection, and adjusting the first contract image to the contract image group.
[0093] In the above implementation, the last page of each contract image group may be checked in sequence according to the order of each contract image group.
[0094] In one method, optical character recognition (OCR) technology can be used to extract target text information of each contract image in each contract image group, and then it can be checked whether seal information and signature information exist in the target text information of each contract image.
[0095] The seal information may include an electronic seal or a pressed seal, and the signature information may include an electronic signature or a handwritten signature.
[0096] If there is a first contract image containing seal information and signature information in the contract image group, it can be determined that the contract image group contains the last page.
[0097] If the first contract image containing seal information and signature information does not exist in the contract image group, the first contract image can be searched. Specifically, the order of the contract images in the contract image set and the position information of the last contract image in the contract image set can be used to search from other contract images after the last contract image. If the contract image closest to the last contract image among other contract images after the last contract image contains seal information and signature information, then the contract image is the last page of the contract image group, and the first contract image containing the seal information and signature information among other contract images after the last contract image and closest to the last contract image can be adjusted to the contract image group.
[0098] For contracts of the same contract type, there may be cutting errors. For example, a project construction contract usually contains contract pages of multiple page categories. When multiple project construction contracts are included, it may happen that the contract image group corresponding to a certain project construction contract is missing one or some contract images. In this case, you can search from other contract image groups of the same contract type that are adjacent to the contract image group.
[0099] In one embodiment, the adjacent contract picture groups after cutting include contract picture groups of the same contract type. After obtaining the contract picture groups after cutting, before determining the processed contract information based on the contract picture groups, the following may also be included: for each contract picture group of the same contract type, extract the first key text information in each contract picture group, and compare whether the first key text information in each contract picture group is consistent; if not, determine the second key text information missing from the target contract picture group; based on the second key text information missing from the target contract picture group and the contract type of the target contract picture group, determine the target page category of the contract picture missing from the target contract picture group; from other contract picture groups adjacent to the target contract picture group and of the same contract type, find out whether there is a second contract picture of the target page category adjacent to the target contract picture group, and if so, adjust the second contract picture to the target contract picture group.
[0100] In the above implementation, the first key text information in each contract image group can be extracted using OCR technology. The first key text information may include key field information in the contract, such as project name, Party A, Party B, contract amount, planned start date, planned completion date, number of seals, number of signatures, and other key text information.
[0101] Since the contract types of each contract picture group are the same, that is, the page categories included are also the same, so if there is no cutting error in the contract picture, the first key text information of each contract picture group should be consistent. Here, by comparing whether the first key text information of each contract picture group is consistent, the target contract picture group with missing key text information and the second key text information missing from the target contract picture group can be determined. Then, according to the second key text information missing from the target contract picture group and the contract type of the target contract picture group, the target page category of the contract picture missing from the target contract picture group can be determined.
[0102] The contract image missing from the target contract image group may be located in other contract image groups of the same contract type that are adjacent to the target contract image group. Therefore, it is possible to search from other contract image groups of the same contract type that are adjacent to the target contract image group to see whether there is a second contract image of the target page category that is adjacent to the target contract image group. If so, the second contract image is adjusted to the target contract image group. If not, it is possible to continue to search for a second contract image of the target page category from other contract image groups of the same contract type that are not adjacent to the target contract image group.
[0103] After obtaining each contract image group, each processed contract information can be determined based on the contract image group. In one embodiment, for each contract image group, the contract information in each contract image in the contract image group can be extracted; based on the contract information, and the contract type and each page category corresponding to the contract image group, a sub-document in the target format is generated to obtain a contract marked with the contract type and directory information; the directory information is obtained based on each page category.
[0104] In the above implementation, the contract information may include text information and picture information in the contract picture, etc. The contract information may be all or part of the information in the contract picture.
[0105] Here, for each contract image in the contract image group, based on the contract information and page category of each contract image, a page document corresponding to each contract image can be generated. Each page document can be generated in the format of the page category of the corresponding contract image. Finally, according to the contract type corresponding to the contract image group, the document corresponding to each contract image, and the page category of each contract image, a sub-document in the target format can be generated. The sub-document can include each page document, and each page document is arranged in the order of the contract images in the contract image group. The sub-document can be marked with the contract type and the directory information obtained based on each page category, so as to obtain each contract.
[0106] like Figure 3 A schematic diagram showing a cut contract picture group is shown. Figure 3 It is shown that the contract picture group after cutting includes the contract picture group corresponding to the project construction contract 1, the contract picture group corresponding to the project construction contract 2, the contract picture group corresponding to the equipment purchase contract 1, and the contract picture group corresponding to the real estate contract 1. The contract picture group corresponding to the project construction contract 1 may include the cover, directory page, first page, content page, and last page; the contract picture group corresponding to the project construction contract 2 may include the first page, content page, and last page; the contract picture group corresponding to the equipment purchase contract 1 may include the cover, first page, content page, and last page; the contract picture group corresponding to the real estate contract 1 may include the first page, content page, and last page. Figure 3 It can be seen that Project Construction Contract 1 and Project Construction Contract 2 are contracts of different contract types.
[0107] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0108] Based on the same inventive concept, a contract document processing device corresponding to the contract document processing method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned contract document processing method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0109] Reference Figure 4 FIG. 1 is a schematic diagram of a structure of a contract document processing device provided by an embodiment of the present disclosure, wherein the device comprises:
[0110] The acquisition module 401 is used to acquire a contract image set corresponding to a single contract document; the contract document is formed by integrating multiple original contracts; the contract image set includes at least one contract image of each of the multiple original contracts; each of the contract images corresponds to a contract page;
[0111] The identification module 402 is used to identify each contract picture in the contract picture set to obtain the picture features of each contract picture;
[0112] A first determination module 403, configured to determine the page category of each contract image and the contract type to which each contract image belongs based on the image features of each contract image;
[0113] The cutting module 404 is used to cut the contract image collection in the order of the contract images in the contract document according to the page categories of the contract images and the contract types to which the contract images belong, to obtain cut contract image groups, and determine the processed contract information based on the contract image groups; each contract image group includes contract images of multiple page categories under the same contract type.
[0114] In an optional implementation, before the recognition module performs the step of recognizing each contract picture in the contract picture set to obtain the picture features of each contract picture, the device further includes:
[0115] A detection module, used to perform angle detection on each of the contract pictures to obtain content angle information of each of the contract pictures;
[0116] A rotation module is used to perform angle rotation processing on the contract image when the content angle information of the contract image indicates that the content arrangement direction in the contract image is not in the standard arrangement direction, so as to make the content arrangement direction consistent with the standard arrangement direction.
[0117] In an optional implementation, after the cutting module executes the step of obtaining the cut contract image group and before executing the step of determining each processed contract information based on the contract image group, the device further includes:
[0118] A first extraction module, used to extract target text information of each contract picture in each contract picture group;
[0119] A judgment module, used for judging whether there is a first contract image containing seal information and signature information among the contract images based on the target text information of the contract images;
[0120] The first adjustment module is used to determine, if it does not exist, the first contract picture that contains the seal information and signature information and is located closest to the last contract picture among the other contract pictures after the last contract picture, based on the order of the contract pictures in the contract picture set and the position information of the last contract picture in the contract picture set, and adjust the first contract picture to the contract picture group.
[0121] In an optional implementation, the adjacent contract picture groups after cutting include contract picture groups with the same contract type;
[0122] After the cutting module executes the step of obtaining the cut contract picture group, and before executing the step of determining each piece of processed contract information based on the contract picture group, the device further includes:
[0123] A second extraction module is used to extract the first key text information in each contract picture group with the same contract type, and compare whether the first key text information in each contract picture group is consistent;
[0124] A second determination module, for determining the second key text information missing from the target contract image group if there is any inconsistency;
[0125] A third determination module is used to determine the target page category of the contract image missing from the target contract image group based on the second key text information missing from the target contract image group and the contract type of the target contract image group;
[0126] The second adjustment module is used to search from other contract picture groups adjacent to the target contract picture group and of the same contract type to see whether there is a second contract picture of the target page category adjacent to the target contract picture group; if so, adjust the second contract picture to the target contract picture group.
[0127] In an optional implementation, the cutting module 404 is specifically used for:
[0128] For each contract picture group, extracting the contract information in each contract picture in the contract picture group;
[0129] Based on the contract information, and the contract type and each page category corresponding to the contract image group, a sub-document in a target format is generated to obtain a contract marked with the contract type and directory information; the directory information is obtained based on each page category.
[0130] In an optional implementation manner, the identification module 402 is specifically configured to:
[0131] The contract picture set is input into a trained picture processing model, and each contract picture in the contract picture set is identified using a feature extraction module in the picture processing model to obtain picture features of each contract picture; the network structure of the picture processing model includes: a convolutional layer and a full pooling average layer, and the feature extraction module is a convolutional layer in the network structure.
[0132] In an optional implementation manner, the first determining module 403 is specifically configured to:
[0133] The image features of each contract image and the page category information under each contract type are input into the image classification module in the image processing model, and the page category of each contract image and the contract type to which each contract image belongs are determined using the image classification module; the image classification module is the full pooling averaging layer in the network structure.
[0134] In an optional embodiment, the device further comprises a training module;
[0135] The training module is used to:
[0136] Obtain a sample contract image set corresponding to a single sample contract document; the sample contract document is formed by integrating multiple original sample contracts; the sample contract image set includes at least one sample contract image of each sample contract in the multiple sample contracts; each sample contract image corresponds to a contract page; each sample contract image is marked with a page category and a contract type to which it belongs;
[0137] Inputting the sample contract image set into a feature extraction module of the image processing model to be trained to obtain image features of each sample contract image;
[0138] Inputting the image features of each sample contract image into the image classification module of the image processing model to obtain the page category prediction results of each sample contract image and the contract type prediction results to which each sample contract image belongs;
[0139] Based on the page category prediction results of each sample contract image and the contract type prediction results of each sample contract image, the image processing model is adjusted until the trained image processing model is obtained.
[0140] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0141] Based on the same technical concept, the embodiment of the present disclosure also provides a computer device. Figure 5 As shown, it is a schematic diagram of the structure of a computer device 500 provided in an embodiment of the present disclosure, including a processor 501, a memory 502, and a bus 503. Among them, the memory 502 is used to store execution instructions, including a memory 5021 and an external memory 5022; the memory 5021 here is also called an internal memory, which is used to temporarily store the operation data in the processor 501, and the data exchanged with the external memory 5022 such as a hard disk. The processor 501 exchanges data with the external memory 5022 through the memory 5021. When the computer device 500 is running, the processor 501 communicates with the memory 502 through the bus 503, so that the processor 501 executes the following instructions:
[0142] Acquire a contract image set corresponding to a single contract document; the contract document is formed by integrating multiple original contracts; the contract image set includes at least one contract image of each of the multiple original contracts; each of the contract images corresponds to a contract page;
[0143] Identify each contract image in the contract image set to obtain image features of each contract image;
[0144] Based on the image features of each of the contract images, determine the page category of each of the contract images and the contract type to which each of the contract images belongs;
[0145] According to the page categories of the contract images and the contract types to which the contract images belong, the contract image collection is cut according to the order of the contract images in the contract document to obtain cut contract image groups, and the processed contract information is determined based on the contract image groups; each contract image group includes contract images of multiple page categories under the same contract type.
[0146] The embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the contract document processing method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0147] The present disclosure also provides a computer program product that carries a program code. The program code includes instructions that can be used to execute the steps of the contract document processing method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0148] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0149] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, 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 through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0150] 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.
[0151] In addition, each functional unit in each embodiment of the present disclosure 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.
[0152] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0153] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be based on the protection scope of the claims.
Claims
1. A contract document processing method, characterized in that: include: Get the contract image collection corresponding to a single contract document; The contract document is integrated from multiple original contracts; the contract image collection includes at least one contract image of each of the multiple original contracts; each of the contract images corresponds to a contract page; Identify each contract image in the contract image set to obtain image features of each contract image; Based on the image features of each of the contract images, determine the page category of each of the contract images and the contract type to which each of the contract images belongs; According to the page categories of the contract images and the contract types to which the contract images belong, the contract image set is cut according to the order of the contract images in the contract document to obtain cut contract image groups, and the processed contract information is determined based on the contract image groups; each contract image group includes contract images of multiple page categories under the same contract type; After obtaining the cut contract image group, and before determining the processed contract information based on the contract image group, the method further includes: Extracting target text information of each contract picture in each contract picture group; Based on the target text information of each of the contract images, determining whether there is a first contract image containing seal information and signature information among the contract images; If it does not exist, then determine the first contract picture that contains the seal information and signature information and is located closest to the last contract picture among the other contract pictures after the last contract picture based on the order of the contract pictures in the contract picture set and the position information of the last contract picture in the contract picture group, and adjust the first contract picture to the contract picture group.
2. The contract document processing method according to claim 1, characterized in that: Before identifying each contract picture in the contract picture set and obtaining picture features of each contract picture, the method further includes: Performing angle detection on each of the contract pictures to obtain content angle information of each of the contract pictures; When the content angle information of the contract image indicates that the content arrangement direction in the contract image is not in the standard arrangement direction, the contract image is subjected to angle rotation processing so that the content arrangement direction is consistent with the standard arrangement direction.
3. The contract document processing method according to claim 1, characterized in that: The adjacent contract image groups after cutting include contract image groups with the same contract type; After obtaining the cut contract image group, and before determining each processed contract information based on the contract image group, the method further includes: For each contract picture group with the same contract type, extract the first key text information in each contract picture group, and compare whether the first key text information in each contract picture group is consistent; If they are inconsistent, then determine the second key text information missing from the target contract image group; Determining a target page category of the contract image missing from the target contract image group based on the second key text information missing from the target contract image group and the contract type of the target contract image group; From other contract picture groups adjacent to the target contract picture group and of the same contract type, search to see whether there is a second contract picture of the target page category adjacent to the target contract picture group; if so, adjust the second contract picture to the target contract picture group.
4. The contract document processing method according to claim 1, characterized in that: Determine the processed contract information based on the contract image group, including: For each contract picture group, extracting the contract information in each contract picture in the contract picture group; Based on the contract information, and the contract type and each page category corresponding to the contract image group, a sub-document in a target format is generated to obtain a contract marked with the contract type and directory information; the directory information is obtained based on each page category.
5. The contract document processing method according to claim 1, characterized in that: Identify each contract image in the contract image set to obtain image features of each contract image, including: The contract picture set is input into a trained picture processing model, and each contract picture in the contract picture set is identified using a feature extraction module in the picture processing model to obtain picture features of each contract picture; the network structure of the picture processing model includes: a convolutional layer and a full pooling average layer, and the feature extraction module is a convolutional layer in the network structure.
6. The contract document processing method according to claim 5, characterized in that: Determining the page category of each contract image and the contract type to which each contract image belongs based on the image features of each contract image includes: The image features of each contract image and the page category information under each contract type are input into the image classification module in the image processing model, and the page category of each contract image and the contract type to which each contract image belongs are determined using the image classification module; the image classification module is the full pooling averaging layer in the network structure.
7. The contract document processing method according to claim 5 or 6, characterized in that: The trained image processing model is determined according to the following steps: Obtain a sample contract image set corresponding to a single sample contract document; the sample contract document is formed by integrating multiple original sample contracts; the sample contract image set includes at least one sample contract image of each sample contract in the multiple sample contracts; each sample contract image corresponds to a contract page; each sample contract image is marked with a page category and a contract type to which it belongs; Inputting the sample contract image set into a feature extraction module of the image processing model to be trained to obtain image features of each sample contract image; Inputting the image features of each sample contract image into the image classification module of the image processing model to obtain the page category prediction results of each sample contract image and the contract type prediction results to which each sample contract image belongs; Based on the page category prediction results of each sample contract image and the contract type prediction results of each sample contract image, the image processing model is adjusted until the trained image processing model is obtained.
8. A contract document processing device, characterized in that: include: An acquisition module is used to obtain a collection of contract images corresponding to a single contract document; The contract document is integrated from multiple original contracts; the contract image collection includes at least one contract image of each of the multiple original contracts; each of the contract images corresponds to a contract page; An identification module, used to identify each contract image in the contract image set to obtain image features of each contract image; A first determination module, configured to determine, based on the image features of each contract image, the page category of each contract image and the contract type to which each contract image belongs; a cutting module, configured to cut the contract image set in the order of the contract images in the contract document according to the page categories of the contract images and the contract types to which the contract images belong, to obtain cut contract image groups, and determine the processed contract information based on the contract image groups; each contract image group includes contract images of multiple page categories under the same contract type; A first extraction module, used to extract target text information of each contract picture in each contract picture group; A judgment module, used for judging whether there is a first contract image containing seal information and signature information among the contract images based on the target text information of the contract images; The first adjustment module is used to determine, if it does not exist, the first contract picture that contains the seal information and signature information and is located closest to the last contract picture among the other contract pictures after the last contract picture, based on the order of the contract pictures in the contract picture set and the position information of the last contract picture in the contract picture set, and adjust the first contract picture to the contract picture group.
9. A computer device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the contract document processing method as described in any one of claims 1 to 7 are performed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the contract document processing method as described in any one of claims 1 to 7.