General card identification model construction method and system based on plain text data
Through the universal card certificate recognition model construction method based on plain text data, the problems of difficulty in obtaining data sets, poor adaptability and high cost in card certificate recognition technology are solved, and efficient and accurate card certificate recognition is achieved, reducing the cost of model training. Improves the universality and adaptability of the system.
Patent Information
- Application Number
- CN202411070845.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-10
AI Technical Summary
There are problems in the existing card certificate identification technology that are difficult to obtain, difficult to adapt to a large number of different types of documents, high complexity and cost of layout models, and insufficient recognition accuracy and reliability.
Using the universal card certificate identification model construction method based on plain text data, custom data amplification is performed by obtaining the certificate sample data set, generating a plain text information extraction data set, and dividing it into a training set and a verification set, using general information extraction The model is trained and a general card identification model is obtained, which avoids layout information training and simplifies the data set production and model training process.
It improves the accuracy and reliability of card certificate identification, reduces model training and maintenance costs, realizes flexible adaptability to multiple certificates, and significantly improves economic and social benefits.
Smart Images

Figure CN119107656A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and system for constructing a universal card recognition model based on plain text data. Background Art
[0002] Document information extraction is a technology that extracts key information from documents into structured information. There is a great demand in all walks of life. Currently, there are the following technical routes:
[0003] 1. Use OCR text recognition and fixed layout matching: This type of method usually pre-fabricates the pixel information of some document information, and uses various algorithms to calculate the proximity between the OCR text recognition box and the pre-fabricated layout information to extract key information. This method is relatively simple to implement, but its problems are: first, the algorithm is not easy to adapt to the layout. Different shooting positions, distances, angles, and text lengths of documents may lead to different layouts, resulting in inability to match; second, all layout formats must be defined in advance, which makes it difficult to deal with a variety of documents.
[0004] 2. Use OCR text recognition and layout extraction model: This type of method usually uses a layout extraction deep learning model to replace the fixed layout matching algorithm, which can solve the problem of adapting to cards with certain layout changes to a certain extent. However, the disadvantages of this method are: the layout recognition of cards is much more difficult than the layout recognition of general documents. In addition, card images are required to train the layout recognition model, and cards usually involve private information, and it is difficult to obtain a data set containing multiple cards; if the method of generating a card dataset is used, the method involved is relatively complicated, and the image changes are limited, which is easy to cause overfitting, and generally requires an equal amount of real data.
[0005] 3. Use OCR text recognition, layout recognition and information extraction models: Based on method 2, this method uses natural language processing technology to extract key information from all card text, reducing the pressure of using layout information to locate key information. However, this method still connects the layout extraction model and the information extraction model in series, relying on a large number of annotated diverse layout cards for training, and the connection of multiple models will consume more hardware resources.
[0006] 4. Method 3 also has a newest variant, which uses OCR text recognition, layout recognition and a large language model, and uses a large model to extract document information. This method has lower training requirements, but it still requires training of the layout recognition model, and the speed of calling the large model is slow, and it cannot be deployed locally, which may pose a risk of information leakage.
[0007] In summary, there are several key issues in the existing general card recognition technology:
[0008] 1. Diverse card data sets are difficult to obtain: Existing card recognition technologies usually require a large amount of real card data for model training, but due to privacy and confidentiality issues, real card data is difficult to obtain; in addition, card data synthesized using image generation technology is difficult to fully meet training requirements in terms of authenticity and diversity, which further limits the effectiveness and practicality of the model.
[0009] 2. Existing technologies are difficult to adapt to a large number of different types of certificates: Construction projects may involve dozens or even hundreds of different types of certificates, which places extremely high demands on the recognition system. Existing technologies usually rely on fixed layout information or specific layout extraction models, which significantly reduces their effectiveness when processing diverse, non-fixed format certificates, resulting in insufficient flexibility and poor adaptability.
[0010] 3. Complexity and cost of layout models: Deep learning models require a lot of computing resources and high-cost manually labeled data during training and deployment. The complexity of the model increases the difficulty of maintenance and updating. The layout model not only requires a large number of samples of different layouts for training, but also has a high maintenance cost as the layout of the certificate changes frequently.
[0011] 4. Accuracy and reliability issues of existing methods: Even for well-trained models, the recognition accuracy and reliability are still insufficient when faced with some subtle changes or unseen layouts. This leads to unsatisfactory model effects in actual application scenarios and difficulty in meeting the needs of high-precision recognition. Summary of the invention
[0012] The purpose of the present invention is to provide a method and system for constructing a universal card recognition model based on plain text data, aiming to solve the above-mentioned problems in the prior art.
[0013] The embodiment of the present invention provides a method for constructing a universal card recognition model based on plain text data, comprising:
[0014] Acquire a document sample data set, perform custom data augmentation on the document sample data set to obtain a plain text information extraction data set, and divide the plain text information extraction data set into a training set and a verification set; and
[0015] The training set is input into a universal information extraction model for training to obtain a universal card recognition model, and the universal card recognition model is verified by the verification set to obtain a final universal card recognition model.
[0016] The embodiment of the present invention provides a system for constructing a universal card recognition model based on plain text data, including:
[0017] A data module, used to obtain a document sample data set, perform custom data augmentation on the document sample data set to obtain a plain text information extraction data set, and divide the plain text information extraction data set into a training set and a verification set; and
[0018] The construction module is used to input the training set into the universal information extraction model for training to obtain a universal card recognition model, and verify the universal card recognition model through the verification set to obtain a final universal card recognition model.
[0019] An embodiment of the present invention further provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method for constructing a universal card recognition model based on plain text data.
[0020] The embodiment of the present invention further provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by a processor, the steps of the method for constructing a universal card recognition model based on plain text data are implemented.
[0021] The use of the embodiments of the present invention may include the following beneficial effects: the embodiments of the present invention propose a universal card recognition method that does not rely on layout information for training, and overcomes many limitations of existing card recognition technologies with innovative data generation and information extraction methods, thereby not only improving the technical performance of the recognition system, but also bringing significant improvements in economic and social benefits. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0023] Figure 1 is a flow chart of a method for constructing a universal card recognition model based on plain text data according to an embodiment of the present invention;
[0024] Figure 2 is a flowchart of data set preparation in an embodiment of the present invention;
[0025] Figure 3 is a schematic diagram of a certificate sample according to an embodiment of the present invention;
[0026] Figure 4 is a schematic diagram of a sample certificate template according to an embodiment of the present invention;
[0027] Figure 5 is a schematic diagram of a text sample generated in an embodiment of the present invention;
[0028] Figure 6 is a schematic diagram of training records in an embodiment of the present invention;
[0029] Figure 7 is a card identification flow chart of an embodiment of the present invention;
[0030] Figure 8 This is a schematic diagram of the actual card recognition effect of an embodiment of the present invention;
[0031] Fig. 9 It is a schematic diagram of a system for constructing a universal card recognition model based on plain text data according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0033] Method Embodiment
[0034] According to an embodiment of the present invention, a method for constructing a universal card recognition model based on plain text data is provided. Figure 1 is a flow chart of a method for constructing a universal card recognition model based on plain text data according to an embodiment of the present invention. Figure 1 As shown, the method for constructing a universal card recognition model based on plain text data according to an embodiment of the present invention specifically includes:
[0035] Step S101, obtaining a document sample dataset, performing custom data augmentation on the document sample dataset to obtain a plain text information extraction dataset, and dividing the plain text information extraction dataset into a training set and a validation set, specifically including:
[0036] The text information in the certificate sample data set is extracted by using OCR technology to obtain a certificate text data set, the certificate text data set is processed into a Python object list, and non-critical information in the list is retained as the original string, and the critical information in the list is replaced by the corresponding generation function to obtain a certificate template corresponding to the certificate sample, and a new data set is generated according to the specified format after calling the certificate template through a Python function, and random information is introduced in the process of generating the new data set to obtain the final plain text information extraction data set;
[0037] The random information includes spaces, wrong characters, missing characters, text replacement, length change, text order change, and random insertion of irrelevant sentences;
[0038] Step S102, inputting the training set into a universal information extraction model for training to obtain a universal card recognition model, and verifying the universal card recognition model with the verification set to obtain a final universal card recognition model;
[0039] The method further comprises:
[0040] The final universal card recognition model is used to identify and extract information from several types of certificates, and the pre-built text classification model is used to classify several types of certificates. The extracted certificate information is post-processed according to the classification results to obtain the certificate information required by the user.
[0041] The above technical solution of the embodiment of the present invention is described in detail below in conjunction with the specific situation of the method for constructing a universal card recognition model based on plain text data in the embodiment of the present invention.
[0042] The embodiment of the present invention adopts an innovative universal card recognition method to solve the problem that it is difficult to obtain a diverse card data set and difficult to adapt to a large number of different types of certificates in the prior art. The method is mainly divided into two parts: the model training process before deployment and the recognition process after deployment. The processing methods used mainly include:
[0043] Optical Character Recognition (OCR) technology: technology for recognizing and extracting text information from documents or images.
[0044] Deep learning and machine learning: especially techniques for general information extraction and model training.
[0045] Information extraction and processing: Extract, classify and analyze specific information from text extracted by OCR.
[0046] Random data generation and synthetic data sets: Use computer algorithms to generate random data information to synthesize training data sets.
[0047] The specific process is as follows:
[0048] 1. Model training process
[0049] The model training process is a key step in the embodiment of the present invention, ensuring that the model can achieve efficient and accurate recognition in a variety of card types. The specific steps are as follows:
[0050] 1. Dataset creation
[0051] 1.1. Collection of certificate samples
[0052] First, we collected dozens of common certificate samples in construction projects. Only one or two samples were needed for each certificate. This method effectively solved the problem of the difficulty in collecting certificate data sets, while avoiding a large number of data privacy risks and simplifying the production process.
[0053] 1.2. Creation of certificate information template
[0054] Use OCR technology to extract the text on the certificate as a continuous string. Specifically, use general OCR technology to identify all text information in each certificate, and arrange them in a default spatial position-based order to form the certificate text; then, process the certificate text into a Python object list, keep the non-critical information part as the original string, and replace the critical information part with the corresponding generation function to generate a large-scale data set later, for example: convert all strings of the certificate into a Python object list, if a part needs to generate a name, it is replaced with a Python function that generates a random name; if a part needs to generate a certificate number, it is replaced with a Python function that generates a certificate number of a specific length. Make a template for each certificate. After practice, dozens of certificates commonly used in construction projects can be summarized into more than a dozen templates, which can be completed in a short time.
[0055] 1.3 Dataset Generation
[0056] Next, write a Python program to call the function containing the keyword template and generate a data set in the specified format. During the generation process, randomness is introduced to increase the diversity and realism of the samples. These randomnesses include spaces, typos, missing words, text replacements, length changes, text order changes, and random insertion of irrelevant sentences. The intensity of these randomnesses can be controlled according to parameters, and different randomnesses will have different effects on the training effect. The generated data set needs to maintain a consistent format, including the original text, the type of keywords to be extracted (such as name, ID number), and the corresponding answers. Finally, an information generation model data set containing the above structure is produced and divided into a training set and a validation set.
[0057] 2. Model training
[0058] Use PaddleNLP's Universal Information Extraction (UIE) model for training. This model can accurately extract specific types of key information based on input text and predefined patterns. If necessary, you can also use other deep learning models with information extraction capabilities. If you choose to use an online large model for information extraction, although it may lead to improved accuracy, it is not as fast and localized as a local model, and may also cause the risk of private information being transmitted online, leading to information leakage. Reasonable parameters should be set during training to avoid overfitting.
[0059] In order to further improve the recognition accuracy, a text classification model can be trained to determine the card type and assist in information extraction. The data set text used by the text classification model is generated in the same way, and each text corresponds to a card type annotation. The text classification pre-trained model used here is the ernie-3.0-tiny-medium-v2-zh model of PaddleNLP, and other models with text functions can also be selected.
[0060] 2. Identification Process
[0061] The recognition process consists of two steps: actual card recognition and information extraction, as well as an optional card classification step.
[0062] 1. OCR recognition
[0063] First, use an OCR model including but not limited to PaddleOCR to perform text recognition, extract the text information in the document image and connect it into a string. This process includes two steps: text detection and text recognition. The order of text boxes generated by text detection can itself reflect part of the layout information.
[0064] 2. Use a general information extraction model for recognition
[0065] The OCR results are concatenated into a string and input into the UIE model as input text together with the information type (schema) to be extracted. The model returns the extraction result, which contains the required key information, and then performs post-processing, such as checking the number of digits in the document number, to ensure the accuracy and structure of the extraction result.
[0066] 3. (Optional) Use the card classification model for classification
[0067] After the OCR results are connected into a string, they can also be input into the card classification model. The model will return the classification results. The classification results can be used to assist the post-processing of the results of the general information extraction model. For example, if it is classified as an ID card, then the unique verification rules of the ID card number can be applied to a key information of the ID card number, thereby improving the extraction accuracy.
[0068] Through the above technical scheme, the embodiment of the present invention realizes an efficient and universal card recognition solution, which comprehensively solves the problems of difficulty in obtaining data sets and poor adaptability to various certificates. This not only improves the accuracy and reliability of card recognition, but also significantly reduces the cost of model training and maintenance.
[0069] Specifically, a universal card recognition method that does not rely on layout information for training is proposed in an embodiment of the present invention, comprising the following steps:
[0070] 1. Dataset creation and model training
[0071] Dataset creation and model training are key steps in universal card recognition solutions, such as Figure 2 As shown, the specific steps include:
[0072] 1. Collection of certificate samples: First, collect samples of various certificates, such as Figure 3 As shown, in many scenarios, there may be dozens of certificates involved in universal card identification, each with different formats and information in different eras. Among them, only a small number of samples need to be collected for each certificate, which greatly reduces the difficulty of making a data set and the risk of privacy leakage. 1-2 samples can be selected for each. As an example, the embodiment of the present invention collects dozens of certificate styles commonly used in the construction project. After manual comparison, it is found that the types of certificates can be divided into major categories such as identity cards, driver's licenses, work permits, work permits, and other certificates. Some types of certificates also include some subcategories.
[0073] 2. Creation of certificate information template:
[0074] 2.1. OCR text extraction: Use OCR technology to extract the text on each certificate as a continuous string. Specifically, use general OCR technology to identify all text information in each certificate and arrange them in a default spatial position-based order.
[0075] 2.2. Template creation: Process the ID text into a Python object list. The non-critical information part remains as the original string, and the critical information part is replaced with the corresponding generation function to facilitate the subsequent generation of large-scale data sets. For example: convert all ID strings into a Python object list. If a part needs to generate a name, it is replaced with a Python function that generates a random name; if a part needs to generate an ID number, it is replaced with a Python function that generates an ID number of a specific length. Figure 4 As shown, all key information is replaced with randomly generated ones, on this basis, diverse card texts can be generated, and a template can be made for each certificate. Through practice, dozens of certificates commonly used in construction projects can be summarized into more than a dozen templates and completed in a short time.
[0076] 3. Dataset generation:
[0077] 3.1. Write a Python program to call a function containing a keyword template to generate a data set in the specified format. Introduce randomness in the generation process to increase the diversity and realism of the samples. These randomnesses include spaces, typos, missing words, text replacements, length changes, text order changes, and random insertion of irrelevant sentences. The intensity of these randomnesses can be controlled by parameters. Different randomnesses will have different effects on the training effect and need to be adjusted according to the training effect. Figure 5 As shown, based on the certificate template, controllable parameters are used to generate certificate texts with random factors such as spaces, typos, missing words, text replacements, text order changes, and insertion of random irrelevant texts.
[0078] 3.2. For the generated data set, maintain a certain format, including the original text, the type of keywords to be extracted (such as name, ID number) and the corresponding answers (key information to be extracted).
[0079] 3.3. Training set and validation set: Create an information generation model dataset containing the above structure and divide it into training set and validation set, ensuring that the validation set has 100-500 images and the rest are training sets.
[0080] 4. Model training:
[0081] Use PaddleNLP's Universal Information Extraction (UIE) model for model training. This model can effectively extract specific types of key information based on the input text and predefined information types (schemas); it can also be replaced with other deep learning models whose task is information extraction. If replaced with an online large model for information extraction, it may be better than the universal information extraction model in terms of accuracy, but it is far inferior in terms of speed and localization, and it will also cause security issues.
[0082] Reasonable parameters should be set during training to avoid overfitting. For example, for PaddleNLP's UIE pre-trained model, it is recommended to set the iter parameter between 1000-3000. The number of epochs is not important because epochs are based on the size of the dataset. When the dataset size can be customized, the main focus is on the number of input samples, which is represented by iter. After training, experiments should be conducted on a test set consisting of real data, and the random generation process of the dataset should be optimized and improved based on the experimental results. Figure 6 As shown, it can be seen that the accuracy of the method proposed in the embodiment of the present invention on the verification set is higher than 90%, but the higher the accuracy on the verification set, the better. Instead, the number of training times should be limited to prevent overfitting, and the parameters that perform best on the real data set should be selected for training.
[0083] Optionally, you can train a text classification model to determine the card type and assist in information extraction. The data set text used by the text classification model is generated in the same way, and each text corresponds to a card type annotation. The text classification model used here can be the ernie-3.0-tiny-medium-v2-zh model of PaddleNLP, or any model with similar functions.
[0084] 2. Identification Process
[0085] The recognition process consists of two steps: actual card recognition and information extraction using the trained model, and an optional card classification step, such as Figure 7 As shown, the layout structure extraction is reduced but the effect is guaranteed, as follows:
[0086] 1. OCR recognition: Use OCR models including but not limited to PaddleOCR to perform text recognition, extract text information from the document image, and connect it into a string. The OCR text extraction model here actually includes two processes: text detection and text recognition. The order of text boxes generated by text detection can itself reflect part of the layout information.
[0087] 2. Use the Common Information Model for Identification
[0088] After the OCR results are concatenated into a string, they are input into the UIE model as input text together with the information type (schema) to be extracted. The model returns the extraction results, including the required key information, and then performs post-processing (such as checking the number of digits in the document number) to ensure the accuracy and structure of the extraction results. The actual recognition effect is as follows Figure 8 As shown, the privacy information has been hidden.
[0089] 3. (Optional) Use the card classification model for classification
[0090] After the OCR results are concatenated into a string, they are input into the card classification model as input text, and the model returns the classification results. The classification results can be used to assist the post-processing of the results of the general information extraction model. For example, if it is classified as an ID card, the key information of the ID card number can use the unique verification rules of the ID card number to improve the extraction accuracy.
[0091] In summary, the embodiments of the present invention achieve card and certificate recognition without relying on layout models and card image datasets, and directly use OCR combined with a general information extraction model to perform card and certificate recognition, which comprehensively solves the problems of difficulty in obtaining datasets and poor adaptability to various certificates. This not only improves the accuracy and reliability of card and certificate recognition, but also significantly reduces the cost of model training and maintenance.
[0092] System Example
[0093] According to an embodiment of the present invention, a system for constructing a universal card recognition model based on plain text data is provided. Fig. 9 Schematic diagram of a system for constructing a universal card recognition model based on plain text data according to an embodiment of the present invention. Fig. 9 As shown, the general card recognition model construction system based on plain text data according to an embodiment of the present invention specifically includes:
[0094] The data module 90 is used to obtain a document sample data set, perform custom data augmentation on the document sample data set to obtain a plain text information extraction data set, and divide the plain text information extraction data set into a training set and a verification set, specifically for:
[0095] The text information in the certificate sample data set is extracted by using OCR technology to obtain a certificate text data set, the certificate text data set is processed into a Python object list, and non-critical information in the list is retained as the original string, and the critical information in the list is replaced by the corresponding generation function to obtain a certificate template corresponding to the certificate sample, and a new data set is generated according to the specified format after calling the certificate template through a Python function, and random information is introduced in the process of generating the new data set to obtain the final plain text information extraction data set;
[0096] The random information includes spaces, wrong characters, missing characters, text replacement, length change, text order change, and random insertion of irrelevant sentences;
[0097] A construction module 92 is used to input the training set into a universal information extraction model for training to obtain a universal card recognition model, and verify the universal card recognition model through the verification set to obtain a final universal card recognition model;
[0098] The system further comprises:
[0099] The application module is used to identify and extract information from several types of certificates through the final universal card recognition model, and at the same time classify several types of certificates using a pre-built text classification model, and post-process the extracted certificate information according to the classification results to obtain the certificate information required by the user.
[0100] The above technical solution of the embodiment of the present invention is described in detail below in conjunction with the specific situation of the system for building a universal card recognition model based on plain text data in the embodiment of the present invention.
[0101] 1. The data module is specifically used for:
[0102] 1.1. Collection of certificate samples: Collect samples of various certificates commonly used in construction projects. Only one or two samples are needed for each certificate.
[0103] 1.2. Creation of certificate information template: Use OCR technology to extract the text on the certificate as a continuous string, convert the extracted text into a Python object list, keep the non-critical information part as the original string, and replace the critical information part with the corresponding generation function to generate a large-scale data set;
[0104] 1.3. Dataset generation: Write a program to call a function containing a keyword template to generate a dataset in the specified format. Introduce randomness to increase the diversity and realism of the samples. The randomness includes spaces, typos, missing words, text replacements, length changes, text order changes, and random insertion of irrelevant sentences. The generated dataset is divided into a training set and a validation set.
[0105] 2. The building blocks are specifically used for:
[0106] 2.1. Model training: Use a general information extraction model (such as PaddleNLP's UIE model) for training and set reasonable parameters to avoid overfitting. If necessary, train a text classification model to determine the card type and assist in information extraction.
[0107] 3. The application module is specifically used for: (identification process)
[0108] 3.1. OCR recognition: Use the OCR model to perform text recognition, extract the text information in the document image and connect it into a string;
[0109] 3.2. Information extraction: Input the OCR results and the information type (schema) to be extracted into the general information extraction model to extract the required key information and perform post-processing;
[0110] 3.3. (Optional) Card classification: Input the OCR results into the card classification model, obtain the classification results and assist in the post-processing of the results of the information extraction model.
[0111] In summary, compared with the prior art, the embodiments of the present invention have significant technical, economic and social benefits, including but not limited to the following aspects:
[0112] 1. Quickly and easily create data sets: By adopting OCR technology and automated data generation methods, card data sets can be quickly and easily created, greatly reducing the time and cost of manual annotation and data processing. The generated data sets contain various document samples to ensure the diversity and coverage of the training set.
[0113] 2. Supporting the creation of data sets containing a large number of card and certificate types: The method proposed in the embodiment of the present invention can process multiple types of certificates, including dozens or even hundreds of different certificates that may be involved in construction projects, overcoming the problem of poor applicability of the prior art to a large number of different certificate types, making the model more versatile and adaptable.
[0114] 3. Avoid privacy leakage issues: Using randomly generated key information to replace real data avoids privacy leakage issues that may arise when collecting and using real card data, thereby improving the security and compliance of data processing. The random data generation method can also generate samples unlimitedly according to demand to ensure the scale and diversity of the data set.
[0115] 4. Increase the richness and diversity of the data set: By introducing randomness, such as spaces, text replacement, length changes, text order changes, and random insertion of irrelevant sentences, the richness and diversity of the data set are significantly enhanced, and the robustness and generalization ability of the model in dealing with different scenarios and variant data are improved.
[0116] 5. The recognition process is simplified and more versatile: The method of combining pure OCR with general information extraction and large models avoids complex layout analysis and template matching, simplifies the recognition process, and the general information extraction model can directly extract key information from the OCR string, improving the flexibility and scalability of the system.
[0117] 6. High recognition rate: After testing, the recognition rate achieved by the embodiment of the present invention is above 90%. Compared with the existing technology that relies on complex layout models and a large amount of real data, the recognition effect is better. Through scientific model training and parameter tuning, the high accuracy and stability of the model in practical applications are ensured.
[0118] In summary, the embodiments of the present invention overcome many limitations of existing card recognition technologies with innovative data generation and information extraction methods, which not only improves the technical performance of the recognition system, but also brings significant improvements in economic and social benefits.
[0119] Device Example 1
[0120] An embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps described in the method embodiment when executed by the processor.
[0121] Device Example 2
[0122] An embodiment of the present invention provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by a processor, the steps described in the method embodiment are implemented.
[0123] The computer-readable storage medium in this embodiment includes, but is not limited to, ROM, RAM, magnetic disk or optical disk, etc.
[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for constructing a universal card recognition model based on plain text data, characterized in that include: Acquire a document sample data set, perform custom data augmentation on the document sample data set to obtain a plain text information extraction data set, and divide the plain text information extraction data set into a training set and a verification set; as well as The training set is input into a universal information extraction model for training to obtain a universal card recognition model, and the universal card recognition model is verified by the verification set to obtain a final universal card recognition model.
2. The method according to claim 1, characterized in that The method further comprises: The final universal card recognition model is used to identify and extract information from several types of certificates, and the pre-built text classification model is used to classify several types of certificates. The extracted certificate information is post-processed according to the classification results to obtain the certificate information required by the user.
3. The method according to claim 1, characterized in that: The document sample dataset is augmented with custom data to obtain a plain text information extraction dataset, which specifically includes: The OCR technology is used to extract the text information in the certificate sample dataset to obtain the certificate text dataset, and the certificate text dataset is processed into a Python object list, and the non-critical information in the list is retained as the original string, and the critical information in the list is replaced with the corresponding generation function to obtain a certificate template corresponding to the certificate sample, and the certificate template is called by a Python function to generate a new dataset according to the specified format, and random information is introduced in the process of generating the new dataset to obtain the final plain text information extraction dataset.
4. The method according to claim 3, characterized in that The random information includes spaces, wrong characters, missing characters, text replacement, length changes, text order changes, and random insertion of irrelevant sentences.
5. A universal card recognition model construction system based on plain text data, characterized by include: A data module is used to obtain a document sample data set, perform custom data augmentation on the document sample data set to obtain a plain text information extraction data set, and divide the plain text information extraction data set into a training set and a verification set; as well as The construction module is used to input the training set into the universal information extraction model for training to obtain a universal card recognition model, and verify the universal card recognition model through the verification set to obtain a final universal card recognition model.
6. The system according to claim 5, characterized in that The system further comprises: The application module is used to identify and extract information from several types of certificates through the final universal card recognition model, and at the same time classify several types of certificates using a pre-built text classification model, and post-process the extracted certificate information according to the classification results to obtain the certificate information required by the user.
7. The system according to claim 5, characterized in that The data module is specifically used for: The OCR technology is used to extract the text information in the certificate sample dataset to obtain the certificate text dataset, and the certificate text dataset is processed into a Python object list, and the non-critical information in the list is retained as the original string, and the critical information in the list is replaced with the corresponding generation function to obtain a certificate template corresponding to the certificate sample, and the certificate template is called by a Python function to generate a new dataset according to the specified format, and random information is introduced in the process of generating the new dataset to obtain the final plain text information extraction dataset.
8. The system according to claim 7, characterized in that The random information includes spaces, wrong characters, missing characters, text replacement, length changes, text order changes, and random insertion of irrelevant sentences.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for constructing a universal card recognition model based on plain text data as described in any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an implementation program for information transmission, and when the program is executed by the processor, the steps of the method for constructing a universal card recognition model based on plain text data as described in any one of claims 1 to 4 are implemented.
