Document identification method, device, equipment and medium

By performing format conversion and perspective transformation on the document file, extracting the features of the document image, and combining probability and text content for identification, the problem of low document data collection efficiency and poor accuracy in the existing technology is solved, and efficient and accurate document data is achieved. extract.

CN114926850BActive Publication Date: 2024-09-17GUANGDONG INST OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210438580.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-25
Publication Date
2024-09-17
Estimated Expiration
2042-04-25

AI Technical Summary

Technical Problem

In the existing technology, document data collection efficiency is low and recognition accuracy is poor, resulting in manual sorting and scanning processes that are time-consuming and prone to recognition errors.

Method used

By obtaining the target document file and converting the format, setting the benchmark key points and detection key points of the reference document image, performing perspective transformation to obtain the second document image, extracting the characteristics of the target element frame, and performing text recognition based on probability and text content to improve recognition Accuracy.

Benefits of technology

It improves the efficiency and accuracy of document data collection, reduces recognition errors, and achieves efficient document text extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure HDA0003614023020000011
    Figure HDA0003614023020000011
  • Figure HDA0003614023020000021
    Figure HDA0003614023020000021
  • Figure HDA0003614023020000031
    Figure HDA0003614023020000031
Patent Text Reader

Abstract

The present invention provides a document recognition method, device, equipment and medium, wherein the method comprises: obtaining a target document file, converting the format of the target document file to obtain a first document image; setting a reference key point of the reference document image, and obtaining the detection key point of the first document image according to the reference key point; transforming the first document image according to the reference key point and the detection key point to obtain a second document image; obtaining a target element frame of the document element in the second document image, wherein the target element frame includes a first element frame and a second element frame; extracting features of the first image in the first element frame to obtain a first feature; determining the second feature according to a first probability, and connecting the first text with the second text in the second feature to obtain the target text. The present invention improves the efficiency and accuracy of document data collection by proposing a document recognition method, device, equipment and medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a document identification method, device, equipment and medium. Background Art

[0002] At present, the document data collection work is mainly done by manually sorting the original bills, scanning them, and finally manually entering the bill information and reviewing the vouchers. Even if intelligent data collection methods are used, there are often cases where the recognition is wrong or even impossible to recognize, which makes the document data collection work extremely inefficient and consumes a lot of time and manpower. Summary of the invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the embodiments of the present invention provide a document recognition method, device, equipment and medium to improve the efficiency and accuracy of document data collection.

[0004] On the one hand, an embodiment of the present invention provides a document recognition method, including: obtaining a target document file, converting the format of the target document file to obtain a first document image; setting a reference key point of the reference document image, and obtaining a detection key point of the first document image according to the reference key point, wherein the position of the reference key point in the reference document image and the position of the detection key point in the first document image correspond one to one; transforming the first document image according to the reference key point and the detection key point to obtain a second document image; obtaining a target element frame of a document element in the second document image, wherein the target element frame includes a first element frame and a second element frame; extracting features from a first image in the first element frame to obtain a first feature; wherein the first feature includes a first probability and a first text, the first probability represents a probability pointing to a second feature, the second feature represents feature extraction of a second image in a second element frame, and the first text is text content after feature extraction of the first image; determining the second feature according to the first probability, connecting the first text with the second text in the second feature to obtain a target text, wherein the second text is text content after feature extraction of the second image.

[0005] The document recognition method according to the embodiment of the present invention has at least the following beneficial effects: using the reference document image to transform the first document image to obtain the second document image, obtaining the target element frame of the second document image to perform feature extraction to obtain the first text and the second text, and connecting the first text and the second text to obtain the target text. In this way, the document text is efficiently extracted, the recognition accuracy is improved, and the recognition error is reduced.

[0006] According to some embodiments of the present invention, the step of obtaining a target document file and converting the format of the target document file to obtain a first document image includes: obtaining the file type of the target document file according to a file name suffix of the target document file; and determining that the file type is a non-image format, then converting the file type to obtain the first document image.

[0007] According to some embodiments of the present invention, transforming the first document image according to the benchmark key points and the detection key points to obtain the second document image includes: obtaining a perspective transformation matrix according to the benchmark key points and the detection key points; and performing a perspective transformation on the first document image using the perspective transformation matrix to obtain the second document image.

[0008] According to some embodiments of the present invention, extracting features from the first image in the first element frame to obtain the first feature includes: scaling the images in the target element frame so that all the images have the same height; performing a convolution operation on the images to obtain a feature vector of sequence features, wherein the feature vector represents a fixed-width feature of the image; obtaining a probability pointing to the second image based on the label distribution of the feature vector as the first probability; extracting features from the image based on the size of the feature vector to obtain the first text; and combining the first probability and the first text as the first feature.

