Multi-granularity scene graph generation method based on predicates and triples

By using dual-stream network and knowledge transfer technology in scene graph generation, combined with coarse-grained predicate features and fine-grained triplet features, the problem of insufficient modeling and long tail of predicate features with large changes in visual appearance is solved, achieving better Generalization ability and recognition effect.

CN118587488AActive Publication Date: 2024-09-03BEIHANG UNIV

Patent Information

Application Number
CN202410694873.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-03
Estimated Expiration
2044-05-31

AI Technical Summary

Technical Problem

Existing scene graph generation methods are difficult to capture predicate features with large changes in visual appearance, and the long-tail problem makes it difficult for the model to generalize and effectively adapt to the distribution of the data set.

Method used

A multi-grained scene graph generation method based on predicates and triples is used to model predicate context and triplet context through a dual-stream scene graph generation network, combined with joint loss and knowledge transfer technology, to integrate coarse-grained predicate features and fine-grained triples group features to enhance the generalization ability of the model.

Benefits of technology

It effectively alleviates the long-tail problem, improves the ability to identify predicate categories with large changes in visual appearance, and expands the application ideas of deep learning models in scene graph generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587488A
    Figure CN118587488A
Patent Text Reader

Abstract

The invention belongs to the technical field of image processing, and provides a multi-granularity scene graph generation method based on predicates and triples. The method comprises the following steps: establishing an image data set; constructing a scene graph generation model based on predicates and triples; model training constraints are set, first-stage training adopts joint loss to train the constraints on the model, the joint loss comprises cross entropy loss and contrast learning loss, and second-stage training adopts cross entropy loss to train the constraints on the model; training a scene graph generation model, adopting a back propagation algorithm for training, and iteratively updating and optimizing model parameters until a model loss region converges; and applying the trained scene graph generation model to scene graph generation. According to the method, the coarse-grained predicate features and the fine-grained triple features among the entities are extracted respectively to complement each other, so that the defect that modeling of predicates with large visual appearance changes is insufficient in an existing algorithm is overcome, and the scene graph generation thought based on a deep learning model is expanded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and in particular relates to a method for generating a multi-granularity scene graph based on predicates and triples. Background Art

[0002] Entities and the relationships between them (predicates) are the cornerstones of understanding visual content. Scene graph generation is a fundamental task in visual content understanding. Its goal is to detect entities in visual images and predict the predicates between them. This goal can be expressed as a <subject, predicate, object> triple. It can be seen that triples are fine-grained categories of predicates. Among them, subjects and objects are entities. Since entities can be identified by object detection technology, the focus of scene graph generation is to identify predicates between entities. The generated scene graphs can be used in many fields, such as embodied intelligence, image retrieval, and visual question answering tasks.

[0003] Existing scene graph generation methods mainly rely on the entity information of target detection to extract distinguishable predicate features between entities. However, the visual appearance of predicates under different subject-object combinations varies greatly, which poses a challenge to the scene graph generation model to capture robust predicate features. In order to solve this problem, Chaofan Zheng et al. (Zheng C, LyuX, Gao L, et al. Prototype-based embedding network for scene graph generation [C] / / Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition. 2023: 22783-22792.) used the text features of the predicate label as the category prototype of the predicate in 2023, and tried to increase the distance between different predicate category features and reduce the distance between predicate features within the class. Although the ability of the scene graph generation model to identify predicate categories has been improved, this method still does not take into account the objective situation that the visual appearance of the same predicate category is very different and it is difficult to directly extract predicate clues.

[0004] In addition, many methods have recently begun to focus on the long-tail problem in scene graph generation tasks. The number of tail predicate categories in the dataset is small and the number of triples is insufficient, which makes it difficult for the model to adapt to the distribution of the dataset. Existing scene graph generation methods enhance attention to tail predicate categories through reweighting and resampling schemes, but ignore the essence of the long-tail problem of predicates, that is, the pattern of tail predicate categories is not sufficient to generalize to more test samples. Summary of the invention

