Fixed-layout certificate structured information extraction method, device, equipment and medium

Through the combination of instance segmentation model and text recognition model, structured information in fixed-layout documents is directly extracted, which solves the problems of complex steps and low recognition rate in the existing technology, and achieves efficient and accurate information extraction.

CN112115907BActive Publication Date: 2024-10-22BEIJING SINOVOICE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011029027.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-27
Publication Date
2024-10-22
Estimated Expiration
2040-09-27

AI Technical Summary

Technical Problem

When existing technology extracts structured information from fixed-layout documents, the steps are complicated, the time cost is high, and the error rate is high. In particular, there are problems with operational difficulty and low recognition rate during manual entry.

Method used

Use the instance segmentation model to perform instance segmentation on the target document image, obtain the segmented instances of the text lines to be recognized, and perform recognition through the preset text recognition model to directly obtain the structured information in the document, simplify the processing process, and improve the recognition accuracy and speed. .

Benefits of technology

By performing instance segmentation based on instance segmentation models for different document types, we can directly locate text line positions, reduce irrelevant text detection, improve recognition accuracy and speed, simplify the process, and reduce error rates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112115907B_ABST
    Figure CN112115907B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention provide a method, device, equipment and medium for extracting structured information from fixed-layout documents. The method comprises: obtaining a target document image; selecting a corresponding instance segmentation model according to the type of the target document image; performing instance segmentation on multiple text lines to be identified in the target document image by using the instance segmentation model, and obtaining segmentation instances corresponding to each of the multiple text lines to be identified; and identifying the segmentation instances of the text lines to be identified by using a preset text recognition model to obtain structured information in the target document image. The present invention uses an instance segmentation model to directly locate the position of the text line to be identified, and then directly sends it to the preset text recognition model for information recognition, without the need to detect and identify irrelevant text lines, thereby simplifying the processing flow and improving the recognition accuracy and recognition speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method, device, equipment and medium for extracting structured information of a fixed-layout certificate. Background Art

[0002] At present, in certain scenarios, it is necessary to extract structured information from fixed pages such as ID cards, vehicle registration certificates, driver's licenses, business licenses, and bills and upload them to electronic devices. Manual data entry is not only complicated, but also time-consuming and error-prone. Summary of the invention

[0003] In view of the above problems, embodiments of the present invention are proposed to provide a method, device, equipment and medium for extracting structured information from a fixed-layout certificate.

[0004] In a first aspect, in order to solve the above-mentioned problem, an embodiment of the present invention discloses a method for extracting structured information of a fixed-layout certificate, the method comprising:

[0005] Obtain the target document image;

[0006] Selecting a corresponding instance segmentation model according to the type of the target document image;

[0007] Performing instance segmentation on a plurality of text lines to be recognized in the target document image by using the instance segmentation model, and obtaining segmentation instances corresponding to each of the plurality of text lines to be recognized;

[0008] The segmentation instance of the text line to be recognized is recognized by a preset text recognition model to obtain the structured information in the target document image.

[0009] Preferably, before the step of acquiring the target document image, the method further includes:

[0010] According to the document type corresponding to the instance segmentation model, a plurality of training samples of documents belonging to the document type are obtained, and instance segmentation and annotation are performed on the text line to be recognized in each image in the training samples;

[0011] Selecting a loss function and an optimizer that match the instance segmentation model, and connecting the loss function and the optimizer to an output layer of the instance segmentation model; wherein different instance segmentation models match different loss functions and optimizers;

[0012] The instance segmentation model is trained by using the training samples, the loss function and the optimizer until the loss of the instance segmentation model converges.

[0013] Preferably, after the step of training the instance segmentation model by using the training samples, the loss function and the optimizer until the loss of the instance segmentation model converges, the method further includes:

[0014] According to the document type corresponding to the instance segmentation model, obtaining test samples of multiple documents belonging to the document type;

[0015] Using the test sample to test the trained instance segmentation model to obtain a test pass rate;

[0016] If the test pass rate is greater than a preset threshold, the instance segmentation model is no longer trained;

[0017] If the test pass rate is less than or equal to the preset threshold, the instance segmentation model is continuously trained using the training samples until the test pass rate of the instance segmentation model is greater than the preset threshold.

[0018] Preferably, the type of the target document image is obtained by:

[0019] Acquire locally a type identifier corresponding to the target document image input by the first user;

[0020] The type of the target document image is determined according to the type identifier.