[0009] According to some embodiments of the present invention, determining the second feature based on the first probability, connecting the first text with the second text in the second feature to obtain a target text, includes: obtaining the second feature based on the highest first probability; obtaining the second text in the second feature, connecting the beginning of the second text with the end of the first text to obtain the target text.

[0010] According to some embodiments of the present invention, determining the second feature based on the first probability, connecting the first text with the second text in the second feature to obtain a target text includes: detecting the target text, and removing duplicate characters in the target text.

[0011] According to some embodiments of the present invention, determining the second feature based on the first probability, connecting the first text with the second text in the second feature to obtain the target text includes: detecting the target text, determining that a spacing symbol appears between two adjacent characters, and then deleting the spacing symbol.

[0012] On the other hand, an embodiment of the present invention provides a document recognition device, including: a first module, used to obtain a target document file, and convert the format of the target document file to obtain a first document image; a second module, used to set a reference key point of a reference document image, and obtain a detection key point of the first document image according to the reference key point, wherein the position of the reference key point in the reference document image and the position of the detection key point in the first document image have a one-to-one correspondence; a third module, used to transform the first document image according to the reference key point and the detection key point to obtain a second document image; and a fourth module, used to obtain a target document element in the second document image. An element box, wherein the target element box includes a first element box and a second element box; a fifth module, used to extract features of the first image in the first element box to obtain a first feature; wherein the first feature includes a first probability and a first text, the first probability represents the probability of pointing to the second feature, the second feature represents the feature extraction of the second image in the second element box, and the first text is the text content after the feature extraction of the first image; a sixth module, used to determine the second feature according to the first probability, connect the first text with the second text in the second feature, and obtain the target text, wherein the second text is the text content after the feature extraction of the second image.

[0013] The document recognition device according to the embodiment of the present invention has at least the following beneficial effects: using the reference document image to transform the first document image to obtain the second document image, obtaining the target element frame of the second document image to perform feature extraction to obtain the first text and the second text, and connecting the first text and the second text to obtain the target text. In this way, the document text is efficiently extracted, the recognition accuracy is improved, and the recognition error is reduced.

[0014] On the other hand, an embodiment of the present invention further provides a computer device, comprising: at least one processor; at least one memory for storing at least one program; when the at least one program is executed by the at least one processor, the at least one processor implements any one of the document identification methods described above.

[0015] The computer device according to the embodiment of the present invention has at least the same beneficial effects as the above-mentioned document recognition method.

[0016] On the other hand, an embodiment of the present invention provides a storage medium, wherein program instructions are stored in the storage medium, and when the program instructions are executed by a processor, the document recognition method described in any one of the above can be implemented.

[0017] The storage medium according to the embodiment of the present invention has at least the same beneficial effects as the above-mentioned document recognition method.

[0018] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flowchart of the steps of the document identification method provided by an embodiment of the present invention;

[0020] Figure 2 is a flowchart of the steps of a document identification method provided by another embodiment of the present invention;

[0021] Figure 3 is a flowchart of the steps of a document identification method provided by another embodiment of the present invention;

[0022] Figure 4 is a flowchart of the steps of a document identification method provided by another embodiment of the present invention;

[0023] Figure 5 is a schematic block diagram of a document recognition device provided by an embodiment of the present invention;

[0024] Figure 6 is a schematic block diagram of a device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. In the subsequent description, the use of suffixes such as "module", "component" or "unit" used to represent elements is only for the purpose of facilitating the description of the present invention, and has no specific meaning in itself. Therefore, "module", "component" or "unit" can be used in a mixed manner. "First", "second" and the like are only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or implicitly indicating the order of the indicated technical features. In this subsequent description, the continuous numbering of the method steps is for the convenience of review and understanding. In combination with the overall technical solution of the present invention and the logical relationship between the various steps, adjusting the implementation order between the steps will not affect the technical effect achieved by the technical solution of the present invention. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0026] Reference Figure 1 , the method of the embodiment of the present invention includes:

[0027] Step S100, obtaining a target document file, and converting the format of the target document file to obtain a first document image;

[0028] According to some embodiments of the present invention, step S100 includes the following steps:

[0029] Get the file type of the target document file according to the file name suffix of the target document file;

[0030] If it is determined that the file type is not in a picture format, the file type is converted into a format to obtain a first document picture.

