A method and system for generating image description based on scene graph subgraph

Through a method based on scene graph subgraphs, combined with subgraph generation and modal alignment processing of global features, the problems of insufficient diversity, accuracy and positioning capabilities in image description generation are solved, and more diverse and accurate images are achieved. Image description generation.

CN117830812BActive Publication Date: 2024-10-18DARK MATTER ARTIFICIAL INTELLIGENT (BEIJING) TECHNOLOGY CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202311873535.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2024-10-18
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

The existing technology has problems of lack of diversity, accuracy, controllability and positioning ability in image description generation. In particular, it cannot effectively retain the information of the edge area, background and non-salient targets of the image, and the generated description does not have the corresponding Image location positioning capabilities.

Method used

Using a method based on scene graph subgraphs, multiple scene graph subgraphs and corresponding features of the image are obtained through the subgraph generation module, modal alignment processing is performed based on global features, and the pre-trained image description generation model is used to output image descriptions. The method includes using PSG algorithm to generate scene graph subgraphs, graph convolution network to extract features, CLIP visual encoder to obtain global features, and feature fusion and alignment through Concat operation and perceptron network.

Benefits of technology

The generated image description is more diverse and accurate, can effectively retain the background and edge area information of the image, has controllability and positioning capabilities, has fewer training parameters, and the model can converge faster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117830812B_ABST
    Figure CN117830812B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for generating image description based on scene graph subgraphs, the method comprising: using a trained subgraph generation module to obtain multiple scene graph subgraphs and corresponding subgraph features of an original image; the subgraph generation module uses a PSG algorithm to generate a scene graph and uses a graph convolutional network to extract subgraph features; using a CLIP visual encoder to obtain the global features of the original image; fusing each scene graph subgraph feature with the global feature respectively; performing modal alignment processing on the fused features; inputting the features after modal alignment processing into a pre-trained image description generation model, and outputting the image description corresponding to the original image. The method can realize dividing the entire image into many sub-regions, each region corresponding to a complete semantic description, and the generated description is more diverse. It can also realize generating descriptions for background, edge regions, and non-salient targets. In addition, the generated image description is controllable and can locate the regional position.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the cross-technical field of computer vision and natural language processing, and more specifically to a method and system for generating image description based on scene graph subgraphs. Background Art

[0002] Image description generation is an important branch of computer vision research. Its main goal is to generate corresponding text descriptions based on the input image information, so as to accurately describe the image content. For image description tasks, the most important thing is to be able to present the information in the image in a clear and accurate text form.

[0003] Image description also has a wide range of practical applications: Assisting the visually impaired: Image description technology can help the visually impaired understand the content of the image, thereby providing more information and help. Image retrieval: Image description can provide richer information, making image retrieval more accurate and precise. Intelligent question-answering system: Combined with image description technology, the intelligent question-answering system can answer questions about the content of the image, making the interaction more natural.

[0004] Regarding the above technical content, the relevant document CN116524513A (Open vocabulary scene graph generation method, system, device and storage medium): The scene graph generated by this invention is an open set. The open set refers to the support for the recognition of categories that have not been seen in the training set, and the number of supported categories is often relatively large. The target position of the scene graph (Scene Graph, SG) generated by this patent is the Bounding Box; so it belongs to the (Scene Graph Generation, SGG) scene graph generation task. In addition, the main function of this document is to generate an open set SG. Among them, related terms: SG is used to describe the existence of targets in the picture and the relationship between targets; Bounding Box: a rectangular area represented by coordinates, generally in two formats:

[0005] a.(x1,y1,x2,y2): coordinates of the upper left and lower right corners of the rectangle

[0006] b.(x,y,w,h): coordinates of the center point of the rectangle, width and height of the rectangle.

[0007] CN117034868A (A BERT-based image description diffusion generation method): This invention applies the diffusion model to image description generation. Aiming at the problem that discrete text information cannot be coupled with the diffusion model, this invention provides a BERT-based image description diffusion generation method. This invention is prone to losing detailed information in the image, that is, the generated image description is prone to losing some content in the image. And the generated description is not diverse.

[0008] CN116935387A (A fast and learnable large-scale image description method): The model of this invention mainly solves the problem of large-scale image computation. This invention divides image encoding into two steps: the first step is to obtain the first feature code, and the second step is to encode the first feature code. The two stages reduce the amount of computation, but similarly, the fine-grained features of the image will be lost during the encoding process, and the description finally generated is not accurate enough.