[0005] Although the visual appearance of samples belonging to the same predicate category varies greatly, when the field of view is limited to a certain triple, the difference in visual appearance becomes smaller. Therefore, fine-grained triple features help to identify coarse-grained predicate categories and increase generalizable predicate patterns. For the long-tail problem in scene graph generation, it is very natural to use the coarse-grained predicate features and fine-grained triple features at the tail to amplify its pattern to alleviate the long-tail problem. Based on this, the present invention proposes a multi-granularity scene graph generation method based on predicates and triples, and its technical solution is as follows:

[0006] A method for generating a multi-granularity scene graph based on predicates and triples comprises the following steps:

[0007] Step S1: Establish an image dataset;

[0008] Step S2: constructing a scene graph generation model, wherein the scene graph generation model is a dual-stream scene graph generation network, modeling the predicate context and the triple context at the same time, and fusing the extracted information at the end stage to form mutual guidance, and then fusing the predicate context and the triple context to realize scene graph generation;

[0009] Step S3: Setting model training constraints. In the first stage of training, joint loss is used to constrain model training. The joint loss includes cross entropy loss and contrastive learning loss. In the second stage of training, cross entropy loss is used to constrain model training.

[0010] Step S4: training the scene graph generation model, using a back propagation algorithm to iteratively update and optimize model parameters until the model loss region converges;

[0011] Step S5: Apply the trained scene graph generation model to scene graph generation.

[0012] Preferably, the scene graph generation model includes a target detector, a predicate context modeler, a triple context modeler and a feature fusion module; wherein,

[0013] The object detector is used to extract initial entity features, initial predicate features and initial triple features from the image data;

[0014] The predicate context modeler takes the initial entity features and the initial predicate features as input, models the context within the predicate, within the entity, and between the predicate and the entity, and obtains the refined predicate features;

[0015] The triple context modeler takes the initialization triple features as input, models the context within the triples, and obtains refined triple features;

[0016] The feature fusion module is used to fuse the refined predicate features and the refined triple features and classify them.

[0017] Preferably, the predicate context modeler is divided into two layers, each layer comprising a predicate context module, an entity context module and a predicate and entity context modeling module.

[0018] Preferably, the triple context modeler is divided into two layers, each layer comprising a triple visual context module, a triple semantic context module and a triple visual and semantic context module.

[0019] Preferably, the joint loss of the first stage training is calculated as follows:

[0020] 1) The cross entropy loss is the cross entropy between the predicate probability and the true label:

[0021]

[0022] where y i,j represents the true label, prob i,j represents the predicate probability, M is the predicate feature p i,j The number of

[0023] 2) Contrastive learning loss is used to constrain features of predicates and triples of the same category:

[0024]

[0025] in represents triplet contrastive learning loss, represents the predicate contrastive learning loss, τ t represents the temperature coefficient of triplet contrastive learning loss, τ p represents the temperature coefficient of the predicate contrast loss, <·,·> represents the dot product, Indicates the triple representation of subject i and object j The triplet features obtained after spatial mapping are Representation and Triples belonging to the same triple category are represented by, Indicates the corresponding predicate representation of subject i and object j The predicate features obtained through spatial mapping, Representation and Predicates belonging to the same predicate category represent;

[0026]

[0027] Where W t and W p Both are weight matrices that can be optimized through back-propagation;

[0028] 3) The joint loss is:

[0029]

[0030] Among them, λ cls , and Both represent the joint loss trade-off parameters.

[0031] Preferably, the cross entropy loss in the second stage is calculated as follows:

[0032]

[0033] where y i,j represents the true label, prob i,j represents the predicate probability, M is the predicate feature p i,j The number of .

[0034] Preferably, the training of the scene graph generation model in step S4 is divided into two stages. The first stage trains the scene graph generation model by inputting image data in the image data set, and the second stage trains a feature fusion module that constructs predicate features and triple features through a knowledge transfer method and inputs them into the scene graph generation model.

[0035] Preferably, the second stage training constructs predicate features and triple features as estimation and sampling based on multivariate Gaussian distribution by using a knowledge transfer method, including:

[0036] 1) Assumptions and Follows a multivariate Gaussian distribution, where the predicate representations belonging to predicate category c Recorded as Belongs to the triple category<s,c,o> The triple representation of s is the category of subject i, o is the category of object j, and their mean and covariance matrices are:

[0037]