[0031] Specifically, select the target document file to be identified, send a post request to the server, and after the server receives the target document file, read the file name suffix to determine the type of file. At present, the target document file is often transmitted in the form of PDF files and pictures. When the target document file is read as a PDF file, the file is converted into a picture format. It can be understood that the format conversion can use software such as the PyMuPDF library; the picture format is divided into many forms, such as png, jpg, bmp, etc., which are not limited here; when the read file is a file type other than a picture, the format conversion must be performed to obtain a file in picture format. If the file is in picture format, no conversion is required. The final picture file is the first document picture.

[0032] Step S200, setting reference key points of the reference document image, and obtaining detection key points of the first document image according to the reference key points, wherein the positions of the reference key points in the reference document image and the positions of the detection key points in the first document image correspond one to one;

[0033] Step S300, transforming the first document image according to the reference key points and the detection key points to obtain a second document image;

[0034] According to some embodiments of the present invention, step S300 includes the following steps: Figure 2 As shown:

[0035] Step S310, obtaining a perspective transformation matrix according to the reference key points and the detection key points;

[0036] Step S320: Perform perspective transformation on the first document image using a perspective transformation matrix to obtain a second document image.

[0037] Specifically, the document image is trained to obtain a reference document image. It can be understood that after repeated and multiple training, the reference document image can identify the clearest and most accurate text in subsequent processing. Set reference key points on the reference document image, and set detection key points on the first document image, wherein the position of the reference key points in the reference document image must correspond to the position of the detection key points in the first document image. For example, the reference key points and the detection key points are respectively set at the four vertices of the table in the corresponding document, the position corresponding to the year, and so on. The perspective transformation matrix is ​​calculated based on the detection key points and the reference key points, and the first document image is perspectively transformed through the perspective transformation matrix to obtain the second document image on the plane of the reference document image. At this time, the second document image is corrected, which is convenient for the subsequent recognition and extraction of the text on the image, and at the same time improves the recognition accuracy. It should be noted that documents are also different according to their uses, places, etc., so the reference document image obtained by training should belong to the same type of document as the first document image. Among them, the HRNet network can be used to train the benchmark document key point detection model. Unlike the traditional method, HRNet does not need to reduce the resolution first and then increase it. HRNet maintains high resolution throughout the process. By gradually adding low-resolution feature map sub-networks to the high-resolution feature map main network in parallel, different networks achieve multi-scale fusion and feature extraction, and the final estimated key points are output in the high-resolution backbone network. The benchmark document image obtained in this way is more accurate.

[0038] Step S400, obtaining a target element frame of a document element in a second document image, wherein the target element frame includes a first element frame and a second element frame;

[0039] Specifically, the second document image is detected to obtain the position of the target element frame of the document element in the second document image. Multiple target element frames can be obtained in one document image, wherein the PP-YOLOv2 model can be used to detect the document elements in the document image to obtain the position of the target element frame. The accuracy of the PP-YOLOv2 model is higher than that of other models. Through incremental ablation, measures that help improve performance without increasing inference time are gradually added, achieving a better balance between performance (49.5% mAP) and speed (69FPS).

[0040] Step S500, extracting features from the first image in the first element frame to obtain a first feature; wherein the first feature includes a first probability and a first text, the first probability represents the probability of pointing to the second feature, the second feature represents feature extraction of the second image in the second element frame, and the first text is the text content after feature extraction of the first image;

[0041] According to some embodiments of the present invention, step S500 includes the following steps: Figure 3 As shown:

[0042] Step S510, scaling the images in the target element frame so that the heights of all images are the same;

[0043] Step S520, performing a convolution operation on the image to obtain a feature vector of the sequence feature, wherein the feature vector represents a fixed width feature of the image;

[0044] Step S530, obtaining a probability of pointing to the second image according to the label distribution of the feature vector as a first probability;

[0045] Step S540, extracting features from the image according to the size of the feature vector to obtain a first text;

[0046] Step S550: combining the first probability and the first text as a first feature.

[0047] According to some embodiments of the present invention, step S500 further includes the following steps: Figure 4 As shown:

[0048] Step S560, obtaining a second feature according to the highest first probability;

[0049] Step S570, obtaining the second text in the second feature, connecting the beginning of the second text with the end of the first text, and obtaining the target text.