[0009] CN115019142A (Image title generation method, system, and electronic device based on fusion features): This invention fuses target features through a graph neural network and finally generates image titles using LSTM. The target features of this invention are obtained by target detection. Target detection will extract the regional features in the bounding box (rectangular area). The rectangular area will contain some background information, which will interfere with the final image description generation.

[0010] The above-mentioned related patent documents all encode the entire image and then directly generate the image description through the decoder. This method has the following disadvantages

[0011] 1. Lack of diversity: A picture often contains many regions, each of which has complete and independent semantic information. If the features of the entire image are directly decoded to generate an image description, the image description will only contain the main content of the image, and a large amount of information about the edge regions or background will be lost;

[0012] 2. Lack of accuracy: Since the entire image is encoded, it is easy to lose information about edge areas, backgrounds, and non-salient objects;

[0013] 3. Uncontrollable: It is impossible to generate a description for a specified sub-area;

[0014] 4. Lack of positioning capability: The generated description cannot be output to the specific location of the corresponding image.

[0015] Therefore, how to overcome the shortcomings of the above problems is a problem that those skilled in the art need to solve urgently. Summary of the invention

[0016] In view of this, the present invention provides a method and system for generating image description based on scene graph subgraphs, which at least partially solve the above technical problems.

[0017] In order to achieve the above object, the present invention adopts the following technical solution:

[0018] In a first aspect, an embodiment of the present invention provides a method for generating an image description based on a scene graph subgraph, comprising the following steps:

[0019] Get the input original image;

[0020] A trained sub-graph generation module is used to obtain a plurality of scene graph sub-graphs and corresponding scene graph sub-graph features of the original image; wherein the sub-graph generation module uses a PSG algorithm to generate a scene graph sub-graph, and uses a graph convolutional network to extract the corresponding scene graph sub-graph features;

[0021] Using CLIP visual encoder to obtain the global features of the original image;

[0022] Fusing each of the scene graph sub-graph features with the global features respectively;

[0023] Perform modality alignment on the fused features;

[0024] The features after modality alignment processing are input into a pre-trained image description generation model, and the image description corresponding to the original image is output.

[0025] Furthermore, a trained sub-graph generation module is used to obtain a plurality of scene graph sub-graphs of the original image and corresponding scene graph sub-graph features, including:

[0026] The PSG algorithm is used to obtain the scene graph of the original image, the corresponding instance segmentation graph and the relationship between the instances;

[0027] Outputting graph embedding through a GCN graph convolutional network according to the relationship between any two objects in the instance segmentation graph and the scene graph;

[0028] Splitting the scene graph into multiple independent sub-graphs and removing duplicate sub-graphs;

[0029] Embedding the graph into the corresponding subgraph, inputting the subgraph discrimination module, and outputting a suitable scene graph subgraph;

[0030] According to outputting the appropriate scene graph subgraph, the corresponding scene graph subgraph features are obtained from the graph embedding.

[0031] Furthermore, the training process of the subgraph generation module includes:

[0032] Traversing the manually annotated image description candidate set, matching each manually annotated image description with all sampled subgraphs; the sampled subgraphs are composed of graph embedding features and corresponding subgraphs;

[0033] Compute the similarity between the feature encodings of all nodes and relations in the sampled subgraph and the manually annotated image descriptions;

[0034] Filter out the sampled sub-images with the greatest similarity to the manually annotated image description as positive samples; and use the unrelated sub-images as negative samples;

[0035] The training data set is composed of positive and negative samples with preset proportions, and the neural network is trained to obtain the optimal discriminant model as the sub-graph generation module.

[0036] Furthermore, each of the scene graph sub-graph features is fused with the global features respectively, including:

[0037] Each of the scene graph sub-graph features is fused with the global features through a Concat operation.

[0038] Furthermore, the fused features are subjected to modality alignment processing, including:

[0039] The fused visual features are aligned to the space of text features using a two-layer perceptron network.

[0040] Furthermore, the pre-trained image description generation model is a pre-trained LLM large language model based on the Transformer architecture.

[0041] In a second aspect, an embodiment of the present invention further provides an image description generation system based on a scene graph subgraph, comprising:

[0042] An acquisition module is used to acquire the input original image;

[0043] A sub-graph generation module, used to obtain multiple scene graph sub-graphs and corresponding scene graph sub-graph features of the original image using the trained sub-graph generation module; wherein the sub-graph generation module uses the PSG algorithm to generate the scene graph sub-graphs, and uses a graph convolutional network to extract the corresponding scene graph sub-graph features;

[0044] A global feature generation module, used for obtaining the global features of the original image by using a CLIP visual encoder;

[0045] A feature fusion module, used to fuse each of the scene graph sub-graph features with the global features respectively;

