Target visual relation extraction method based on statistical prior bias

CN118552779APending Publication Date: 2024-08-27NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410661441.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

Existing visual relationship extraction technology is difficult to effectively utilize the statistical correlation between target categories and relationship types, resulting in insufficient accuracy of the model in identifying object relationships in images, especially insufficient generalization capabilities in unseen scenes.

Method used

A target visual relationship extraction method based on statistical prior bias is adopted. By constructing a visual relationship extraction model, the pre-trained visual model is used to extract image features, calculate the statistical prior bias of each pair of targets, and input it into the relationship prediction layer for relationship Predictions, optimizing models to improve accuracy.

Benefits of technology

By introducing statistical prior knowledge, the accuracy of visual relationship extraction and the generalization ability of the model are significantly improved, allowing it to more accurately infer and predict the relationship between targets in unseen scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118552779A
    Figure CN118552779A
Patent Text Reader

Abstract

The invention discloses a target visual relation extraction method based on statistical prior bias, and the method comprises the steps: constructing a visual relation extraction model which comprises a pre-training visual model and a relation prediction layer; extracting picture features by using a pre-trained visual model; obtaining feature representations of all targets according to the picture features and the target region labels; calculating the statistical prior bias of each pair of targets; inputting the feature representation of each pair of targets and the statistical prior bias of each pair of targets into a relation prediction layer for relation prediction; and calculating a relation prediction loss function, optimizing the visual relation extraction model by using the relation prediction loss function, and performing visual relation extraction by using the visual relation extraction model. According to the method, the statistical prior knowledge of the target type and the relation type is concerned, the statistical prior knowledge is creatively utilized to provide a prior bias for the visual relation extraction model, and the accuracy of visual relation extraction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of deep learning and image processing, and in particular to a method for extracting target visual relations based on statistical prior bias. Background Art

[0002] Visual relationship extraction is a task in the field of computer vision that aims to identify and understand the relationships between different objects in an image. It involves modeling and inferring spatial, functional, and semantic relationships between objects. Usually the input is an image and the location of the target in the image, and the output is a label or category that describes the relationship between the objects. For example, in an image containing a person and a ball, the visual relationship extraction task can classify the relationship between the person and the ball, such as "holding", "kicking", "touching", etc.

[0003] The value of the visual relationship extraction task lies in improving the computer's understanding and reasoning ability of image scenes, providing support for visual search and other computer vision tasks, and playing an important role in practical applications, such as scene understanding, visual reasoning, visual search, and computer-assisted vision tasks. In visual relationship extraction, there is a strong statistical correlation between target categories and relationship types. For example, the relationship between a person and a ball may be "holding", "kicking", etc., but it is unlikely to be "wearing". The use of statistical relationships can be used to enhance the learning and generalization capabilities of the model. By considering the statistical relationship between target categories and relationship categories during training, we can guide the model to better learn and generalize the feature representations between different targets and relationships. This helps to improve the robustness and generalization ability of the model, enabling it to accurately infer and predict the relationship between targets in unseen scenes. Therefore, how to introduce this statistical relationship between target categories and relationship types into the visual relationship extraction algorithm to improve its performance is a research path worth exploring. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention discloses a method for extracting target visual relationships based on statistical prior bias. The method can identify the relationship between targets in an image. Compared with the existing methods, the method pays attention to the statistical prior knowledge of target types and relationship types, and innovatively uses the statistical prior knowledge to provide a prior bias for the visual relationship extraction model, thereby improving the accuracy of visual relationship extraction.

[0005] The objective of the present invention is achieved through the following technical solution, a method for extracting target visual relations based on statistical prior bias, the method comprising:

[0006] Step 1: Build a visual relationship extraction model, including a pre-trained visual model and a relationship prediction layer;

[0007] Step 2: Use the pre-trained visual model to extract image features;

[0008] Step 3, obtain the feature representation of all targets based on the image features and target area annotations;

[0009] Step 4, calculate the statistical prior bias of each pair of targets;

[0010] Step 5: Input the feature representation of each pair of targets and the statistical prior bias of each pair of targets into the relationship prediction layer to perform relationship prediction;

[0011] Step 6: Calculate the relationship prediction loss function, use the relationship prediction loss function to optimize the visual relationship extraction model, and use the visual relationship extraction model to perform visual relationship extraction.

[0012] The method of extracting image features using a pre-trained visual model includes the following steps:

[0013] The input image is represented as Use the pre-trained visual model to extract the visual features of the input image. The expression is:

[0014] F img =ResNet(x)

[0015] in, Represents the visual features of the image, W and H represent the width and height of the image, d represents the hidden layer dimension of ResNet, and s represents the downsampling multiple of ResNet.