[0021] Preferably, the type of the target document image is obtained by:

[0022] Obtaining type information carried by the target document image;

[0023] The type information is parsed to obtain the type of the target document image.

[0024] Preferably, the target document image includes an image area of ​​the target document; after acquiring the target document image, the method further includes:

[0025] Transforming the image region of the target document into the predicted region of the target document image;

[0026] If any side of the image area of ​​the target document does not fit with the corresponding side of the predicted area, correcting the target document image so that each side of the image area of ​​the target document fits with the corresponding side of the predicted area;

[0027] The corrected target document image is sent to the instance segmentation model for instance segmentation of the text lines to be recognized.

[0028] Preferably, the step of acquiring training samples of a plurality of certificates belonging to the certificate type according to the certificate type corresponding to the instance segmentation model comprises:

[0029] Copying each image in the training sample to obtain a plurality of copied images;

[0030] Performing data enhancement on the multiple copied images to obtain multiple data enhanced images;

[0031] The multiple data-enhanced images are added to the training samples.

[0032] In a second aspect, in order to solve the above problem, an embodiment of the present invention further discloses a device for extracting structured information of a fixed-layout certificate, the device comprising:

[0033] An image acquisition module, used to acquire the target document image;

[0034] A model selection module, used to select a corresponding instance segmentation model according to the type of the target document image;

[0035] An instance segmentation module, used to perform instance segmentation on a plurality of text lines to be identified in the target document image by using the instance segmentation model, and obtain segmentation instances corresponding to each of the plurality of text lines to be identified;

[0036] The information acquisition module is used to identify the segmentation instance of the text line to be identified through a preset text recognition model to obtain the structured information in the target document image.

[0037] On the third aspect, in order to solve the above-mentioned problem, an embodiment of the present invention further discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of a method for extracting structured information from a fixed-layout document as described in the first aspect above are implemented.

[0038] In a fourth aspect, in order to solve the above-mentioned problem, an embodiment of the present invention further discloses 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 method for extracting structured information of a fixed-layout certificate in the first aspect are implemented.

[0039] The embodiments of the present invention include the following advantages:

[0040] In an embodiment of the present invention, a target document image is acquired; a corresponding instance segmentation model is selected according to the type of the target document image; multiple text lines to be identified in the target document image are instance segmented by the instance segmentation model to acquire segmentation instances corresponding to each of the multiple text lines to be identified; the segmentation instances of the text lines to be identified are identified by a preset text recognition model to acquire structured information in the target document image. The present invention uses the corresponding instance segmentation model to perform instance segmentation for different document images, making the acquired segmentation instances more accurate. At the same time, the present invention uses the instance segmentation model to directly locate the position of the text line to be identified, and then directly sends it to the preset text recognition model for information recognition. There is no need to detect and identify irrelevant text lines, which simplifies the processing flow and improves the recognition accuracy and speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a flow chart of the application steps of a method for extracting structured information from a fixed-layout certificate of the present invention.

[0042] Figure 2 It is a flow chart of the steps of a method for extracting structured information from a fixed-layout certificate of the present invention.

[0043] Figure 3 It is a structural block diagram of an embodiment of a fixed-layout document structured information extraction device of the present invention. DETAILED DESCRIPTION

[0044] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0045] At present, there are two main methods for extracting structured information from fixed-layout documents: the method of configuring a fixed template and the method based on text line detection and recognition. These methods are introduced below.

[0046] 1. By configuring a fixed template.

[0047] This method requires first configuring a fixed template, then normalizing the ID card to an image of the same size as the fixed template, and finally using the fixed template to find the area to be identified in the ID card image, thereby extracting structured information. For example, in the common bank card account extraction, the user first uses a mobile phone or other electronic device to start the program for bank card account extraction, and a rectangular recognition box will appear on the device display; then the user needs to use the device's camera to focus on the bank card to be identified, and use the mobile device to make the four sides of the bank card and the four sides of the rectangular recognition box completely overlap; finally, the device normalizes the bank card image to the fixed template image, and the fixed template finds the area where the bank card account number is located, thereby extracting the bank card account number.

[0048] Disadvantages: This method requires the document image to be normalized to the fixed template image through the user's focusing operation, which increases the difficulty of user operation and makes document recognition very difficult. At the same time, the commonly used fixed template with normalization algorithm is often not robust enough, resulting in a low recognition rate of this method.

[0049] 2. Methods based on text line detection and recognition.