[0046] The modality alignment module is used to perform modality alignment processing on the fused features;

[0047] The image description generation module is used to input the features after modality alignment processing into a pre-trained image description generation model, and output the image description corresponding to the original image.

[0048] Furthermore, the subgraph generation module comprises:

[0049] A PSG generation module, used to obtain the scene graph of the original image, the corresponding instance segmentation graph and the relationship between instances by using a PSG algorithm;

[0050] A graph embedding acquisition module, used to output a graph embedding through a graph convolutional network according to the relationship between any two objects in the instance segmentation graph and the scene graph;

[0051] A sub-graph sampling module, used for splitting the scene graph into multiple independent sub-graphs and removing duplicate sub-graphs;

[0052] The sub-graph discrimination module is used to take the graph embedding and the corresponding sub-graph as input, output a suitable scene graph sub-graph; and obtain the corresponding scene graph sub-graph feature from the graph embedding according to the output suitable scene graph sub-graph.

[0053] Furthermore, the training process of the subgraph generation module includes:

[0054] Traversing the manually annotated image description candidate set, matching each manually annotated image description with all sampled subgraphs; the sampled subgraphs are composed of graph embedding features and corresponding subgraphs;

[0055] Compute the similarity between the feature encodings of all nodes and relations in the sampled subgraph and the manually annotated image descriptions;

[0056] Filter out the sampled sub-images with the greatest similarity to the manually annotated image description as positive samples; and use the unrelated sub-images as negative samples;

[0057] The training data set is composed of positive and negative samples with preset proportions, and the neural network is trained to obtain the optimal discriminant model as the sub-graph generation module.

[0058] Furthermore, the feature fusion module is specifically used to fuse each of the scene graph sub-graph features with the global feature through a Concat operation.

[0059] Furthermore, the modality alignment module is specifically used to align the fused visual features to the space of text features using a two-layer perceptron network.

[0060] Furthermore, the pre-trained image description generation model in the image description generation module is a pre-trained LLM large language model based on the Transformer architecture.

[0061] In a third aspect, an embodiment of the present invention further provides a terminal device, which includes a processor and a memory, the processor being used to implement various instructions; the memory being used to store multiple instructions, and the instructions being suitable for being loaded by the processor and executing a method for generating an image description based on a scene graph subgraph as described in any one of the first aspects.

[0062] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded by a processor of a terminal device and executing a method for generating an image description based on a scene graph subgraph as described in any one of the first aspects.

[0063] The descriptions of the second to fourth aspects of the present invention can refer to the detailed description of the first aspect; and the beneficial effects of the descriptions of the second to fourth aspects can refer to the analysis of the beneficial effects of the first aspect, which will not be repeated here.

[0064] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a method for generating image description based on scene graph subgraphs, which has the following technical advantages:

[0065] 1. More diversity: The entire image is divided into many sub-regions, each region corresponds to a complete semantic description, so the generated description is more diverse.

[0066] 2. More accurate: It can generate descriptions of background, edge areas, and non-salient targets.

[0067] 3. Controllability: It is possible to generate image description only for a certain area of ​​the image, rather than the entire image.

[0068] 4. Positioning capability: The generated image description can be output to describe the location of the area it comes from.

[0069] 5. Faster training: Since a pre-trained large language model is used, the present invention has fewer training parameters and requires less training data, so the model can converge faster. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0071] Figure 1 Schematic diagram of semantic segmentation, instance segmentation and panoptic segmentation.

[0072] Figure 2 A diagram illustrating examples of scene graph terminology.

[0073] Figure 3 A flowchart of a method for generating an image description based on a scene graph subgraph provided by an embodiment of the present invention.

[0074] Figure 4An overall schematic diagram of a method for generating image description based on a scene graph subgraph provided in an embodiment of the present invention.

[0075] Figure 5 Using PSG algorithm Figure 2 The scene graph obtained by processing.

[0076] Figure 6 Generate network training example graph for subgraph.

[0077] Figure 7 Generate network training examples for images.

[0078] Figure 8 The input original image is used for illustration.

[0079] Fig. 9 To use the PSG algorithm Figure 8 The scene graph obtained by processing.

[0080] Fig.10 A block diagram of an image description generation system based on a scene graph subgraph provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0081] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0082] In order to more clearly describe the technical solution of the present invention, the relevant technical terms are first explained and described:

[0083] 1. Terminology

[0084] 1. Scene Graph: Scene graph, abbreviated as SG, is used to describe the objects in the picture and the relationship between them;

[0085] 2. Predicate: Predicate, equivalent to the predicate in Chinese, is used to describe the relationship between two targets;