[0038] Among them, M c Represents the predicate features in the data that belong to the predicate category c Number, M <s,c,o> Indicates that the data belongs to the triple category<s,c,o> The triplet features of number, and represents the mean and covariance of the predicate features of predicate category c, and Represents triple category<s,c,o> The mean and covariance of the triplet features of ;

[0039] 2) define knowledge transfer as the migration covariance matrix from a predicate category or triple category with a large number of samples to a predicate category or triple category with a small number of samples;

[0040] The knowledge transfer process in the predicate is expressed as follows:

[0041]

[0042] where β c,k is the mean of the c-th predicate category and the k-th predicate category and The Euclidean similarity between c To construct the target number of predicate features of the cth type, is the predicate covariance matrix after knowledge transfer;

[0043] The knowledge transfer process in triples is expressed as follows:

[0044]

[0045] where β <s,c,o>,k For the<s,c,o> The triplet categories and the kth triplet category mean and The Euclidean similarity between <s,c,o> To construct<s,c,o> The target number of triplet-like features, is the triple covariance matrix after knowledge transfer;

[0046] 3) Sampling from the multivariate Gaussian distribution after knowledge transfer to obtain triple feature samples:

[0047]

[0048] in Representative is the mean value, is the multivariate Gaussian distribution of covariance, is the triple feature obtained by sampling;

[0049] 4) Sampling from the multivariate Gaussian distribution after knowledge transfer to obtain the constructed predicate feature sample:

[0050]

[0051] in Representative is the mean value, is the multivariate Gaussian distribution of covariance, is the sampled predicate feature.

[0052] Compared with the prior art, the present invention has the following beneficial effects:

[0053] This paper proposes a multi-granularity scene graph generation method based on predicates and triples. By effectively modeling coarse-grained predicate features and fine-grained triple features, it makes up for the defect of insufficient modeling of predicates with large visual appearance changes in existing algorithms. By migrating the predicate knowledge from the head to the tail, the long tail problem is effectively alleviated, and the idea of ​​scene graph generation based on deep learning models is expanded. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] 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 will be briefly introduced below. The features and advantages of the present invention can be more clearly understood by referring to the drawings. The drawings are schematic and should not be understood as limiting the present invention in any way. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0055] Figure 1 The present invention is a flowchart of a method for generating a multi-granularity scene graph based on predicates and triples.

[0056] Figure 2 A model architecture diagram is generated for the scene graph constructed by the present invention.

[0057] Figure 3 The scene graph result graph is output by the scene graph generation model of the present invention. DETAILED DESCRIPTION

[0058] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

[0059] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0060] A method for generating a multi-granularity scene graph based on predicates and triples comprises the following steps:

[0061] Step 1: Prepare the image data set, complete the image data set selection, and perform image data division.

[0062] Step 2: Construct a scene graph generation model. The scene graph generation model is a dual-stream scene graph generation network. The predicate context and triple context are modeled at the same time, and the extracted information is fused at the end stage to form mutual guidance, and then the predicate context and triple context are fused to realize scene graph generation.

[0063] Specifically, the scene graph generation model includes a target detector, a predicate context modeler, a triple context modeler and a feature fusion module; wherein,

[0064] The object detector is used to extract initial entity features, initial predicate features and initial triple features from the image data;

[0065] The predicate context modeler takes the initial entity features and the initial predicate features as input, models the context within the predicate, within the entity, and between the predicate and the entity, and obtains the refined predicate features;

[0066] The triple context modeler takes the initialization triple features as input, models the context within the triples, and obtains refined triple features;

[0067] The feature fusion module is used to fuse the refined predicate features and the refined triple features and classify them.

[0068] 1) The predicate context modeler is divided into two layers, each layer includes a predicate context module, an entity context module and a predicate and entity context modeling module, which are used to refine the predicate features. i,j} M and initialize entity features {e i} N , the predicate context modeler calculates the refined predicate features The specific calculation is as follows:

[0069]

