Image key point matching method based on graph neural network
Through hierarchical attention map neural network and graph data enhancement method, the problem of dependence on initial visual features and noise interference in image key point matching is solved, and higher matching accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202210604896.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2042-05-30
AI Technical Summary
The existing technology is difficult to resist outliers and noise interference in the image key point matching, and relies too much on the initial visual features, resulting in insufficient robustness of the matching model.
The hierarchical attention graph neural network is combined with the graph data enhancement method to learn more general hierarchical structure features by generating interactive training between the enhanced view and the original view, and uses the Hungarian algorithm to discretize the matching results.
It improves the accuracy and prediction efficiency of image key point matching, enhances the robustness of the model, and can more effectively resist outliers and noise interference in the image.
Smart Images

Figure CN114882338B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and further relates to a method for matching image key points based on graph neural network in the field of computer vision technology. The present invention can be applied to the matching between all visual key points in two or more images. Background Art
[0002] Image visual target key point matching aims to establish the correspondence between key points of two or more images. Generally speaking, this problem first requires extracting the visual features of the image key points, then using the visual features to calculate the affinity scores between the key points, and calculate the optimal matching results. Traditional methods for extracting image target key point features generally use SIFT, SURF, etc., while methods for constructing target structures can be achieved through Delaunay triangulation decomposition, full connection, etc. However, the graph matching problem involved in this process is generally an NP-hard problem and is difficult to solve. At the same time, the semantic information between image key points is independent of each other, and the matching results can only be based on local visual features, resulting in the image key point matching model being not robust enough.
[0003] In their paper "Neural Graph Matching Network: Learning Lawler's Quadratic Assignment Problem with Extension to Hypergraph and Multiple-graph Matching" (IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.), M. Zhang et al. proposed a deep graph matching method based on association graph node classification to solve the problem of image key point matching. The specific steps of this method are: first, construct graph structure data and extract key point visual features; second, use the similarity scores of nodes and edges to construct an affinity matrix, and convert it into a feature matrix of the matching association graph; third, use a graph neural network to classify the nodes of the association graph to obtain matching results, and use the back-propagation algorithm to train the network, directly establishing message transmission between the key points of the two graphs. Although the matching method of association graph classification improves the accuracy of the model, the method still has the disadvantage that the complexity of the association graph grows quadratically with the number of key points, and the algorithm complexity is relatively high. At the same time, due to the lack of an explicit intra-graph message propagation mechanism, the model is too dependent on the initial visual features of the key points.
[0004] The Institute of Automation of the Chinese Academy of Sciences proposed a method for matching image key points in its patent application "Image key point matching method based on deep graph embedding network and structural self-learning" (application number: 202110202841.0, application publication number: CN 112801206 A). The method is implemented by the following steps: step 1, structurally processing the key points of the acquired image pair to be matched respectively by Delaunay triangulation decomposition or K nearest neighbor method to obtain the adjacency matrix of the key points of the two images; step 2, inputting the image pair to be matched and its key points and adjacency matrix into a trained image key point matching network, extracting the key point feature map by the feature extraction network in the image key point matching network, and obtaining the key point feature matrix by bilinear interpolation method; step 3, updating the key point feature matrix and the graph structure by the deep map embedding network in the image key point matching network; step 4, calculating the similarity matrix by the deep map matching network in the image key point matching network, and obtaining the matching matrix by the Sinkhorn algorithm; step 5, updating the key point feature matrix based on the matching matrix; step 6, repeatedly executing step 3 to step 4 until the set number of repeated executions is reached, and obtaining the final matching matrix of the image pair to be matched; step 7, discretizing the final matching matrix by the Hungarian algorithm, and obtaining the key point matching result of the image pair to be matched. The shortcoming of this method is that the graph data structure constructed by Delaunay triangulation or K-nearest neighbor method for image key points is relatively fixed, which requires the use of a large number of training data models to learn universal structural features, and it is difficult to train a strong and robust matching model to resist the interference of outliers and noise in the image. Summary of the invention
[0005] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and propose an image key point matching method based on graph neural network, which is used to solve the problems that the existing matching methods are difficult to resist the interference of outliers and noise in the image and are too dependent on the initial visual features of the image key points.
[0006] The idea of achieving the purpose of the present invention is that the present invention transforms the image key point matching problem into a graph matching problem through an image key point structured method, uses a hierarchical attention graph neural network to measure the affinity scores between image key points, and uses hierarchical attention scores to adaptively fuse messages from different neighborhood ranges, so that the matching model can learn more general hierarchical features to improve the recognition of nodes, solving the problem that the image key point matching model is too dependent on the initial visual features of the image key points. The present invention uses a graph data enhancement method to train a strong and robust matching model, randomly masks the node features of the matching graph to generate an enhanced view, and uses the interactive matching between the enhanced view and the original view to train the model, solving the problem that the matching model is difficult to resist outliers and noise in the graph.
[0007] The specific steps for achieving the purpose of the present invention are as follows:
[0008] Step 1: Build a hierarchical attention graph neural network:
[0009] Step 1.1, build a thirteen-layer hierarchical attention graph neural network, whose structure is as follows: the first graph convolutional network layer, the first activation function layer, the first attention layer, the second graph convolutional network layer, the second activation function layer, the second attention layer, the third graph convolutional network layer, the third activation function layer, the third attention layer, the fourth graph convolutional network layer, the fourth activation function layer, the fourth attention layer, the first feature fusion layer;
[0010] Step 1.2, set the dimensions of the first to fourth graph convolutional network layers of the hierarchical attention graph neural network to 1024, 512, 256, and 128 respectively, set the first to fourth activation function layers to the LeakyReLU function, and set the dimensions of the first to fourth attention layers to 128;
[0011] Step 2: Generate training set:
[0012] Step 2.1, select at least 500 pairs of images, each pair of images has the same type and equal number of key points;
[0013] Step 2.2, model each image as a corresponding graph data, where the total number of nodes in each graph data is equal to the number of key points in the corresponding image; use the Delaunay triangulation algorithm to generate an adjacency matrix of the graph data corresponding to the image based on the relative positions between the key points of each image;
[0014] Step 2.3, input each image into the VGG-16 network that has been trained in the prior art, the second sublayer in the fourth layer and the first sublayer in the fifth layer of the VGG-16 network output the shallow feature map and the deep feature map of each image respectively, perform bilinear interpolation on all key points of each image in the shallow feature map to obtain a shallow visual feature matrix, use the same method to obtain a deep visual feature matrix, and combine the shallow visual feature matrix and the deep visual feature matrix to form a node feature matrix of the graph data corresponding to the image;
[0015] Step 2.4, the node feature matrix and adjacency matrix of all graph data are combined into an original view, the node features of each graph data are randomly deleted to generate a perturbed node feature matrix, and the perturbed node feature matrix and adjacency matrix of all graph data are combined into an enhanced view;
[0016] Step 2.5, the key point matching labels between the original view, enhanced view and all image pairs are combined into a training set;
[0017] Step 3, train the hierarchical attention graph neural network:
[0018] The training set is input into the hierarchical attention graph neural network, and forward propagation is performed to obtain the loss value of the network. The back propagation algorithm is used to iteratively update the parameters of the network until the loss value of the hierarchical attention graph neural network converges, and a trained hierarchical attention graph neural network is obtained.
[0019] Step 4: Match the key points of the image to be predicted:
[0020] Step 4.1, using the same operation as steps 2 and 3, extracting and structuring the key points of the image to be matched, and then inputting them into the trained hierarchical attention graph neural network to obtain the soft matching matrix between the images to be matched;
[0021] Step 4.2: Use the Hungarian algorithm to discretize the soft matching matrix and obtain the key point matching results of the image pair to be matched.
[0022] Compared with the prior art, the present invention has the following advantages:
[0023] First, since the present invention uses a hierarchical attention graph neural network to measure the affinity scores between image key points, it is used to improve the recognition of node features and reduce the complexity of calculation, thereby overcoming the deficiency of existing matching methods that are overly dependent on the initial visual features of image key points, thereby improving the accuracy and prediction efficiency of image key point matching.
[0024] Second, since the present invention designs an enhanced view generation method based on graph data enhancement, trains the hierarchical attention graph neural network, and uses enhanced views to introduce random noise for node features for model training, the model can learn the constraint relationship between key points in the graph, overcoming the defect that the existing matching methods are difficult to resist outliers and noise interference in the graph, so that the present invention can obtain strong and robust image key point matching results. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0026] Combine the following Figure 1 The specific steps for implementing the present invention are further described in detail with reference to the accompanying drawings and embodiments.
[0027] Step 1: Build a hierarchical attention-based deep matching network.
[0028] Step 1.1, build a thirteen-layer hierarchical attention graph neural network, whose structure is: first graph convolution layer, first activation function layer, first attention layer, second graph convolution layer, second activation function layer,
[0029] Second attention layer, third graph convolution layer, third activation function layer, third attention layer, fourth graph convolution layer, fourth activation function layer, fourth attention layer.
[0030] Step 1.2, set the dimensions of the first to fourth graph convolutional network layers of the hierarchical attention graph neural network to 1024, 512, 256, 128 respectively, the first to fourth activation function layers are set to the LeakyReLU function, and the dimensions of the first to fourth attention layers are set to 128, 128, 128, 128 respectively.
[0031] Step 2: Generate a training set.
[0032] Step 2.1, select the first 70% of images from the Willow ObjectClass dataset and the Pascal VOC Keypoint dataset respectively, and select a sample with the same type and equal number of key points for each sample, so as to generate at least 500 pairs of images.
[0033] Step 2.2: Model each image as a corresponding graph data. The total number of nodes in each graph data is equal to the number of key points in the corresponding image. Use the Delaunay triangulation algorithm to generate an adjacency matrix of the graph data corresponding to the image based on the relative positions between the key points of each image.
[0034] In step 2.3, each image is input into the trained VGG-16 network in the prior art. The second sublayer in the fourth layer and the first sublayer in the fifth layer of the VGG-16 network output the shallow feature map and the deep feature map of each image respectively. Bilinear interpolation is performed on all key points of each image in the shallow feature map to obtain a shallow visual feature matrix. The deep visual feature matrix is obtained by the same method. The shallow visual feature matrix and the deep visual feature matrix are combined to form a node feature matrix of the graph data corresponding to the image.
[0035] In step 2.4, the node feature matrices and adjacency matrices of all graph data are combined into an original view, the node features of each graph data are randomly deleted with a probability of 40% and filled with 0 values to generate a perturbed node feature matrix, and the perturbed node feature matrices and adjacency matrices of all graph data are combined into an enhanced view.
[0036] In step 2.5, the key point matching labels between the original view, enhanced view and all image pairs are combined into an image key point matching training set.
[0037] Step 3: Train the hierarchical attention graph neural network.
[0038] The training set is input into the hierarchical attention graph neural network, and the forward propagation is performed to obtain the loss value. The back propagation algorithm is used to iteratively update the parameters of the network until the loss value of the hierarchical attention graph neural network converges to obtain a trained hierarchical attention graph neural network.
[0039] The forward propagation calculation steps of the hierarchical attention graph neural network are as follows:
[0040] Step 3.1, calculate the node features of each graph data in the training set at each layer of the network according to the following formula:
[0041]
[0042] in, Represents the node features of the i-th node in the k-th graph data output by the l-th graph convolution layer of the hierarchical attention graph neural network, MLP l represents the activation function of the lth activation function layer of the hierarchical attention graph neural network, εl represents the learnable vector of the lth graph convolution layer of the hierarchical attention graph neural network, ∑ represents the summation operation, N(ki) represents the set of nodes directly adjacent to the ith node in the kth graph data, and the direct adjacent means that there is an edge between two nodes.
[0043] Step 3.2, calculate the attention score of each graph data node in the training set at each layer of the network according to the following formula:
[0044]
[0045] in, represents the attention score of the i-th node in the k-th graph data output by the l-th attention layer in the hierarchical attention graph neural network, exp(·) represents the exponential operation with the natural constant e as the base, s l represents the learnable projection vector of the lth attention layer of the hierarchical attention graph neural network, and L represents the total number of layers of the graph neural network.
[0046] Step 3.3, calculate the node embedding feature matrix of each graph data in the training set according to the following formula:
[0047]
[0048] Among them, z ki Represents the node embedding feature of the i-th node in the k-th graph data.
[0049] Step 3.4, use the following formula to calculate the affinity matrix between each graph data pair in the training set.
[0050]
[0051] Among them, M represents the affinity matrix between graph data pairs in the training set, and Z and They represent the node embedding feature matrices in the original view and enhanced view in the training set, respectively. The superscript T represents the transposition operation;
[0052] Step 3.5, all affinity matrices M are normalized row by row using softmax, and the soft matching matrix S corresponding to the affinity matrix M is calculated using the Sinkhorn algorithm;
[0053] Step 3.6, calculate the loss function of the layered attention graph neural network according to the following formula:
[0054] l(S)=-∑Y ed logS uv +(1-Y ed )log(1-S uv )
[0055] Among them, l(S) represents the loss function, S uv represents the element in the uth row and vth column of the soft matching matrix, Y ed Indicates the element in the eth row and dth column of the key point matching label matrix. The values of u and e are equal, and the values of v and d are equal.
[0056] Step 4: Match the key points of the image to be predicted.
[0057] Step 4.1, using the same operation as steps 2 and 3, extracts and structures the key points of the image to be matched, and then inputs them into the trained hierarchical attention graph neural network to obtain the soft matching matrix between the images to be matched.
[0058] Step 4.2: discretize the soft matching matrix through the Hungarian algorithm to obtain the matching results of the image pair to be matched.
[0059] The effect of the present invention is further described below in conjunction with simulation experiments.
[0060] 1. Simulation experiment conditions:
[0061] The hardware platform of the simulation experiment of the present invention is: the processor is Intel (R) Xeon (R) CPU E5-2650v4, the main frequency is 2.20GHz, and the memory is 256GB.
[0062] The software platform for the simulation experiment of the present invention is: Ubuntu 18.04 operating system and python 3.6.
[0063] The compound sample data sets used in the simulation experiment of the present invention are Willow ObjectClass data set and Pascal VOC Keypoint data set.
[0064] The Willow ObjectClass dataset is a real image matching dataset with 5 categories: faces, ducks, bottles, cars, and motorcycles, each of which contains at least 40 images. All instances from the same category are aligned in their poses, and all instances have 10 visible key points. The dataset was generated by M. Cho et al. in "Learning Graphs to Match, 2013 IEEE International Conference on Computer Vision, 2013, pp. 25-32".
[0065] The Pascal VOC Keypoint dataset is a large-scale real image matching dataset containing 20 categories of instances with real keypoint locations. We filter the original dataset into 7020 training images and 1682 test images for experiments. The dataset was generated by L. Bourdev et al. in "Poselets: Body part detectors trained using 3D humanpose annotations, IEEE 12th International Conference on Computer Vision, 2009, pp. 1365-1372".
[0066] 2. Simulation content and results analysis:
[0067] The simulation experiment of the present invention adopts the present invention and four existing image key point matching methods (GMN, PCA-GM, NGM, NHGM) to perform key point matching on input image samples respectively to obtain matching results.
[0068] The prior art GMN graph matching method refers to the graph matching network proposed by A. Zanfir et al. in "Deep Learning of Graph Matching, 2018 IEEE / CVF Conference on Computer Vision and Pattern Recognition, 2018, pp. 2684-2693", referred to as GMN.
[0069] The prior art PCA-GM graph matching method refers to the cross-graph affinity matching method based on graph neural network proposed by R. Wang et al. in "Learning combinatorial embedding networks for deep graph matching, in Proceedings of the IEEE / CVF International Conference on Computer Vision, 2019, pp. 3056–3065", referred to as PCA-GM.
[0070] The prior art NGM graph matching method refers to a graph matching method based on association graph proposed by M. Zhang et al. in "Neural Graph Matching Network: Learning Lawler's Quadratic Assignment Problem with Extension to Hypergraph and Multiple-graph Matching, in IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.", referred to as NGM.
[0071] The prior art NHGM graph matching method refers to a hypergraph-based graph matching method proposed by M. Zhang et al. in "Neural Graph Matching Network: Learning Lawler's Quadratic Assignment Problem with Extension to Hypergraph and Multiple-graph Matching, in IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.", referred to as NHGM.
[0072] The matching results of the five methods were evaluated using the evaluation indicator matching accuracy, and the experimental results on the WillowObjectClass dataset and the Pascal VOC Keypoint dataset were plotted in Tables 1 and 2, respectively.
[0073] Table 1 Summary of key point matching accuracy on the Willow ObjectClass dataset
[0074] Object category car duck face motorbike winebottle mean GMN 67.8 76.7 99.8 69.2 83.1 79.3 PCA-GM 87.6 81.4 100.0 76.5 86.9 85.6 NGM 84.2 77.6 99.4 76.8 88.3 85.3 Ours 91.1 89.2 100.0 92.1 93.3 93.1
[0075] Table 2. Key point matching accuracy on the Pascal VOC Keypoint dataset
[0076] Object category aero bike bird boat bottle bus car cat chair cow GMN 31.9 47.2 51.9 40.8 68.7 72.2 53.6 52.8 34.6 48.6 PCA-GM 51.2 61.3 61.6 58.4 78.8 73.9 68.5 71.1 40.1 63.3 NGM 50.1 63.5 57.9 53.4 79.8 77.1 73.6 68.2 41.1 66.4 Ours 53.3 69.7 63.5 52.0 81.2 75.7 67.4 72.8 44.5 68.5 Object category table dog horse mbike person plant sheep sofa train tv GMN 72.3 47.7 54.8 51.0 38.6 75.1 49.5 49.5 83.0 86.3 PCA-GM 45.1 64.4 66.4 62.2 45.1 79.1 68.4 60.0 80.3 91.9 NGM 40.8 60.3 61.9 63.5 45.6 77.1 69.3 65.5 79.2 88.2 Ours 62.6 69.7 68.2 67.0 45.3 88.7 72.1 53.0 80.2 92.2
[0077] Ours in Table 1 and Table 2 represents the simulation experiment results of the present invention.
[0078] It can be seen from Table 1 that the matching accuracy of the present invention on the five categories in the Willow ObjectClass dataset exceeds that of the prior art, proving that the present invention can achieve a higher accuracy in a small number of image key point matching tasks.
[0079] It can be seen from Table 2 that the matching accuracy of the present invention in most categories in the Pascal VOC Keypoint dataset exceeds that of the prior art, proving that the present invention can still maintain a high accuracy in complex image key point matching tasks.
Claims
1. A method for matching image key points based on graph neural network, characterized in that: The image key points are constructed as graph structure data, the node features are randomly masked to generate enhanced views, and the graph data is embedded using a hierarchical attention graph neural network. The specific steps of the matching method include the following: Step 1: Build a hierarchical attention graph neural network: Step 1.1, build a thirteen-layer hierarchical attention graph neural network, whose structure is as follows: the first graph convolutional network layer, the first activation function layer, the first attention layer, the second graph convolutional network layer, the second activation function layer, the second attention layer, the third graph convolutional network layer, the third activation function layer, the third attention layer, the fourth graph convolutional network layer, the fourth activation function layer, the fourth attention layer, the first feature fusion layer; Step 1.2, set the dimensions of the first to fourth graph convolutional network layers of the hierarchical attention graph neural network to 1024, 512, 256, and 128 respectively, set the first to fourth activation function layers to the LeakyReLU function, and set the dimensions of the first to fourth attention layers to 128; Step 2: Generate training set: Step 2.1, select at least 500 pairs of images, each pair of images has the same type and equal number of key points; Step 2.2, model each image as a corresponding graph data, where the total number of nodes in each graph data is equal to the number of key points in the corresponding image; use the Delaunay triangulation algorithm to generate an adjacency matrix of the graph data corresponding to the image based on the relative positions between the key points of each image; Step 2.3, input each image into the VGG-16 network that has been trained in the prior art, the second sublayer in the fourth layer and the first sublayer in the fifth layer of the VGG-16 network output the shallow feature map and the deep feature map of each image respectively, perform bilinear interpolation on all key points of each image in the shallow feature map to obtain a shallow visual feature matrix, use the same method to obtain a deep visual feature matrix, and combine the shallow visual feature matrix and the deep visual feature matrix to form a node feature matrix of the graph data corresponding to the image; Step 2.4, the node feature matrix and adjacency matrix of all graph data are combined into an original view, the node features of each graph data are randomly deleted to generate a perturbed node feature matrix, and the perturbed node feature matrix and adjacency matrix of all graph data are combined into an enhanced view; Step 2.5, the key point matching labels between the original view, enhanced view and all image pairs are combined into a training set; Step 3, train the hierarchical attention graph neural network: The training set is input into the hierarchical attention graph neural network, and forward propagation is performed to obtain the loss value of the network. The back propagation algorithm is used to iteratively update the parameters of the network until the loss value of the hierarchical attention graph neural network converges, and a trained hierarchical attention graph neural network is obtained. Step 4: Match the key points of the image to be predicted: Step 4.1, using the same operation as steps 2 and 3, extracting and structuring the key points of the image to be matched, and then inputting them into the trained hierarchical attention graph neural network to obtain the soft matching matrix between the images to be matched; Step 4.2: Use the Hungarian algorithm to discretize the soft matching matrix and obtain the key point matching results of the image pair to be matched.
2. The image key point matching method based on graph neural network according to claim 1 is characterized in that: The steps for forward propagation to obtain the network loss value described in step 3 are as follows: The first step is to calculate the node features of each graph data in the training set at each layer of the network according to the following formula: in, Represents the node features of the i-th node in the k-th graph data output by the l-th graph convolution layer of the hierarchical attention graph neural network, MLP l represents the activation function of the lth activation function layer of the hierarchical attention graph neural network, ε l represents the learnable vector of the lth graph convolutional layer of the hierarchical attention graph neural network, ∑ represents the summation operation, N(ki) represents the set of nodes directly adjacent to the ith node in the kth graph data, and the directly adjacent means that there is an edge between the two nodes; The second step is to calculate the attention score of each graph data node in the training set at each layer of the network according to the following formula: in, represents the attention score of the i-th node in the k-th graph data output by the l-th attention layer in the hierarchical attention graph neural network, exp(·) represents the exponential operation with the natural constant e as the base, s l represents the learnable projection vector of the lth attention layer of the hierarchical attention graph neural network, and L represents the total number of layers of the graph neural network; The third step is to calculate the node embedding feature matrix of each graph data in the training set according to the following formula: Among them, z ki Represents the node embedding feature of the i-th node in the k-th graph data; The fourth step is to calculate the affinity matrix between each graph data pair in the training set using the following formula; Among them, M represents the affinity matrix between graph data pairs in the training set, and Z and They represent the node embedding feature matrices in the original view and enhanced view in the training set, respectively. The superscript T represents the transposition operation; Step 5: Normalize all affinity matrices M by row using softmax, and calculate the soft matching matrix S corresponding to the affinity matrix M using the Sinkhorn algorithm. Step 6: Calculate the loss value of the layered attention graph neural network according to the following formula: l(S)=-∑Y ed logS uv +(1-Y ed )log(1-S uv ) Among them, l(S) represents the loss value, S uv represents the element in the uth row and vth column of the soft matching matrix, Y ed Represents the element in the e-th row and d-th column in the key point matching label matrix; where the values of u and e are equal, and the values of v and d are equal.
