Image text retrieval method and system based on scene graph
By constructing visual and text scene graphs, using graph attention networks for feature extraction and fusion, and combining global and local similarity measurement models, the problem of insufficient utilization of image and text information in the existing technology is solved, and the accuracy of image text retrieval is improved. sex and performance.
Patent Information
- Application Number
- CN202410807776.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-06-21
AI Technical Summary
It is difficult for the existing technology to fully utilize the global information, fine-grained information and interaction of images and texts in image text retrieval, which affects the accuracy and diversity of retrieval, especially when processing multi-modal information.
By constructing a visual scene graph and a text scene graph, using the graph attention network for feature extraction and fusion, combining the global and local visual-text scene graph similarity measurement models, and training the loss function to improve retrieval performance.
It improves the accuracy and performance of image text retrieval, enables a more comprehensive assessment of the matching degree between images and text, and expands retrieval application scenarios.
Smart Images

Figure CN118673166A
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer vision and multimodal retrieval, and in particular to an image text retrieval method and system based on scene graph. Background Art
[0002] With the rapid development of digitalization, the generation and storage of image and text data have shown an explosive growth trend. At the same time, traditional information retrieval methods can no longer meet people's needs for efficient and accurate retrieval, especially in multimodal information retrieval, where the challenges are even more prominent.
[0003] In this context, image-text retrieval has attracted much attention as an important information retrieval task. It aims to effectively retrieve images or text information related to user queries from huge image and text databases, and provide users with personalized and accurate retrieval services. Existing technical applications mainly map images and texts into a unified feature space for matching, which is often only applicable to simpler images and texts. It is difficult to capture more fine-grained information in images and texts, or only uses the regional information of the image, without considering the interaction between entities / objects in the image and text, and the retrieval performance is low. Recently, some research works have achieved image-text matching by constructing scene graphs. These technologies mainly construct scene graphs of images and texts, and then perform image-text matching by comparing the similarities of the two scene graphs. However, this type of technology often only uses information from a single modality when processing image and text information, and does not consider integrating information from other modalities for feature enhancement, which affects the accuracy and diversity of retrieval.
[0004] One of the current existing technologies is an image-text retrieval method that encodes images and text into global vectors in the same space in the paper "Dual-path convolutional image-text embeddings with instance loss". This technology constructs an end-to-end dual-path convolutional network to learn the representation of images and texts, and introduces instance loss to solve the matching problem between images and texts. The disadvantage of this method is that the technical solution is only applicable to simple cases where there is only one object in the image or only one short sentence in the text, because it ignores the importance of finer-grained information in images and texts, such as the relationship between objects and interactions, which limits its applicability in certain application scenarios.
[0005] The second existing technology is a fine-grained image-text matching method in the paper "Stacked cross attention for image-textmatching", which captures the fine-grained interaction between images and texts by stacking cross attention to infer the potential semantic alignment between objects or other salient regions and corresponding words, and infers image-text similarity, thereby achieving image-text retrieval. The disadvantage of this method is that it only uses the regional information of the image, does not consider the interaction between entities / objects in the image and text, and ignores the multimodal knowledge relationship between images and texts. Summary of the invention
[0006] The purpose of the present invention is to overcome the shortcomings of existing methods and propose an image text retrieval method and system based on scene graph. The main problem solved by the present invention is how to comprehensively and fully utilize the global information of the image, the fine-grained information in the image and text, and the interaction and multimodal knowledge relationship between the two to improve the retrieval accuracy and expand the retrieval application scenarios.
[0007] In order to solve the above problems, the present invention proposes an image text retrieval method based on scene graph, the method comprising:
[0008] Input images and texts from the retrieval dataset, preprocess the images to obtain images of uniform size, and divide the retrieval dataset into a training set and a test set;
[0009] Extracting features from the image of uniform size, and fusing features using a fully connected network to obtain object multimodal fusion features and object relationship multimodal fusion features, constructing a visual scene graph using the object multimodal fusion features as nodes and the object relationship multimodal fusion features as edges, learning and updating the graph attention network to obtain an updated visual scene graph;
[0010] Extracting word features and semantic triple features from the text, constructing a text scene graph with word features as nodes and semantic triple features as edges, learning and updating the text scene graph with a graph attention network to obtain an updated text scene graph, and enhancing the updated visual scene graph with the updated text scene graph to obtain a text-enhanced visual scene graph;
[0011] Calculating an overall similarity score using the updated text scene graph and the text-enhanced visual scene graph, constructing a global-local visual-text scene graph similarity measurement model, and training the global-local visual-text scene graph similarity measurement model using a loss function until the function converges to obtain a converged global-local visual-text scene graph similarity measurement model;
[0012] The user inputs the query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result.
[0013] Preferably, images and texts are input from the retrieval data set, the images are preprocessed to obtain images of uniform size, and the retrieval data set is divided into a training set and a test set, specifically:
[0014] The retrieval dataset consists of images and texts, stored in the form of image-text pairs. Each image has one or more corresponding texts to describe the content of the image.
[0015] Preprocess the image and adjust it to the preset image size by scaling;
[0016] Split the dataset into training and testing sets.
[0017] Preferably, feature extraction is performed on the image of uniform size, and feature fusion is performed using a fully connected network to obtain object multimodal fusion features and object relationship multimodal fusion features, a visual scene graph is constructed using the object multimodal fusion features as nodes and the object relationship multimodal fusion features as edges, and a graph attention network is used to learn and update the graph to obtain an updated visual scene graph, specifically:
[0018] Preferably, word features and semantic triple features are extracted from the text, a text scene graph is constructed with word features as nodes and semantic triple features as edges, a graph attention network is used to learn and update the text scene graph to obtain an updated text scene graph, and the updated visual scene graph is enhanced with the updated text scene graph to obtain a text-enhanced visual scene graph, specifically:
[0019] Preferably, the updated text scene graph and the text-enhanced visual scene graph are used to calculate the overall similarity score, a global-local visual-text scene graph similarity measurement model is constructed, and the global-local visual-text scene graph similarity measurement model is trained using a loss function until the function converges to obtain a converged global-local visual-text scene graph similarity measurement model, specifically:
[0020] Preferably, the user inputs the query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result, specifically:
[0021] Accordingly, the present invention also provides an image text retrieval system based on a scene graph, comprising:
[0022] A preprocessing unit, used for inputting images and texts from a retrieval data set, preprocessing the images to obtain images of uniform size, and dividing the retrieval data set into a training set and a test set;
[0023] A global-local visual-text scene graph similarity measurement model construction unit is used to extract features from the image of uniform size, and use a fully connected network to fuse features to obtain object multimodal fusion features and object relationship multimodal fusion features, construct a visual scene graph with object multimodal fusion features as nodes and object relationship multimodal fusion features as edges, and use a graph attention network to learn and update it to obtain an updated visual scene graph; extract word features and semantic triple features from the text, construct a text scene graph with word features as nodes and semantic triple features as edges, use a graph attention network to learn and update it to obtain an updated text scene graph, and use the updated text scene graph to enhance the updated visual scene graph to obtain a text-enhanced visual scene graph; use the updated text scene graph and the text-enhanced visual scene graph to calculate the overall similarity score, construct a global-local visual-text scene graph similarity measurement model, and use a loss function to train the global-local visual-text scene graph similarity measurement model until the function converges to obtain a converged global-local visual-text scene graph similarity measurement model;
[0024] The query retrieval unit is used for the user to input the query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result.
[0025] The implementation of the present invention has the following beneficial effects:
[0026] The present invention captures objects and interactions between objects in images and texts by constructing scene graphs of images and texts, which can promote a deeper understanding of image and text queries and help enhance image-text retrieval; in constructing a visual scene graph, label semantic information and text semantic information are integrated, and in constructing a text scene graph, visual information is integrated, so that interactions between different modalities are realized and hidden multimodal knowledge relationships are mined, which can improve the accuracy of retrieval; by calculating the similarity between the visual scene graph and the text scene graph from both local and global perspectives, the matching degree between the image and the text can be more comprehensively evaluated, thereby improving the performance of the image-text retrieval task. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 is a flow chart of an image text retrieval method based on a scene graph according to an embodiment of the present invention;
[0028] Figure 2 is a flow chart of generating a visual scene graph according to an embodiment of the present invention;
[0029] Figure 3 is a flow chart of generating a text scene graph according to an embodiment of the present invention;
[0030] Figure 4It is a structural diagram of an image text retrieval system based on a scene graph according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] 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.
[0032] Figure 1 is a flow chart of an image text retrieval method based on a scene graph according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0033] S1, input images and texts from the retrieval dataset, preprocess the images to obtain images of uniform size, and divide the retrieval dataset into a training set and a test set;
[0034] S2, extracting features from the image of uniform size, and using a fully connected network to perform feature fusion to obtain object multimodal fusion features and object relationship multimodal fusion features, constructing a visual scene graph using the object multimodal fusion features as nodes and the object relationship multimodal fusion features as edges, learning and updating the graph attention network to obtain an updated visual scene graph;
[0035] S3, extracting word features and semantic triple features from the text, constructing a text scene graph with word features as nodes and semantic triple features as edges, learning and updating the text scene graph with a graph attention network to obtain an updated text scene graph, and enhancing the updated visual scene graph with the updated text scene graph to obtain a text-enhanced visual scene graph;
[0036] S4, using the updated text scene graph and the text-enhanced visual scene graph to calculate the overall similarity score, constructing a global-local visual-text scene graph similarity measurement model, and using a loss function to train the global-local visual-text scene graph similarity measurement model until the function converges, thereby obtaining a converged global-local visual-text scene graph similarity measurement model;
[0037] S5, the user inputs the query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result.
[0038] Step S1 is as follows:
[0039] S1-1, the retrieval dataset consists of images and texts, which are stored in the form of image-text pairs. Each image has one or more corresponding texts to describe the content of the image;
[0040] S1-2, pre-processing the image and adjusting it to a preset image size by scaling.
[0041] Step S2, generate a visual scene graph, such as Figure 2 As shown, the details are as follows:
[0042] S2-1, using Faster-R-CNN to detect the object area of the image of uniform size, and obtaining the position coordinates of all objects; for each detected object, using CLIP to encode the object area into a visual feature, and then mapping the visual feature and the position coordinates to a high-dimensional space through two linear layers, and adding the two features to obtain the initialized object visual feature; for any two objects, generating an associated area covering the two, obtaining the relational position coordinates of the area, using CLIP to encode the associated area into a relational visual feature, and then mapping the relational visual feature and the relational position coordinates to a high-dimensional space through two linear layers, and adding the two features to obtain the initialized object relational visual feature;
[0043] S2-2, using Faster-R-CNN to extract the categories, attributes and relationships between the detected objects in the image of the uniform size, to obtain initial object semantic labels and initial object relationship semantic labels, using Fast-Text to perform feature extraction on these two types of labels respectively and map them to a high-dimensional space through a linear layer, to obtain object semantic features and object relationship semantic features;
[0044] S2-3, using a fully connected network to perform feature fusion by vector concatenation, connecting the object visual feature and the object semantic feature as well as the object relationship visual feature and the object relationship semantic feature, to obtain an object multimodal fusion feature and an object relationship multimodal fusion feature;
[0045] S2-4, respectively update the nodes and edges of the visual scene graph to obtain an updated visual scene graph, that is, for the nodes of the visual scene graph, the nodes of the visual scene graph are updated through the fully connected layer according to the previous layer's own information; for the edges of the visual scene graph, the edges of the visual scene graph are updated through the fully connected layer based on the previous layer's own information and the information of the previous layer's neighbor nodes.
[0046] Step S3, generate a text scene graph, such as Figure 3 As shown, the details are as follows:
[0047] S3-1, extracting semantic triples of the text using the SPICE method;
[0048] S3-2, mapping the text and each word of the semantic triple to a high-dimensional space through a GloVe word embedding model and representing them as dense real-valued vectors, to obtain word embeddings of the words and word embeddings of the semantic triples;
[0049] S3-3, inputting the word embedding of the word and the word embedding of the semantic triple into two BiLSTM models respectively, obtaining the forward and backward features of the word and the semantic triple and taking the average value to obtain the word feature and the semantic triple feature;
[0050] S3-4, constructing a preliminary text scene graph using the word features as nodes and the semantic triple features as edges;
[0051] S3-5, mapping the updated visual scene graph to obtain semantic features through a learnable linear layer, and enhancing the preliminary text scene graph through vector connection to obtain an enhanced text scene graph;
[0052] S3-6, using a graph attention network to learn and update the features of the enhanced text scene graph to obtain an updated text scene graph;
[0053] S3-7, mapping the semantic features back to the features of the updated visual scene graph through a learnable linear layer, and enhancing the features of the updated visual scene graph by vector connection using the features of the updated text scene graph to obtain a text-enhanced visual scene graph.
[0054] Step S4 is as follows:
[0055] S4-1, performing local similarity measurement on the updated text scene graph and the text-enhanced visual scene graph, that is, matching each node feature and each edge feature of the updated text scene graph and the text-enhanced visual scene graph respectively; for a node, calculating the matching score between it and the relevant object in the image, and taking the average value as the node score; for an edge, calculating the score between it and the relevant matching edge in the image, and taking the average value as the edge score, and adding the node score and the edge score to obtain a local similarity score;
[0056] S4-2, using a learnable linear layer to convert the updated text scene graph and the text-enhanced visual scene graph into text scene graph embedding and visual scene graph embedding, and using the text scene graph embedding and the visual scene graph embedding to perform global similarity measurement, that is, calculating the cosine distance of the vectors of the text scene graph embedding and the visual scene graph embedding to obtain a global similarity score;
[0057] S4-3, adding the local similarity score and the global similarity score to obtain an overall similarity score, and constructing a global-local visual-text scene graph similarity measurement model;
[0058] S4-4, using the improved triplet loss function in which negative samples are replaced by the most difficult negative samples to train the global-local visual-text scene graph similarity measurement model, so that the global similarity score of similar image-text pairs is higher than that of dissimilar image-text pairs, the loss function includes two parts: one part is for real image-text pairs, and the other part is for the most difficult negative triplet, and its expression is:
[0059]
[0060] Among them, m is the boundary parameter, k and l represent the corresponding image-text pairs, and k and It represents an unmatched pair. and l also represent unmatched pairs;
[0061] S4-5, stopping the training when the loss function converges, and obtaining a converged global-local visual-text scene graph similarity measurement model.
[0062] Step S5 is as follows:
[0063] S5-1, the user inputs the query object into the converged global-local visual-text scene graph similarity measurement model, constructs the corresponding scene graph and matches it with the relative scene graph in the model, and calculates the overall similarity score, that is, if the user input is an image, then the visual scene graph corresponding to the input image and the text scene graph of the text in the test set are constructed to obtain several visual-text scene graph pairs, and the overall similarity score is calculated for each visual-text scene graph pair; if the user input is text, then the text scene graph of the input text and the visual scene graph of the image in the test set are constructed to obtain several text-scene graph pairs, and the overall similarity score is calculated for each text-scene graph pair;
[0064] S5-2, sorting the overall similarity scores, wherein the results with higher overall similarity scores are more relevant answers retrieved, and are output as matching results.
[0065] Accordingly, the present invention also provides an image text retrieval system based on scene graph, such as Figure 4 As shown, including:
[0066] A preprocessing unit 1 is used to input images and texts from a retrieval data set, preprocess the images to obtain images of uniform size, and divide the retrieval data set into a training set and a test set;
[0067] Specifically, the retrieval dataset consists of images and texts, which are stored in the form of image-text pairs. Each image has one or more corresponding texts to describe the content of the image.
[0068] Preprocess the image and adjust it to the preset image size by scaling it.
[0069] A global-local visual-text scene graph similarity measurement model construction unit 2 is used to extract features from the image of uniform size, and use a fully connected network to perform feature fusion to obtain object multimodal fusion features and object relationship multimodal fusion features, construct a visual scene graph with object multimodal fusion features as nodes and object relationship multimodal fusion features as edges, and use a graph attention network to learn and update it to obtain an updated visual scene graph; extract word features and semantic triple features from the text, construct a text scene graph with word features as nodes and semantic triple features as edges, use a graph attention network to learn and update it to obtain an updated text scene graph, and use the updated text scene graph to enhance the updated visual scene graph to obtain a text-enhanced visual scene graph; use the updated text scene graph and the text-enhanced visual scene graph to calculate the overall similarity score, construct a global-local visual-text scene graph similarity measurement model, and use a loss function to train the global-local visual-text scene graph similarity measurement model until the function converges to obtain a converged global-local visual-text scene graph similarity measurement model;
[0070] Specifically, Faster-R-CNN is used to detect the region of the object of the image of uniform size, and the position coordinates of all objects are obtained; for each detected object, CLIP is used to encode the object region into a visual feature, and then the visual feature and the position coordinate are mapped to a high-dimensional space through two linear layers, and the two features are added to obtain the initialized object visual feature; for any two objects, an associated region covering the two is generated, and the relational position coordinates of the region are obtained, and CLIP is used to encode the associated region into a relational visual feature, and then the relational visual feature and the relational position coordinate are mapped to a high-dimensional space through two linear layers, and the two features are added to obtain the initialized object relational visual feature;
[0071] Using Faster-R-CNN to extract the categories, attributes and relationships between detected objects in the image of uniform size, to obtain initial object semantic labels and initial object relationship semantic labels, using Fast-Text to extract features from the two types of labels respectively and map them to a high-dimensional space through a linear layer, to obtain object semantic features and object relationship semantic features;
[0072] Using a fully connected network, feature fusion is performed by vector concatenation to connect the object visual feature and the object semantic feature as well as the object relationship visual feature and the object relationship semantic feature to obtain object multimodal fusion features and object relationship multimodal fusion features;
[0073] The nodes and edges of the visual scene graph are updated respectively to obtain an updated visual scene graph, that is, for the nodes of the visual scene graph, the nodes of the visual scene graph are updated through the fully connected layer according to the information of the previous layer; for the edges of the visual scene graph, the edges of the visual scene graph are updated through the fully connected layer in combination with the information of the previous layer and the information of the neighboring nodes of the previous layer;
[0074] Extracting semantic triples of the text using the SPICE method;
[0075] Mapping the text and each word of the semantic triple to a high-dimensional space through a GloVe word embedding model and expressing them as dense real-valued vectors to obtain word embeddings of the words and word embeddings of the semantic triples;
[0076] Inputting the word embedding of the word and the word embedding of the semantic triple into two BiLSTM models respectively, obtaining the forward and backward features of the word and the semantic triple and taking the average value to obtain the word feature and the semantic triple feature;
[0077] Constructing a preliminary text scene graph using the word features as nodes and the semantic triple features as edges;
[0078] By means of a learnable linear layer, the feature map of the updated visual scene graph is used to obtain semantic features, and the initial text scene graph is enhanced by vector connection to obtain an enhanced text scene graph;
[0079] Using a graph attention network to learn and update the features of the enhanced text scene graph to obtain an updated text scene graph;
[0080] Mapping the semantic features back to features of the updated visual scene graph through a learnable linear layer, and enhancing the features of the updated visual scene graph by vector connection using the features of the updated text scene graph to obtain a text-enhanced visual scene graph;
[0081] Performing local similarity measurement on the updated text scene graph and the text-enhanced visual scene graph, that is, matching each node feature and each edge feature of the updated text scene graph and the text-enhanced visual scene graph respectively; for a node, calculating the matching score between it and the relevant object in the image, and taking the average as the node score; for an edge, calculating the score between it and the relevant matching edge in the image, and taking the average as the edge score, and adding the node score and the edge score to obtain a local similarity score;
[0082] Using a learnable linear layer to convert the updated text scene graph and the text-enhanced visual scene graph into text scene graph embedding and visual scene graph embedding, and using the text scene graph embedding and the visual scene graph embedding to perform global similarity measurement, that is, calculating the cosine distance of the vectors of the text scene graph embedding and the visual scene graph embedding to obtain a global similarity score;
[0083] Adding the local similarity score and the global similarity score to obtain an overall similarity score, and constructing a global-local visual-text scene graph similarity measurement model;
[0084] The global-local visual-text scene graph similarity measurement model is trained using an improved triplet loss function in which negative samples are replaced by the most difficult negative samples, so that the global similarity score of similar image-text pairs is higher than that of dissimilar image-text pairs. The loss function includes two parts: one for real image-text pairs and the other for the most difficult negative triplet, and its expression is:
[0085]
[0086] Among them, m is the boundary parameter, k and l represent the corresponding image-text pairs, and k and It represents an unmatched pair. and l also represent unmatched pairs;
[0087] The training is stopped when the loss function converges, and a converged global-local visual-text scene graph similarity measurement model is obtained.
[0088] A query retrieval unit 3, used for a user to input a query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result;
[0089] Specifically, the user inputs the query object into the converged global-local visual-text scene graph similarity measurement model, constructs a corresponding scene graph and matches it with the relative scene graph in the model, and calculates the overall similarity score, that is, if the user input is an image, then the visual scene graph corresponding to the input image and the text scene graph of the text in the test set are constructed to obtain several visual-text scene graph pairs, and the overall similarity score is calculated for each visual-text scene graph pair; if the user input is text, then the text scene graph of the input text and the visual scene graph of the image in the test set are constructed to obtain several text-scene graph pairs, and the overall similarity score is calculated for each text-scene graph pair;
[0090] The overall similarity scores are ranked, and the results with higher overall similarity scores are more relevant answers retrieved, which are output as matching results.
[0091] Therefore, the present invention captures objects and interactions between objects in images and texts by constructing scene graphs of images and texts, which can promote a deeper understanding of image and text queries and help enhance image-text retrieval; it integrates label semantic information and text semantic information in constructing visual scene graphs, and integrates visual information in constructing text scene graphs, realizes interactions between different modalities and mines hidden multimodal knowledge relationships, which can improve the accuracy of retrieval; and calculates the similarity between visual scene graphs and text scene graphs from both local and global perspectives, which can more comprehensively evaluate the degree of matching between images and texts, thereby improving the performance of image-text retrieval tasks.
[0092] The above is a detailed introduction to an image text retrieval method and system based on a scene graph provided by an embodiment of the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for a person skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A scene graph-based image text retrieval method, characterized in that: The method comprises: Input images and texts from the retrieval dataset, preprocess the images to obtain images of uniform size, and divide the retrieval dataset into a training set and a test set; Extracting features from the image of uniform size, and fusing features using a fully connected network to obtain object multimodal fusion features and object relationship multimodal fusion features, constructing a visual scene graph using the object multimodal fusion features as nodes and the object relationship multimodal fusion features as edges, learning and updating the graph attention network to obtain an updated visual scene graph; Extracting word features and semantic triple features from the text, constructing a text scene graph with word features as nodes and semantic triple features as edges, learning and updating the text scene graph with a graph attention network to obtain an updated text scene graph, and enhancing the updated visual scene graph with the updated text scene graph to obtain a text-enhanced visual scene graph; Calculating an overall similarity score using the updated text scene graph and the text-enhanced visual scene graph, constructing a global-local visual-text scene graph similarity measurement model, and training the global-local visual-text scene graph similarity measurement model using a loss function until the function converges to obtain a converged global-local visual-text scene graph similarity measurement model; The user inputs the query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result.
2. The scene graph-based image text retrieval method according to claim 1, characterized in that: The image and text are input from the retrieval data set, the image is preprocessed to obtain an image of uniform size, and the retrieval data set is divided into a training set and a test set, specifically: The retrieval dataset consists of images and texts, stored in the form of image-text pairs. Each image has one or more corresponding texts to describe the content of the image. Preprocess the image and adjust it to the preset image size by scaling it.
3. The scene graph-based image text retrieval method according to claim 1, characterized in that: The image of the uniform size is subjected to feature extraction, and feature fusion is performed using a fully connected network to obtain object multimodal fusion features and object relationship multimodal fusion features, a visual scene graph is constructed using the object multimodal fusion features as nodes and the object relationship multimodal fusion features as edges, and a graph attention network is used to learn and update the graph to obtain an updated visual scene graph, specifically: Using Faster-R-CNN to detect the regions of the objects in the image of uniform size, and obtaining the position coordinates of all objects; for each detected object, using CLIP to encode the object region into visual features, and then mapping the visual features and the position coordinates to a high-dimensional space through two linear layers, and adding the two features to obtain the initialized object visual features; For any two objects, generate a correlation region covering the two objects, obtain the relational position coordinates of the region, use CLIP to encode the correlation region into a relational visual feature, then map the relational visual feature and the relational position coordinates to a high-dimensional space through two linear layers, and add the two features to obtain the initialized object relational visual feature; Using Faster-R-CNN to extract the categories, attributes and relationships between detected objects in the image of uniform size, to obtain initial object semantic labels and initial object relationship semantic labels, using Fast-Text to extract features from the two types of labels respectively and map them to a high-dimensional space through a linear layer, to obtain object semantic features and object relationship semantic features; Using a fully connected network, feature fusion is performed by vector concatenation to connect the object visual feature and the object semantic feature as well as the object relationship visual feature and the object relationship semantic feature to obtain object multimodal fusion features and object relationship multimodal fusion features; The nodes and edges of the visual scene graph are updated respectively to obtain an updated visual scene graph, that is, for the nodes of the visual scene graph, the nodes of the visual scene graph are updated through the fully connected layer according to the previous layer's own information; for the edges of the visual scene graph, the edges of the visual scene graph are updated through the fully connected layer based on the previous layer's own information and the information of the previous layer's neighbor nodes.
4. The scene graph-based image text retrieval method according to claim 1, characterized in that: The extracting of word features and semantic triple features from the text, constructing a text scene graph with word features as nodes and semantic triple features as edges, learning and updating it with a graph attention network to obtain an updated text scene graph, and enhancing the updated visual scene graph with the updated text scene graph to obtain a text-enhanced visual scene graph, specifically: Extracting semantic triples of the text using the SPICE method; Mapping the text and each word of the semantic triple to a high-dimensional space through a GloVe word embedding model and expressing them as dense real-valued vectors to obtain word embeddings of the words and word embeddings of the semantic triples; Inputting the word embedding of the word and the word embedding of the semantic triple into two BiLSTM models respectively, obtaining the forward and backward features of the word and the semantic triple and taking the average value to obtain the word feature and the semantic triple feature; Constructing a preliminary text scene graph using the word features as nodes and the semantic triple features as edges; By means of a learnable linear layer, the feature map of the updated visual scene graph is used to obtain semantic features, and the initial text scene graph is enhanced by vector connection to obtain an enhanced text scene graph; Using a graph attention network to learn and update features of the enhanced text scene graph to obtain an updated text scene graph; The semantic features are mapped back to the features of the updated visual scene graph through a learnable linear layer, and the features of the updated text scene graph are used to enhance the features of the updated visual scene graph through vector connection to obtain a text-enhanced visual scene graph.
5. The scene graph-based image text retrieval method according to claim 1, characterized in that: The method of calculating the overall similarity score by using the updated text scene graph and the text-enhanced visual scene graph, constructing a global-local visual-text scene graph similarity measurement model, and training the global-local visual-text scene graph similarity measurement model by using a loss function until the function converges to obtain a converged global-local visual-text scene graph similarity measurement model, is specifically: Performing local similarity measurement on the updated text scene graph and the text-enhanced visual scene graph, that is, matching each node feature and each edge feature of the updated text scene graph and the text-enhanced visual scene graph respectively; for a node, calculating the matching score between it and the relevant object in the image, and taking the average as the node score; for an edge, calculating the score between it and the relevant matching edge in the image, and taking the average as the edge score, and adding the node score and the edge score to obtain a local similarity score; Using a learnable linear layer to convert the updated text scene graph and the text-enhanced visual scene graph into text scene graph embedding and visual scene graph embedding, and using the text scene graph embedding and the visual scene graph embedding to perform global similarity measurement, that is, calculating the cosine distance of the vectors of the text scene graph embedding and the visual scene graph embedding to obtain a global similarity score; Adding the local similarity score and the global similarity score to obtain an overall similarity score, and constructing a global-local visual-text scene graph similarity measurement model; The global-local visual-text scene graph similarity measurement model is trained using an improved triplet loss function in which negative samples are replaced by the most difficult negative samples, so that the global similarity score of similar image-text pairs is higher than that of dissimilar image-text pairs. The loss function includes two parts: one for real image-text pairs and the other for the most difficult negative triplet, and its expression is: Among them, m is the boundary parameter, k and l represent the corresponding image-text pairs, and k and It represents an unmatched pair. and l also represent unmatched pairs; The training is stopped when the loss function converges, and a converged global-local visual-text scene graph similarity measurement model is obtained.
6. The scene graph-based image text retrieval method according to claim 1, characterized in that: The user inputs the query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result, specifically: The user inputs the query object into the converged global-local visual-text scene graph similarity measurement model, constructs the corresponding scene graph and matches it with the relative scene graph in the model, and calculates the overall similarity score, that is, if the user input is an image, then the visual scene graph corresponding to the input image and the text scene graph of the text in the test set are constructed to obtain several visual-text scene graph pairs, and the overall similarity score is calculated for each visual-text scene graph pair; if the user input is text, then the text scene graph of the input text and the visual scene graph of the image in the test set are constructed to obtain several text-scene graph pairs, and the overall similarity score is calculated for each text-scene graph pair; The overall similarity scores are ranked, and the results with higher overall similarity scores are more relevant answers retrieved, which are output as matching results.
7. An image text retrieval system based on scene graph, characterized in that: The system comprises: A preprocessing unit, used for inputting images and texts from a retrieval data set, preprocessing the images to obtain images of uniform size, and dividing the retrieval data set into a training set and a test set; A global-local visual-text scene graph similarity measurement model construction unit is used to extract features from the image of uniform size, and use a fully connected network to fuse features to obtain object multimodal fusion features and object relationship multimodal fusion features, construct a visual scene graph with object multimodal fusion features as nodes and object relationship multimodal fusion features as edges, and use a graph attention network to learn and update it to obtain an updated visual scene graph; extract word features and semantic triple features from the text, construct a text scene graph with word features as nodes and semantic triple features as edges, use a graph attention network to learn and update it to obtain an updated text scene graph, and use the updated text scene graph to enhance the updated visual scene graph to obtain a text-enhanced visual scene graph; use the updated text scene graph and the text-enhanced visual scene graph to calculate the overall similarity score, construct a global-local visual-text scene graph similarity measurement model, and use a loss function to train the global-local visual-text scene graph similarity measurement model until the function converges to obtain a converged global-local visual-text scene graph similarity measurement model; The query retrieval unit is used for the user to input the query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result.
8. The scene graph-based image text retrieval system according to claim 7, characterized in that: The preprocessing unit is used to input images and texts from the retrieval data set, preprocess the images to obtain images of uniform size, and divide the retrieval data set into a training set and a test set, specifically: The retrieval dataset consists of images and texts, stored in the form of image-text pairs. Each image has one or more corresponding texts to describe the content of the image. Preprocess the image and adjust it to the preset image size by scaling it.
9. The scene graph-based image text retrieval system according to claim 7, characterized in that: The global-local visual-text scene graph similarity measurement model construction unit is used to extract features from the image of uniform size, and use a fully connected network to perform feature fusion to obtain object multimodal fusion features and object relationship multimodal fusion features, construct a visual scene graph with object multimodal fusion features as nodes and object relationship multimodal fusion features as edges, and use a graph attention network to learn and update it to obtain an updated visual scene graph; extract word features and semantic triple features from the text, construct a text scene graph with word features as nodes and semantic triple features as edges, use a graph attention network to learn and update it to obtain an updated text scene graph, and use the updated text scene graph to enhance the updated visual scene graph to obtain a text-enhanced visual scene graph; use the updated text scene graph and the text-enhanced visual scene graph to calculate the overall similarity score, construct a global-local visual-text scene graph similarity measurement model, and use a loss function to train the global-local visual-text scene graph similarity measurement model until the function converges to obtain a converged global-local visual-text scene graph similarity measurement model, specifically: Using Faster-R-CNN to detect the regions of the objects in the image of uniform size, and obtaining the position coordinates of all objects; for each detected object, using CLIP to encode the object region into visual features, and then mapping the visual features and the position coordinates to a high-dimensional space through two linear layers, and adding the two features to obtain the initialized object visual features; For any two objects, generate a correlation region covering the two objects, obtain the relational position coordinates of the region, use CLIP to encode the correlation region into a relational visual feature, then map the relational visual feature and the relational position coordinates to a high-dimensional space through two linear layers, and add the two features to obtain the initialized object relational visual feature; Using Faster-R-CNN to extract the categories, attributes and relationships between detected objects in the image of uniform size, to obtain initial object semantic labels and initial object relationship semantic labels, using Fast-Text to extract features from the two types of labels respectively and map them to a high-dimensional space through a linear layer, to obtain object semantic features and object relationship semantic features; Using a fully connected network, feature fusion is performed by vector concatenation to connect the object visual feature and the object semantic feature as well as the object relationship visual feature and the object relationship semantic feature to obtain object multimodal fusion features and object relationship multimodal fusion features; The nodes and edges of the visual scene graph are updated respectively to obtain an updated visual scene graph, that is, for the nodes of the visual scene graph, the nodes of the visual scene graph are updated through the fully connected layer according to the information of the previous layer; for the edges of the visual scene graph, the edges of the visual scene graph are updated through the fully connected layer in combination with the information of the previous layer and the information of the neighboring nodes of the previous layer; Extracting semantic triples of the text using the SPICE method; Mapping the text and each word of the semantic triple to a high-dimensional space through a GloVe word embedding model and expressing them as dense real-valued vectors to obtain word embeddings of the words and word embeddings of the semantic triples; Inputting the word embedding of the word and the word embedding of the semantic triple into two BiLSTM models respectively, obtaining the forward and backward features of the word and the semantic triple and taking the average value to obtain the word feature and the semantic triple feature; Constructing a preliminary text scene graph using the word features as nodes and the semantic triple features as edges; By means of a learnable linear layer, the feature map of the updated visual scene graph is used to obtain semantic features, and the initial text scene graph is enhanced by vector connection to obtain an enhanced text scene graph; Using a graph attention network to learn and update features of the enhanced text scene graph to obtain an updated text scene graph; Mapping the semantic features back to features of the updated visual scene graph through a learnable linear layer, and enhancing the features of the updated visual scene graph by vector connection using the features of the updated text scene graph to obtain a text-enhanced visual scene graph; Performing local similarity measurement on the updated text scene graph and the text-enhanced visual scene graph, that is, matching each node feature and each edge feature of the updated text scene graph and the text-enhanced visual scene graph respectively; for a node, calculating the matching score between it and the relevant object in the image, and taking the average as the node score; for an edge, calculating the score between it and the relevant matching edge in the image, and taking the average as the edge score, and adding the node score and the edge score to obtain a local similarity score; Using a learnable linear layer to convert the updated text scene graph and the text-enhanced visual scene graph into text scene graph embedding and visual scene graph embedding, and using the text scene graph embedding and the visual scene graph embedding to perform global similarity measurement, that is, calculating the cosine distance of the vectors of the text scene graph embedding and the visual scene graph embedding to obtain a global similarity score; Adding the local similarity score and the global similarity score to obtain an overall similarity score, and constructing a global-local visual-text scene graph similarity measurement model; The global-local visual-text scene graph similarity measurement model is trained using an improved triplet loss function in which negative samples are replaced by the most difficult negative samples, so that the global similarity score of similar image-text pairs is higher than that of dissimilar image-text pairs. The loss function includes two parts: one for real image-text pairs and the other for the most difficult negative triplet, and its expression is: Among them, m is the boundary parameter, k and l represent the corresponding image-text pairs, and k and It represents an unmatched pair. and l also represent unmatched pairs; The training is stopped when the loss function converges, and a converged global-local visual-text scene graph similarity measurement model is obtained.
10. The scene graph-based image text retrieval system according to claim 7, characterized in that: The query retrieval unit is used for the user to input the query object into the converged global-local visual-text scene graph similarity measurement model to obtain a matching result, specifically: The user inputs the query object into the converged global-local visual-text scene graph similarity measurement model, constructs the corresponding scene graph and matches it with the relative scene graph in the model, and calculates the overall similarity score, that is, if the user input is an image, then the visual scene graph corresponding to the input image and the text scene graph of the text in the test set are constructed to obtain several visual-text scene graph pairs, and the overall similarity score is calculated for each visual-text scene graph pair; if the user input is text, then the text scene graph of the input text and the visual scene graph of the image in the test set are constructed to obtain several text-scene graph pairs, and the overall similarity score is calculated for each text-scene graph pair; The overall similarity scores are ranked, and the results with higher overall similarity scores are more relevant answers retrieved, which are output as matching results.
Citation Information
Patent Citations
Cross-modal image text retrieval method of hybrid fusion model
CN112784092A
Cross-modal retrieval method and system based on multi-granularity feature fusion
CN115391625A
Image and text semantic similarity calculation method and system applied to social media
CN117421609A
Scene graph embeddings using relative similarity supervision
US20220391433A1
Cited By
Image processing method and device based on open vocabularies and storage medium
CN119251408A
Power scene graph generation method and device based on multi-modal data
CN119578413A
Video content detection method
CN120356136A