[0070] PCM 1 and PCM 2 They represent the first and second layers of the predicate context modeler, respectively, and both have the same model structure and operation mode. i,j The number of N is e i The number of, where M = N × (N-1). and Predicate features and entity features calculated for the first layer of the predicate context modeler. Predicate feature p i,j Indicates that its subject is entity e i and the object is entity e j . PCM 1For example, for the input initialization predicate feature {p i,j} M and initialize entity features {e i} N , respectively calculate the features {p′ with their respective internal contexts i,j} M and {e′ i} N Then calculate the features {p″ of the predicate with entity context and the entity with predicate context i,j} M and {e″ i} N , further adding and The specific calculation is as follows:

[0071] {p′ i,j} M =SelfAttention({p i,j} M )

[0072] {p″ i,j} M =CrossAttention({p i,j} M ,{e i} N )

[0073]

[0074] {e′ i} N =SelfAttention({e i} N )

[0075] {e″ i} N =CrossAttention({e i} N ,{p i,j} M )

[0076]

[0077] Among them, SelfAttention represents the self-attention operator, whose goal is to obtain the context information between the input feature sets, and CrossAttention represents the cross-attention operator, whose goal is to obtain the context information between the two sets of input feature sets. 1 Calculate the predicate feature {p′ i,j}M Taking the self-attention operator as an example, the self-attention operator first converts the input initial predicate feature set {p i,j} M Map to A total of 24 spaces are available. and Represents the “query features” q mapped to 8 feature spaces respectively 1 …q 8 , mapped to the “key features” k of the 8 feature spaces 1 …k 8 and mapped to 8 “value features” v 1 …v 8 Then calculate and and The attention matrix between feature sets Finally, the attention matrix and The spatial feature set is multiplied and concatenated to get the output {p′ i,j} M The specific calculation is as follows:

[0078]

[0079] Among them, ⊙ represents matrix multiplication, () T represents matrix transposition, Concat represents concatenation operation, W SA represents the weight matrix that can be optimized by back-propagation. 1 Calculate the predicate feature {p″ i,j} N×(N-1) Taking the cross-attention operator as an example, the cross-attention operator first transforms the input feature set {p i,j} M and {e i} N Map to A total of 24 spaces are available. and Then calculate and and The attention matrix between feature sets Finally, the attention matrix and The spatial feature set is multiplied and concatenated to get the output {p″ i,j} M The specific calculation is as follows:

[0080]

[0081] 2) The triple context modeler is divided into two layers, each layer includes a triple visual context module, a triple semantic context module and a triple visual and semantic context module, which are used to refine the triple features. The triple visual feature is initialized as {Concat(e i ,p i,j ,e j )} M , the semantic features of the triples are initialized as {s i,j} M , where s i,j Entity e extracted by the object detector i and e j Corresponding semantic information. For the input triple visual features and triple semantic features, the triple context modeler will obtain refined triple features The specific calculation is as follows:

[0082]

[0083] Among them, TCM 1 and TCM 2 They represent the first layer and the second layer of the triple context modeler respectively, and both have the same model structure and operation method. and The triplet visual features and triplet semantic features calculated for the first layer of the triplet context modeler. i,j Indicates that it is the subject and entity e i and the object is entity e j . With TCM 1 For example, for the input initialization triple visual feature {Concat(e i ,p i,j ,e j )} M And the initialized triple semantic features {s i,j} M , respectively calculate the features {t′ with their respective internal contexts i,j} M and {s′ i,j} M Then, we calculate the features {t″ of the triplet visual with semantic context and the triplet semantic with visual context i,j} M and {s″ i,j} M , further adding and The specific calculation is as follows:

[0084] {t′ i,j} M=SelfAttention({Concat(e i ,p i,j ,e j )} M )

[0085] {t″ i,j} M =CrossAttention({Concat(e i ,p i,j ,e j )} M ,{s i,j} M )

[0086]

[0087] {s′ i,j} M =SelfAttention({s i,j} M )

[0088] {s″ i,j} M =CrossAttention({s i,j} M ,{p i,j} M )

[0089]

[0090] 3) The feature fusion module refines the predicate features and refined triple features Splice and classify. The specific calculation is as follows:

[0091]

[0092]

[0093] Where W f Represents the weights that can be optimized through back propagation. exp refers to the exponential calculation based on the base of the natural logarithm. logit i,j Represents the weight W f The output score, prob i,j That is, the model output is entity e i As the subject and as the entity j The probability of a predicate being an object.