[0050] This method uses the text line recognition results to find the corresponding key position on the document image, and finds the corresponding value based on prior information (generally using the relative position relationship between key and value), thereby realizing structured information extraction. For example, to extract structured information from an ID card, first identify all the information on the front of the ID card, then find the key position such as the position of "name", then locate the value position in the line of text such as "XXX" based on the position of "name", and finally extract the value such as extracting information from "XXX".

[0051] Disadvantages: This method needs to detect the key on the ID image, and then use the key position to find the corresponding value position and extract information. Therefore, this method needs to detect and identify the key that the user does not need, which makes the method complicated and the recognition speed is low.

[0052] In view of the above problems, the embodiments of the present invention provide a method, device, equipment and medium for extracting structured information from fixed-layout documents. The core idea is to regard the text (value) to be identified in the target document image as the object of entity segmentation, and use the instance segmentation model corresponding to the target document image to directly locate the location of the text to be identified, and then directly send it to the preset text recognition model for recognition to obtain the structured information in the target document image. Therefore, the present invention does not need to detect and identify the key, simplifies the post-processing process, and thus improves the recognition rate and recognition speed. The following is a detailed introduction to the embodiments of the present invention.

[0053] See also Figure 1 , shows a flowchart of the application steps of a method for extracting structured information of a fixed-layout certificate of the present invention, which may specifically include the following steps:

[0054] Step 101, obtaining a target document image.

[0055] In an embodiment of the present invention, a user may obtain an image of a target document through an electronic device. For example, a user may take a photo of a target document through a mobile phone, a tablet computer, or other electronic device with a camera to obtain an image of the target document. Alternatively, an image of the target document may be obtained by selecting an image from an album. The embodiment of the present invention does not limit the method of obtaining an image of the target document. In an embodiment of the present invention, the target document may include, but is not limited to, fixed-format documents such as identity cards, vehicle registration certificates, driver's licenses, business licenses, and bills.

[0056] Step 102: Select a corresponding instance segmentation model according to the type of the target document image.

[0057] In an embodiment of the present invention, there are corresponding instance segmentation models for different types of certificates. Each type of certificate corresponds to a corresponding instance segmentation model one-to-one. Among them, the instance segmentation model may include a Mask R-CNN model, a SIS model, a FCIS model, a PAN model, and the like. In practical applications, the Mask R-CNN model is preferred, which can give the location box, category, and mask of the target in the target box. In an embodiment of the present invention, the Mask R-CNN model can be used to train different types of certificates separately to obtain trained Mask R-CNN models corresponding to different types of certificates. For example, the identity card corresponds to Mask R-CNN model 1, the vehicle registration certificate corresponds to Mask R-CNN model 2, the driver's license corresponds to Mask R-CNN model 3, and the like.

[0058] Preferably, the embodiment of the present invention may also have multiple instance segmentation models as described above, where different certificates may correspond to different or the same instance segmentation models. For example, the ID card corresponds to Mask R-CNN model 1, the vehicle registration card corresponds to Mask R-CNN model 2, the driver's license corresponds to the SIS model, the business license corresponds to the FCIS model 1, the bill corresponds to the FCIS model 2, and the like.

[0059] Step 103: perform instance segmentation on a plurality of text lines to be identified in the target document image using the instance segmentation model to obtain segmentation instances corresponding to each of the plurality of text lines to be identified.

[0060] In the embodiment of the present invention, generally, there are multiple lines of text in the target document image. When the text to be recognized contains multiple lines, each line can be used as an independent text to be recognized. In the embodiment of the present invention, the text to be recognized refers to the specific information in the target document image. For example, the identity card at least includes "name", "gender", "nationality", etc. The text to be recognized in the embodiment of the present invention refers to the specific name information after the "name", such as "Liu XX", etc., the specific gender information after the "gender", such as "male" or "female", and the specific nationality information after the "nationality", such as "Han" or "Manchu", etc. For another example, there is specific residence information after the "address" in the identity card. The specific residence information may be too long and require multiple lines of description. Therefore, in the embodiment of the present invention, there are multiple lines of text lines to be recognized corresponding to the residence information.

[0061] In the present invention, the target document image is input into the corresponding instance segmentation model, and the instance segmentation model performs instance segmentation operation on multiple text lines to be recognized on the target document image to obtain segmentation instances corresponding to each of the multiple text lines to be recognized.

[0062] Step 104: Recognize the segmented instances of the text line to be recognized by using a preset text recognition model to obtain structured information in the target document image.

