A method and apparatus for information extraction
Patent Information
- Application Number
- CN202211312254.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-25
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-10-25
AI Technical Summary
但该方法无法区分节点间出现粘连的情况,所以只能用于简单场景
[0041]与现有技术相比,本申请首先根据任务场景确定至少一个关键实体信息;然后识别所述任务场景中的目标图像所包含的实体信息对,其中,所述实体信息对包括实体信息内容以及与所述实体信息内容对应的坐标数据;再对所述实体信息对进行编码得到各个所述实体信息对对应的特征值;随后构建每个所述特征值对应的多头矩阵,将各个所述多头矩阵组成特征值矩阵;最后识别包含所述关键实体信息的实体信息内容所对应的多头矩阵在所述特征值矩阵中的位置;通过确定所述位置对应的目标多头矩阵,对所述目标多头矩阵对应的特征值进行解码得到所述关键实体信息。
Smart Images

Figure CN115797941B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technology, and in particular to a method and apparatus for information extraction. Background Technology
[0002] With the development of technology, high technology has gradually been integrated into people's daily learning and life. When taking notes in class but the notes are too long, most people will choose to take pictures and then write notes based on the content of the pictures. However, this is inefficient, and when there is a lot of image content, it will take a lot of time to reorganize. Therefore, extracting information from document images is particularly important.
[0003] Optical Character Recognition (OCR) provides a possible way to extract information from document images, but it is inevitable that it will recognize other unwanted content. For example, if there is a text-like billboard in the image, OCR will extract all the recognized text, which will cause some trouble for the subsequent data processing. Therefore, a method that can extract key information is needed.
[0004] Existing technologies often use graph neural network-based methods to extract key information. This method utilizes the results of OCR, dividing the output text into text detection boxes, each box representing a node. Multiple nodes are adjacent by edges, forming a graph structure. A graph convolutional network is then used iteratively to obtain the graph's features. Finally, each node is classified, and edge connectivity is predicted to obtain the final result. However, this method cannot distinguish between nodes that are connected, thus limiting its application to simple scenarios. Summary of the Invention
[0005] In view of this, embodiments of this application provide an information extraction method and apparatus, which are designed to handle information extraction tasks in any general scenario, wherein the general scenario includes simple scenarios and complex scenarios.
[0006] In a first aspect, embodiments of this application provide an information extraction method, the method comprising:
[0007] Identify at least one key entity based on the task scenario;
[0008] Identify entity information pairs contained in target images within a task scenario, wherein each entity information pair includes entity information content and coordinate data corresponding to the entity information content;
[0009] Encode the entity information pairs to obtain the feature values corresponding to each entity information pair;
[0010] Construct the multi-head matrix corresponding to each eigenvalue, and combine the multi-head matrices into an eigenvalue matrix;
[0011] Identify the position of the multi-head matrix corresponding to the entity information content containing key entity information in the eigenvalue matrix;
[0012] Determine the target multi-head matrix corresponding to the location, and decode the feature values corresponding to the target multi-head matrix to obtain key entity information.
[0013] Optionally, the entity information pairs contained in the target image in the recognition task scene include:
[0014] The entity information pairs contained in the target image in the task scene are identified by optical character recognition.
[0015] Preferably, before encoding the entity information pairs to obtain the feature values corresponding to each entity information pair, the method further includes:
[0016] The layout model is pre-trained using entity information pairs contained in the target images in the identified task scene. The layout model is used to encode the data and obtain feature values.
[0017] Optionally, construct the multi-head matrix corresponding to each eigenvalue, and combine the multi-head matrices to form the eigenvalue matrix, including:
[0018] The entity information is filled into the corresponding feature values into the multi-head matrix. The multi-head matrices are then arranged horizontally and vertically according to the coordinate data, and the various multi-head matrices are combined to form the feature value matrix.
[0019] Optionally, identifying the position of the multi-head matrix corresponding to the entity information content containing key entity information within the eigenvalue matrix includes:
[0020] The multi-head matrix containing entity information content, with the eigenvalues corresponding to the start and end fields of the eigenvalue matrix, is marked as the first position.
[0021] Determine whether there are key entity information corresponding to feature values in the multi-head matrix marked as the first position;
[0022] The multi-head matrix that does not contain feature values corresponding to key entity information is marked as the second position, and the multi-head matrix that contains feature values corresponding to key entity information is marked as the third position.
[0023] Determine the position of the third position in the eigenvalue matrix.
[0024] Secondly, embodiments of this application provide an information extraction device, which includes:
[0025] The key entity information determination module is used to determine at least one key entity information based on the task scenario;
[0026] The entity information pair recognition module is used to recognize entity information pairs contained in the target image in the task scene. The entity information pair includes entity information content and coordinate data corresponding to the entity information content.
[0027] The information encoding module is used to encode entity information pairs to obtain the feature values corresponding to each entity information pair;
[0028] The multi-head matrix construction module is used to construct the multi-head matrix corresponding to each eigenvalue and combine the multi-head matrices into an eigenvalue matrix.
[0029] The location recognition module is used to identify the position of the multi-head matrix corresponding to the entity information content containing key entity information in the eigenvalue matrix;
[0030] The decoding module is used to determine the target multi-head matrix corresponding to the location, and decode the feature values corresponding to the target multi-head matrix to obtain key entity information.
[0031] Preferably, the device further includes:
[0032] The layout model pre-training module is used to pre-train the layout model using the entity information pairs contained in the target images in the identified task scene. The layout model is used to encode the data and obtain feature values.
[0033] Optionally, the location recognition module includes:
[0034] The first position annotation unit is used to annotate the multi-head matrix containing entity information content in the feature value matrix with the feature value corresponding to the start field and the feature value corresponding to the end field as the first position;
[0035] The judgment unit is used to determine whether there are feature values corresponding to key entity information in the multi-head matrix marked as the first position;
[0036] The second position annotation unit is used to annotate multi-head matrices that do not have feature values corresponding to key entity information as the second position;
[0037] The third position annotation unit is used to annotate the multi-head matrix containing feature values corresponding to key entity information as the third position;
[0038] A position determination unit is used to determine the position of the third position in the eigenvalue matrix.
[0039] Thirdly, embodiments of this application provide an apparatus comprising a memory and a processor, the memory being used to store instructions or code, and the processor being used to execute the instructions or code to cause the apparatus to perform the information extraction method described in any of the first aspects above.
[0040] Fourthly, embodiments of this application provide a computer storage medium storing code, wherein when the code is executed, a device running the code implements the information extraction method described in any of the first aspects above.
[0041] Compared with existing technologies, this application first determines at least one key entity information based on the task scenario; then identifies entity information pairs contained in the target image in the task scenario, wherein the entity information pair includes entity information content and coordinate data corresponding to the entity information content; then encodes the entity information pairs to obtain feature values corresponding to each entity information pair; subsequently constructs a multi-head matrix corresponding to each feature value, and combines the multi-head matrices into a feature value matrix; finally, identifies the position of the multi-head matrix corresponding to the entity information content containing the key entity information in the feature value matrix; and by determining the target multi-head matrix corresponding to the position, decodes the feature values corresponding to the target multi-head matrix to obtain the key entity information.
[0042] Since each multi-head matrix contains only one eigenvalue data, the key entity information is obtained by decoding only the eigenvalue data in the multi-head matrix containing the key entity information. Therefore, there is no interference between entity information contents, which makes the method provided in this application applicable to complex scenarios and also has a better effect on key entity information extraction in simple scenarios. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings used in the description of the embodiment or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 A flowchart of one method of information extraction provided in the embodiments of this application;
[0045] Figure 2 This is a schematic diagram of the eigenvalue matrix construction method provided in the embodiments of this application;
[0046] Figure 3 A schematic diagram illustrating the first position annotation provided in an embodiment of this application;
[0047] Figure 4 A schematic diagram illustrating the second and third position annotations provided in the embodiments of this application;
[0048] Figure 5 Another flowchart illustrating the information extraction method provided in this application embodiment;
[0049] Figure 6 This is a schematic diagram of the structure of an information extraction device provided in an embodiment of this application. Detailed Implementation
[0050] Existing technologies often use graph neural network-based methods to extract key information. This method utilizes the results of Optical Character Recognition (OCR), dividing the output text into text detection boxes, each box representing a node. Multiple nodes are adjacent by edges, thus forming a graph structure. A graph convolutional network is then used iteratively to obtain the graph's features. Finally, each node is classified, and edge connectivity is predicted to obtain the final result.
[0051] Research has shown that existing technologies cannot distinguish between instances where nodes are stuck together. For example, in machine-printed invoices, multiple entities may be printed together. Existing technologies cannot distinguish between instances where two nodes are stuck together, resulting in missed detections. Therefore, existing technologies can only be used in simple scenarios.
[0052] Compared to existing technologies, this application first determines at least one key entity information based on the task scenario; then identifies entity information pairs contained in the target image in the task scenario, wherein each entity information pair includes entity information content and coordinate data corresponding to the entity information content; next, the entity information pairs are encoded to obtain feature values corresponding to each entity information pair; subsequently, a multi-head matrix corresponding to each feature value is constructed, and the multi-head matrices are combined to form a feature value matrix; finally, the position of the multi-head matrix corresponding to the entity information content containing the key entity information is identified in the feature value matrix; by determining the target multi-head matrix corresponding to the position, the feature values corresponding to the target multi-head matrix are decoded to obtain the key entity information.
[0053] Since each multi-head matrix contains only one eigenvalue data, the key entity information is obtained by decoding only the eigenvalue data in the multi-head matrix containing the key entity information. Therefore, there is no interference between entity information contents, which makes the method provided in this application applicable to complex scenarios and also has a better effect on key entity information extraction in simple scenarios.
[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0055] See Figure 1, Figure 1 A flowchart of an information extraction method provided in this application embodiment includes:
[0056] S101: Determine at least one key entity information based on the task scenario.
[0057] The task scenario refers to a scenario where information extraction is required, such as extracting information contained in a target image.
[0058] Key entity information refers to the specific entity information that needs to be extracted in the task scenario. For example, in the ID card scanning task scenario, the ID card number and name can be identified as key entity information, and these two key entity information can be extracted using the information extraction method provided in any embodiment of this application.
[0059] S102: Identify the entity information pairs contained in the target image in the task scene.
[0060] The entity information includes the entity information content and the coordinate data corresponding to the entity information content. For example, in the scenario of extracting ID card information, the entity information content includes name, ID number, home address, etc.; the coordinate data corresponding to the entity information content is the position coordinate data of each field of the entity information content relative to the origin, which is established with the image edge as the coordinate system.
[0061] The purpose of this step is to extract all the information contained in the target image.
[0062] In one possible implementation, the entity information pairs contained in the target image in the task scene include:
[0063] The entity information pairs contained in the target image in the task scene are identified by optical character recognition.
[0064] Optical Character Recognition (OCR) refers to the process by which electronic devices (such as scanners or digital cameras) examine characters printed on paper, determine their shapes by detecting dark and light patterns, and then translate the shapes into computer text using character recognition methods.
[0065] OCR can be used to obtain the entity information content of all entities with entity shape features in the target image, and the position of the entity information content can be restored according to the coordinates.
[0066] S103: Encode the entity information pairs to obtain the feature values corresponding to each entity information pair.
[0067] Since entity information pairs cannot be directly recognized by intelligent devices such as computers, the purpose of this encoding step is to transform entity information pairs into feature values that can be recognized by intelligent devices, so that intelligent devices can continue to perform subsequent information extraction steps.
[0068] Generally, feature values are obtained by encoding different entity information with different values. For example, when scanning student grade information, a value of 0 is assigned to first grade and 1 to second grade.
[0069] S104: Construct the multi-head matrix corresponding to each eigenvalue, and combine the multi-head matrices into an eigenvalue matrix.
[0070] Each multi-head matrix can be viewed as a data storage address, which stores the feature value corresponding to an entity information pair. The process of combining multi-head matrices into an feature value matrix can be seen as a data integration process, the purpose of which is to combine all the scattered multi-head matrices into a dataset for subsequent data extraction.
[0071] In one possible implementation, a multi-head matrix is constructed for each eigenvalue, and the eigenvalue matrix is formed by combining the multi-head matrices:
[0072] Fill the multi-head matrix with the corresponding feature values of the entity information pairs;
[0073] The multi-head matrices are arranged horizontally and vertically according to the coordinate data, and the multi-head matrices are combined to form an eigenvalue matrix.
[0074] See Figure 2 , Figure 2 This is a schematic diagram of the eigenvalue matrix construction method provided in the embodiments of this application. The horizontal and vertical columns representing hamburgers, fries, total, and numbers (i.e., price information) are entity information content. Each small square is a multi-head matrix, and all multi-head matrices together form an eigenvalue matrix.
[0075] The step of arranging the multi-head matrix horizontally and vertically according to the coordinate data can be done according to the coordinate data or randomly. The final eigenvalue matrix is a square matrix with the same number of rows and columns.
[0076] S105: Identify the position of the multi-head matrix corresponding to the entity information content containing key entity information in the eigenvalue matrix.
[0077] The position of the multi-head matrix corresponding to the entity information content containing key entity information in the eigenvalue matrix refers to the relative position of the multi-head matrix in the eigenvalue matrix. By establishing a coordinate system and reading the coordinate information of each multi-head matrix, the position of the multi-head matrix corresponding to the entity information content containing key entity information in the eigenvalue matrix can be accurately obtained through the relative position.
[0078] In one possible implementation, identifying the position of the multi-head matrix corresponding to the entity information content containing the key entity information in the eigenvalue matrix includes:
[0079] The multi-head matrix containing the entity information content of the eigenvalue matrix is marked as the first position, with the eigenvalue matrix corresponding to the eigenvalues of the starting field and the eigenvalues of the ending field being the eigenvalues.
[0080] Determine whether the feature value corresponding to the key entity information exists in the multi-head matrix marked as the first position;
[0081] The multi-head matrix that does not contain the feature value corresponding to the key entity information is marked as the second position, and the multi-head matrix that contains the feature value corresponding to the key entity information is marked as the third position;
[0082] Determine the position of the third position in the eigenvalue matrix.
[0083] The role of the multi-head matrix labeling, which includes the feature values corresponding to the start and end fields of the entity information content, as the first position in subsequent steps is as follows:
[0084] Read all feature values belonging to the same entity information content between the start field feature value and the end field feature value. For example, see [link to example]. Figure 3 , Figure 3 This is a schematic diagram illustrating the annotation of the first position provided in an embodiment of this application. Figure 3 In this method, by labeling the multi-head matrix containing the start and end feature values of the hamburger and fries as 1, the multi-head matrix that can constitute the entity information content is identified. Since the feature value matrix is a matrix with an equal number of rows and columns, it is only necessary to label the entity information content in the upper triangular matrix. For example, the labeling method is to first scan the feature value of the start field of the hamburger, i.e., "Han", and then scan the feature value corresponding to the end field of the hamburger, i.e., "Bao", and label the corresponding multi-head matrix position as 1. The scanning order can also be vertical scanning first and then horizontal scanning, and the labeling value can be any value other than 1.
[0085] For an explanation of marking the multi-head matrix where the feature value corresponding to the key entity information does not exist as the second position and the multi-head matrix where the feature value corresponding to the key entity information exists as the third position, please refer to [link to documentation]. Figure 4 , Figure 4 This is a schematic diagram illustrating the annotations of the second and third positions provided in an embodiment of this application. Assuming the key entity information is pre-defined as "hamburger," then... Figure 3 The first position of the multi-head matrix containing the key entity information of "hamburger" is marked as 1 and marked as 2. The marked position of the multi-head matrix is the third position. The multi-head matrix can be marked as 2 or other values different from the first position. The multi-head matrix that does not contain the key entity information of "hamburger" is marked with a value other than the first and third positions or is not marked. The marked position of the multi-head matrix is the second position. When determining the multi-head matrix where the key entity information is located, it is only necessary to scan the position of the multi-head matrix marked as the third position.
[0086] S106: Determine the target multi-head matrix corresponding to the location, and decode the feature values corresponding to the target multi-head matrix to obtain key entity information.
[0087] In step S105, the position of the key entity information in the eigenvalue matrix has been determined. Since the eigenvalue matrix is composed of at least one multi-head matrix, and the above position is also a relative position in the eigenvalue matrix, each position corresponds to a multi-head matrix. Therefore, the multi-head matrix corresponding to that position can be determined.
[0088] Once the multi-head matrix is determined, the eigenvalues within the multi-head matrix can be decoded to obtain entity information containing key entity information. The purpose of this decoding step is to transform the content that intelligent devices can recognize into content that humans can understand, thus completing the task of extracting key entity information.
[0089] In this embodiment, since each multi-head matrix contains only one feature value, the key entity information is obtained by decoding only the feature value data in the multi-head matrix containing the key entity information. Therefore, there is no interference between the entity information content, which makes the method provided by this application applicable to complex scenarios and also has a better effect on key entity information extraction in simple scenarios.
[0090] In the embodiments of this application, the above Figure 1 A pre-training step for the layout model can be added before step S103, which will be described below. It should be noted that the implementation methods given below are merely illustrative examples and do not represent all implementation methods of the embodiments of this application.
[0091] See Figure 5 , Figure 5This is a flowchart illustrating the information extraction method proposed in this application embodiment after incorporating the pre-training step of the layout model. Some steps are the same as those in the above method embodiments, so they will not be described in detail in this embodiment. The method includes the following steps:
[0092] S501: Determine at least one key entity information based on the task scenario.
[0093] S502: Identify the entity information pairs contained in the target image in the task scene. The entity information pairs include entity information content and coordinate data corresponding to the entity information content.
[0094] S503: Use the entity information pairs contained in the target images in the identified task scene to pre-train the layout model.
[0095] The layout model is used to encode the data and obtain feature values.
[0096] The layout model is pre-set according to the task scenario. For example, in the scenario of scanning an ID card, the layout model is pre-set to be similar in size to the ID card and the information position is set. When performing the task of scanning an ID card to obtain information, the border of the physical ID card can be scanned directly, and then the information extraction and other steps can be performed.
[0097] In one possible implementation, pre-training the layout model using entity information pairs contained in the identified target images in the task scene includes:
[0098] The entity information pairs contained in the target images in the identified task scene are used as training samples and input into the layout model.
[0099] By pre-training the layout model using training samples, a layout model is obtained that can encode entity information pairs contained in target images in a task scenario.
[0100] S504: Encode the entity information pairs to obtain the feature values corresponding to each entity information pair.
[0101] S505: Construct the multi-head matrix corresponding to each eigenvalue, and combine the multi-head matrices into an eigenvalue matrix.
[0102] S506: Identify the position of the multi-head matrix corresponding to the entity information content containing the key entity information in the eigenvalue matrix.
[0103] S507: Determine the target multi-head matrix corresponding to the location, and decode the feature values corresponding to the target multi-head matrix to obtain the key entity information.
[0104] This application embodiment improves the accuracy of encoding in specific task scenarios by adding a step of pre-training the layout model using entity information pairs contained in the target images in the identified task scene. This allows the information extraction method proposed in this application to be applied to different task scenarios, thus improving the wide applicability of the information extraction method proposed in this application.
[0105] The above are some specific implementations of the information extraction method provided in the embodiments of this application. Based on this, this application also provides a corresponding apparatus. The apparatus provided in the embodiments of this application will be described below from the perspective of functional modularity.
[0106] See Figure 6 The schematic diagram shown illustrates the structure of the information extraction device, which includes:
[0107] The key entity information determination module 601 is used to determine at least one key entity information based on the task scenario.
[0108] The entity information pair recognition module 602 is used to recognize entity information pairs contained in the target image in the task scene, wherein the entity information pair includes entity information content and coordinate data corresponding to the entity information content;
[0109] The information encoding module 603 is used to encode entity information pairs to obtain the feature values corresponding to each entity information pair;
[0110] The multi-head matrix construction module 604 is used to construct the multi-head matrix corresponding to each eigenvalue and combine the multi-head matrices into an eigenvalue matrix.
[0111] The location recognition module 605 is used to identify the position of the multi-head matrix corresponding to the entity information content containing key entity information in the eigenvalue matrix;
[0112] The decoding module 606 is used to determine the target multi-head matrix corresponding to the position and decode the feature values corresponding to the target multi-head matrix to obtain key entity information.
[0113] In one possible implementation, the entity information is specifically used by the identification module 602 for:
[0114] The entity information pairs contained in the target image in the task scene are identified by optical character recognition.
[0115] In one possible implementation, the device further includes:
[0116] The layout model pre-training module is used to pre-train the layout model using entity information pairs contained in the target images in the identified task scene.
[0117] The layout model is used to encode the data and obtain feature values.
[0118] In one possible implementation, the multi-head matrix construction module 604 is specifically used for:
[0119] The entity information is filled into the corresponding feature values into the multi-head matrix. The multi-head matrix is then arranged horizontally and vertically according to the coordinate data, and the various multi-head matrices are combined to form the feature value matrix.
[0120] In one possible implementation, the location identification module 605 includes:
[0121] The first position annotation unit is used to annotate the multi-head matrix containing entity information content in the feature value matrix with the feature value corresponding to the start field and the feature value corresponding to the end field as the first position;
[0122] The judgment unit is used to determine whether there are feature values corresponding to key entity information in the multi-head matrix marked as the first position;
[0123] The second position annotation unit is used to annotate the multi-head matrix that does not have the corresponding feature value of the key entity information as the second position;
[0124] The third position annotation unit is used to annotate the multi-head matrix containing the feature value corresponding to the key entity information as the third position;
[0125] A position determination unit is used to determine the position of the third position in the eigenvalue matrix.
[0126] In this embodiment, since each multi-head matrix contains only one feature value, the key entity information is obtained by decoding only the feature value data in the multi-head matrix containing the key entity information. Therefore, there is no interference between the entity information content, which makes the method provided by this application applicable to complex scenarios and also has a better effect on key entity information extraction in simple scenarios.
[0127] This application also provides corresponding devices and computer storage media for implementing the solutions provided in this application.
[0128] The device includes a memory and a processor. The memory stores instructions or code, and the processor executes the instructions or code to enable the device to perform the information extraction method described in any embodiment of this application.
[0129] The computer storage medium stores code, and when the code is run, the device running the code implements the information extraction method described in any embodiment of this application.
[0130] In the embodiments of this application, the terms "first" and "second" (if they exist) are used only as name identifiers and do not represent the order of first and second.
[0131] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus a general-purpose hardware platform. Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as a read-only memory (ROM) / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a router) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0132] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0133] The above description is merely an exemplary implementation of this application and is not intended to limit the scope of protection of this application.
Claims
1. A method for information extraction, characterized in that, The method includes: At least one key entity information is determined based on the task scenario; wherein, the task scenario refers to a scenario in which information extraction is required, and the task scenario includes an ID card scanning task scenario; the key entity information refers to the specific entity information to be extracted in the task scenario, and the key entity information includes ID card number and name; Identify entity information pairs contained in the target image in the task scene. The entity information pair includes entity information content and coordinate data corresponding to the entity information content. The entity information content includes name, ID number or home address. The coordinate data corresponding to the entity information content is calculated by establishing a coordinate system based on the image edge and calculating the position coordinate data of each field of the entity information content relative to the origin. The entity information pairs are encoded to obtain the feature values corresponding to each entity information pair; Construct a multi-head matrix corresponding to each eigenvalue, and combine the multi-head matrices to form an eigenvalue matrix; Identify the position of the multi-head matrix corresponding to the entity information content containing the key entity information in the feature matrix; Determine the target multi-head matrix corresponding to the location, and decode the feature values corresponding to the target multi-head matrix to obtain the key entity information; The position of the multi-head matrix corresponding to the entity information content containing the key entity information in the feature matrix includes: The multi-head matrix containing the entity information content of the eigenvalue matrix is marked as the first position, with the eigenvalue matrix corresponding to the eigenvalues of the starting field and the eigenvalues of the ending field being the eigenvalues. Determine whether the feature value corresponding to the key entity information exists in the multi-head matrix marked as the first position; The multi-head matrix that does not contain the feature value corresponding to the key entity information is marked as the second position, and the multi-head matrix that contains the feature value corresponding to the key entity information is marked as the third position; Determine the position of the third position in the eigenvalue matrix; Before encoding the entity information pairs to obtain the feature values corresponding to each entity information pair, the process further includes: Using the entity information pairs contained in the target images in the identified task scene, a layout model is pre-trained, wherein the layout model is used to encode data and obtain feature values. The step of constructing the multi-head matrix corresponding to each eigenvalue and assembling the eigenvalue matrix from the multi-head matrices includes: The entity information is filled into the corresponding feature values into a multi-head matrix. The multi-head matrices are then arranged horizontally and vertically according to the coordinate data, and the multi-head matrices are combined to form a feature value matrix.
2. The method according to claim 1, characterized in that, The entity information pairs contained in the target image in the task scene to be identified include: The entity information pairs contained in the target image in the task scene are identified by optical character recognition.
3. An information extraction device, characterized in that, The device includes: The key entity information determination module is used to determine at least one key entity information based on the task scenario; wherein, the task scenario refers to a scenario in which information extraction is required, and the task scenario includes an ID card scanning task scenario; the key entity information refers to the specific entity information to be extracted in the task scenario, and the key entity information includes ID card number and name; The entity information pair recognition module is used to recognize entity information pairs contained in the target image in the task scene. The entity information pair includes entity information content and coordinate data corresponding to the entity information content. The entity information content includes name, ID number or home address. The coordinate data corresponding to the entity information content is calculated by establishing a coordinate system based on the image edge and calculating the position coordinates of each field of the entity information content relative to the origin. The information encoding module is used to encode the entity information pairs to obtain the feature values corresponding to each entity information pair; A multi-head matrix construction module is used to construct a multi-head matrix corresponding to each of the eigenvalues and to combine the multi-head matrices into an eigenvalue matrix. The location recognition module is used to identify the position of the multi-head matrix corresponding to the entity information content containing the key entity information in the feature value matrix; The decoding module is used to determine the target multi-head matrix corresponding to the location, and decode the feature values corresponding to the target multi-head matrix to obtain the key entity information; The location identification module includes: The first position annotation unit is used to annotate the multi-head matrix containing the feature values of the start field and the end field of the entity information content in the feature value matrix as the first position; The judgment unit is used to determine whether the feature value corresponding to the key entity information exists in the multi-head matrix marked at the first position; The second position annotation unit is used to annotate the multi-head matrix that does not have the corresponding feature value of the key entity information as the second position; The third position annotation unit is used to annotate the multi-head matrix containing the feature value corresponding to the key entity information as the third position; A position determination unit is used to determine the position of the third position in the eigenvalue matrix; The device further includes: The layout model pre-training module is used to pre-train the layout model using the entity information pairs contained in the target images in the identified task scene, wherein the layout model is used to encode the data and obtain feature values. The multi-head matrix construction module is specifically used for: The entity information is filled into the corresponding feature values into the multi-head matrix. The multi-head matrix is then arranged horizontally and vertically according to the coordinate data, and the various multi-head matrices are combined to form the feature value matrix.
4. An information extraction device, characterized in that, The device includes: A memory for storing instructions or code for extracting the information; A processor for executing instructions or code for the information extraction to implement the information extraction method according to any one of claims 1-2.
5. A computer storage medium, characterized in that, The computer storage medium stores code, and when the code is executed, the device running the code implements the information extraction method according to any one of claims 1-2.
Citation Information
Patent Citations
Bill identification method and device, computer equipment and storage medium
CN114067344A