[0094] Step 3: Set model training constraints. In the first stage of training, the joint loss is used to constrain model training. The joint loss includes cross entropy loss and contrastive learning loss. In the second stage of training, the cross entropy loss is used to constrain model training.

[0095] Specifically, the joint loss calculation method of the first stage training is as follows:

[0096] 1) The cross entropy loss is the cross entropy between the predicate probability and the true label:

[0097]

[0098] where y i,j represents the true label, prob i,j represents the predicate probability, M is the predicate feature p i,j The number of

[0099] 2) Contrastive learning loss is used to constrain features of predicates and triples of the same category:

[0100]

[0101] in represents triplet contrastive learning loss, represents the predicate contrastive learning loss, τ t represents the temperature coefficient of triplet contrastive learning loss, τ p represents the temperature coefficient of the predicate contrast loss, <·,·> represents the dot product, Indicates the triple representation of subject i and object j The triplet features obtained after spatial mapping are Representation and Triples belonging to the same triple category are represented by, Indicates the corresponding predicate representation of subject i and object j The predicate features obtained through spatial mapping, Representation and Predicates belonging to the same predicate category represent;

[0102]

[0103] Where W t and W p Both are weight matrices that can be optimized through back-propagation;

[0104] 3) The joint loss is:

[0105]

[0106] Among them, λ cls , and Both represent the joint loss trade-off parameters.

[0107] The cross entropy loss in the second stage is calculated as follows:

[0108]

[0109] where y i,j represents the true label, prob i,j represents the predicate probability, M is the predicate feature p i,j The number of .

[0110] Step 4: Train the scene graph generation model. The training adopts the back propagation algorithm to iteratively update and optimize the model parameters until the model loss area converges.

[0111] Specifically, the training of the scene graph generation model is divided into two stages. The first stage trains the scene graph generation model by inputting image data in the image dataset. The second stage trains the feature fusion module that constructs predicate features and triple features through the knowledge transfer method and inputs them into the scene graph generation model.

[0112] The second stage of training constructs predicate features and triple features as estimation and sampling based on multivariate Gaussian distribution through knowledge transfer method, including:

[0113] 1) Assumptions and Follows a multivariate Gaussian distribution, where the predicate representations belonging to predicate category c Recorded as Belongs to the triple category<s,c,o> The triple representation of s is the category of subject i, o is the category of object j, and their mean and covariance matrices are:

[0114]

[0115] Among them, M c Represents the predicate features in the data that belong to the predicate category c Number, M <s,c,o> Indicates that the data belongs to the triple category<s,c,o> The triplet features of number, and represents the mean and covariance of the predicate features of predicate category c, and Represents triple category<s,c,o> The mean and covariance of the triplet features of ;

[0116] 2) define knowledge transfer as the migration covariance matrix from a predicate category or triple category with a large number of samples to a predicate category or triple category with a small number of samples;

[0117] The knowledge transfer process in the predicate is expressed as follows:

[0118]

[0119] where β c,k is the mean of the c-th predicate category and the k-th predicate category and The Euclidean similarity between c To construct the target number of predicate features of the cth type, is the predicate covariance matrix after knowledge transfer;

[0120] The knowledge transfer process in triples is expressed as follows:

[0121]

[0122] where β <s,c,o>,k For the<s,c,o> The triplet categories and the kth triplet category mean and The Euclidean similarity between <s,c,o> To construct<s,c,o> The target number of triplet-like features, is the triple covariance matrix after knowledge transfer;

[0123] 3) Sampling from the multivariate Gaussian distribution after knowledge transfer to obtain triple feature samples:

[0124]

[0125] in Representative is the mean value, is the multivariate Gaussian distribution of covariance, is the triple feature obtained by sampling;

[0126] 4) Sampling from the multivariate Gaussian distribution after knowledge transfer to obtain the constructed predicate feature sample:

[0127]

[0128] in Representative is the mean value, is the multivariate Gaussian distribution of covariance, is the sampled predicate feature.

[0129] Step 5: Apply the trained scene graph generation model to scene graph generation.

[0130] Example 1

[0131] A multi-granularity scene graph generation method based on predicates and triples, such as Figure 1 As shown, the steps are as follows:

[0132] 1. Prepare image data sets, complete image data set selection, and image data set division.

[0133] 1.1 This example selects the commonly used Visual Genome dataset, Open Image V6 dataset and GQA dataset.

[0134] 1.2 For the Visual Genome dataset, 57,723 images are used for training, 5,000 images are used for validation, and 26,446 images are used for testing; for the Open Image V6 dataset, 126,368 images are used for training, 1,183 images are used for validation, and 5,322 images are used for testing. For the GQA dataset, 57,613 images are used for training, 5,000 images are used for validation, and 8,208 images are used for testing.

[0135] 2. Build a scene graph generation model, such as Figure 2 As shown, the scene graph generation model contains an object detector, a predicate context modeler, a triple context modeler, and a feature fusion module.

[0136] 3. Design model training constraints. Model training is divided into two stages. In the first stage, joint loss is used to constrain model training. The joint loss includes cross entropy loss and contrastive learning loss. The second stage uses cross entropy loss. The specific constraint design has been discussed in the content of the invention and will not be repeated here. The trade-off parameters of each sub-constraint of the joint loss are set as:

[0137] λ cls =3,

[0138] 4. Train the scene graph generation model. In the first stage, the back propagation algorithm is used to update and optimize the weights of all network parameters until the model loss converges; in the second stage, the back propagation algorithm is used to update and optimize the weights of the feature fusion module network parameters. In this embodiment, the scene graph generation training and evaluation are completed on the PyTorch platform. The model is trained on a single NVIDIAA800 GPU (80GB) with a batch size of 16. The SGD optimizer is used in the first and second stages, using 1×10 as the initial learning rate. -4Train the model. For all image datasets, observe the model's results on the validation dataset every 2,000 iterations. Stop model training when the validation set results no longer improve.

[0139] 5. After the model training is completed, the scene graph generation inference is performed. The image is input into the scene graph generation model, and the model output result is the scene graph result. Figure 3 As shown, the present invention can effectively complete the task of scene graph generation.

[0140] Through the nonlinear electromagnetic field analysis method described in this embodiment, efficient numerical analysis of nonlinear electromagnetic fields with random effects is achieved, which minimizes the calculation scale and improves the calculation efficiency. It does not need to solve ultra-large-scale algebraic equations at each time step, and can ensure the convergence of the numerical analysis method.

[0141] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may include that the first and second features are in direct contact, or may include that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, a first feature being "above", "above" and "above" a second feature includes that the first feature is directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. A first feature being "below", "below" and "below" a second feature includes that the first feature is directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature.

[0142] In the present invention, the terms "first", "second", "third", "fourth" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance. The term "plurality" refers to two or more, unless otherwise clearly defined.

[0143] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A multi-granularity scene graph generation method based on predicates and triples, It is characterized in that The following steps are involved: Step S1: Establish an image dataset; Step S2: constructing a scene graph generation model, wherein the scene graph generation model is a dual-stream scene graph generation network, modeling the predicate context and the triple context at the same time, and fusing the extracted information at the end stage to form mutual guidance, and then fusing the predicate context and the triple context to realize scene graph generation; Step S3: Setting model training constraints. In the first stage of training, joint loss is used to constrain model training. The joint loss includes cross entropy loss and contrastive learning loss. In the second stage of training, cross entropy loss is used to constrain model training. Step S4: training the scene graph generation model, using a back propagation algorithm to iteratively update and optimize model parameters until the model loss region converges; Step S5: Apply the trained scene graph generation model to scene graph generation.

2. The method for generating a multi-granularity scene graph according to claim 1, It is characterized in that The scene graph generation model includes a target detector, a predicate context modeler, a triple context modeler and a feature fusion module; wherein, The object detector is used to extract initial entity features, initial predicate features and initial triple features from the image data; The predicate context modeler takes the initial entity features and the initial predicate features as input, models the context within the predicate, within the entity, and between the predicate and the entity, and obtains the refined predicate features; The triple context modeler takes the initialization triple features as input, models the context within the triples, and obtains refined triple features; The feature fusion module is used to fuse the refined predicate features and the refined triple features and classify them.