[0063] In the present invention, the preset text recognition model may include but is not limited to: Keras model, CSDN model, etc.

[0064] In an embodiment of the present invention, the segmentation instances corresponding to multiple text lines to be recognized are input into a preset text recognition model, the preset text recognition model performs text recognition, outputs recognition results of multiple text lines to be recognized, and finally combines the recognition results from top to bottom to obtain complete text information.

[0065] In an embodiment of the present invention, a target document image is acquired; a corresponding instance segmentation model is selected according to the type of the target document image; multiple text lines to be identified in the target document image are instance segmented by the instance segmentation model to acquire segmentation instances corresponding to each of the multiple text lines to be identified; the segmentation instances of the text lines to be identified are identified by a preset text recognition model to acquire structured information in the target document image. The present invention uses the corresponding instance segmentation model to perform instance segmentation for different document images, making the acquired segmentation instances more accurate. At the same time, the present invention uses the instance segmentation model to directly locate the position of the text line to be identified, and then directly sends it to the preset text recognition model for information recognition. There is no need to detect and identify irrelevant text lines, which simplifies the processing flow and improves the recognition accuracy and speed.

[0066] See also Figure 2, shows a flowchart of a method for extracting structured information of a fixed-layout certificate of the present invention, which may specifically include the following steps:

[0067] Step 201 : According to the document type corresponding to the instance segmentation model, training samples of multiple documents belonging to the document type are obtained, and instance segmentation and annotation are performed on the text lines to be recognized in each image in the training samples.

[0068] In an embodiment of the present invention, the training samples also need to be preprocessed, specifically: copying each image in the training sample to obtain a plurality of copied images; performing data enhancement on the plurality of copied images to obtain a plurality of data enhanced images; and adding the plurality of data enhanced images to the training sample.

[0069] Specifically, multiple images of various types of certificates can be obtained by crawling the Internet, for example, 1,000 images. Copy these images and perform data enhancement on the copied images, for example, by rotation, translation, scale transformation, etc., and add the data-enhanced images to the corresponding training samples, so as to train the instance segmentation model with the expanded training samples, and force the instance segmentation model to learn robust features such as rotation, translation, and scale transformation. Use manual or other methods to perform instance segmentation annotation on the text lines to be identified in each image in the training sample. Among them, when the text to be identified contains multiple lines (such as address lines), each line is annotated as an independent instance, and finally the instance recognition results are combined from top to bottom to obtain the complete entry information.

[0070] In an embodiment of the present invention, by expanding the data-augmented image into the original training sample, the instance segmentation model trained with the expanded training sample can accurately perform instance segmentation on target document images with features such as different sizes, different shooting angles, and blurred fonts, thereby enhancing the robustness of the trained instance segmentation model.

[0071] Step 202, selecting a loss function and an optimizer that match the instance segmentation model, and connecting the loss function and the optimizer to the output layer of the instance segmentation model; wherein different instance segmentation models match different loss functions and optimizers.

[0072] In the embodiment of the present invention, it is necessary to design a suitable loss function and optimizer for the instance segmentation model corresponding to each type of document image. The loss function is used as a parameter of the optimizer, and the optimizer is added to the output layer of the corresponding instance segmentation model. The loss function is made to converge as much as possible. For example, the loss function is brought into the minimize method of the optimizer as a parameter.

[0073] Among them, the loss function can be: square error loss function, absolute error loss function, Huber loss function, binary cross entropy loss function, Hinge loss function, multi-classification cross entropy loss function, KL divergence loss function, etc. It depends on the specific situation during design.

[0074] The optimizer can be: standard gradient descent (GD), batch gradient descent (BGD), stochastic gradient descent (SGD), momentum optimization, AdaGrad algorithm, RMSProp algorithm, AdaDelta algorithm, etc. It depends on the specific situation during design.

[0075] The criterion for selecting the loss function for the instance segmentation model is: since different texts to be recognized in the target document image occupy different pixels, and texts to be recognized with a short length occupy fewer pixels and are easily ignored during training, in order to ensure the pixel category balance between segmented objects as much as possible, the weight of the texts to be recognized with a small pixel size is increased, and the weight of the texts to be recognized with a large pixel size is reduced, and the designed loss function is required to converge quickly.

[0076] The criterion for selecting an optimizer for the instance segmentation model is that the optimizer can quickly converge the loss function to a relatively good stable value by adjusting the network weights.