[0016] The method of obtaining feature representations of all targets based on image features and target area annotations includes the following steps:

[0017] According to the target area annotation, the target position is represented as the coordinates of the rectangular box (x i ,y i , w i ,h i ), where i represents the index of the target, x i and i Indicates the coordinates of the upper left corner of the rectangular box, w i and h i Indicates the width and height of the rectangular box;

[0018] Use the ROIAlign algorithm to map the target area annotation to the space of image features to obtain the visual feature map of the target, which is expressed as:

[0019]

[0020] in, represents the visual feature map of the i-th target, d represents the hidden layer dimension of ResNet, and s oIndicates the output size of ROIAlign;

[0021] Adaptively pool the visual feature map of the i-th target to obtain the feature representation of the i-th target, which is expressed as:

[0022]

[0023] in, Represents the feature representation of the i-th target;

[0024] Visual features are extracted for each target to obtain feature representations of all targets:

[0025]

[0026] in, represents the feature representation of all targets, and n represents the number of targets.

[0027] The calculation of the statistical prior bias of each pair of targets comprises the following steps:

[0028] Step 401: There are L types of relationships in the data set. The type of the i-th target is a and the type of the j-th target is b. Create a relationship frequency statistics vector f with a length of L between the i-th target and the j-th target. ij , for f ij Assign a value to f ij The value of the kth element is the number of occurrences of triples in the training set, with subject type a, object type b, and relation type being the kth relation;

[0029] Step 402: Calculate the frequency statistics vector f of the relationship between the i-th target and the j-th target ij Normalized, the expression is:

[0030]

[0031]

[0032] in, Yes and f ij The normalized vector, is the statistical prior bias between the ith and jth targets, express The kth element of ijk represents f ij The kth element of , L represents the number of relationship categories in the dataset.

[0033] The step of inputting the feature representation of each pair of targets and the statistical prior bias of each pair of targets into the relationship prediction layer to perform relationship prediction includes the following steps:

[0034] The expression of relationship prediction is:

[0035]

[0036] Among them, p ij represents the predicted relationship probability vector between the i-th target and the j-th target, softmax is the activation function, [·,·] represents the vector concatenation operation, W o1 , W o2 and b o is a learnable parameter, is the feature representation of the i-th target, is the feature representation of the jth target, is the statistical prior bias between the i-th target and the j-th target.

[0037] The calculation of the relationship prediction loss function, optimizing the visual relationship extraction model with the relationship prediction loss function, and performing visual relationship extraction using the visual relationship extraction model include the following steps:

[0038] Step 601, calculate the relationship prediction loss function, the expression is:

[0039]

[0040] Among them, Loss represents the relationship prediction loss function, n represents the number of targets, L represents the number of relationship categories in the dataset, and p ijk Represents the relationship probability vector p between the predicted i-th target and the j-th target ij The kth element of ijk is a relation annotation. When the i-th target and the j-th target have the k-th relationship, q ijk =1, otherwise q ijk =0;

[0041] Step 602, using the relationship prediction loss function Loss to optimize the visual relationship extraction model, and using the visual relationship extraction model to perform visual relationship extraction.

[0042] Compared with the existing methods, the advantages of the method of the present invention are: this technology provides a target visual relationship extraction method based on statistical prior bias, which focuses on the statistical prior knowledge of target types and relationship types, and innovatively uses statistical prior knowledge to provide a prior bias for the visual relationship extraction model by calculating the statistical correlation between target types and relationship types, thereby improving the accuracy of visual relationship extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of a flow chart of an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all 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.

[0045] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0046] In this example, we assume that we want to build an intelligent security system. The system aims to automatically detect and identify the relationship between objects by analyzing the real-time video stream captured by the surveillance camera, thereby providing a more intelligent and efficient security monitoring function. The system can identify the relationship between people and objects in the image, such as "carrying", "placing", "pushing", etc. through visual relationship extraction technology. When the system detects abnormal behavioral relationships, such as "carrying large objects into prohibited areas" or "placing objects in dangerous locations", it can automatically trigger an alarm and notify security personnel. For the task of visual relationship extraction, a target visual relationship extraction method based on statistical prior bias is used.

[0047] Therefore, if Figure 1 As shown, a method for extracting target visual relations based on statistical prior bias comprises:

[0048] Step 1: Build a visual relationship extraction model, including a pre-trained visual model and a relationship prediction layer;

[0049] Step 2: Use the pre-trained visual model to extract image features;

[0050] Step 3, obtain the feature representation of all targets based on the image features and target area annotations;

[0051] Step 4, calculate the statistical prior bias of each pair of targets;