[0086] 3. SGG (Scene Graph Generation): scene graph generation;

[0087] 4.PSG (Panoptic Scene Graph Generation): Panoptic scene graph generation;

[0088] 5. Segmentation;

[0089] a.Semantic Segmentation: semantic segmentation;

[0090] b.Instance Segmentation: instance segmentation;

[0091] c.Panoptic Segmentation: Panoptic segmentation;

[0092] Segmentation refers to the use of masks to distinguish different types of objects in the image. It is divided into the three types of segmentation mentioned above. The differences between the three types of segmentation are as follows: Figure 1 As shown in the figure, semantic segmentation only needs to distinguish objects of different categories, without requiring to distinguish objects of the same category; instance segmentation requires to distinguish objects of the same category, but does not segment the background, such as the sky; panoramic segmentation is equivalent to combining semantic segmentation with instance segmentation, that is, it requires to distinguish objects of the same category and segment the background.

[0093] 6.Bounding Box: Use coordinates to represent a rectangular area. There are generally two formats:

[0094] a.(x1,y1,x2,y2): coordinates of the upper left and lower right corners of the rectangle;

[0095] b.(x,y,w,h): coordinates of the center point of the rectangle, width and height of the rectangle.

[0096] II. Necessary description of the technology involved in this invention:

[0097] 2.1 Scene Graph

[0098] A scene graph is a graph used to describe objects in an image and the relationships between them. It is usually represented by triplet.

[0099] A triple is defined as:

[0100] (Subject, Predicate, Object): Subject and Object are both targets in the image, and Predicate is the relationship between targets. To distinguish between the two targets, the target before the predicate is called Subject, and the target after the predicate is called Object.

[0101] The following are examples: Figure 2 As shown, the scene graph (SG) can be represented by the following set of triples:

[0102] (water ski, on, water)

[0103] (Girl, play, water ski)

[0104] (person, beside, girl)…

[0105] 2.2 Two academic tasks related to SG

[0106] 7. SGG (Scene Graph Generation): scene graph generation;

[0107] 8.PSG (Panoptic Scene Graph Generation): Panoptic scene graph generation;

[0108] Among them, SGG needs to output the target category, the location of the target (Boundingbox), and the relationship between the targets;

[0109] PSG believes that the bounding box contains background information, so the target position is replaced by the target's panoptic segmentation map (Panoptic Segmentation);

[0110] 2.3 Image Description

[0111] Image description is to describe the content of the image in a few sentences. Usually, each sentence describes the overall content of the image or the content of a certain area. For example Figure 2 The description can be:

[0112] 1). A girl is paddling on a water ski;

[0113] 2). A young girl is lying on a water ski and paddling;

[0114] 3). A girl is paddling on the water slide at the amusement park and looking at a person in front of her;

[0115] 2.4 Scene Graph (SG) Subgraph

[0116] The scene graph subgraph splits the entire scene graph into many independent subgraphs. Each subgraph corresponds to a complete piece of semantic information. It can be understood that each subgraph can be expressed by a sentence.

[0117] Why do we need scene graph subgraphs?

[0118] The content of a picture is often complex and difficult to describe clearly in one sentence. Split the entire picture into many regions and extract the scene graph sub-graphs of each region. It is simpler to describe only each sub-graph than to describe the entire picture.

[0119] Embodiment 1:

[0120] The embodiment of the present invention discloses a method for generating an image description based on a scene graph subgraph, referring to Figure 3 As shown, the following steps are included:

[0121] S1, obtain the input original image;

[0122] S2. Using a trained sub-graph generation module to obtain multiple scene graph sub-graphs and corresponding scene graph sub-graph features of the original image; wherein the sub-graph generation module uses a PSG algorithm to generate scene graph sub-graphs, and uses a graph convolutional network to extract corresponding scene graph sub-graph features;

[0123] S3, using CLIP visual encoder to obtain the global features of the original image;

[0124] S4, fusing each of the scene graph sub-graph features with the global features respectively;

[0125] S5, performing modality alignment processing on the fused features;

[0126] S6. Input the features after modality alignment processing into a pre-trained image description generation model, and output the image description corresponding to the original image.

[0127] In this embodiment, the overall solution involves two parts, such as Figure 4 As shown, it is a schematic diagram of the overall solution; including: 1. The original image is first generated into a scene graph sub-graph through a sub-graph generation module; involving the above steps S1-S3; 2. Each sub-graph is input into an image description generation model to generate an image description; involving the above steps S4-S5.

[0128] The following is a detailed description of each of the above steps:

[0129] In step S1, the input original image is obtained, which is an RGB image, such as Figure 2 As shown;

[0130] Step S2 specifically includes:

[0131] S21. Use the PSG algorithm to obtain the scene graph of the original image, the corresponding instance segmentation graph and the relationship between instances; the scene graph G = (V, E), where V describes the set of all targets in the image, and E represents the set of relationships in the image.

[0132] like Figure 5 As shown, Figure 5 The left side shows the instance segmentation map, and the right side shows the relationship between objects in the image.

[0133] The format is defined as follows:

[0134] ObjectID_Predicate_ObjectID_probability, where ObjectID is the target ID, Predicate is the relationship between two targets, and probability is the probability of predicting the relationship.

[0135] The objects in this picture are: surfboard_0 (surfboard), person_1 (person), person_2 (person), water-other_3 (water), and wall-wood_4 (wallboard).

[0136] The image has the following relationships (triplet):

[0137] (surfboard, on, water-other)

[0138] (Person,on,surfboard)

[0139] (person, besides, person)

[0140] for example Figure 5 In the figure, 0_on_3_0.982 means that the surfboard is on the water, and the relationship probability is 0.982.

[0141] S22. Output the graph embedding through the GCN graph convolutional network according to the relationship between any two objects in the instance segmentation graph and the scene graph. This step is used to fuse the features between related objects in the image, such as the relationship (bus, parked on, road). The bus and the road have a relationship, so the representation of the bus needs to fuse the representation of the road (node) and the parked on (relationship). Then, the instance segmentation features and adjacency matrix obtained by the PSG algorithm (the relationship between any two objects is also obtained through the scene graph generated by the PSG algorithm) are passed through the GCN graph convolutional network to output the graph embedding.

[0142] S23, split the scene graph into multiple independent sub-graphs and remove duplicate sub-graphs; in this step, the entire scene graph (SG) is split into multiple independent sub-graphs, each sub-graph constitutes a complete semantic information, that is, the semantic information contained in each sub-graph can be expressed in a complete sentence.

[0143] The specific implementation of this module is: randomly select some nodes from V, and if there is a relationship between two randomly selected nodes, connect the two nodes. After removing duplicate subgraphs, many subgraphs will be obtained. Many of the subgraphs here cannot constitute complete semantic information and need further discrimination and screening.

[0144] S24, input the graph embedding and the corresponding sub-graph into a sub-graph discrimination module, and output a suitable scene graph sub-graph; and obtain corresponding scene graph sub-graph features from the graph embedding according to the output of the suitable scene graph sub-graph.

[0145] The sub-image sampled in the previous step is judged. In the training stage, the sub-image judgment requires manually annotated image descriptions to supervise the judgment of sub-images. In the inference stage, since the sub-image generation module has been trained, the sub-image proposal can be directly judged. The idea of ​​judgment is to give high scores to suitable sub-image proposals and low scores to inappropriate sub-image proposals.

[0146] The subgraph discrimination module is used to screen the subgraphs obtained by subgraph sampling. The semantic information of the subgraph output by this module can be expressed in a complete sentence.

[0147] The focus of the sub-graph generation module is how to classify labels for randomly sampled sub-graphs. The implementation steps are as follows:

[0148] 1. Traverse the candidate set of manually annotated image descriptions and match each manually annotated image description with all randomly sampled sub-images.

[0149] 2. The matching idea is to calculate the similarity between the feature encoding of all nodes and relationships in the sampled subgraph and the description of the manually annotated image.

[0150] 3. Each manually annotated image is matched with the sub-image with the greatest similarity, which is the positive sample.

[0151] 4. Finally, each manually annotated image will be associated with a sub-image.

[0152] 5. Sub-graphs that are not associated are negative samples.

[0153] 6. Since the number of negative samples is much larger than the number of positive samples, the negative samples are randomly sampled during the training process to ensure that the ratio of positive to negative samples is 1:1. The positive and negative samples constitute the training data, and the CNN neural network is trained to obtain the optimal discriminant model as the sub-graph generation module.

[0154] In steps S3-S4, the sub-images that have passed through the sub-image generation module will be responsible for generating the corresponding regional image descriptions. The regional image description needs to take into account the global information of the entire image. Therefore, in step S4, each sub-image feature is fused with the global features of the image one by one. The features of the global image are directly obtained using the CLIP visual encoder. The features of the sub-image are obtained from the image embedding. Feature fusion fuses the global features and the local features of the sub-image together through the Concat operation.