[0077] Step 203: Train the instance segmentation model using the training samples, the loss function, and the optimizer until the loss of the instance segmentation model converges.

[0078] In the embodiment of the present invention, the training samples are input into the corresponding instance segmentation model with the added loss function and optimizer, and the training is continued until the loss of the instance segmentation model converges. That is, the trained instance segmentation model can accurately perform instance segmentation on the target document image. Among them, the embodiment of the present invention can select the tensorflow framework to train the instance segmentation model.

[0079] Step 204: According to the document type corresponding to the instance segmentation model, a plurality of test samples of documents belonging to the document type are obtained.

[0080] In the present invention, the test samples are used to test the performance strength of the trained instance segmentation model.

[0081] In an embodiment of the present invention, multiple test samples corresponding to the instance segmentation model can be obtained by means of a web crawler, and generally the ratio of the number of test samples to the number of training samples is 1:4. The text to be recognized in each image in the test sample is annotated as a KV structured image, that is, the text to be recognized in each image is marked, so that when determining the test pass rate, it is known that the marked part is the text to be recognized. Step 205, the trained instance segmentation model is tested with the test sample to obtain the test pass rate.

[0082] In an embodiment of the present invention, the KV structured images annotated in the training samples are input one by one into the trained instance segmentation model to obtain the segmentation instances corresponding to the images, and the segmentation instances are sent to the preset text recognition model for recognition. The correctness of the recognition result is determined by comparing whether the information of the annotated position in the KV structured image is the same as the information recognized by the preset text recognition model. Finally, the recognition accuracy rate of the text to be recognized is statistically determined to determine the pass rate of the instance segmentation result. For example, if a text to be recognized is recognized incorrectly, it means that the segmentation instance corresponding to the text to be recognized is also wrong.

[0083] Step 206: if the test pass rate is greater than a preset threshold, the instance segmentation model is no longer trained; if the test pass rate is less than or equal to the preset threshold, the instance segmentation model is continued to be trained using the training samples until the test pass rate of the instance segmentation model is greater than the preset threshold.

[0084] In the embodiment of the present invention, a pass rate, i.e., a preset threshold, is preset. The magnitude relationship between the test pass rate and the preset threshold is compared to determine whether the trained instance segmentation model needs to be further trained based on the magnitude relationship. The trained instance segmentation model is stored for use in instance segmentation of the target document image.

[0085] In the embodiment of the present invention, the trained instance segmentation model is tested to ensure that the trained instance segmentation model meets the usage requirements, thereby preventing the trained instance segmentation model from having a low recognition rate.

[0086] Step 207: Acquire a target document image, and select a corresponding instance segmentation model according to the type of the target document image.

[0087] In an embodiment of the present invention, the type of the target document image can be obtained in two ways. Specifically, the first way is to obtain the type identifier corresponding to the target document image input by the first user from the local; and determine the type of the target document image according to the type identifier. The second way is to obtain the type information carried by the target document image; parse the type information to obtain the type of the target document image; and determine the corresponding instance segmentation model according to the type of the target document image.

[0088] In actual applications, the type option of the target ID image can be set on the user's front end. Before uploading the target ID image, the user needs to select the type of the target ID image to be uploaded. The image data of the target ID and the type data of the target ID image are packaged and sent to the background program. The background program parses the image data of the target ID to obtain the type of the target ID image, and matches the corresponding instance segmentation model with the type of the target ID image.

[0089] In another implementation, only an upload button for uploading the target ID image is set on the user's front end. The user directly uploads the target ID image to the background through the upload button. The background obtains the type identification corresponding to the target ID image through image classification model detection, and determines the type of the corresponding target ID image according to the type identification. Finally, the corresponding instance segmentation model is matched according to the type of the target ID image. Among them, the image classification model includes but is not limited to: SVM classification model, CNN classifier based on deep learning, etc.

[0090] Step 208, calibrate the target document image.

[0091] In the implementation of the present invention, the image area of ​​the target certificate is transformed into the predicted area of ​​the target certificate image; if any side of the image area of ​​the target certificate does not fit with the corresponding side of the predicted area, the target certificate image is corrected so that the sides of the image area of ​​the target certificate fit with the corresponding sides of the predicted area; the corrected target certificate image is sent to the instance segmentation model for instance segmentation of the text line to be recognized.

[0092] In actual applications, the target document image uploaded by the user generally includes an image area and a blank area outside the image area, and the image area may be skewed, and the skewed image area may cause the preset text recognition model to recognize inaccurately. Therefore, the embodiment of the present invention can set a prediction area in the background to correct the target document image. The details are as follows:

[0093] First, the target ID image is placed in the prediction area of ​​the target ID image; then, it is detected whether the sides of the target ID image coincide with the four sides of the prediction area of ​​the target ID image; then, if any side of the image area of ​​the target ID does not fit with the corresponding side of the prediction area, the target ID image is rotated so that the sides of the image area of ​​the target ID fit with the corresponding sides of the prediction area; finally, the corrected target ID image is sent to the instance segmentation model for instance segmentation of the text line to be recognized.

[0094] In another embodiment, the correction of the target document image can also be achieved by:

[0095] The target document image is input into the preset text direction judgment model, which judges whether the text in the input image is displayed in the forward direction. If not, the image is corrected to make the text in the image display in the forward direction. Generally speaking, if the angle of the text in the image is within the range of -45°~45°, the preset text direction judgment model will consider that the text in the image is displayed in the forward direction and will not make any adjustments; if the angle of the text in the image is not within the range of -45°~45°, the preset text direction judgment model will consider that the text in the image is not displayed in the forward direction and correct the image to make the angle of the text in the image within the range of -45°~45°. Finally, the corrected target document image is sent to the instance segmentation model for instance segmentation of the text line to be recognized.

[0096] In the embodiment of the present invention, by correcting the target document image, the segmented instance obtained by the trained instance segmentation model is displayed in the forward direction, so that the preset text recognition model can accurately recognize the segmented instance displayed in the forward direction, thereby increasing the recognition accuracy of the preset text recognition model.

[0097] Step 209: performing instance segmentation on the multiple text lines to be recognized in the target document image through the instance segmentation model, and obtaining segmentation instances corresponding to each of the multiple text lines to be recognized.

[0098] In the embodiment of the present invention, generally, there are multiple lines of text in the target document image. When the text to be recognized contains multiple lines, each line can be used as an independent text to be recognized. In the embodiment of the present invention, the text to be recognized refers to the specific information in the target document image. For example, the identity card at least includes "name", "gender", "nationality", etc. The text to be recognized in the embodiment of the present invention refers to the specific name information after the "name", such as "Liu XX", etc., the specific gender information after the "gender", such as "male" or "female", and the specific nationality information after the "nationality", such as "Han" or "Manchu", etc. For another example, there is specific residence information after the "address" in the identity card. The specific residence information may be too long and require multiple lines of description. Therefore, in the embodiment of the present invention, there are multiple lines of text lines to be recognized corresponding to the residence information.

[0099] In the present invention, the target document image is input into the corresponding instance segmentation model, and the instance segmentation model performs instance segmentation operation on multiple text lines to be recognized on the target document image to obtain segmentation instances corresponding to each of the multiple text lines to be recognized.

[0100] Step 210: Recognize the segmented instances of the text line to be recognized by using a preset text recognition model to obtain structured information in the target document image.

[0101] In the present invention, the preset text recognition model may include but is not limited to: Keras model, CSDN model, etc.

[0102] In an embodiment of the present invention, the segmentation instances corresponding to the multiple text lines to be recognized are input into a preset text recognition model, the preset text recognition model performs text recognition, outputs the recognition results of the multiple text lines to be recognized, and finally the recognition results are combined from top to bottom to obtain complete text information. Taking the identity card as an example, the specific information represented by the output results "name", "gender", "nationality", "birth", "year", "month", "day", "address", and "citizen identification number" are combined from top to bottom in the original order to obtain complete text information.

[0103] The following are the beneficial effects of the embodiments of the present invention:

[0104] First, by expanding the data-augmented images into the original training samples, the instance segmentation model trained with the expanded training samples can accurately perform instance segmentation on target document images with different sizes, different shooting angles, and blurred fonts, thereby enhancing the robustness of the trained instance segmentation model.

[0105] Second, by selecting a matching loss function and optimizer for the corresponding instance segmentation model, the training progress of the instance segmentation model is accelerated, making the trained instance segmentation model more accurate.

[0106] Third, by testing the trained instance segmentation model, it is ensured that the trained instance segmentation model meets the usage requirements and has generalization capabilities, thereby preventing the trained instance segmentation model from having a low recognition rate.

[0107] Fourth, by correcting the target document image, the segmented instance obtained by the trained instance segmentation model is displayed in the forward direction, so that the preset text recognition model can accurately recognize the segmented instance displayed in the forward direction, thereby increasing the recognition accuracy of the preset text recognition model.