[0050] Specifically, scale the obtained target element boxes so that the heights of the images are the same, and then perform convolution calculation on the images to obtain feature vectors. The feature vectors represent the features of the fixed width of the images. For example, the default width is 1 because the images have been scaled to the same height. At this time, the picture pixels in each target element box are the same. The target element boxes include a first element box and a second element box. The image in the first element box is the first image, and the image in the second element box is the second image. It can be understood that the first and second here do not indicate the quantity. For example, there are many target element boxes in a bill picture. Set one of them as the first element box, then all the target element boxes except the first element box are set as the second element box. The same applies to the first image and the second image. Extract the first text from the image according to the size of the feature vector, and the probability of pointing to the second image obtained from the label distribution of the feature vector is the first probability. Combine the first probability and the first text to obtain the first feature. Therefore, the first probability of pointing to the second feature is actually the probability of pointing to the second image in the second feature. For example, the first image is extracted to obtain the text "ticket" as the first text, and the second image is extracted to obtain texts such as "voucher", "agent", and "number" as the second text. According to the label distribution of the feature vector, the first probability of pointing to the second image corresponding to the second text "voucher" is 90%, the first probability of pointing to the second image corresponding to the second text "agent" is 0.1%, and the first probability of pointing to the second image corresponding to the second text "number" is 0.7%... Then the first feature includes the first text and all the first probabilities. Compare all the first probabilities, take the second feature pointed to by the highest first probability, and obtain the second text in the second feature. Connect the head of the second text to the end of the first text. For example, the highest first probability is 90%, and the second text extracted from the corresponding second image is "voucher". Connect the "ticket" of the first text with the "voucher" of the second text, with the first text in the front and the second text in the back, to obtain the target text "bill". In this way, when the context is associated, a more accurate phrase can be connected, improving the accuracy. Among them, the ResAttentionCRNN model can be used to perform text recognition on the pictures. The ResAttentionCRNN model adds an attention mechanism bidirectional LSTM and a residual connection ResNet32 to the traditional CRNN model, making the recognition more accurate.

[0051] Step S600: Determine the second feature according to the first probability, and connect the first text with the second text in the second feature to obtain the target text, where the second text is the text content after feature extraction of the second image.

[0052] According to some embodiments of the present invention, step S600 includes the following steps:

[0053] Detect the target text and remove duplicate characters in the target text;

[0054] If it is determined that there is an interval symbol between two adjacent characters, the interval symbol will be deleted.

[0055] Specifically, due to reasons such as character spacing and image distortion, there may be a situation where characters appear repeatedly after recognition. At this time, the continuously and repeatedly appearing characters in the target text are deleted, and only one of them is retained. For example, if "ticket ticket ticket code" is recognized, at this time, the repeatedly appearing "ticket" characters are de-duplicated, and only one of them is retained. In addition, when there is an interval symbol between characters, such as "ticket - code", this interval symbol also represents that the character appears repeatedly multiple times, so the interval symbol needs to be deleted. In this way, the recognition error of the text is reduced, making the final obtained target text statement more coherent and accurate.

[0056] On the one hand, referring to Figure 5 , this embodiment provides a document recognition device, which at least includes: a first module 510, a second module 520, a third module 530, a fourth module 540, a fifth module 550, and a sixth module 560.

[0057] Specifically, after the first module 510 obtains the target document file, it converts the format of the target document file and outputs the first document image. The second module 520 sets the reference key points of the reference document image, receives the first document image, sets the detection key points on the first document image, and the positions of the detection key points in the first document image correspond one by one to the positions of the reference key points in the reference document image. At this time, the reference key points and the detection key points are output to the third module 530. The third module 530 calculates the perspective transformation matrix based on the reference key points and the detection key points. After the first document image is transformed by the perspective transformation matrix, it outputs the second document image to the fourth module 540. The fourth module 540 detects the second document image and obtains the target element frame of the document elements on the second document image. The fifth module 550 inputs the target element frame and extracts the features of the image in the target element frame. The target element frame is divided into a first element frame and a second element frame. The image in the first element frame is the first image, and the image in the second element frame is the second image. After feature extraction, the first feature and the second feature are obtained. After feature extraction of the first image in the first element frame, the first feature is obtained, and the first feature includes the first text and the first probability. The sixth module 560 takes the second feature pointed to by the first probability with the maximum value among the first probabilities pointing to the second feature, obtains the second text therein, connects it with the first text, and outputs the final target text.

[0058] Referring to Figure 6, this embodiment provides an electronic device, including a processor 710 and a memory 720 coupled to the processor 710, the memory 720 stores program instructions that can be executed by the processor 710, and the processor 710 implements the above-mentioned document recognition method when executing the program instructions stored in the memory 720. Among them, the processor 710 can also be called a CPU (Central Processing Unit). The processor 710 may be an integrated circuit chip with signal processing capabilities. The processor 710 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor, or the general-purpose processor can also be any conventional processor, etc. The memory 720 can include various components (for example, machine-readable media), including but not limited to random access memory components, read-only components and any combination thereof. The memory 720 can also include: instructions (for example, software) (for example, stored in one or more machine-readable media); the instructions implement the document recognition method in the above-mentioned embodiment. The electronic device has the function of carrying and running the software system for document recognition provided by the embodiment of the present invention, for example, a personal computer (PC), a mobile phone, a smart phone, a personal digital assistant (PDA), a wearable device, a Pocket PC (PPC), a tablet computer, etc.