3. The method for generating a multi-granularity scene graph according to claim 2, It is characterized in that The predicate context modeler is divided into two layers, each layer includes a predicate context module, an entity context module and a predicate and entity context modeling module.

4. The method for generating a multi-granularity scene graph according to claim 2, It is characterized in that The triple context modeler is divided into two layers, each layer comprising a triple visual context module, a triple semantic context module, and a triple visual and semantic context module.

5. The method for generating a multi-granularity scene graph according to claim 1, It is characterized in that The joint loss of the first stage of training is calculated as follows: 1) The cross entropy loss is the cross entropy between the predicate probability and the true label: where y i,j represents the true label, prob i,j represents the predicate probability, M is the predicate feature p i,j The number of 2) Contrastive learning loss is used to constrain features of predicates and triples of the same category: in represents triplet contrastive learning loss, represents the predicate contrastive learning loss, τ t represents the temperature coefficient of triplet contrastive learning loss, τ p represents the temperature coefficient of the predicate contrastive learning loss, <·,·> represents the dot product, Indicates the triple representation of subject i and object j The triplet features obtained after spatial mapping are Representation and Triples belonging to the same triple category are represented by, Indicates the corresponding word representation of subject i and object j The predicate features obtained through spatial mapping, Representation and Predicates belonging to the same predicate category represent; Where W t and W p Both are weight matrices that can be optimized through back-propagation; 3) The joint loss is: Among them, λ cls , and Both represent the joint loss trade-off parameters.

6. The method for generating a multi-granularity scene graph according to claim 1, It is characterized in that The cross entropy loss in the second stage is calculated as follows: where y i,j represents the true label, prob i,j represents the predicate probability, M is the predicate feature p i,j The number of .

7. The method for generating a multi-granularity scene graph according to claim 1, It is characterized in that The training of the scene graph generation model in step S4 is divided into two stages. The first stage trains the scene graph generation model by inputting image data in the image data set, and the second stage trains the feature fusion module of the scene graph generation model by constructing predicate features and triple features through the knowledge transfer method.

8. The method for generating a multi-granularity scene graph according to claim 7, It is characterized in that The second stage of training constructs predicate features and triple features as estimation and sampling based on multivariate Gaussian distribution through knowledge transfer method, including: 1) Assumptions and Follows a multivariate Gaussian distribution, where the predicate representations belonging to predicate category c Recorded as Belongs to the triple category<s,c,o> The triple representation of s is the category of subject i, o is the category of object j, and their mean and covariance matrices are: Among them, M c Represents the predicate features in the data that belong to the predicate category c Number, M <s,c,o> Indicates that the data belongs to the triple category<s,c,o> The triplet features of number, and represents the mean and covariance of the predicate features of predicate category c, and Represents triple category<s,c,o> The mean and covariance of the triplet features of ; 2) define knowledge transfer as the migration covariance matrix from a predicate category or triple category with a large number of samples to a predicate category or triple category with a small number of samples; The knowledge transfer process in the predicate is expressed as follows: where β c,j is the mean of the c-th predicate category and the k-th predicate category and The Euclidean similarity between c To construct the target number of predicate features of the cth type, is the predicate covariance matrix after knowledge transfer; The knowledge transfer process in triples is expressed as follows: where β <s,c,o>,k For the<s,c,o> The triplet categories and the kth triplet category mean and The Euclidean similarity between <s,c,o> To construct<s,c,o> The target number of triplet-like features, is the triple covariance matrix after knowledge transfer; 3) Sampling from the multivariate Gaussian distribution after knowledge transfer to obtain triple feature samples: in Representative is the mean value, is the multivariate Gaussian distribution of covariance, is the triple feature obtained by sampling; 4) Sampling from the multivariate Gaussian distribution after knowledge transfer to obtain the constructed predicate feature sample: in Representative is the mean value, is the multivariate Gaussian distribution of covariance, is the sampled predicate feature.

Citation Information

Patent Citations

  • Unbiased scene graph generation method based on double-branch hybrid learning network

    CN115565052A

  • Method for performing multi-level feature fusion extraction by adopting multi-head attention

    CN117312487A

  • Method and system for scene graph generation

    US20220391704A1

Cited By

  • End-to-end dynamic scene graph generation method and system

    CN120807734A