[0108] Therefore, the present invention can use the corresponding instance segmentation model to perform instance segmentation for different certificate images, making the acquired segmentation instances more accurate. At the same time, the present invention uses the instance segmentation model to directly locate the position of the text line to be recognized, and then directly sends it to the preset text recognition model for information recognition, without the need to detect and recognize irrelevant text lines, simplifying the processing flow and improving the recognition accuracy and recognition speed.

[0109] See also Figure 3 , shows a structural block diagram of an embodiment of a fixed-layout document structured information extraction device of the present invention. The specific device is as follows:

[0110] The image acquisition module 301 is used to acquire the target document image.

[0111] The model selection module 302 is used to select a corresponding instance segmentation model according to the type of the target document image.

[0112] The instance segmentation module 303 is used to perform instance segmentation on multiple text lines to be recognized in the target document image through the instance segmentation model, and obtain segmentation instances corresponding to each of the multiple text lines to be recognized.

[0113] The information acquisition module 304 is used to identify the segmentation instance of the text line to be recognized by using a preset text recognition model to obtain the structured information in the target document image.

[0114] The model selection module 302 further includes the following submodules:

[0115] The type identification acquisition submodule is used to locally acquire the type identification corresponding to the target certificate image input by the first user.

[0116] The first type acquisition submodule is used to determine the type of the target document image according to the type identifier.

[0117] The type information acquisition submodule is used to acquire the type information carried by the target document image.

[0118] The second type acquisition submodule is used to parse the type information to obtain the type of the target document image.

[0119] Preferably, the device further comprises:

[0120] The training sample acquisition module is used to acquire training samples of multiple certificates belonging to the certificate type according to the certificate type corresponding to the instance segmentation model, and perform instance segmentation and annotation on the text lines to be identified in each image in the training samples.

[0121] Wherein, the training sample acquisition module includes:

[0122] An image duplication submodule, used for duplicating each image in the training sample to obtain a plurality of duplicated images;

[0123] A data enhancement submodule, used for performing data enhancement on the plurality of copied images to obtain a plurality of data enhanced images;

[0124] The image adding submodule is used to add the multiple data-enhanced images to the training samples.

[0125] A loss function and optimizer selection module is used to select a loss function and optimizer that match the instance segmentation model, and connect the loss function and optimizer to the output layer of the instance segmentation model; wherein different instance segmentation models match different loss functions and optimizers.

[0126] A training module is used to train the instance segmentation model through the training samples, the loss function and the optimizer until the loss of the instance segmentation model converges.

[0127] The test sample acquisition module is used to acquire test samples of multiple certificates belonging to the certificate type according to the certificate type corresponding to the instance segmentation model.

[0128] The test pass rate acquisition module is used to test the trained instance segmentation model using the test sample to obtain the test pass rate.

[0129] The test pass rate judgment module is used to stop training the instance segmentation model if the test pass rate is greater than a preset threshold.

[0130] The test pass rate judgment module is also used to continue training the instance segmentation model with the training samples if the test pass rate is less than or equal to the preset threshold, until the test pass rate of the instance segmentation model is greater than the preset threshold.

[0131] The image area transformation module is used to transform the image area of ​​the target certificate into the predicted area of ​​the target certificate image, wherein the target certificate image includes the image area of ​​the target certificate.

[0132] The image correction module is used to correct the target document image if any side of the image area of ​​the target document does not fit with the corresponding side of the predicted area, so as to make each side of the image area of ​​the target document fit with the corresponding side of the predicted area.

[0133] The image sending module is used to send the corrected target document image to the instance segmentation model for instance segmentation of the text line to be recognized.

[0134] Based on the same inventive concept, another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements the steps of the method described in any of the above embodiments of the present application.

[0135] Based on the same inventive concept, another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the method described in any of the above embodiments of the present application.

[0136] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0137] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0138] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0139] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0140] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0141] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.