[0155] In step S5, currently, the large language model (LLM) has achieved relatively good results in various text generation tasks. Directly using the text generation ability of the pre-trained LLM makes the image-to-text task simple. However, since LLM is trained with a large amount of text, the information of the image belongs to two different modalities. If LLM is needed to generate text descriptions, it is necessary to align the visual model information to the space of the text model. In step S5, a simple two-layer perceptron (MLP) is used to align the fused visual features to the space of the text features.

[0156] In step S6, the final image description is generated by inputting the fusion features of the sub-image and the global image, the features after modality alignment, and the pre-trained large language model based on the Transformer architecture, and outputting the image description.

[0157] In this embodiment, the overall solution involves two parts, and the model training can also be divided into two stages:

[0158] In the first stage, the subgraph generation network (i.e., subgraph generation module) is trained. The subgraph generation network training example is as follows: Figure 6 shown.

[0159] The second stage trains the image generation network (i.e., the image description generation model). The image generation network training examples are as follows: Figure 7 shown.

[0160] The complete steps are as follows:

[0161] 1. Obtain images and annotated image description text pairs as training data;

[0162] 2. If Figure 4 As shown, build a neural network and various modules for training;

[0163] 3. Train the sub-graph generation module, which includes the PSG generation module, the graph embedding acquisition module, and the sub-graph discrimination module. The loss function is binary cross entropy.

[0164] 4. The training image uses the trained sub-image generation module (step 2) to generate sub-images;

[0165] 5. Use CLIP to extract global features of the image;

[0166] 6. Fuse the sub-graph features (step 3) and the global features (step 4) to obtain the fused features;

[0167] 7. The fused features are fed into the modality alignment network;

[0168] 8. The output features of step 7 are passed through LLM to generate image description;

[0169] 9. The label of the generated image description is the description text in step 1, and the loss function is cross entropy.

[0170] For example, Figure 8 As the picture input, the method of this embodiment is used to obtain the trained sub-picture generation module Figure 8 As multiple scene graph subgraphs of the original image and the corresponding subgraph features, the SG is generated by the PSG algorithm as follows Fig. 9 As shown, the text description SG is as follows, and only 5 records are listed:

[0171] (1): Bus_0, on, road_6, 0.93789566

[0172] (2): Truck_1, parked on, road_6, 0.9317536

[0173] (3): sky-other-merged (sky)_2, over (over), bus (bus)_0, 0.9278145

[0174] (4): sky-other-merged (sky)_2, over (over), road (road)_6, 0.90668315

[0175] (5): person_4, walking on, pavement-merged_10, 0.863878

[0176] Then, through the GCN graph convolution network output graph embedding and sub-graph sampling processing, it is determined that only sub-graphs (2) and (5) are appropriate in the previous step. Then, the CLIP visual encoder is used to obtain Figure 8 The global features of the original image; the features of sub-image (2) and sub-image (5) are fused with the global features respectively; the fused features are modally aligned; the features after modality alignment are input into the pre-trained image description generation model, and the image description corresponding to the original image is output:

[0177] Sub-image (2): There is a truck parked next to the bus, on the side of the road;

[0178] Sub-image (5): On the right side of the image, there are three pedestrians walking on the sidewalk, two of them are walking together.

[0179] After the merger, Figure 8The image description is: there is a truck parked on the side of the road next to the bus; on the right side of the picture, there are three pedestrians walking on the sidewalk, two of them walking together.

[0180] The image description generation method based on scene graph subgraph provided by the embodiment of the present invention can effectively extract the scene graph subgraph and subgraph features in the original image through the subgraph generation module, and capture the semantic information in the image. And combined with the global features extracted by the CLIP visual encoder, the context of the overall image is comprehensively considered to improve the comprehensiveness of the image description. Through the modal alignment processing of the perceptron network, the effective correspondence between the visual features and the text features is achieved, and the consistency and coherence of the generated image description are improved. Finally, the features after the modal alignment processing are input into the pre-trained image description generation model, and the image description corresponding to the original image is output. The generated image description is more diverse, more accurate, and has controllability and positioning capabilities. In addition, due to the use of a pre-trained large language model, the training parameters of the present invention are fewer, and less training data is required, and the model can converge faster.

[0181] Embodiment 2:

[0182] Based on the same inventive concept, an embodiment of the present invention further provides an image description generation system based on a scene graph subgraph, referring to Fig.10 As shown, including:

[0183] An acquisition module is used to acquire the input original image;

[0184] A sub-graph generation module, used to obtain multiple scene graph sub-graphs and corresponding scene graph sub-graph features of the original image using the trained sub-graph generation module; wherein the sub-graph generation module uses the PSG algorithm to generate the scene graph sub-graphs, and uses a graph convolutional network to extract the corresponding scene graph sub-graph features;

