Image processing method and device, electronic equipment, storage medium and program product
By identifying text information and multi-modal features in images, classifying image attributes and performing matching, it solves the problem of being unable to parse the text association relationships in image tables in the existing technology, and realizes the distinction of image attributes and the fully structured analysis of matching relationships. , improving the accuracy and structuring of data processing.
Patent Information
- Application Number
- CN202410674757.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-17
AI Technical Summary
Existing technology cannot parse the correlation between text content in tables in the form of images, resulting in data mining algorithms being unable to process semi-structured data and lacking effective structured analysis.
By determining text information and multi-modal features in images, classifying image attribute categories, and performing image matching based on features and categories, the matching relationship analysis between regional images is achieved.
It achieves the distinction of image attributes and fully structured analysis of matching relationships, improving the accuracy of matching between images and text and the ability to process structured data.
Smart Images

Figure CN118658166A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method and device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] The current processing method for tables in image form can basically only restore the cell layout and text content in the table image, but cannot parse the relationship between the text content. Such structuring can be said to be only half done. For many scenarios, such half structuring does not make much sense. The data mining algorithms in related technologies cannot process such semi-structured data. Summary of the invention
[0003] The present disclosure provides an image processing method and device, an electronic device, a computer-readable storage medium, and a computer program product.
[0004] In a first aspect, the present disclosure provides an image processing method, comprising:
[0005] Determine a first image in the image to be recognized and first text information of the first image;
[0006] Determining multimodal feature information of the first image according to the first text information and the first image;
[0007] Determining an attribute category of the first image according to the multimodal feature information;
[0008] A matching image of the first image is determined according to the multimodal feature information and the attribute category.
[0009] In a second aspect, the present disclosure provides an image processing device, comprising:
[0010] An image recognition module, used to determine a first image in an image to be recognized and first text information of the first image;
[0011] a feature extraction module, configured to determine multimodal feature information of the first image based on the first text information and the first image;
[0012] an attribute determination module, configured to determine an attribute category of the first image according to the multimodal feature information;
[0013] An image matching module is used to determine a matching image of the first image according to the multimodal feature information and the attribute category.
[0014] In a third aspect, the present disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and one or more of the computer programs are executed by the at least one processor so that the at least one processor can perform the above-mentioned image processing method.
[0015] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned image processing method when executed by a processor.
[0016] In a fifth aspect, the present disclosure provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned image processing method.
[0017] The image processing method provided by the embodiment of the present disclosure can determine the first image and the corresponding text in the image to be identified; extract multimodal features based on the first image and the corresponding text, and determine the attribute category of the first image based on the multimodal features, thereby realizing the distinction of image attributes; and then match multiple first images based on the multimodal features and the attribute category to obtain a matching image of the first image, thereby realizing the analysis of the matching relationship between regional images.
[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings, in which:
[0020] Figure 1 An application scenario diagram of the image processing method and device provided in the embodiments of the present disclosure;
[0021] Figure 2 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0022] Figure 3 is a schematic diagram of an image to be recognized in an embodiment of the present disclosure;
[0023] Figure 4 A block diagram of an image processing device provided by an embodiment of the present disclosure;
[0024] Figure 5 A block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0026] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0027] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0028] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "including" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. "Connected" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect.
[0029] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.
[0030] In the technical solution disclosed in this disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals. The use of user data in this technical solution complies with relevant national laws and regulations (for example, the "Information Security Technology Personal Information Security Specification", etc.). For example: corresponding prescribed measures are taken for personal information access control; prescribed restrictions are imposed on the display of personal information; the purpose of using personal information does not exceed the scope of direct or reasonable association; when using personal information, clear identity orientation is eliminated to avoid precise positioning of specific individuals.
[0031] In financial statements, expense lists and other data, there are a large number of tables in the form of images. This type of table can intuitively express data information, but its internal kv relationship is difficult for computers to save and understand. At present, optical character recognition (OCR) is usually used to identify text areas for table data in the form of images, obtain the position of each text area on the image and its corresponding recognition result, and then perform structured operations on this OCR result.
[0032] The table structuring algorithm in the related art can restore the distribution of table cells, including the location of cells and the boundary coordinate information of cells, through the table frame detection algorithm or the table line segmentation algorithm, plus post-processing operations. At the same time, the OCR result and the table restoration result are combined to complete the table recovery from image to structured data, and the table image can be restored to an editable table such as Excel, a processable data structure, etc. However, the algorithm solution in the related art can basically only do this step, restoring the cell layout and text content in the table image, but cannot parse the association relationship of the text content.
[0033] According to the image processing method of the embodiment of the present disclosure, it is possible to obtain a first image and corresponding text in an image to be identified; extract multimodal features based on the first image and the corresponding text, and determine the attribute category of the first image based on the multimodal features, thereby achieving distinction of image attributes; and then match multiple first images based on the multimodal features and the attribute category to obtain a matching image of the first image, thereby achieving analysis of the matching relationship between regional images.
[0034] Figure 1 This is an application scenario diagram of the image processing method and device provided in the embodiments of the present disclosure.
[0035] like Figure 1As shown, the application scenario of the embodiment of the present disclosure may include a terminal device 101, a network 103 and a server 102. The network 103 is used to provide a medium for a communication link between the terminal device 101 and the server 102. The network 103 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0036] The user can use the terminal device 101 to interact with the server 102 through the network 103 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0037] The terminal device 101 may be any electronic device having a display screen and supporting web browsing, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, and the like.
[0038] The server 102 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the terminal device 101. The background management server may analyze and process received data such as user requests, and feed back processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0039] It should be noted that the image processing method and apparatus provided in the embodiments of the present disclosure may be executed by the server 102. Accordingly, the image processing method and apparatus provided in the embodiments of the present disclosure may be arranged in the server 102. The image processing method and apparatus provided in the embodiments of the present disclosure may also be executed by a server or server cluster that is different from the server 102 and that can communicate with the terminal device 101 and / or the server 102. Accordingly, the image processing method and apparatus provided in the embodiments of the present disclosure may also be arranged in a server or server cluster that is different from the server 102 and that can communicate with the terminal device 101 and / or the server 102.
[0040] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0041] Figure 2 A flowchart of an image processing method provided by an embodiment of the present disclosure. Figure 2 , the method comprising:
[0042] Step S21, determining a first image in the image to be recognized and first text information of the first image;
[0043] Step S22, determining multimodal feature information of the first image according to the first text information and the first image;
[0044] Step S23, determining the attribute category of the first image according to the multimodal feature information;
[0045] Step S24: determining a matching image of the first image according to the multimodal feature information and the attribute category.
[0046] For example, the image to be identified is an image that can be divided into multiple areas and includes structured text information in the areas, such as a table image, including an expense list, a flow table, etc. Among them, the text information of multiple areas of the image to be identified may correspond to different attribute categories, including an identifier (key) category and a data (value) category, etc. For example, the text information in a cell of a table image may be an identifier: name, or data: Mr. Wang. The present disclosure does not limit the specific type of the image to be identified and the type and number of specific attribute categories of the areas in the image to be identified.
[0047] In step S21, a first image in the image to be recognized and first text information of the first image may be determined.
[0048] In some possible implementations, a target detection algorithm may be used to perform target detection on the image to be identified, and multiple image regions in the image to be identified, hereinafter referred to as first images, such as each cell of a table image as a first image; and the position information of each first image is determined, represented as the vertex coordinates of the circumscribed rectangular box of the first image, such as the coordinates of two diagonal vertices. Among them, the target detection algorithm may use YOLO (You Only Look Once, a target detection network that only requires one CNN operation), Cascade R-CNN, Cascade Region Convolutional Neural Networks, etc., and the present disclosure does not limit this.
[0049] In some possible implementations, an optical character recognition (OCR) algorithm may be used to perform text recognition on the image to be recognized, and determine the text area in the image to be recognized. Each text area includes the text information itself (for example, the characters "** City ** Road * Number ***") and the position information of the text area, which is represented as the vertex coordinates of the circumscribed rectangular box of the text area, such as the coordinates of two vertices at opposite corners. It should be understood that other recognition algorithms may also be used to implement text recognition, and the present disclosure does not limit this.
[0050] In some possible implementations, the region corresponding to characters in the image to be recognized that are located in the same row and the distance between adjacent characters is less than or equal to a preset distance can be recognized as a text region.
[0051] Figure 3 is a schematic diagram of an image to be recognized in an embodiment of the present disclosure. Figure 3 As shown, the image to be identified is a customer information list. The characters "Customer Number" in the first image corresponding to the 1st row and 1st column are one text area, the characters "Company Name" in the first image corresponding to the 1st row and 2nd column are another text area, and the characters "** City ** Road * No. ***" and "Building * Block **" in the first image corresponding to the 4th row and 6th column are two different text areas, and the same applies to other text areas.
[0052] In some possible implementations, the first image and the text area may be matched according to the position information of the first image and the position information of the text area. For each text area, the intersection-over-union (IOU) of the position information of the text area and the position information of each first image may be calculated respectively, and the first image with the largest IOU is used as the matching first image, and the text information of the text area is used as the text information of the first image with the largest IOU.
[0053] In some possible implementations, the same first image may match multiple text regions, that is, there are multiple text lines in the same cell, for example Figure 3 The characters "** City ** Road * Number ***" and "Building * Block **" in the first image corresponding to the 4th row and 6th column of are two different text areas. In this case, the text information of multiple text areas can be merged as the first text information of the first image.
[0054] In this way, each first image is matched with each text area, and after the text information is merged, the first text information of each first image of the image to be identified is obtained, and the processing of step S21 is completed.
[0055] In step S22, multimodal feature information of the first image may be determined according to the first text information and the first image.
[0056] In some possible implementations, in the image dimension, the first image can be feature extracted by a convolutional neural network (CNN), or the first image can be serialized by linear mapping to obtain the image features of the first image; in the text dimension, the word vectors and one-dimensional position vectors of the first text information can be obtained respectively, and the text features of the first image can be obtained by fusion. Among them, the word vector of the first text information is a vector obtained by vectorizing and concatenating all the words in the first text information; the one-dimensional position vector is used to represent the sorting position of the first text information in the first text information of all the first images of the image to be identified. The present disclosure does not limit the specific method used to extract image features and text features.
[0057] In some possible implementations, the image features and text features of the first image can be processed through a multimodal feature extraction network to obtain multimodal feature information of the first image. The feature extraction network can be a Transformer network model based on text and image, or a multimodal network model of other structures, which is not limited in the present disclosure.
[0058] In step S23, the attribute category of the first image may be determined according to the multimodal feature information.
[0059] In some possible implementations, the multimodal feature information of the first image may be classified by a neural network model for classification or by a linear mapping method to determine the attribute category of the first image. Each first image may correspond to one or more attribute categories, and the present disclosure does not limit the specific classification processing method and the number of attribute categories of each first image.
[0060] In some possible implementations, the attribute category may include an identification category and a data category. The identification category is the key in a key-value pair, which may also be called a "header" or "question", and the content may be, for example, "name", "address", "contact information", etc. The data category is the value in a key-value pair, which may also be called "information" or "answer", and the content may be, for example, "Mr. Li", "No. *, ** Road, ** City", etc. The attribute category may also include other categories, which are not limited in the present disclosure.
[0061] In step S24, a matching image of the first image is determined according to the multimodal feature information and the attribute category.
[0062] That is to say, multiple first images may be matched according to the multimodal feature information and attribute category of each first image to determine the matching relationship between the first images.
[0063] In some possible implementations, for the first image of the identification category, a matching image may be determined from the first image of the data category; the multimodal feature information of the first image of the identification category and the multimodal feature information of the first image of the data category may be fused, and the fused features may be processed by a neural network model for classification to determine whether the first image of the identification category matches the first image of the data category, thereby determining a matching image of the first image of the identification category. For example, the matching image of the first image whose text information is "name" is the first image whose text information is "Mr. Li".
[0064] In some possible implementations, for the first image of the data category, if it has been matched with the first image of the identification category, the first image of the identification category can be directly determined as the matching image; if it has not been matched with the first image of the identification category, the matching image can be determined from other first images. The specific determination method may be the same as or different from the above method, and the present disclosure does not limit this.
[0065] In this way, after matching all first images of the image to be recognized, a matching image of each first image can be obtained. A first image can have one or more matching images, which is not limited in the present disclosure.
[0066] According to the image processing method of the embodiment of the present disclosure, it is possible to obtain a first image and corresponding text in an image to be identified; extract multimodal features based on the first image and the corresponding text, and determine the attribute category of the first image based on the multimodal features, thereby achieving distinction of image attributes; and then match multiple first images based on the multimodal features and the attribute category to obtain a matching image of the first image, thereby achieving analysis of the matching relationship between regional images.
[0067] The image processing method according to the embodiment of the present disclosure is described below.
[0068] As mentioned above, in step S21, the first image in the image to be identified and the first text information of the first image may be determined. The step of determining the first text information of the first image in step S21 includes:
[0069] Acquire first position information of a text area in the image to be recognized and second text information of the text area;
[0070] Acquire second position information of the first image;
[0071] Determining a correspondence between the second text information and the first image according to the first position information and the second position information;
[0072] The first text information is determined according to the corresponding relationship and the second text information corresponding to the corresponding relationship.
[0073] For example, an optical character recognition (OCR) algorithm may be used to perform text recognition on an image to be recognized, and determine a text region in the image to be recognized. Each text region includes second text information (e.g., characters "** City ** Road * Number ***") and first position information of the text region, represented as vertex coordinates of a circumscribed rectangular frame of the text region, such as two vertex coordinates of opposite corners. It should be understood that other recognition algorithms may also be used to implement text recognition, and the present disclosure does not limit this.
[0074] In some possible implementations, a target detection algorithm may be used to perform target detection on the image to be identified, determine multiple image regions in the image to be identified, each image region is a first image, and obtain the second position information of each first image, which is represented as the vertex coordinates of the circumscribed rectangular frame of the first image, such as the coordinates of two diagonal vertices. Among them, the target detection algorithm may use YOLO (You Only Look Once), Cascade Region Convolutional Neural Networks (CascadeR-CNN), etc., and the present disclosure does not limit this.
[0075] In some possible implementations, the region corresponding to the characters in the image to be recognized that are located in the same row and the distance between adjacent characters is less than or equal to a preset distance can be recognized as a text region. Figure 3 As shown, the characters "Customer Number" in the first image corresponding to the 1st row and the 1st column are one text area, the characters "Company Name" in the first image corresponding to the 1st row and the 2nd column are another text area, the characters "** City ** Road * No. ***" and "Building * Block **" in the first image corresponding to the 4th row and the 6th column are two different text areas, and the same applies to other text areas.
[0076] In some possible implementations, the first image and the text area may be matched according to the first position information of the text area and the second position information of the first image to determine the corresponding relationship between the second text information and the first image. For each text area, the intersection-over-union (IOU) of the first position information of the text area and the second position information of each first image may be calculated respectively, and the first image with the largest IOU is taken as the matching first image, and the second text information of the text area is taken as the text information that has a corresponding relationship with the first image with the largest IOU.
[0077] For example, assuming that there are 366 first images in the image to be recognized, it is necessary to calculate the intersection and union ratio between the certain text area and each of the 366 first images, and obtain a total of 366 intersection and union ratios. Then, the maximum intersection and union ratio is selected from the 366 intersection and union ratios, and the second text information is mapped to the first image corresponding to the maximum intersection and union ratio.
[0078] In some possible implementations, if there is only one second text information corresponding to a first image, the second text information is directly used as the first text information of the first image; if there are multiple second text information corresponding to the first image, that is, there are multiple text lines in the same cell, for example Figure 3 The characters "** City ** Road * Number ***" and "Building * Block **" in the first image corresponding to the 4th row and 6th column are two different text areas, then the multiple second text information can be spliced and merged to obtain the first text information of the first image.
[0079] In this way, each first image is matched with each text area, and after the text information is merged, the first text information of each first image of the image to be recognized is obtained.
[0080] In this way, the correspondence between image and text can be achieved, and the accuracy of matching between image and text can be improved.
[0081] In step S22, multimodal feature information of the first image may be determined according to the first text information and the first image. Step S22 may include:
[0082] Determining text feature information of the first image according to the first text information;
[0083] determining image feature information of the first image according to the first image;
[0084] The multimodal feature information of the first image is determined according to the text feature information and the image feature information.
[0085] For example, in the image dimension, the features of the first image can be extracted by a convolutional neural network (CNN), or the first image can be serialized by linear mapping to obtain image feature information of the first image.
[0086] In the example, when processed by linear mapping, each first image can be scaled to a uniform size, such as 64*128; the scaled first image can be divided into image blocks of fixed size, such as an image block size of 16*16; and then, an image feature sequence is obtained by flattening and serializing through linear mapping as image feature information of the first image.
[0087] It should be understood that those skilled in the art may set the method for obtaining image feature information according to actual conditions, and the present disclosure does not limit this.
[0088] In some possible implementations, in the text dimension, the text feature information of the first image may include at least one of a word vector of the first text information, a one-dimensional position vector, and a two-dimensional position vector of the first text information in the image to be identified.
[0089] The word vector of the first text information is a vector obtained by vectorizing and concatenating all the words in the first text information. The one-dimensional position vector is used to represent the sorting position of the first text information in all the first text information of the image to be identified, and can be obtained, for example, by sorting all the first text information from left to right and from top to bottom. The two-dimensional position vector may include the two-dimensional position of the center of the first image in the image to be identified, and may also include the width and height information of the first image. The two-dimensional position and width and height information of the first image can be determined by normalizing the position of the bounding box of the first image.
[0090] In some possible implementations, the word vector of the first text information, the one-dimensional position vector, the two-dimensional position vector of the first text information in the image to be identified, etc. may be concatenated and fused to obtain the text feature information of the first image.
[0091] In some possible implementations, the image feature information and text feature information of the first image can be processed through a multimodal feature extraction network to obtain multimodal feature information of the first image. The feature extraction network can be a Transformer network model based on text and image, or a multimodal network model of other structures, which is not limited in the present disclosure.
[0092] Among them, the Transformer network model has a multi-layer network structure, and each layer of the network structure is mainly composed of multi-head self-attention and position-wise fully connected feedforward neural network. After processing each layer of the network structure of the Transformer network model, the feature vector of the first image can be obtained, which contains image features, semantic features of the text and some other information. After calculation by the multi-layer network structure, multimodal feature information is generated for each first image. The dimension of the multimodal feature information is, for example, 768 dimensions, and the present disclosure does not limit the specific dimension of the multimodal feature information.
[0093] In this way, the first image can be characterized in both text and image modes, thereby improving the richness of feature information and improving the accuracy of subsequent image matching.
[0094] In step S23, the attribute category of the first image may be determined according to the multimodal feature information.
[0095] In some possible implementations, the multimodal feature information of the first image may be classified by a neural network model for classification or by a linear mapping method to determine the attribute category of the first image. Each first image may correspond to one or more attribute categories, and the present disclosure does not limit the specific classification processing method and the number of attribute categories.
[0096] In some possible implementations, multiple labels for attribute category classification may be set, including identification category, data category, other category, etc. In the case of processing by linear mapping, a classification model may be constructed by a linear layer + sigmoid classifier, and the multimodal feature information of each first image may be input into the classification model to output the attribute category of the first image.
[0097] In some possible implementations, the identification category is the key in the key-value pair, which may also be called "header" or "question", and the content may be, for example, "name", "address", "contact information", etc. The data category is the value in the key-value pair, which may also be called "information" or "answer", and the content may be, for example, "Mr. Li", "No. **, ** Road, ** City", etc. The attribute category may also include categories other than the above categories, which are not limited in the present disclosure.
[0098] In the example, the "unit price" text in the expense list table belongs to the identification category; the "100 yuan" text belongs to the data category. If the table structure information such as "shopping information-unit price-100 yuan" appears in the table, "shopping information" can be regarded as the first-level identification category, and "unit price" can be regarded as the second-level identification category. In this case, when "shopping information" and "unit price" match, "shopping information" can be used as the identification category and "unit price" as the data category; when "unit price" and "100 yuan" match, "unit price" can be used as the identification category and "100 yuan" as the data category. If there are categories that do not conform to the key-value pair in the table, such as remarks information, they will be treated as other categories.
[0099] In this way, each first image may include multiple attribute categories. By setting a sigmoid classifier, the probability that the first image belongs to each attribute category can be obtained. When the probability exceeds a threshold, it is considered to belong to the category.
[0100] After the attribute category of the first image is obtained, a matching image of the first image can be determined according to the multimodal feature information and the attribute category in step S24. That is, multiple first images can be matched according to the multimodal feature information and the attribute category of each first image to determine the matching relationship between the first images.
[0101] In some possible implementations, the graph structure of the image to be identified can be modeled based on the multimodal feature information, which is denoted as G. The graph structure of the image to be identified includes nodes and edges between nodes. Each first image corresponds to a node, which is denoted as N = {n i},n i is the multimodal feature information of node i, the edge between nodes is the feature vector representing the relationship between nodes, and the edge between node i and node j is denoted as l ij =n i ||n j , || means concatenation, nj is the multimodal feature information of node j. The matching relationship between nodes can be predicted through the edges between nodes.
[0102] In the process of obtaining multimodal feature information through the Transformer network model, the Transformer computing structure completes the feature fusion between different nodes, that is, n i It not only contains the features of the current node i, but also the global features. The multimodal feature information of each node can represent the layout information of the entire graph. The edges between nodes include the semantic information, location information, image information of the two nodes, and global node information, etc., which are used as input features to predict the matching relationship between nodes, which can improve the matching accuracy.
[0103] In some possible implementations, step S24 may include:
[0104] If the attribute category of the first image includes an identification category, searching for a second image corresponding to the identification category in the first image whose attribute category includes a data category, wherein a distance between the second image and the first image is less than or equal to a distance threshold;
[0105] According to the multimodal feature information of the first image whose attribute category includes the identification category and the multimodal feature information of the second image, a matching image of the first image is determined from the second image.
[0106] For example, based on the attribute category, the identification category and the data category, that is, the key and the value, can be matched. Considering that the matching between the first images that are far away in the image to be identified is more difficult, the calculation complexity is very high, and the probability of mismatch is high, the first images within a certain distance threshold range can be matched, thereby reducing the calculation complexity and improving the matching accuracy.
[0107] In some possible implementations, the distance between adjacent first images is 1, the distance between first images separated by one first image is 2, and so on. If the attribute category of the first image includes an identification category, an image whose attribute category includes a data category and whose distance from the first image is less than or equal to a distance threshold m can be found as the second image corresponding to the identification category. m can be an integer greater than or equal to 2, and the present disclosure does not limit the specific value of the distance threshold m.
[0108] In the example, in the image to be identified, the content of the data category is usually behind the row or column of the content of the identification category, for example, the content "name" is displayed first and then the content "Wang" is displayed in a row. In this case, all images around the first image with a distance less than or equal to the distance threshold m can be used as the second image, or the image behind the row and column of the first image with a distance less than or equal to the distance threshold m can be used as the second image, thereby narrowing the matching range and reducing the computational complexity. Among them, when the display order of the images to be identified is from left to right and from top to bottom, the back of the row is the right of the same row, and the back of the column is the bottom of the same column. The present disclosure does not limit the specific display order.
[0109] In some possible implementations, a matching image of the first image may be determined from the second image according to the multimodal feature information of the first image whose attribute category includes the identification category and the multimodal feature information of the second image. i and the multimodal feature information n of the second image j , the eigenvector l corresponding to the edge between the two ij =n i ||n j The first image is input into a trained classification neural network model (eg, a binary classifier) to determine whether there is a matching relationship between the first image and the second image; if there is a matching relationship, the second image is used as a matching image of the first image.
[0110] In this way, by processing each second image corresponding to the identification category, a matching image of the first image can be determined from the second image. Furthermore, by processing each first image whose attribute category includes the identification category, a matching image of each first image whose attribute category includes the identification category can be determined, completing the local matching process.
[0111] In this way, the computational complexity can be reduced while improving the accuracy of image matching.
[0112] Through the above processing method, the matching between the first images within a certain distance range can be achieved, and the matching of the first images outside the certain distance range can also be performed through other methods to complete the matching relationship.
[0113] In some possible implementations, after determining the multimodal feature information of the first image in step S22, the image processing method according to the embodiment of the present disclosure may further include:
[0114] A matching method for the first image is determined according to the multimodal feature information of the first image.
[0115] For example, for a first image that is farther away, a matching method can be set, including row matching and column matching, etc., to achieve the completion of the matching relationship. For each first image, the multimodal feature information of the first image can be processed by a trained classification neural network model (such as a multi-classifier) to determine the category of the matching method of the first image; the multimodal feature information of the first image can also be processed by linear calculation to determine the category of the matching method of the first image. The present disclosure does not limit the specific determination method.
[0116] In the example, the categories of matching methods can be further refined. For example, the categories of matching methods include row matching-middle (used to indicate that the first image is an image in the middle position in the matching relationship), row matching-start (used to indicate that the first image is an image in the starting position in the matching relationship), column matching-middle (used to indicate that the first image is an image in the middle position in the matching relationship), column matching-start (used to indicate that the first image is an image in the starting position in the matching relationship), etc. The present disclosure does not limit the specific classification method of the matching methods.
[0117] In some possible implementations, step S24 may include: if the attribute category of the first image includes a data category, determining a matching image of the first image from a third image in the same column or row as the first image according to a matching method of the first image.
[0118] That is, for a first image whose attribute category includes a data category, a matching image of the first image can be determined according to the matching method of the first image. If the matching method of the first image is row matching, the matching image is determined from the third image in the same row; if the matching method of the first image is column matching, the matching image is determined from the third image in the same column.
[0119] In some possible implementations, the step of determining a matching image of the first image from a third image in the same column or row as the first image includes:
[0120] In a case where the matching mode of the first image is column matching, determining a matching image of the first image from a third image located in the same column as the first image, the matching mode of the matching image being column matching, being located in front of the column of the first image and having the smallest distance from the first image;
[0121] When the matching method of the first image is row matching, a matching image of the first image is determined from a third image located in the same row as the first image, and the matching method of the matching image is row matching, the matching image is located in front of the row of the first image and has the smallest distance from the first image.
[0122] That is to say, forward matching is maintained when matching according to the matching method. If the matching method of the first image is column matching, the third image whose matching method is also column matching, located in front of the column of the first image and with the smallest distance from the first image, is used as the matching image of the first image. Similarly, if the matching method of the first image is row matching, the third image whose matching method is also row matching, located in front of the row of the first image and with the smallest distance from the first image, is used as the matching image of the first image. Among them, when the display order of the images to be identified is from left to right and from top to bottom, the front of the column is above the same column, and the front of the row is to the left of the same row. In this way, by forward matching the first images one by one, matching of all first images whose attribute categories include data categories can be achieved.
[0123] In the example, in column matching, the third image in the same column as the first image can be determined based on the intersection of horizontal space between the first images; the distance between the first image and the third image can be determined based on the vertical distance, and the horizontal space can refer to the length of the image in the row direction; in row matching, the third image in the same row as the first image can be determined based on the intersection of vertical space between the first images; the distance between the first image and the third image can be determined based on the horizontal distance, and the vertical space can refer to the length of the image in the column direction. The present disclosure does not limit the specific calculation method of the same column, the same row, and the distance.
[0124] In the example, when the matching method is further refined, for the first image whose matching method is row matching-middle or column matching-middle, forward matching can continue; for the first image whose matching method is row matching-start or column matching-start, it can be used as the first image in the matching relationship to complete a series of matching processes.
[0125] like Figure 3 As shown, the matching method of the first image "BOLID" in the 1st row and 1st column can be column matching-middle, and the first image "BLONP" can be matched to the front of the column; the first image "BLONP" can be matched to the first image "BLAUS" to the front of the column, and so on, until the first image "ALFKI" is matched to the first image "Customer Number" to the front of the column, and the matching method is column matching-start, completing the matching process of the entire column.
[0126] In this way, the amount of calculation can be greatly reduced while improving the matching accuracy.
[0127] In some possible implementations, after completing the matching based on the identification category and the matching based on the matching method, the matching relationship between the first images can be merged to obtain the final structured matching result. Based on the structured matching result, a series of subsequent work such as structured preservation, information mining, and document question and answer can be performed.
[0128] After matching, the matching relationship between the first images can be one-to-one or one-to-many, that is, one identification category can correspond to the content of multiple data categories.
[0129] like Figure 3 As shown, the first image "Customer Number" corresponding to the 1st row and the 1st column is an identification category and the matching method is column matching-start, and the other first images in the entire 1st column are data categories and the matching method is column matching-middle; in the matching based on the identification category, when m=2, the first image "Customer Number" can be matched to the first images "ALFKI" and "ANATR"; in the matching based on the matching method, the first images in the 1st column except the first image "Customer Number" are matched one by one upward in the column; after merging, the final matching result is that the first image "Customer Number" matches all other first images in the same column, that is, 1 identification (key) corresponds to multiple data (values).
[0130] In the related art, text classification is usually used to analyze the image form of the table, which can only output semi-structured recovery results and cannot fully structure the kv relationship. In particular, the layout of the table image (such as the expense list, etc.) is not fixed, such as the existence of merging, crossing lines, etc., and it is uncertain what identification information will appear, so the processing effect of the related technology will be worse.
[0131] According to the image processing method of the embodiment of the present disclosure, it is possible to obtain the first image and the corresponding text in the image to be identified; extract multimodal features based on the first image and the corresponding text; determine the attribute category and matching method of the first image based on the multimodal features, thereby achieving the distinction of the image kv attributes and the determination of the image matching direction. Furthermore, according to the multimodal features, attribute categories and matching methods, multiple first images are matched based on identification categories and matched based on matching methods, respectively, greatly reducing the amount of calculation while improving the matching accuracy; then the matching relationships are merged to obtain the final matching results of the image to be identified, thereby achieving a complete structured analysis of the matching relationship between regional images.
[0132] The table layout restored in the related art is actually difficult to further process. However, the image processing method according to the embodiment of the present disclosure can perform a series of subsequent work such as structured preservation, information mining, and document question and answer based on the obtained structured matching results.
[0133] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.
[0134] In addition, the present disclosure also provides an image processing device, an electronic device, and a computer-readable storage medium, all of which can be used to implement any image processing method provided by the present disclosure. The corresponding technical solutions and descriptions are referred to the corresponding records in the method part and will not be repeated here.
[0135] Figure 4 A block diagram of an image processing device provided in an embodiment of the present disclosure.
[0136] Reference Figure 4 , an embodiment of the present disclosure provides an image processing device, the image processing device comprising:
[0137] An image recognition module 41 is used to determine a first image in an image to be recognized and first text information of the first image;
[0138] A feature extraction module 42, configured to determine multimodal feature information of the first image according to the first text information and the first image;
[0139] An attribute determination module 43, configured to determine an attribute category of the first image according to the multimodal feature information;
[0140] The image matching module 44 is used to determine a matching image of the first image according to the multimodal feature information and the attribute category.
[0141] In some possible implementations, the image recognition module 41 is used to:
[0142] Determine first position information of a text area in the image to be identified and second text information of the text area; obtain second position information of the first image; determine a correspondence between the second text information and the first image based on the first position information and the second position information; determine the first text information based on the correspondence and the second text information corresponding to the correspondence.
[0143] In some possible implementations, the feature extraction module 42 is used to:
[0144] Determine text feature information of the first image according to the first text information; determine image feature information of the first image according to the first image; and determine multimodal feature information of the first image according to the text feature information and the image feature information.
[0145] In some possible implementations, the attribute category includes an identification category and a data category; wherein the image matching module 44 is used to: if the attribute category of the first image includes an identification category, search for a second image corresponding to the identification category in the first image whose attribute category includes a data category, and the distance between the second image and the first image is less than or equal to a distance threshold; determine a matching image of the first image from the second image based on the multimodal feature information of the first image whose attribute category includes the identification category and the multimodal feature information of the second image.
[0146] In some possible implementations, the device further includes: a matching mode determination module, configured to determine a matching mode of the first image according to the multimodal feature information of the first image;
[0147] Among them, the attribute categories include identification categories and data categories, and the image matching module 44 is used to: if the attribute categories of the first image include data categories, then according to the matching method of the first image, determine the matching image of the first image from the third image in the same column or row as the first image.
[0148] In some possible implementations, the matching method includes column matching and row matching, and the image matching module 44 is used to: when the matching method of the first image is column matching, determine a matching image of the first image from a third image that is located in the same column as the first image, the matching method of the matching image being column matching, being located in front of the column of the first image and having the smallest distance from the first image;
[0149] When the matching method of the first image is row matching, a matching image of the first image is determined from a third image located in the same row as the first image, and the matching method of the matching image is row matching, the matching image is located in front of the row of the first image and has the smallest distance from the first image.
[0150] The specific implementation process of the above-mentioned image processing device is the same as the specific implementation process of the image processing method in the above-mentioned embodiment, and will not be repeated here.
[0151] Each module in the above image processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0152] Figure 5 A block diagram of an electronic device provided in an embodiment of the present disclosure.
[0153] Reference Figure 5 An embodiment of the present disclosure provides an electronic device, which includes: at least one processor 501; at least one memory 502, and one or more I / O interfaces 503, connected between the processor 701 and the memory 502; wherein the memory 502 stores one or more computer programs that can be executed by the at least one processor 501, and the one or more computer programs are executed by the at least one processor 501 so that the at least one processor 501 can perform the above-mentioned image processing method.
[0154] Each module in the above electronic device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0155] The present disclosure also provides a computer-readable storage medium on which a computer program is stored, wherein the computer program implements any of the above-mentioned image processing methods when executed by a processor. The computer-readable storage medium may be a volatile or non-volatile computer-readable storage medium.
[0156] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes any one of the above-mentioned image processing methods.
[0157] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium).
[0158] As is known to those of ordinary skill in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it is known to those of ordinary skill in the art that communication media typically contain computer-readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.
[0159] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0160] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0161] The computer program product described herein may be implemented in hardware, software, or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), etc.
[0162] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0163] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0164] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0165] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0166] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. An image processing method, characterized in that: include: Determine a first image in the image to be recognized and first text information of the first image; Determining multimodal feature information of the first image according to the first text information and the first image; Determining an attribute category of the first image according to the multimodal feature information; A matching image of the first image is determined according to the multimodal feature information and the attribute category.
2. The image processing method according to claim 1, characterized in that: The determining the first text information of the first image includes: Acquire first position information of a text area in the image to be recognized and second text information of the text area; Acquire second position information of the first image; Determining a correspondence between the second text information and the first image according to the first position information and the second position information; The first text information is determined according to the corresponding relationship and the second text information corresponding to the corresponding relationship.
3. The image processing method according to claim 1, characterized in that: The determining the multimodal feature information of the first image according to the first text information and the first image includes: Determining text feature information of the first image according to the first text information; determining image feature information of the first image according to the first image; The multimodal feature information of the first image is determined according to the text feature information and the image feature information.
4. The image processing method according to claim 1, characterized in that: The attribute categories include identification categories and data categories; Wherein, determining a matching image of the first image according to the multimodal feature information and the attribute category includes: If the attribute category of the first image includes an identification category, searching for a second image corresponding to the identification category in the first image whose attribute category includes a data category, wherein a distance between the second image and the first image is less than or equal to a distance threshold; According to the multimodal feature information of the first image whose attribute category includes the identification category and the multimodal feature information of the second image, a matching image of the first image is determined from the second image.
5. The image processing method according to claim 1, characterized in that: After determining the multimodal feature information of the first image according to the first text information and the first image, the method further includes: Determining a matching method for the first image according to the multimodal feature information of the first image; The attribute category includes an identification category and a data category, and determining a matching image of the first image according to the multimodal feature information and the attribute category includes: If the attribute category of the first image includes a data category, a matching image of the first image is determined from a third image in the same column or row as the first image according to the matching method of the first image.
6. The image processing method according to claim 5, characterized in that: The matching method includes column matching and row matching. Determining a matching image of the first image from a third image located in the same column or row as the first image according to the matching mode of the first image includes: In a case where the matching mode of the first image is column matching, determining a matching image of the first image from a third image located in the same column as the first image, the matching mode of the matching image being column matching, being located in front of the column of the first image and having the smallest distance from the first image; When the matching method of the first image is row matching, a matching image of the first image is determined from a third image located in the same row as the first image, and the matching method of the matching image is row matching, the matching image is located in front of the row of the first image and has the smallest distance from the first image.
7. An image processing device, characterized in that: include: An image recognition module, used to determine a first image in an image to be recognized and first text information of the first image; a feature extraction module, configured to determine multimodal feature information of the first image based on the first text information and the first image; an attribute determination module, configured to determine an attribute category of the first image according to the multimodal feature information; An image matching module is used to determine a matching image of the first image according to the multimodal feature information and the attribute category.
8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the image processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the image processing method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The invention comprises a computer-readable code or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the image processing method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method, device and equipment for image recognition and computer readable storage medium
CN108345882A
Table image recognition method and device, computer equipment and storage medium
CN113283355A
Table image processing method and device, computer equipment and readable storage medium
CN113837151A
Form identification method and device and electronic equipment
CN114724156A
Medical report text data processing method, system and device and storage medium
CN117765559A