[0142] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0143] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0144] The fixed-layout certificate structured information extraction method, device, equipment and medium provided by the present invention are introduced in detail above. The principles and implementation methods of the present invention are explained in this article using specific examples. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for extracting structured information from a fixed-layout certificate, characterized in that: The method comprises: According to the document type corresponding to the instance segmentation model, a plurality of training samples of documents belonging to the document type are obtained, and the text lines to be recognized in each image in the training samples are subjected to instance segmentation annotation; the step of obtaining the training samples of the plurality of documents belonging to the document type according to the document type corresponding to the instance segmentation model comprises: copying each image in the training sample to obtain a plurality of copied images; performing data enhancement on the plurality of copied images to obtain a plurality of data enhanced images; and adding the plurality of data enhanced images to the training sample; Selecting a loss function and an optimizer that match the instance segmentation model, and connecting the loss function and the optimizer to an output layer of the instance segmentation model; wherein different instance segmentation models match different loss functions and optimizers; Training the instance segmentation model by using the training samples, the loss function and the optimizer until the loss of the instance segmentation model converges; Obtain the target document image; Selecting a corresponding instance segmentation model according to the type of the target document image; Performing instance segmentation on a plurality of text lines to be recognized in the target document image by using the instance segmentation model, and obtaining segmentation instances corresponding to each of the plurality of text lines to be recognized; Identifying the segmented instances of the text lines to be identified by a preset text recognition model to obtain structured information in the target document image; In which, when there are multiple text lines to be recognized, the segmentation instances corresponding to the multiple text lines to be recognized are respectively input into the preset text recognition model, text recognition is performed through the preset text recognition model, and the recognition results of the multiple text lines to be recognized are output, and the recognition results are combined from top to bottom to obtain complete text information.

2. The method according to claim 1, characterized in that After the step of training the instance segmentation model by using the training samples, the loss function and the optimizer until the loss of the instance segmentation model converges, the method further includes: According to the document type corresponding to the instance segmentation model, obtaining test samples of multiple documents belonging to the document type; Using the test sample to test the trained instance segmentation model to obtain a test pass rate; If the test pass rate is greater than a preset threshold, the instance segmentation model is no longer trained; If the test pass rate is less than or equal to the preset threshold, the instance segmentation model is continuously trained using the training samples until the test pass rate of the instance segmentation model is greater than the preset threshold.

3. The method according to claim 1, characterized in that The type of the target document image is obtained by: Acquire locally a type identifier corresponding to the target document image input by the first user; The type of the target document image is determined according to the type identifier.

4. The method according to claim 1, characterized in that: The type of the target document image is obtained by: Obtaining type information carried by the target document image; The type information is parsed to obtain the type of the target document image.

5. The method according to claim 1, characterized in that The target certificate image includes an image area of ​​the target certificate; After acquiring the target document image, the method further includes: Transforming the image region of the target document into the predicted region of the target document image; If any side of the image area of ​​the target document does not fit with the corresponding side of the predicted area, correcting the target document image so that each side of the image area of ​​the target document fits with the corresponding side of the predicted area; The corrected target document image is sent to the instance segmentation model for instance segmentation of the text lines to be recognized.

6. A device for extracting structured information from a fixed-layout certificate, characterized in that: The device comprises: A training sample acquisition module, used to acquire training samples of multiple certificates belonging to the certificate type according to the certificate type corresponding to the instance segmentation model, and perform instance segmentation and annotation on the text line to be recognized in each image in the training sample; An image duplication submodule, used for duplicating each image in the training sample to obtain a plurality of duplicated images; A data enhancement submodule, used for performing data enhancement on the plurality of copied images to obtain a plurality of data enhanced images; An image adding submodule, used for adding the plurality of data-enhanced images to the training samples; A loss function and optimizer selection module, used to select a loss function and an optimizer matching the instance segmentation model, and connect the loss function and the optimizer to the output layer of the instance segmentation model; wherein different instance segmentation models match different loss functions and optimizers; A training module, used for training the instance segmentation model through the training samples, the loss function and the optimizer until the loss of the instance segmentation model converges; An image acquisition module, used to acquire the target document image; A model selection module, used to select a corresponding instance segmentation model according to the type of the target document image; An instance segmentation module, used to perform instance segmentation on a plurality of text lines to be identified in the target document image by using the instance segmentation model, and obtain segmentation instances corresponding to each of the plurality of text lines to be identified; An information acquisition module, used to identify the segmentation instance of the text line to be recognized by using a preset text recognition model to obtain structured information in the target document image; In which, when there are multiple text lines to be recognized, the segmentation instances corresponding to the multiple text lines to be recognized are respectively input into the preset text recognition model, text recognition is performed through the preset text recognition model, and the recognition results of the multiple text lines to be recognized are output, and the recognition results are combined from top to bottom to obtain complete text information.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of a method for extracting structured information from a fixed-format document as described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a method for extracting structured information from a fixed-format document as described in any one of claims 1 to 5.