Single / multi-page file mixed scanning and automatic merging method based on AI classification
By building a FastText-based AI classification module and OCR technology, it automatically identifies and merges single page and multi-page attachments, solving the problems of inefficient scanning efficiency and manual operation dependence in the existing technology, and achieving fully automated file scanning and storage.
Patent Information
- Application Number
- CN202510283812.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-08-08
AI Technical Summary
Existing electronic imaging systems cannot batch scan multi-page attachments, and the association of multi-page attachments requires manual operation, which cannot achieve automation and efficiency improvement.
Using an AI classification method, an AI classification module is built through the FastText model, an OCR technology is used to transform image files into text data, and a text classification model is used to automatically identify single page or multi-page data to realize automatic merging and storage of attachments.
It realizes automatic hybrid scanning merging of single page and multi-page attachments, improves file scanning efficiency, and realizes fully automated file recognition and stored procedures.
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data processing technology, and in particular relates to a method for automatic merging of mixed scanning of single / multi-page files based on AI classification. Background Art
[0002] With the gradual maturity of the financial shared service model and the development of artificial intelligence technology, it is necessary to deeply apply electronic image scanning technology to achieve paperless office and full automation of the review process for business document approval.
[0003] Electronic images serve as the basis for financial audits, and each electronic image file is associated with an approval document. As the source for converting paper attachments into electronic images, an electronic image scanning system must at least meet the following functions or steps: 1. Scan and store, 2. Associate with documents, and 3. AI-powered analysis.
[0004] In some companies, electronic images only have a storage function, that is, the front desk staff will take photos of paper attachments by themselves, merge multiple pages of attachments by themselves, and upload the bill of lading. The electronic image can directly store these attachments. This type of situation is not within the scope of this patent. This patent mainly discusses business situations where the electronic imaging system needs to complete the scanning and storage of paper attachments, that is, the attachments of the bill of lading person are handed over to the image scanner in batches by mail or on-site transfer, and the image scanner converts the paper attachments into electronic attachments through the electronic imaging system.
[0005] Traditional electronic images often need to be scanned and stored one by one, and cannot be completed in batches. For multi-page attachments (such as contracts), they are treated like single-page attachments, with each page scanned as a separate file and then stored. The association between different pages of multi-page attachments requires manual operation to merge them into a single file. Or even no operation is performed. When each page is allowed to be stored as a file, it is impossible to introduce any AI capabilities to optimize business or improve energy efficiency for such business flows.
[0006] Later electronic imaging systems could use manual addition of multi-page segmentation codes before scanning to achieve semi-automatic batch mixed scanning of single-page / multi-page attachments and merge multi-page attachments into one file. Summary of the Invention
[0007] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a method for automatic merging of single / multi-page file mixed scanning based on AI classification. The method of the present invention automatically completes the recognition, scanning and merged storage of attachments during the file scanning stage through the setting of a text classification model, thereby improving the efficiency of file scanning and realizing mixed scanning of single-page and multi-page attachments.
[0008] In order to achieve the above invention purpose, the technical solution provided by the present invention is as follows:
[0009] A method for automatically merging mixed scanning of single / multi-page documents based on AI classification, the method specifically comprising the following steps:
[0010] S1, builds an AI classification module, which is the FastText model;
[0011] S2, divide the labeled image data into training data and test data, and divide it into training set and test set;
[0012] S3, converts the image file data of the training set and test set into text data through OCR technology;
[0013] S4, using the FastText classification algorithm to build a FastText model, input the converted text data in the training set into the FastText model to train the corresponding text classification model;
[0014] S5, placing the document to be scanned into the scanner for scanning, and the scanner scans the document text to obtain image data of the attachment;
[0015] S6. The image data obtained by scanning is input into the AI classification module. The text classification model in the AI classification module identifies the image data and determines whether the image data is single-page data or multi-page data. The single-page data is directly stored after scanning, and the multi-page data is merged into one file and then stored, completing the mixed scanning and storage of single-page data and multi-page data.
[0016] Furthermore, the construction of the AI classification module is specifically as follows:
[0017] S11, data preparation, obtains the real image data stored by the user and labels each real image data;
[0018] S12, dividing the labeled image data into training data and test data, that is, dividing it into a training set and a test set;
[0019] S13, converting the image file data of the training set and the test set into text data through OCR technology;
[0020] S14, using the FastText classification algorithm to establish a FastText model, inputting the converted text data in the training set into the FastText model to train a corresponding text classification model.
[0021] Furthermore, the labeling of the real image data includes image data content, image data type and image data keywords.
[0022] Furthermore, the text classification model training is specifically as follows: the text data in the training set is input into the FastText model for training, the text is represented by n-gram features, and the hierarchical softmax and negative sampling techniques are used to accelerate the model training to obtain a text classification model corresponding to the text data.
[0023] Furthermore, after the text classification model training is completed, the text data in the test set is input into the text classification model for model testing. When the test result reaches the set threshold, the training of the text classification model is completed. When the test result does not reach the set threshold, the text classification model is retrained using the training set.
[0024] Furthermore, the document includes multiple attachments, including multi-page attachments and single-page attachments. The first page of each document to be scanned is provided with a QR code containing the approval number, and each document corresponds to a QR code containing the approval number.
[0025] Furthermore, the text classification model classifies the image data specifically as follows:
[0026] S61, calling the scanner interface to obtain all scanned image data;
[0027] S62, the text classification model in the AI classification module performs a classification judgment on each scanned image data to determine whether the first page of the scanned image data is a document. If it is determined to be a document, the mixed attachments in the document are classified;
[0028] S63, when the image data is a single-page attachment, the image data is directly saved;
[0029] S63, when the image data is a multi-page attachment, the text classification model determines that the current page is the first page, last page or middle page of the multi-page attachment. When the current page is the first page or the middle page, the image data is placed in the queue of images to be merged. Until the text classification model determines that the current page being scanned is the last page, the last page is placed in the queue of images to be merged, and all attachments in the queue of images to be merged are merged into one file and stored.
[0030] Furthermore, when the text classification model stores the recognized image data, the data is uploaded to the storage server in the form of a tuple, where the tuple includes the approval order number of each attachment and the scanned image data.
[0031] Based on the above technical solution, the present invention's patented method for automatic merging of single / multi-page mixed scanning files based on AI classification has achieved the following technical advantages through practical application:
[0032] 1. The present invention provides a method for automatic merging of mixed scanning of single / multi-page files based on AI classification. By setting a text classification model, the method automatically completes the identification, scanning and merged storage of attachments during the file scanning stage, thereby improving the efficiency of file scanning and realizing mixed scanning of single-page and multi-page attachments. DETAILED DESCRIPTION
[0033] To make the objectives, technical solutions, and advantages of the present invention more clearly understood, the present invention is described below by way of specific examples. However, it should be understood that these descriptions are merely illustrative and are not intended to limit the scope of the present invention. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the present invention.
[0034] The present invention can also apply a large language classification model to realize the recognition and judgment of image data. The large language model has good semantic understanding ability; using prompt words, it can realize the text classification task of 0 samples; no sample training and testing are required.
[0035] The present invention relates to a method for automatically merging mixed scanning of single-page / multi-page files based on AI classification, which specifically includes the following steps:
[0036] S1, builds an AI classification module, which is the FastText model;
[0037] S2, divide the labeled image data into training data and test data, and divide it into training set and test set;
[0038] S3, converts the image file data of the training set and test set into text data through OCR technology;
[0039] S4, using the FastText classification algorithm to build a FastText model, input the converted text data in the training set into the FastText model to train the corresponding text classification model;
[0040] The present invention can also apply a large language classification model to realize the recognition and judgment of image data. The large language model has good semantic understanding ability. By using prompt words, the text classification task of 0 samples can be realized. No sample training and testing is required.
[0041] S5, placing the document to be scanned into the scanner for scanning, and the scanner scans the document text to obtain image data of the attachment;
[0042] S6. The image data obtained by scanning is input into the AI classification module. The text classification model in the AI classification module identifies the image data and determines whether the image data is single-page data or multi-page data. The single-page data is directly stored after scanning, and the multi-page data is merged into one file and then stored, completing the mixed scanning and storage of single-page data and multi-page data.
[0043] Furthermore, the construction of the AI classification module is specifically as follows:
[0044] S11, data preparation, obtains the real image data stored by the user and labels each real image data;
[0045] S12, dividing the labeled image data into training data and test data, that is, dividing it into a training set and a test set;
[0046] S13, converting the image file data of the training set and the test set into text data through OCR technology;
[0047] S14, using the FastText classification algorithm to establish a FastText model, inputting the converted text data in the training set into the FastText model to train a corresponding text classification model.
[0048] The labeling of the real image data includes the content of the image data, the type of image data and the keywords of the image data.
[0049] The text classification model training is specifically as follows: the text data in the training set is input into the FastText model for training, the text is represented by n-gram features, and the hierarchical softmax and negative sampling techniques are used to accelerate the model training to obtain a text classification model corresponding to the text data.
[0050] After the text classification model training is completed, the text data in the test set is input into the text classification model for model testing. When the test result reaches the set threshold, the training of the text classification model is completed. When the test result does not reach the set threshold, the text classification model is retrained using the training set.
[0051] The document includes multiple attachments, including multi-page attachments and single-page attachments. The first page of each document to be scanned is provided with a QR code containing the approval number, and each document corresponds to a QR code containing the approval number.
[0052] The text classification model classifies image data specifically as follows:
[0053] S61, calling the scanner interface to obtain all scanned image data;
[0054] S62, the text classification model in the AI classification module performs a classification judgment on each scanned image data to determine whether the first page of the scanned image data is a document. If it is determined to be a document, the mixed attachments in the document are classified;
[0055] S63, when the image data is a single-page attachment, the image data is directly saved;
[0056] S63, when the image data is a multi-page attachment, the text classification model determines that the current page is the first page, last page or middle page of the multi-page attachment. When the current page is the first page or the middle page, the image data is placed in the queue of images to be merged. Until the text classification model determines that the current page being scanned is the last page, the last page is placed in the queue of images to be merged, and all attachments in the queue of images to be merged are merged into one file and stored.
[0057] When the text classification model stores the recognized image data, the data is uploaded to the storage server in the form of a tuple, where the tuple includes the approval order number of each attachment and the scanned image data.
[0058] When receiving the (approval form number, scanned image data) tuple, a random UUID is generated as the file name; the scanned data is uploaded to the object storage server and a file access URL is generated; the URL is placed in the queue to be parsed; and the (approval form number, scanned image data, file name, file URL) is stored in the database.
[0059] Regarding the three major drawbacks of traditional electronic imaging for multi-page attachment scanning mentioned in the background technology:
[0060] 1) For multi-page attachments, just like single-page attachments, each page is scanned as a separate file and then manually merged;
[0061] 2) Even without merging, a multi-page attachment will always be stored as multiple files in the electronic image system. This makes it very inconvenient for subsequent business operations to use the image;
[0062] 3) Although the manual involvement of the split code method is very low, it still requires manual participation and is not fully automated;
[0063] The present invention proposes an implementation method that supports automatically distinguishing single-page and multi-page attachments when scanning attachments in batches, and outputting multi-page attachments as one file instead of multiple single files, which is convenient for subsequent business use, thereby solving the three drawbacks of the above-mentioned traditional electronic imaging system.
[0064] Example
[0065] For an attachment, there are two classifications involved:
[0066] The first classification requires determining whether the attachment is a single-page attachment or a multi-page attachment;
[0067] If it is a multi-page attachment, it needs to be classified a second time and then judged by 3 tags: first page / middle page / last page;
[0068] If it is the first page, then the attachments scanned subsequently need to be placed in the queue to be merged until the last page is encountered;
[0069] If it is an intermediate page, just put it directly into the queue to be merged;
[0070] If it is the last page, merge the images in the queue to be merged.
[0071] These two classifications can be performed using either traditional models or large language models. Generally, since a large number of samples are available at the client site, this approach is typically adopted for this project. To improve recognition accuracy, users are encouraged to add labels to the homepage, middle pages, and end pages, where possible, to facilitate model recognition. With these labels and sufficient data, traditional models can achieve classification accuracy rates exceeding 99%, often approaching 100%.
[0072] 1. If FastText or other traditional models are used for classification:
[0073] 1) You need to prepare a data set in advance. The more comprehensive the data, the better. The larger the data volume, the better.
[0074] 2) Divide the above dataset into training dataset and test dataset
[0075] 3) Use the training set data to train the FastText model or other traditional classification models
[0076] 4) Use the test set data to evaluate the effectiveness of the model trained in 3). 2. If a large language model is used for classification:
[0077] 1) Use OCR to identify the plain text data in the image file
[0078] 2) Use the plain text data identified in 1) to directly query the large model in the form of questions. The plain text data sample is: "Name Zhang San Gender Male Nationality Han Birth Date 19XX Address XXX Citizen ID Number XXXXXXXXXXXXXXXXXX"
[0079] 3) Determine the relevant categories based on the return of the large model.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to preferred embodiments, ordinary technicians in the field should understand that the specific implementation methods of the invention can still be modified or some technical features can be replaced by equivalents without departing from the spirit of the technical solutions of the present invention. They should all be included in the scope of the technical solutions for which protection is sought in the present invention.
Claims
1. A method for automatic merging of mixed scanning of single / multi-page documents based on AI classification, characterized in that: The method specifically comprises the following steps: S1, builds an AI classification module, which is the FastText model; S2, divide the labeled image data into training data and test data, and divide it into training set and test set; S3, converts the image file data of the training set and test set into text data through OCR technology; S4, using the FastText classification algorithm to build a FastText model, input the converted text data in the training set into the FastText model to train the corresponding text classification model; S5, placing the document to be scanned into the scanner for scanning, and the scanner scans the document text to obtain image data of the attachment; S6. The image data obtained by scanning is input into the AI classification module. The text classification model in the AI classification module identifies the image data and determines whether the image data is single-page data or multi-page data. The single-page data is directly stored after scanning, and the multi-page data is merged into one file and then stored, completing the mixed scanning and storage of single-page data and multi-page data.
2. The method for automatic merging of single / multi-page mixed scanning of documents based on AI classification according to claim 1, characterized in that: The construction of the AI classification module is specifically as follows: S11, data preparation, obtains the real image data stored by the user and labels each real image data; S12, dividing the labeled image data into training data and test data, that is, dividing it into a training set and a test set; S13, converting the image file data of the training set and the test set into text data through OCR technology; S14, using the FastText classification algorithm to establish a FastText model, inputting the converted text data in the training set into the FastText model to train a corresponding text classification model.
3. The method for automatic merging of single / multi-page mixed scanning of documents based on AI classification according to claim 2, characterized in that: The labeling of the real image data includes the content of the image data, the type of image data and the keywords of the image data.
4. The method for automatically merging single / multi-page documents by mixed scanning based on AI classification according to claim 2, characterized in that: The text classification model training is specifically as follows: the text data in the training set is input into the FastText model for training, the text is represented by n-gram features, and the hierarchical softmax and negative sampling techniques are used to accelerate the model training to obtain a text classification model corresponding to the text data.
5. The method for automatic merging of single / multi-page mixed scanning of documents based on AI classification according to claim 4 is characterized in that: After the text classification model training is completed, the text data in the test set is input into the text classification model for model testing. When the test result reaches the set threshold, the training of the text classification model is completed. When the test result does not reach the set threshold, the text classification model is retrained using the training set.
6. The method for automatically merging single / multi-page documents by mixed scanning based on AI classification according to claim 2, characterized in that: The document includes multiple attachments, including multi-page attachments and single-page attachments. The first page of each document to be scanned is provided with a QR code containing the approval number, and each document corresponds to a QR code containing the approval number.
7. The method for automatically merging single / multi-page documents by mixed scanning based on AI classification according to claim 6, characterized in that: The text classification model classifies image data specifically as follows: S61, calling the scanner interface to obtain all scanned image data; S62, the text classification model in the AI classification module performs a classification judgment on each scanned image data to determine whether the first page of the scanned image data is a document. If it is determined to be a document, the mixed attachments in the document are classified; S63, when the image data is a single-page attachment, the image data is directly saved; S63, when the image data is a multi-page attachment, the text classification model determines that the current page is the first page, last page or middle page of the multi-page attachment. When the current page is the first page or the middle page, the image data is placed in the queue of images to be merged. Until the text classification model determines that the current page being scanned is the last page, the last page is placed in the queue of images to be merged, and all attachments in the queue of images to be merged are merged into one file and stored.
8. The method for automatic merging of single / multi-page mixed scanning files based on AI classification according to claim 1, characterized in that: When the text classification model stores the recognized image data, the data is uploaded to the storage server in the form of a tuple, where the tuple includes the approval order number of each attachment and the scanned image data.