[0052] Step 5: Input the feature representation of each pair of targets and the statistical prior bias of each pair of targets into the relationship prediction layer to perform relationship prediction;

[0053] Step 6: Calculate the relationship prediction loss function, use the relationship prediction loss function to optimize the visual relationship extraction model, and use the visual relationship extraction model to perform visual relationship extraction.

[0054] The method of extracting image features using a pre-trained visual model includes the following steps:

[0055] The input image is represented as Use the pre-trained visual model to extract the visual features of the input image. The expression is:

[0056] F img =ResNet(x)

[0057] in, Represents the visual features of the image, W and H represent the width and height of the image, d represents the hidden layer dimension of ResNet, and s represents the downsampling multiple of ResNet.

[0058] ResNet is a deep convolutional neural network structure proposed by Kaiming He et al. of Microsoft Research. Its main innovation is the introduction of residual connections or skip connections to solve the gradient vanishing and gradient exploding problems in deep network training.

[0059] The introduction of ResNet is of great significance in deep learning. Through the design of residual connections, it allows the construction of very deep networks, which has achieved significant performance improvements in large-scale image classification and other computer vision tasks. The flexibility and powerful feature representation capabilities of ResNet make it an important basic model in many fields.

[0060] By pre-training on large-scale image datasets (such as ImageNet), ResNet can learn a set of common image feature representations. These features can capture low-level visual features (such as edges, textures) and high-level semantic features (such as object shapes, parts, etc.) in images. This pre-training can give the network a good initial feature extraction capability, providing a stronger foundation for subsequent tasks.

[0061] The method of obtaining feature representations of all targets based on image features and target area annotations includes the following steps:

[0062] According to the target area annotation, the target position is represented as the coordinates of the rectangular box (x i ,y i ,w i ,h i ), where i represents the index of the target, x i and i Indicates the coordinates of the upper left corner of the rectangular box, w i and h i Indicates the width and height of the rectangular box;

[0063] Use the ROIAlign algorithm to map the target area annotation to the space of image features to obtain the visual feature map of the target, which is expressed as:

[0064]

[0065] in, represents the visual feature map of the i-th target, d represents the hidden layer dimension of ResNet, and s o Indicates the output size of ROIAlign;

[0066] RoIAlign is a feature alignment method used in target detection and object recognition tasks. It solves the problem of information loss and accuracy degradation that may occur when using RoIPooling.

[0067] In the object detection task, a common method is to extract the region of interest and project it onto the feature map, and then map each RoI to a fixed-size feature map region through the RoIPooling operation. However, the RoIPooling operation is based on rounding operations, which may cause fine feature position offsets, thereby reducing positioning accuracy.

[0068] RoIAlign solves this problem by using bilinear interpolation to extract the features of the RoI region from the feature map in a more accurate way.

[0069] Adaptively pool the visual feature map of the i-th target to obtain the feature representation of the i-th target, which is expressed as:

[0070]

[0071] in, Represents the feature representation of the i-th target;

[0072] Visual features are extracted for each target to obtain feature representations of all targets:

[0073]

[0074] in, represents the feature representation of all targets, and n represents the number of targets.

[0075] The calculation of the statistical prior bias of each pair of targets comprises the following steps:

[0076] Step 401: There are L types of relationships in the data set. The type of the i-th target is a and the type of the j-th target is b. Create a relationship frequency statistics vector f with a length of L between the i-th target and the j-th target. ij , for f ij Assign a value to f ij The value of the kth element is the number of occurrences of triples in the training set, with subject type a, object type b, and relation type being the kth relation;

[0077] Step 402: Calculate the frequency statistics vector f of the relationship between the i-th target and the j-th targetij Normalized, the expression is:

[0078]

[0079]

[0080] in, Yes and f ij The normalized vector, is the statistical prior bias between the ith and jth targets, express The kth element of ijk represents f ij The kth element of , L represents the number of relationship categories in the dataset.

[0081] The step of inputting the feature representation of each pair of targets and the statistical prior bias of each pair of targets into the relationship prediction layer to perform relationship prediction includes the following steps:

[0082] The expression of relationship prediction is:

[0083]

[0084] Among them, p ij represents the predicted relationship probability vector between the i-th target and the j-th target, softmax is the activation function, [·,·] represents the vector concatenation operation, W o1 , W o2 and b o is a learnable parameter, is the feature representation of the i-th target, is the feature representation of the jth target, is the statistical prior bias between the i-th target and the j-th target.

[0085] The calculation of the relationship prediction loss function, optimizing the visual relationship extraction model with the relationship prediction loss function, and performing visual relationship extraction using the visual relationship extraction model include the following steps:

[0086] Step 601, calculate the relationship prediction loss function, the expression is:

[0087]

[0088] Among them, Loss represents the relationship prediction loss function, n represents the number of targets, L represents the number of relationship categories in the dataset, and p ijk Represents the relationship probability vector p between the predicted i-th target and the j-th target ij The kth element of ijkis a relation annotation. When the i-th target and the j-th target have the k-th relationship, q ijk =1, otherwise q ijk =0;

[0089] Step 602, using the relationship prediction loss function Loss to optimize the visual relationship extraction model, and using the visual relationship extraction model to perform visual relationship extraction.

[0090] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

Claims

1. A method for extracting target visual relations based on statistical prior bias, characterized in that: The method comprises: Step 1: Build a visual relationship extraction model, including a pre-trained visual model and a relationship prediction layer; Step 2: Use the pre-trained visual model to extract image features; Step 3, obtain the feature representation of all targets based on the image features and target area annotations; Step 4, calculate the statistical prior bias of each pair of targets; Step 5: Input the feature representation of each pair of targets and the statistical prior bias of each pair of targets into the relationship prediction layer to perform relationship prediction; Step 6: Calculate the relationship prediction loss function, use the relationship prediction loss function to optimize the visual relationship extraction model, and use the visual relationship extraction model to perform visual relationship extraction.

2. The method for extracting target visual relations based on statistical prior bias according to claim 1, characterized in that: The method of extracting image features using a pre-trained visual model includes the following steps: The input image is represented as Use the pre-trained visual model to extract the visual features of the input image. The expression is: F img =ResNet(x) in, Represents the visual features of the image, W and H represent the width and height of the image, d represents the hidden layer dimension of ResNet, and s represents the downsampling multiple of ResNet.

3. The method for extracting target visual relations based on statistical prior bias according to claim 2, characterized in that: The method of obtaining feature representations of all targets based on image features and target area annotations includes the following steps: According to the target area annotation, the target position is represented as the coordinates of the rectangular box (x i ,y i ,w i ,h i ), where i represents the index of the target, x i and i Indicates the coordinates of the upper left corner of the rectangular box, w i and h i Indicates the width and height of the rectangular box; Use the ROIAlign algorithm to map the target area annotation to the space of image features to obtain the visual feature map of the target, which is expressed as: in, represents the visual feature map of the i-th target, d represents the hidden layer dimension of ResNet, and s o Indicates the output size of ROIAlign; Adaptively pool the visual feature map of the i-th target to obtain the feature representation of the i-th target, which is expressed as: in, Represents the feature representation of the i-th target; Visual features are extracted for each target to obtain feature representations of all targets: in, represents the feature representation of all targets, and n represents the number of targets.

4. The method for extracting target visual relations based on statistical prior bias according to claim 3, characterized in that: The calculation of the statistical prior bias of each pair of targets comprises the following steps: Step 401: There are L types of relationships in the data set. The type of the i-th target is a and the type of the j-th target is b. Create a relationship frequency statistics vector f with a length of L between the i-th target and the j-th target. ij , for f ij Assign a value to f ij The value of the kth element is the number of occurrences of triples in the training set, with subject type a, object type b, and relation type being the kth relation; Step 402: Calculate the frequency statistics vector f of the relationship between the i-th target and the j-th target ij Normalized, the expression is: in, Yes and f ij The normalized vector, is the statistical prior bias between the ith and jth targets, express The kth element of ijk represents f ij The kth element of , L represents the number of relationship categories in the dataset.

5. The method for extracting target visual relations based on statistical prior bias according to claim 4, characterized in that: The step of inputting the feature representation of each pair of targets and the statistical prior bias of each pair of targets into the relationship prediction layer to perform relationship prediction includes the following steps: The expression of relationship prediction is: Among them, p ij represents the predicted relationship probability vector between the i-th target and the j-th target, softmax is the activation function, [·,·] represents the vector concatenation operation, W o1 , W o2 and b o is a learnable parameter, is the feature representation of the j-th target.

6. The method for extracting target visual relations based on statistical prior bias according to claim 5, characterized in that: The calculation of the relationship prediction loss function, optimizing the visual relationship extraction model with the relationship prediction loss function, and performing visual relationship extraction using the visual relationship extraction model include the following steps: Step 601, calculate the relationship prediction loss function, the expression is: Among them, Loss represents the relationship prediction loss function, p ijk Represents the relationship probability vector p between the predicted i-th target and the j-th target ij The kth element of ijk is a relation annotation. When the i-th target and the j-th target have the k-th relationship, q ijk =1, otherwise q ijk =0; Step 602, using the relationship prediction loss function Loss to optimize the visual relationship extraction model, and using the visual relationship extraction model to perform visual relationship extraction.