[0185] A global feature generation module, used for obtaining the global features of the original image by using a CLIP visual encoder;

[0186] The feature fusion module is used to fuse each of the scene graph sub-graph features with the global features one by one through a Concat operation.

[0187] The modality alignment module is used to perform modality alignment processing on the fused features; specifically, it is used to align the fused visual features to the space of text features using a two-layer perceptron network.

[0188] The image description generation module is used to input the features after modality alignment processing into a pre-trained image description generation model, and output the image description corresponding to the original image. The pre-trained image description generation model is a pre-trained LLM large language model based on the Transformer architecture.

[0189] Furthermore, the generation module includes:

[0190] A PSG generation module, used to obtain the scene graph of the original image, the corresponding instance segmentation graph and the relationship between instances by using a PSG algorithm;

[0191] A graph embedding acquisition module, used to output a graph embedding through a graph convolutional network according to the relationship between any two objects in the instance segmentation graph and the scene graph;

[0192] A sub-graph sampling module, used for splitting the scene graph into multiple independent sub-graphs and removing duplicate sub-graphs;

[0193] The sub-graph discrimination module is used to take the graph embedding and the corresponding sub-graph as input, output a suitable scene graph sub-graph; and obtain the corresponding scene graph sub-graph feature from the graph embedding according to the output suitable scene graph sub-graph.

[0194] Furthermore, the training process of the subgraph generation module includes:

[0195] Traversing the manually annotated image description candidate set, matching each manually annotated image description with all sampled subgraphs; the sampled subgraphs are composed of graph embedding features and corresponding subgraphs;

[0196] Compute the similarity between the feature encodings of all nodes and relations in the sampled subgraph and the manually annotated image descriptions;

[0197] Filter out the sampled sub-images with the greatest similarity to the manually annotated image description as positive samples; and use the unrelated sub-images as negative samples;

[0198] The training data set is composed of positive and negative samples with preset proportions, and the neural network is trained to obtain the optimal discriminant model as the sub-graph generation module.

[0199] The specific implementation methods of the above modules have been described in Example 1 and will not be described in detail here.

[0200] The scene graph subgraph-based image description generation system provided in this embodiment is modularly designed to facilitate system maintenance and expansion. Each module focuses on a specific task, which improves the flexibility of the system and can quickly generate image descriptions under real-time requirements.

[0201] Embodiment 3:

[0202] In one or more embodiments, a terminal device is disclosed, including a server, the server including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method for generating an image description based on a scene graph subgraph in Example 1 when executing the program. For the sake of brevity, it will not be described in detail here.

[0203] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0204] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.

[0205] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.

[0206] Embodiment 4:

[0207] In one or more embodiments, a computer-readable storage medium is disclosed, in which a plurality of instructions are stored, and the instructions are suitable for being loaded by a processor of a terminal device and executing the method for generating image description based on a scene graph subgraph described in Example 1. The computer-readable storage medium provides a convenient way to enable the method for generating image description to be flexibly applied on different terminal devices.

[0208] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0209] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating image description based on scene graph subgraph, characterized in that: The following steps are involved: Get the input original image; A trained sub-graph generation module is used to obtain a plurality of scene graph sub-graphs and corresponding scene graph sub-graph features of the original image; wherein the sub-graph generation module uses a PSG algorithm to generate a scene graph sub-graph, and uses a graph convolutional network to extract the corresponding scene graph sub-graph features; Using CLIP visual encoder to obtain the global features of the original image; Fusing each of the scene graph sub-graph features with the global features respectively; Perform modality alignment on the fused features; Input the features after modality alignment processing into a pre-trained image description generation model, and output the image description corresponding to the original image; The trained sub-graph generation module is used to obtain multiple scene graph sub-graphs of the original image and corresponding scene graph sub-graph features, including: The PSG algorithm is used to obtain the scene graph of the original image, the corresponding instance segmentation graph and the relationship between the instances; Outputting a graph embedding through a graph convolutional network according to the relationship between any two objects in the instance segmentation graph and the scene graph; Splitting the scene graph into multiple independent sub-graphs and removing duplicate sub-graphs; Embedding the graph into the corresponding subgraph, inputting the subgraph discrimination module, and outputting a suitable scene graph subgraph; According to outputting the appropriate scene graph subgraph, the corresponding scene graph subgraph features are obtained from the graph embedding.