[0059] This embodiment provides a computer-readable storage medium, which stores a program, and the program is executed by a processor to implement the above-mentioned document recognition method.

[0060] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.

[0061] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the aforementioned business data processing method.

[0062] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0063] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0064] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0065] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0066] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0067] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0068] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

[0069] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the described embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.

Claims

1. A document identification method, characterized in that: include: Acquire a target document file, and convert the format of the target document file to obtain a first document image; Setting a reference key point of the reference document image, and acquiring a detection key point of the first document image according to the reference key point, wherein a position of the reference key point in the reference document image and a position of the detection key point in the first document image correspond one to one; Transforming the first document image according to the reference key points and the detection key points to obtain a second document image; Acquire a target element frame of a document element in the second document image, wherein the target element frame includes a first element frame and a second element frame; Extract features of the first image in the first element frame to obtain a first feature; The first feature includes a first probability and a first text, the first probability represents the probability of pointing to the second feature, the second feature represents feature extraction of the second image in the second element frame, and the first text is the text content after feature extraction of the first image; determining the second feature according to the first probability, connecting the first text with the second text in the second feature to obtain a target text, wherein the second text is the text content after feature extraction from the second image; Extracting features of the first image in the first element frame to obtain a first feature includes: Scaling the images in the target element frame so that all the images have the same height; Performing a convolution operation on the image to obtain a feature vector of a sequence feature, wherein the feature vector represents a fixed-width feature of the image; Obtaining a probability of pointing to the second image according to the label distribution of the feature vector as the first probability; Extracting features from the image according to the size of the feature vector to obtain the first text; combining the first probability and the first text as the first feature; The determining the second feature according to the first probability, and connecting the first text with the second text in the second feature to obtain the target text includes: According to the highest first probability, obtaining the second feature; The second text in the second feature is obtained, and the beginning of the second text is connected to the end of the first text to obtain the target text.

2. The document recognition method according to claim 1, characterized in that: The step of obtaining a target document file and converting the format of the target document file to obtain a first document image includes: According to the file name suffix of the target document file, obtaining the file type of the target document file; If it is determined that the file type is not in a picture format, the file type is converted into a format to obtain the first document picture.

3. The document recognition method according to claim 1, characterized in that: The step of transforming the first document image according to the reference key points and the detection key points to obtain a second document image includes: Obtaining a perspective transformation matrix according to the reference key points and the detection key points; The first document image is perspective transformed using the perspective transformation matrix to obtain the second document image.

4. The document recognition method according to claim 1, characterized in that: The determining the second feature according to the first probability, and connecting the first text with the second text in the second feature to obtain the target text includes: The target text is detected, and duplicate characters in the target text are removed.

5. The document recognition method according to claim 1, characterized in that: The determining the second feature according to the first probability, and connecting the first text with the second text in the second feature to obtain the target text includes: The target text is detected, and if a spacer symbol is determined to exist between two adjacent characters, the spacer symbol is deleted.

6. A document recognition device, characterized in that: The document recognition method according to any one of claims 1 to 5, wherein the document recognition device comprises: The first module is used to obtain a target document file and convert the format of the target document file to obtain a first document image; A second module is used to set a reference key point of the reference document image, and obtain a detection key point of the first document image according to the reference key point, wherein the position of the reference key point in the reference document image and the position of the detection key point in the first document image correspond one to one; A third module is used to transform the first document image according to the reference key points and the detection key points to obtain a second document image; A fourth module is used to obtain a target element frame of a document element in the second document image, wherein the target element frame includes a first element frame and a second element frame; A fifth module is used to extract features from the first image in the first element frame to obtain a first feature; wherein the first feature includes a first probability and a first text, the first probability represents a probability pointing to a second feature, the second feature represents feature extraction of the second image in the second element frame, and the first text is the text content after feature extraction of the first image; The sixth module is used to determine the second feature according to the first probability, connect the first text with the second text in the second feature, and obtain the target text, wherein the second text is the text content after feature extraction of the second image.

7. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The storage medium stores a program, and the program is executed by a processor to implement the method according to any one of claims 1 to 5.