2. The method for generating image description based on scene graph subgraph according to claim 1, characterized in that: The training process of the subgraph generation module includes: Traversing the manually annotated image description candidate set, matching each manually annotated image description with all sampled subgraphs; the sampled subgraphs are composed of graph embedding features and corresponding subgraphs; Compute the similarity between the feature encodings of all nodes and relations in the sampled subgraph and the manually annotated image descriptions; Filter out the sampled sub-images with the greatest similarity to the manually annotated image description as positive samples; and use the unrelated sub-images as negative samples; The training data set is composed of positive and negative samples with preset proportions, and the neural network is trained to obtain the optimal discriminant model as the sub-graph generation module.

3. The method for generating image description based on scene graph subgraph according to claim 1, characterized in that: Each of the scene graph sub-graph features is fused with the global features respectively, including: Each of the scene graph sub-graph features is fused with the global features through a Concat operation.

4. The method for generating image description based on scene graph subgraph according to claim 1, characterized in that: The fused features are subjected to modality alignment processing, including: The fused visual features are aligned to the space of text features using a two-layer perceptron network.

5. The method for generating image description based on scene graph subgraph according to claim 1, characterized in that: The pre-trained image description generation model is a pre-trained LLM large language model based on the Transformer architecture.

6. A scene graph subgraph-based image description generation system, characterized in that: include: An acquisition module is used to acquire the input original image; A sub-graph generation module, used to obtain multiple scene graph sub-graphs and corresponding scene graph sub-graph features of the original image using the trained sub-graph generation module; wherein the sub-graph generation module uses the PSG algorithm to generate the scene graph sub-graphs, and uses a graph convolutional network to extract the corresponding scene graph sub-graph features; A global feature generation module, used for obtaining the global features of the original image by using a CLIP visual encoder; A feature fusion module, used to fuse each of the scene graph sub-graph features with the global features respectively; The modality alignment module is used to perform modality alignment processing on the fused features; An image description generation module is used to input the features after modality alignment processing into a pre-trained image description generation model, and output an image description corresponding to the original image; The sub-graph generation module comprises: A PSG generation module, used to obtain the scene graph of the original image, the corresponding instance segmentation graph and the relationship between instances by using a PSG algorithm; A graph embedding acquisition module, used to output a graph embedding through a graph convolutional network according to the relationship between any two objects in the instance segmentation graph and the scene graph; A sub-graph sampling module, used for splitting the scene graph into multiple independent sub-graphs and removing duplicate sub-graphs; The sub-graph discrimination module is used to take the graph embedding and the corresponding sub-graph as input, output a suitable scene graph sub-graph; and obtain the corresponding scene graph sub-graph feature from the graph embedding according to the output suitable scene graph sub-graph.

7. The image description generation system based on scene graph subgraph according to claim 6, characterized in that: The training process of the subgraph generation module includes: Traversing the manually annotated image description candidate set, matching each manually annotated image description with all sampled subgraphs; the sampled subgraphs are composed of graph embedding features and corresponding subgraphs; Compute the similarity between the feature encodings of all nodes and relations in the sampled subgraph and the manually annotated image descriptions; Filter out the sampled sub-images with the greatest similarity to the manually annotated image description as positive samples; and use the unrelated sub-images as negative samples; The training data set is composed of positive and negative samples with preset proportions, and the neural network is trained to obtain the optimal discriminant model as the sub-graph generation module.

8. The image description generation system based on scene graph subgraph according to claim 6, characterized in that: The feature fusion module is specifically used to fuse each of the scene graph sub-graph features with the global feature through a Concat operation.

9. The image description generation system based on scene graph subgraph according to claim 6, characterized in that: The modality alignment module is specifically used to align the fused visual features to the space of text features using a two-layer perceptron network.

10. The image description generation system based on scene graph subgraph according to claim 6, characterized in that: The pre-trained image description generation model in the image description generation module is a pre-trained LLM large language model based on the Transformer architecture.

11. A terminal device, comprising a processor and a memory, wherein the processor is used to implement each instruction; and the memory is used to store multiple instructions, characterized in that: The instructions are suitable for being loaded by a processor and executing the method for generating an image description based on a scene graph subgraph as described in any one of claims 1 to 5.

12. A computer-readable storage medium storing a plurality of instructions, characterized in that: The instructions are suitable for being loaded by a processor of a terminal device and executing the method for generating an image description based on a scene graph subgraph as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Image title generation method and system based on fusion features, and electronic equipment

    CN115019142A

  • Open word list scene graph generation method, system and equipment and storage medium

    CN116524513A

  • Fast learnable large-scale image description method

    CN116935387A

  • BERT-based image description diffusion generation method

    CN117034868A

  • Network construction method for improving unique diversity of image text description

    CN114625882A