Camera pose estimation method and system based on recursive gated convolution, and storage medium
Through a camera pose estimation method based on recursive gated convolution, combined with relative position encoding and self-attention mechanism, the feature matching problem of visual odometry in complex environments is solved, and the accuracy and stability of camera pose estimation are improved. .
Patent Information
- Application Number
- CN202411223080.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-10-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In visual odometry, under complex conditions such as significant changes in illumination, traditional key point matching methods have poor extraction results, resulting in drift errors in camera pose estimation, which affects applications in fields such as autonomous driving.
A camera pose estimation method based on recursive gated convolution is used to extract features of the image to be matched, obtain coarse-level and fine-level feature maps, and combine relative position encoding and self-attention mechanisms to perform feature matrix fusion and matching to improve matching. Accuracy.
It enhances the recognition ability of translation invariance, improves the accuracy of feature matching and camera pose estimation, reduces drift errors, and improves performance in complex environments.
Smart Images

Figure CN118762084A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of visual odometers, and in particular to a camera pose estimation method, system and storage medium based on recursive gated convolution. Background Art
[0002] Simultaneous localization and mapping refers to a method in which a mobile device equipped with specific sensors builds an environmental model and estimates its own movement while moving in an unknown environment. This method has been widely used in the fields of autonomous driving, drones, and unmanned ships. Compared with laser point cloud SLAM (Simultaneous Localization and Mapping), visual SLAM has become a hot topic of research today because of its rich information and high cost-effectiveness. As the front end of visual SLAM, the theoretical basis of visual odometry is incremental pose estimation based on inter-frame matching. It inevitably has defects such as drift errors. Therefore, exploring the optimization solution of visual odometry has become a hot topic of current research.
[0003] Visual odometry is an important research direction in the field of computer vision. It mainly estimates the motion trajectory of the camera in three-dimensional space by processing and analyzing image sequences and matching key points. Traditional key point matching methods such as ORB (Oriented FAST and Rotated BRIEF) and SIFT (Scale-invariant feature transform) are hot topics in computer vision research. These features have good versatility and robustness, but the extraction effect is relatively poor under complex conditions such as obvious changes in lighting. Summary of the invention
[0004] Based on this, it is necessary to propose a camera pose estimation method, system and storage medium based on recursive gated convolution to address the above problems.
[0005] A camera pose estimation method based on recursive gated convolution, the method comprising: Based on recursive gated convolution, feature extraction is performed on a group of images to be matched to obtain a group of coarse-level feature maps and fine-level feature maps.
[0006] According to the one-dimensional vector corresponding to the coarse-level feature map, a relative position code in the one-dimensional vector is determined.
[0007] A set of fused feature matrices is obtained according to the coarse-level feature map and the relative position encoding.
[0008] A primary matching is performed on the score matrices between a group of the fused feature matrices to determine a primary matching set.
[0009] The initial matching set is respectively mapped onto a set of the detailed feature maps, a set of local feature maps is extracted, and secondary matching is performed through the central vectors of the local feature maps to determine a secondary matching set.
[0010] A group of matching feature points is extracted from the secondary matching set, and camera pose estimation is performed based on the group of matching feature points.
[0011] The method of extracting features of a group of images to be matched based on recursive gated convolution to obtain a group of coarse-level feature maps and fine-level feature maps specifically includes: Initial convolution is performed on a group of images to be matched respectively to obtain a group of coarse-level feature maps of the images to be matched.
[0012] Two-dimensional convolution is performed on the coarse-level feature maps of a group of images to be matched, and high-resolution image features extracted from non-initial levels in the two-dimensional convolution layer are upsampled.
[0013] The high-resolution image features extracted at the current level in the two-dimensional convolutional layer are concatenated with the high-resolution image features after upsampling at the next level to obtain a set of high-resolution feature maps.
[0014] Based on recursive gated convolution, the number of channels of a group of high-resolution feature maps is adjusted respectively.
[0015] According to the depth convolution, a group of the high-resolution feature maps after the number of channels is adjusted are divided into a plurality of sub-regions.
[0016] Each of the sub-regions is element-by-element multiplied to obtain a set of fine-level feature maps of the image to be matched.
[0017] The step of obtaining a set of fusion feature matrices according to the coarse-level feature map and the relative position encoding specifically includes: The coarse-level feature maps are respectively encoded according to the relative position encoding to obtain a group of coarse-level feature maps with position information.
[0018] The query matrix of the coarse-level feature map with position information of the previous frame and the key matrix and value matrix of the coarse-level feature map with position information of the next frame are obtained according to preset matrix parameters, and the relative position encoding is added to the query matrix and the key matrix.
[0019] The self-attention of a group of the coarse-level feature maps is determined according to the query matrix and the key matrix after adding the relative position encoding, and the cross-attention between a group of the coarse-level feature maps is determined according to the self-attention until a preset number of attention calculations is reached to obtain a feature matrix.
[0020] The feature matrix is upsampled and fused with the original features of the coarse-level feature map to form a set of fused feature matrices.
[0021] The step of performing primary matching on the score matrices between a group of the fused feature matrices to determine a primary matching set specifically includes: A score matrix between a set of the fused feature matrices is determined.
[0022] A matching probability between a set of the coarse-level feature maps is determined according to the score matrix.
[0023] A primary match is performed according to the matching probability and a preset threshold to determine a primary matching set.
[0024] The performing of primary matching according to the matching probability and a preset threshold to determine the initial matching set specifically includes: according to ; Perform primary matching and determine the initial matching set, where: is the nearest neighbor algorithm, is the initial matching set, is the i-th point in the coarse feature map of the previous frame, is the jth point in the coarse-level feature map of the next frame, is the matching probability matrix, is the matching probability of the i-th point in the coarse feature map of the previous frame and the j-th point in the coarse feature map of the next frame, is the preset threshold.
[0025] The step of mapping the initial matching set to a set of the detailed feature maps, extracting a set of local feature maps, performing secondary matching through a central vector of the set of local feature maps, and determining a secondary matching set specifically includes: The positions of the initial matching sets are respectively located on a group of the detailed feature maps, and a local window of a preset size is determined at the position.
[0026] Based on the local window of the preset size, a set of transformed local feature maps is extracted.
[0027] A set of central vectors of the local feature maps are associated to construct a heat map.
[0028] A secondary matching is performed according to the expectation of the probability distribution corresponding to the heat map to determine a secondary matching set of a group of images to be matched.
[0029] The extracting a group of matching feature points from the secondary matching set and performing camera pose estimation according to the group of matching feature points specifically includes: A group of matching feature points in the secondary matching set is extracted, and a basic matrix and a homography matrix of the group of matching feature points are obtained.
[0030] An initial camera pose is determined according to the fundamental matrix and the homography matrix.
[0031] A reprojection error function is determined according to the initial camera pose, and a reprojection error minimized by the reprojection error function is selected as the optimal camera pose.
[0032] The step of determining a reprojection error function according to the initial camera pose and selecting a minimized reprojection error of the reprojection error function as the optimal camera pose specifically includes: according to Determine a reprojection error function, and select the reprojection error that minimizes the reprojection error of the reprojection error function as the optimal camera pose, where: is the reprojection error function, is the initial camera pose between the i-th frame and the i+1-th frame to be matched, is the matching feature point of the i+1th frame to be matched, is the matching feature point of the i-th frame to be matched, k is the total number of frames, argmin() is to minimize the reprojection error, is the squared L2 norm.
[0033] A camera pose estimation system based on recursive gated convolution, the system comprising: A coarse-level feature map and a fine-level feature map extraction module, used to extract features from a set of images to be matched based on recursive gated convolution, and obtain a set of coarse-level feature maps and a fine-level feature map; A relative position code determination module, used to determine the relative position code in the one-dimensional vector according to the one-dimensional vector corresponding to the coarse-level feature map; A fusion feature matrix determination module, used to obtain a set of fusion feature matrices according to the coarse-level feature map and the relative position encoding; An initial matching set determination module, used to perform primary matching on a score matrix between a group of fused feature matrices to determine an initial matching set; A secondary matching set determination module, used to map the primary matching set to a set of the detailed feature maps respectively, extract a set of local feature maps, perform secondary matching through a central vector of the set of local feature maps, and determine a secondary matching set; The camera pose estimation module is used to extract a group of matching feature points from the secondary matching set and perform camera pose estimation based on the group of matching feature points.
[0034] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to execute the steps of the method described above.
[0035] The embodiments of the present invention have the following beneficial effects: The present invention is based on recursive gated convolution, and performs feature extraction on a group of images to be matched respectively, and obtains a group of coarse-level feature maps and fine-level feature maps, and can efficiently realize information interaction of any order by means of gated convolution and recursive operation. Further, through the coarse-level feature map and relative position coding, a group of fused feature matrices are obtained, which combines the hierarchical information and spatial position information of the feature map, and provides a richer feature representation for subsequent matching, and the relative position coding that considers the relative position relationship between elements can enhance the recognition ability of translation invariance to process variable-length input sequences, thereby increasing the number of interactive calculations and improving the accuracy of feature matching. Further, the score matrix between a group of fused feature matrices is primary matched to determine the initial matching set. Through the primary matching, the most likely matching candidate area can be quickly located, and the initial matching set is respectively mapped to a group of fine-level feature maps to extract a group of local feature maps. Secondary matching is performed through the central vector of the local feature map to determine the secondary matching set, which can more accurately capture the local differences and similarities between images, further screen out the most accurate matching set, and improve the accuracy of the matching result. Finally, a set of matching feature points is extracted from the secondary matching set, and a more accurate camera pose estimation is performed based on these matching feature points. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] in: Figure 1 A schematic flow chart of an embodiment of a camera pose estimation method based on recursive gated convolution provided by the present invention; Figure 2 A schematic diagram of the structure of an embodiment of a feature graph pyramid network based on recursive gated convolution provided by the present invention; Figure 3 A schematic diagram of the structure of an embodiment of the recursive gated convolution provided by the present invention; Figure 4 A schematic diagram of the structure of an embodiment of a local feature Transformer encoder provided by the present invention; Figure 5A schematic flow chart of another embodiment of a camera pose estimation method based on recursive gated convolution provided by the present invention; Figure 6 A schematic flow chart of another embodiment of a camera pose estimation method based on recursive gated convolution provided by the present invention; Figure 7 A schematic flow chart of another embodiment of a camera pose estimation method based on recursive gated convolution provided by the present invention; Figure 8 A schematic structural diagram of an embodiment of a camera pose estimation system based on recursive gated convolution provided by the present invention; Fig. 9 A schematic structural diagram of an embodiment of a storage medium provided by the present invention. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] like Figure 1 As shown, Figure 1 A schematic diagram of a flow chart of an embodiment of a camera pose estimation method based on recursive gated convolution provided by the present invention. A camera pose estimation method based on recursive gated convolution, the method comprising: S101: Based on recursive gated convolution, feature extraction is performed on a group of images to be matched respectively to obtain a group of coarse-level feature maps and fine-level feature maps.
[0040] Exemplarily, a group of images to be matched include images to be matched in a previous frame and images to be matched in a subsequent frame. Initial convolution is performed on the group of images to be matched respectively to obtain a group of coarse-level feature maps of the images to be matched; two-dimensional convolution is performed on the group of images to be matched respectively, and high-resolution image features extracted from non-initial levels in the two-dimensional convolution layer are upsampled; high-resolution image features extracted from the current level in the two-dimensional convolution layer are spliced with high-resolution image features after upsampling in the next level to obtain a group of high-resolution feature maps; based on recursive gated convolution, the number of channels of the high-resolution feature map is adjusted; the high-resolution feature map after the number of channels is divided into a number of sub-regions according to depth convolution; element-by-element multiplication is performed between each sub-region to obtain a group of fine-level feature maps of the images to be matched.
[0041] Specifically, refer to Figure 2 , Figure 2The present invention provides a schematic diagram of the structure of an embodiment of a feature graph pyramid network based on recursive gated convolution. The present invention uses a feature graph pyramid network based on recursive gated convolution to extract features of a group of images to be matched, and obtains a group of coarse-level feature graphs and fine-level feature graphs. Specifically, the initial convolution is composed of a first convolution layer, a second convolution layer, a third convolution layer, and a fourth convolution layer, wherein Conv1 is the first convolution layer, Conv2_x is the second convolution layer, Conv3_x is the third convolution layer, Conv4_x is the fourth convolution layer, Conv2d 1×1, s1 is a two-dimensional convolution with a step size of s1 and a convolution kernel of 1×1, Conv2d 1×1, s2 is a two-dimensional convolution with a step size of s2 and a convolution kernel of 1×1, g n Conv2d3×3, s0 is a recursive gated convolution with a stride of s0 and a convolution kernel of 3×3, g n Conv2d 3×3, s1 is a recursive gated convolution with a stride of s1 and a convolution kernel of 3×3, g n Conv2d 3×3, s2 is a recursive gated convolution with a stride of s2 and a convolution kernel of 3×3. Figure 2 From the bottom layer to the upper layer on the left, the feature map size is halved after each initial convolution, and a total of 3 levels of coarse feature maps are generated. The convolution kernel in the middle is 1×1. The two-dimensional convolution performs a two-dimensional convolution on the features obtained by the initial convolution at the corresponding level, outputs high-resolution image features, and acts as a gradient buffer for the backbone network. After upsampling, the high-resolution image features are element-wise added to the high-resolution image features of the previous layer, and the process is repeated until a high-resolution feature map is generated.
[0042] Furthermore, the final fine-level feature map is generated through the rightmost recursive gated convolution, and the aliasing effect of upsampling is reduced. Figure 3 , Figure 3 Schematic diagram of the structure of an embodiment of the recursive gated convolution provided by the present invention, Mul is a multiplier, DWConv is a depthwise convolution, C is the number of channels, Proj is the item to be calculated, is the number of channels of the input item, C is single channel, C / 4 is quarter channel, C / 2 is half channel, and 2C is dual channel. After the image is input, it first enters the Mul and DWConv on the left, 2C-C / 4, and then from DWConv, 2C-C / 4 to 3 Muls respectively. The gated convolution first uses two convolution layers to adjust the number of feature channels, and then uses deep convolution to divide the output features into several sub-regions. Each sub-region is multiplied by the corresponding sub-region one by one to obtain a fine-level feature map. Recursion refers to the process of continuously multiplying elements. In this way, the more high-order information of the features in the back is saved, the more feature interactions there will be in the high order. Using cyclic gate convolution, high-order features, that is, the fine-level feature map of the image to be matched, can be obtained. As can be seen from the figure, the number of interactive feature channels of each order is C / 4, C / 2, and C, respectively, so that feature extraction from coarse to fine levels is achieved, and fewer channels are used in low orders.
[0043] It should be noted that in the present invention, the depthwise convolution uses a 6×6 convolution kernel.
[0044] S102: Determine a relative position code in the one-dimensional vector according to the one-dimensional vector corresponding to the coarse-level feature map.
[0045] Exemplarily, a group of coarse-level feature maps are flattened respectively to obtain a one-dimensional vector corresponding to the coarse-level feature map, and determine the relative position code in the one-dimensional vector.
[0046] S103: Obtain a set of fused feature matrices according to the coarse-level feature map and the relative position encoding.
[0047] Exemplarily, coarse-level feature maps are respectively encoded according to relative position coding to obtain a group of coarse-level feature maps with position information; a query matrix of the coarse-level feature map with position information of the previous frame and a key matrix and a value matrix of the coarse-level feature map with position information of the next frame are obtained according to preset matrix parameters, and relative position coding is added to the query matrix and the key matrix; self-attention of a group of coarse-level feature maps is determined according to the query matrix and the key matrix after adding the relative position coding, and cross-attention between a group of coarse-level feature maps is determined according to the self-attention, until a preset number of attention calculations is reached to obtain a feature matrix; the feature matrix is upsampled and fused with the original features of the coarse-level feature map to form a group of fused feature matrices.
[0048] Specifically, the local feature Transformer encoder is used to determine the self-attention of a set of coarse-level feature maps, and the cross-attention between the coarse-level feature maps is determined based on the respective attention results. Multiple rounds of self-attention and cross-attention are performed alternately to obtain a fused feature matrix. Figure 4 , Figure 4The structure diagram of an embodiment of the local feature Transformer encoder provided by the present invention. The Transformer encoder is composed of a plurality of sequentially connected encoder layers. First, the coarse feature maps are encoded according to the relative position encoding to obtain a set of coarse feature maps with position information. Two frames of coarse feature maps F with position information are input. A and F B , F A is the coarse-level feature map with position information of the previous frame, F B is a coarse-level feature map with position information for the next frame, after the preset matrix parameters ( To preset the query matrix parameters, is the preset key matrix parameter, is the preset value matrix parameter) to obtain the coarse feature map F with position information of the previous frame A The query matrix Q and the coarse-level feature map F with position information of the next frame B The key matrix K and value matrix V of the query matrix Q and the key matrix K are added with relative position encoding, and enter the self-attention layer and the cross-attention layer. For each cycle, the self-attention is calculated first. After the self-attention is calculated in each cycle, the cross-attention is calculated again until the preset number of attention calculations is reached, and the feature matrix is obtained. The feature matrix represents the relationship between feature points and feature points. Further, the feature matrix is upsampled and fused with the original features of the coarse-level feature map with position information of the previous frame to form a fused feature matrix of the coarse-level feature map of the previous frame. Similarly, the feature matrix is upsampled and fused with the original features of the coarse-level feature map of the subsequent frame with position information to form a fused feature matrix of the coarse-level feature map of the subsequent frame.
[0049] When determining the attention weight, the position relationship between elements in the sequence needs to be considered, and the relative position encoding takes into account the relative position relationship between elements. Specifically, for the feature sequence in the coarse-level feature map of each frame , we need to calculate each element With other elements The attention weight between them is shown as follows: ; in, is the attention weight, For elements and The relative position encoding between them, exp() is the exponential function, n is the total number of elements, k is the kth element, As shown below: ; in, For elements and The relative position encoding between The query matrix, For those with location information The key matrix of As shown below: ; in, For those with location information The key matrix of The original bond matrix, for and The relative position relationship between the two, the present invention uses a convolutional layer to calculate .
[0050] S104: Perform primary matching on the score matrices between a set of fused feature matrices to determine a primary matching set.
[0051] Exemplarily, a score matrix between a set of coarse-level feature maps is determined based on a set of fused feature matrices; a matching probability between a set of coarse-level feature maps is determined based on the score matrix; primary matching is performed based on the matching probability and a preset threshold to determine an initial matching set.
[0052] Specifically, the score matrix between a set of coarse-level feature maps is determined according to the following formula: ; Among them, S ( , ) is a score matrix between a set of coarse-level feature maps, is the i-th point in the coarse feature map of the previous frame, is the jth point in the coarse-level feature map of the next frame, is the inner product operation, is the fusion feature matrix of the coarse-level feature map of the previous frame, is the fused feature matrix of the coarse-level feature map of the subsequent frame.
[0053] Furthermore, the matching probability between a set of coarse-level feature maps is determined according to the following formula: ; in, is the matching probability of the i-th point in the coarse feature map of the previous frame and the j-th point in the coarse feature map of the next frame, To calculate the optimal matching method, is the score matrix of the i-th point in the coarse feature map of the previous frame and any point in the coarse feature map of the next frame, is the score matrix of the jth point in the coarse feature map of the subsequent frame and any point in the coarse feature map of the previous frame, is the i-th point in the coarse feature map of the previous frame, is the jth point in the coarse-level feature map of the next frame.
[0054] Further, primary matching is performed according to the following formula to determine the initial matching set: ; in, is the nearest neighbor algorithm, is the initial matching set, is the i-th point in the coarse feature map of the previous frame, is the jth point in the coarse-level feature map of the next frame, is the matching probability matrix, is the matching probability of the i-th point in the coarse feature map of the previous frame and the j-th point in the coarse feature map of the next frame, is the preset threshold. Select the confidence level higher than the threshold The matching is to select the matching results whose matching probability is greater than or equal to the threshold, and further implement the mutual neighbor standard to filter out possible erroneous rough matching results and improve the rough matching effect and efficiency.
[0055] S105: Map the initial matching set to a set of detailed feature maps respectively, extract a set of local feature maps, perform secondary matching through the central vectors of the set of local feature maps, and determine the secondary matching set.
[0056] Exemplarily, the positions of the initial matching sets on a set of fine-level feature maps are located respectively, and a local window of a preset size is determined at the position; based on the local window of the preset size, a set of transformed local feature maps is extracted; the center vectors of two local feature maps are associated to construct a heat map; secondary matching is performed according to the expectation of the probability distribution corresponding to the heat map to determine a secondary matching set of a set of images to be matched.
[0057] S106: extracting a group of matching feature points from the secondary matching set, and performing camera pose estimation based on the group of matching feature points.
[0058] Exemplarily, a set of matching feature points in the secondary matching set is extracted ( ), get the basic matrix and homography matrix of a set of matching feature points.
[0059] Specifically, a basic matrix and a homography matrix of a set of matching feature points are determined according to the epipolar constraint equation between the feature points to be matched. The epipolar constraint equation is shown as follows: ; Among them, F is the basic matrix, is the homography matrix, is the transposition of the matching feature points of the i+1th frame to be matched, is the matching feature point of the i-th frame of the image to be matched.
[0060] Furthermore, the initial camera pose is determined according to the fundamental matrix or the homography matrix.
[0061] Specifically, the initial camera pose is determined by the homography matrix as shown below: H = KT; in, is the homography matrix, K is the camera intrinsic parameter, and T is the initial camera pose.
[0062] When determining the initial camera pose through the basic matrix, first determine the essential matrix, which is shown in the following formula: ; Among them, E is the essential matrix, is the transpose of the essential matrix, and F is the basic matrix.
[0063] Furthermore, the essential matrix is subjected to singular value decomposition to determine the left singular vector matrix, as shown in the following formula: ; Among them, E is the essential matrix, is the left singular vector matrix, V is the orthogonal matrix, is the transpose of an orthogonal matrix.
[0064] Further, the rotation matrix and translation vector are determined. The rotation matrix is shown as follows: ; in, is the rotation matrix, Rz is the rotation matrix around the z-axis, is the transpose of the orthogonal matrix, is the left singular vector matrix.
[0065] Finally, the initial camera pose is determined according to the following formula: T = [R|t]; Where T is the initial camera pose, is the rotation matrix, and t is the last column of the left singular vector matrix.
[0066] Furthermore, a reprojection error function is determined according to the initial camera pose, and the reprojection error minimized by the reprojection error function is selected as the optimal camera pose.
[0067] Specifically, in an ideal case, for a pair of matching feature points , there must be . However, in real life, noise is inevitable and reprojection errors are bound to exist. The reprojection error of the i-th frame to be matched is as follows: ; in, is the reprojection error of the i-th frame to be matched, is the initial camera pose between the i-th frame and the i+1-th frame to be matched, is the matching feature point of the i+1th frame to be matched, is the matching feature point of the i-th frame to be matched, and k is the total number of frames.
[0068] Furthermore, the reprojection error function is determined according to the following formula, and the reprojection error minimized by the reprojection error function is selected as the optimal camera pose: ; in, is the reprojection error function, is the initial camera pose between the i-th frame and the i+1-th frame to be matched, is the matching feature point of the i+1th frame to be matched, is the matching feature point of the i-th frame to be matched, k is the total number of frames, argmin() is to minimize the reprojection error, is the squared L2 norm.
[0069] It can be seen from the above description that the present invention is based on recursive gated convolution, and a group of images to be matched are respectively extracted to obtain a group of coarse-level feature maps and fine-level feature maps, and can efficiently realize information interaction of any order with the help of gated convolution and recursive operation. Further, through the coarse-level feature map and relative position coding, a group of fused feature matrices are obtained, which combines the hierarchical information and spatial position information of the feature map, and provides a richer feature representation for subsequent matching. And the relative position coding that considers the relative position relationship between elements can enhance the recognition ability of translation invariance to process variable-length input sequences, thereby increasing the number of interactive calculations and achieving the improvement of feature matching accuracy. Further, the score matrix between a group of fused feature matrices is primary matched to determine the initial matching set. Through the primary matching, the most likely matching candidate area can be quickly located, and the initial matching set is respectively mapped to a group of fine-level feature maps to extract a group of local feature maps. Secondary matching is performed through the central vector of the local feature map to determine the secondary matching set, which can more accurately capture the local differences and similarities between images, further screen out the most accurate matching set, and improve the accuracy of the matching results. Finally, a set of matching feature points is extracted from the secondary matching set, and a more accurate camera pose estimation is performed based on these matching feature points.
[0070] like Figure 5 As shown, Figure 5A schematic flow chart of another embodiment of a camera pose estimation method based on recursive gated convolution provided by the present invention. A camera pose estimation method based on recursive gated convolution, the method comprising: S201: performing initial convolution on a group of images to be matched respectively to obtain a coarse-level feature map of a group of images to be matched.
[0071] For example, in combination with participation Figure 2 , the initial convolution consists of the first convolution layer, the second convolution layer, the third convolution layer and the fourth convolution layer, where Conv1 is the first convolution layer, Conv2_x is the second convolution layer, Conv3_x is the third convolution layer, and Conv4_x is the fourth convolution layer. A set of feature images to be matched are initially convolved through a feature map pyramid network based on recursive gated convolution to obtain a set of coarse-level feature maps of images to be matched.
[0072] S202: Perform two-dimensional convolution on a group of images to be matched respectively, and upsample the high-resolution image features extracted from the non-initial layers in the two-dimensional convolution layer.
[0073] S203: Concatenate the high-resolution image features extracted at the current level in the two-dimensional convolutional layer with the high-resolution image features after upsampling at the next level to obtain a set of high-resolution feature maps.
[0074] For example, in combination with participation Figure 2 , Conv2d 1×1, s1 is a two-dimensional convolution with a stride of s1 and a convolution kernel of 1×1, Conv2d 1×1, s2 is a two-dimensional convolution with a stride of s2 and a convolution kernel of 1×1, from bottom to top, they are the first level, the second level, and the third level. In particular, two-dimensional convolution is performed on the coarse-level feature maps of a group of images to be matched, and the high-resolution image features extracted from the highest level in the two-dimensional convolution layer are upsampled to obtain the high-resolution feature map of the highest level, and the high-resolution feature map is input to the recursive gated convolution of the corresponding level to extract the fine-level feature map of the highest level. Specifically, the third level is the highest level, and the coarse-level feature image output by the third level is upsampled after the high-resolution image features are output by the two-dimensional convolution of the corresponding level, and the high-resolution feature map of the current level is obtained, and the high-resolution feature map is input to the recursive gated convolution of the corresponding level to extract the fine-level feature map of the third level. Specifically, the third level is the highest level, and the coarse-level feature image output by the third level is upsampled after the high-resolution image features are output by the two-dimensional convolution of the corresponding level, and the high-resolution feature map of the current level is obtained, and the high-resolution feature map is input to the recursive gated convolution of the corresponding level to extract the fine-level feature map of the third level.
[0075] The coarse-level feature image output by the second level is convolved with the high-resolution image features of the upsampled third level to obtain the high-resolution feature map of the current level, which is then input into the recursive gated convolution to extract the fine-level feature map of the second level.
[0076] The coarse-level feature image output by the first level is concatenated with the high-resolution image features of the upsampled second level after the corresponding two-dimensional convolution to obtain the high-resolution feature map of the current level, which is then input into the recursive gated convolution to extract the fine-level feature map of the first level.
[0077] S204: Based on recursive gated convolution, adjust the number of channels of a set of high-resolution feature maps respectively.
[0078] S205: Divide a set of high-resolution feature maps after adjusting the number of channels into a plurality of sub-regions according to the depth convolution.
[0079] S206: Perform element-by-element multiplication between each sub-region to obtain a set of fine-level feature maps of the image to be matched.
[0080] It should be noted that steps S204-S206 are Figure 1 This has been discussed in detail in the implementation scenario shown and will not be repeated here.
[0081] like Figure 6 As shown, Figure 6 A schematic flow chart of another embodiment of a camera pose estimation method based on recursive gated convolution provided by the present invention. A camera pose estimation method based on recursive gated convolution, the method comprising: S301: Based on recursive gated convolution, feature extraction is performed on a group of images to be matched respectively to obtain a group of coarse-level feature maps and fine-level feature maps.
[0082] S302: Determine a relative position code in the one-dimensional vector according to the one-dimensional vector corresponding to the coarse-level feature map.
[0083] Exemplarily, a group of coarse-level feature maps are flattened respectively to obtain a one-dimensional vector corresponding to the coarse-level feature map, and determine the relative position code in the one-dimensional vector.
[0084] S303: Encode the coarse-level feature maps respectively according to the relative position coding to obtain a group of coarse-level feature maps with position information.
[0085] S304: Obtain a query matrix of a coarse-level feature map with position information of a previous frame and a key matrix and a value matrix of a coarse-level feature map with position information of a subsequent frame according to preset matrix parameters, and add relative position coding to the query matrix and the key matrix.
[0086] For example, referring to Figure 4 First, the coarse-level feature maps are encoded according to the relative position encoding to obtain a set of coarse-level feature maps with position information. Two frames of coarse-level feature maps F with position information are input. A and F B , F Ais the coarse-level feature map with position information of the previous frame, F B is a coarse-level feature map with position information for the next frame, after the preset matrix parameters ( To preset the query matrix parameters, is the preset key matrix parameter, is the preset value matrix parameter), obtain the coarse-level feature map F with position information of the previous frame A The query matrix Q and the coarse-level feature map F with position information of the next frame B The key matrix K and value matrix V of the query matrix Q and the key matrix K are encoded with relative positions, and then enter the self-attention layer and the cross-attention layer.
[0087] S305: Determine the self-attention of a set of coarse-level feature maps according to the query matrix and the key matrix after adding the relative position encoding, and determine the cross-attention between a set of coarse-level feature maps according to the self-attention, until reaching a preset number of attention calculations to obtain a feature matrix.
[0088] Exemplarily, self-attention is calculated first, and after calculating self-attention in each cycle, cross-attention is calculated again until a preset number of attention calculations is reached to obtain a feature matrix.
[0089] Specifically, in the self-attention mechanism, for each feature sequence in the coarse-level feature map of the previous frame , we need to calculate each element With other elements The attention weight between them is shown as follows: ; in, is the attention weight, For elements and The relative position encoding between them, exp() is the exponential function, n is the total number of elements, k is the kth element, As shown below: ; in, For elements and The relative position encoding between The query matrix, For those with location information The key matrix of As shown below: ; in, For those with location information The key matrix of The original bond matrix, for and The relative position relationship between the two, the present invention uses a convolutional layer to calculate .
[0090] S306: Upsample the feature matrix and fuse it with the original features of the coarse-level feature map to form a set of fused feature matrices.
[0091] S307: Determine a score matrix between a set of coarse-level feature maps according to a set of fused feature matrices.
[0092] Exemplarily, the score matrix between the two fused feature matrices is determined according to the following formula: ; Among them, S ( , ) is a score matrix between a set of coarse-level feature maps, is the i-th point in the coarse feature map of the previous frame, is the jth point in the coarse-level feature map of the next frame, is the inner product operation, is the fusion feature matrix of the coarse-level feature map of the previous frame, is the fused feature matrix of the coarse-level feature map of the subsequent frame.
[0093] S308: Determine a matching probability between a set of coarse-level feature maps according to the score matrix.
[0094] Exemplarily, the matching probability between a set of coarse-level feature maps is determined according to the following formula: ; in, is the matching probability of the i-th point in the coarse feature map of the previous frame and the j-th point in the coarse feature map of the next frame, To calculate the optimal matching method, is the score matrix of the i-th point in the coarse feature map of the previous frame and any point in the coarse feature map of the next frame, is the score matrix of the jth point in the coarse feature map of the subsequent frame and any point in the coarse feature map of the previous frame, is the i-th point in the coarse feature map of the previous frame, is the jth point in the coarse-level feature map of the next frame.
[0095] S309: Perform primary matching according to the matching probability and the preset threshold to determine a primary matching set.
[0096] Exemplarily, primary matching is performed according to the following formula to determine the initial matching set: ; in, is the nearest neighbor algorithm, is the initial matching set, is the i-th point in the coarse feature map of the previous frame, is the jth point in the coarse-level feature map of the next frame, is the matching probability matrix, is the matching probability of the i-th point in the coarse feature map of the previous frame and the j-th point in the coarse feature map of the next frame, is the preset threshold.
[0097] S310: Locate the positions of the initial matching sets on a set of fine-level feature maps, and determine a local window of a preset size at the position.
[0098] For example, for each initial matching pair in the initial matching set, first locate its position on the fine-level feature map, and then crop two sets of preset sizes to The local window.
[0099] S311: Extracting a set of transformed local feature maps based on a local window of a preset size.
[0100] Exemplarily, a smaller local feature Transformer module is used to transform the cropped features in each window multiple times to generate a set of transformed local feature maps.
[0101] S312: Associate a set of central vectors of local feature maps to construct a heat map.
[0102] Exemplarily, the center vector of the local feature map of the image to be matched in the previous frame is associated with all vectors in the local feature map of the image to be matched in the subsequent frame, thereby generating a heat map, which is the matching probability of each pixel in the neighborhood of the matching point of the image to be matched in the subsequent frame with the matching point of the image to be matched in the previous frame.
[0103] S313: Perform secondary matching according to the expectation of the probability distribution corresponding to the heat map to determine a secondary matching set of images to be matched.
[0104] like Figure 7 As shown, Figure 7 A schematic flow chart of another embodiment of a camera pose estimation method based on recursive gated convolution provided by the present invention. A camera pose estimation method based on recursive gated convolution, the method comprising: S401: Based on recursive gated convolution, feature extraction is performed on a group of images to be matched respectively to obtain a group of coarse-level feature maps and fine-level feature maps.
[0105] S402: Determine a relative position code in the one-dimensional vector according to the one-dimensional vector corresponding to the coarse-level feature map.
[0106] S403: Obtain a set of fused feature matrices according to the coarse-level feature map and the relative position encoding.
[0107] S404: Perform primary matching on the score matrices between a set of fused feature matrices to determine a primary matching set.
[0108] S405: Map the initial matching set to a set of detailed feature maps respectively, extract a set of local feature maps, perform secondary matching through the central vectors of the set of local feature maps, and determine the secondary matching set.
[0109] It should be noted that steps S401-S405 are Figure 1 This has been discussed in detail in the implementation scenario shown and will not be repeated here.
[0110] S406: Extract a group of matching feature points from the secondary matching set, and obtain a basic matrix and a homography matrix of the group of matching feature points.
[0111] Exemplarily, a set of matching feature points in the secondary matching set is extracted ( ), obtain a set of basic matrix and homography matrix of matching feature points, and determine the initial camera pose according to the basic matrix and homography matrix; Specifically, the basic matrix and the homography matrix are determined according to the epipolar constraint equation between the feature points to be matched. The epipolar constraint equation is shown as follows: ; Among them, F is the basic matrix, is the homography matrix, is the transposition of the matching feature points of the i+1th frame to be matched, is the matching feature point of the i-th frame of the image to be matched.
[0112] S407: Determine the initial camera pose according to the fundamental matrix and the homography matrix.
[0113] Exemplarily, the initial camera pose is determined according to a fundamental matrix or a homography matrix.
[0114] Specifically, the initial camera pose is determined by the homography matrix as shown below: H = KT; Among them, H is the homography matrix, K is the camera intrinsic parameter, and T is the initial camera pose.
[0115] When determining the initial camera pose through the basic matrix, first determine the essential matrix, which is shown in the following formula: ; Among them, E is the essential matrix, is the transpose of the essential matrix, and F is the basic matrix.
[0116] Furthermore, the essential matrix is subjected to singular value decomposition to determine the left singular vector matrix, as shown in the following formula: ; Among them, E is the essential matrix, is the left singular vector matrix, V is the orthogonal matrix, is the transpose of an orthogonal matrix.
[0117] Further, the rotation matrix and translation vector are determined. The rotation matrix is shown as follows: ; in, is the rotation matrix, Rz is the rotation matrix around the z-axis, is the transpose of the orthogonal matrix, is the left singular vector matrix.
[0118] Finally, the initial camera pose is determined according to the following formula: T = [R|t]; Where T is the initial camera pose, is the rotation matrix, and t is the last column of the left singular vector matrix.
[0119] S408: Determine a reprojection error function according to the initial camera pose, and select the reprojection error that minimizes the reprojection error of the reprojection error function as the optimal camera pose.
[0120] Exemplarily, the reprojection error function is determined according to the following formula: ; in, is the reprojection error function, is the initial camera pose between the i-th frame and the i+1-th frame to be matched, is the matching feature point of the i+1th frame to be matched, is the matching feature point of the i-th frame to be matched, k is the total number of frames, argmin() is to minimize the reprojection error, is the squared L2 norm.
[0121] like Figure 8 As shown, Figure 8 A schematic diagram of the structure of an embodiment of a camera pose estimation system based on recursive gated convolution provided by the present invention. A camera pose estimation system 10 based on recursive gated convolution comprises: The coarse-level feature map and fine-level feature map extraction module 11 is used to extract features from a group of images to be matched based on recursive gated convolution to obtain a group of coarse-level feature maps and fine-level feature maps.
[0122] The relative position code determination module 12 is used to determine the relative position code in the one-dimensional vector according to the one-dimensional vector corresponding to the coarse-level feature map.
[0123] The fused feature matrix determination module 13 is used to obtain a set of fused feature matrices according to the coarse-level feature map and the relative position encoding.
[0124] The initial matching set determination module 14 is used to perform primary matching on the score matrices between a set of fused feature matrices to determine an initial matching set.
[0125] The secondary matching set determination module 15 is used to map the initial matching set to a set of detailed feature maps respectively, extract a set of local feature maps, perform secondary matching through the central vector of the set of local feature maps, and determine the secondary matching set.
[0126] The camera pose estimation module 16 is used to extract a set of matching feature points from the secondary matching set and perform camera pose estimation based on the set of matching feature points.
[0127] Exemplarily, in the coarse-level feature map and fine-level feature map extraction module 11, an initial convolution is performed on a group of images to be matched to obtain a group of coarse-level feature maps of the images to be matched; a two-dimensional convolution is performed on the coarse-level feature maps of the images to be matched, and the high-resolution image features extracted from the non-initial level in the two-dimensional convolution layer are upsampled; the high-resolution image features extracted from the current level in the two-dimensional convolution layer are spliced with the high-resolution image features after upsampling of the next level to obtain a group of high-resolution feature maps; based on recursive gated convolution, the number of channels of a group of high-resolution feature maps is adjusted; according to the depth convolution, the group of high-resolution feature maps after the channel number adjustment is divided into several sub-regions; each sub-region is multiplied element by element to obtain a group of fine-level feature maps of the images to be matched. Further, in the relative position code determination module 12, the relative position code in the one-dimensional vector is determined according to the one-dimensional vector corresponding to the coarse-level feature map. Further, in the fusion feature matrix determination module 13, the coarse feature maps are respectively encoded according to the relative position coding to obtain a group of coarse feature maps with position information; the query matrix of the coarse feature map containing position information in the previous frame and the key matrix and value matrix of the coarse feature map containing position information in the next frame are obtained according to the preset matrix parameters, and the relative position coding is added to the query matrix and the key matrix; the self-attention of a group of coarse feature maps is determined according to the query matrix and the key matrix after adding the relative position coding, and the cross attention between a group of coarse feature maps is determined according to the self-attention until the preset attention calculation times are reached to obtain the feature matrix; the feature matrix is upsampled and fused with the original features of the coarse feature map to form a fusion feature matrix. Further, in the initial matching set determination module 14, the score matrix between a group of coarse feature maps is determined according to a group of fusion feature matrices; the matching probability between a group of coarse feature maps is determined according to the score matrix; primary matching is performed according to the matching probability and the preset threshold value to determine the initial matching set. Furthermore, in the secondary matching set determination module 15, the positions of the initial matching sets on a set of fine-level feature maps are located, and a local window of a preset size is determined at the position; based on the local window of the preset size, a set of transformed local feature maps is extracted; the center vectors of a set of local feature maps are associated to construct a heat map; secondary matching is performed according to the expectation of the probability distribution corresponding to the heat map to determine a set of secondary matching sets of images to be matched. Finally, in the camera pose estimation module 16, a set of matching feature points in the secondary matching set is extracted, and the basic matrix and homography matrix of a set of matching feature points are obtained; the initial camera pose is determined according to the basic matrix and the homography matrix; the reprojection error function is determined according to the initial camera pose, and the reprojection error minimized by the reprojection error function is selected as the optimal camera pose.
[0128] like Fig. 9 As shown, Fig. 9The storage medium 20 stores at least one computer program 21, which is executed by a processor to implement the following. Figure 1 , Figure 5 , Figure 6 and Figure 7 In one embodiment, the storage medium 20 may be a storage chip, a hard disk, a mobile hard disk, a USB flash drive, an optical disk, or other readable and writable storage tools, or a server, etc.
[0129] Additionally, the processes depicted in the figures do not necessarily have to be performed in the particular order shown or in sequential order to achieve desired results. In certain implementations, multitasking and parallel processing are also possible or may be advantageous.
[0130] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0131] The apparatus, device, non-volatile computer-readable storage medium and method provided in the embodiments of this specification correspond to each other, and therefore, the apparatus, device, and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the corresponding apparatus, device, and non-volatile computer storage medium will not be repeated here.
[0132] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0133] For the convenience of description, the above device is described by being divided into various units according to their functions and described separately. Of course, when implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware. It should be understood by those skilled in the art that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of this specification can take 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.) containing computer-usable program codes.
[0134] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0137] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0138] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0139] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0140] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0141] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0142] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0143] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A camera pose estimation method based on recursive gated convolution, characterized in that: The method comprises: Based on recursive gated convolution, feature extraction is performed on a group of images to be matched to obtain a group of coarse-level feature maps and fine-level feature maps; Determining a relative position code in the one-dimensional vector according to the one-dimensional vector corresponding to the coarse-level feature map; Acquire a set of fused feature matrices according to the coarse-level feature map and the relative position encoding; Performing primary matching on the score matrices between a group of the fused feature matrices to determine a primary matching set; Mapping the initial matching set to a set of the detailed feature maps respectively, extracting a set of local feature maps, performing secondary matching through the central vectors of the set of local feature maps, and determining a secondary matching set; A group of matching feature points is extracted from the secondary matching set, and camera pose estimation is performed based on the group of matching feature points.
2. The camera pose estimation method based on recursive gated convolution according to claim 1, characterized in that: Based on the recursive gated convolution, feature extraction is performed on a group of images to be matched respectively to obtain a group of coarse-level feature maps and fine-level feature maps, which specifically includes: Performing initial convolution on a group of images to be matched respectively to obtain a group of coarse-level feature maps of the images to be matched; Performing two-dimensional convolution on the coarse-level feature maps of a group of images to be matched, respectively, and upsampling the high-resolution image features extracted from the non-initial level in the two-dimensional convolution layer; splicing the high-resolution image features extracted at the current level in the two-dimensional convolutional layer with the high-resolution image features after upsampling at the next level to obtain a set of high-resolution feature maps; Based on recursive gated convolution, adjusting the number of channels of a group of high-resolution feature maps respectively; Dividing a set of high-resolution feature maps after adjusting the number of channels into a plurality of sub-regions according to the depth convolution; Each of the sub-regions is element-by-element multiplied to obtain a set of fine-level feature maps of the image to be matched.
3. The camera pose estimation method based on recursive gated convolution according to claim 2, characterized in that: The step of obtaining a set of fusion feature matrices according to the coarse-level feature map and the relative position encoding specifically includes: Encode the coarse-level feature maps respectively according to the relative position encoding to obtain a group of coarse-level feature maps with position information; Acquire a query matrix of the coarse-level feature map with position information of the previous frame and a key matrix and a value matrix of the coarse-level feature map with position information of the next frame according to preset matrix parameters, and add the relative position encoding to the query matrix and the key matrix; Determine the self-attention of a group of the coarse-level feature maps according to the query matrix and the key matrix after adding the relative position encoding, and determine the cross-attention between a group of the coarse-level feature maps according to the self-attention until a preset number of attention calculations is reached to obtain a feature matrix; The feature matrix is upsampled and fused with the original features of the coarse-level feature map to form a set of fused feature matrices.
4. The camera pose estimation method based on recursive gated convolution according to claim 3, characterized in that: The performing preliminary matching on the score matrices between a group of the fused feature matrices to determine the preliminary matching set specifically includes: Determine a score matrix between a group of the coarse-level feature maps according to a group of the fused feature matrices; Determining a matching probability between a set of the coarse-level feature maps according to the score matrix; A primary match is performed according to the matching probability and a preset threshold to determine a primary matching set.
5. The camera pose estimation method based on recursive gated convolution according to claim 4, characterized in that: The performing primary matching according to the matching probability and the preset threshold to determine the initial matching set specifically includes: according to Perform primary matching and determine the initial matching set, where: is the nearest neighbor algorithm, is the initial matching set, is the i-th point in the coarse feature map of the previous frame, is the jth point in the coarse-level feature map of the next frame, is the matching probability matrix, is the matching probability of the i-th point in the coarse feature map of the previous frame and the j-th point in the coarse feature map of the next frame, is the preset threshold.
6. The camera pose estimation method based on recursive gated convolution according to claim 4, characterized in that: Mapping the initial matching set to a set of the detailed feature maps respectively, extracting a set of local feature maps, performing secondary matching through a set of central vectors of the local feature maps, and determining a secondary matching set specifically includes: Locating the positions of the initial matching sets on a set of the detailed feature maps, and determining a local window of a preset size at the position; Extracting a set of transformed local feature maps based on the local window of the preset size; Associating a set of center vectors of the local feature maps to construct a heat map; A secondary matching is performed according to the expectation of the probability distribution corresponding to the heat map to determine a secondary matching set of the images to be matched.
7. The camera pose estimation method based on recursive gated convolution according to claim 6, characterized in that: The extracting a group of matching feature points from the secondary matching set and performing camera pose estimation according to the group of matching feature points specifically includes: Extracting a group of matching feature points from the secondary matching set, and obtaining a basic matrix and a homography matrix of the group of matching feature points; Determine an initial camera pose according to the fundamental matrix and the homography matrix; A reprojection error function is determined according to the initial camera pose, and a reprojection error minimized by the reprojection error function is selected as the optimal camera pose.
8. The camera pose estimation method based on recursive gated convolution according to claim 7, characterized in that: Determining a reprojection error function according to the initial camera pose, and selecting a minimized reprojection error of the reprojection error function as the optimal camera pose, specifically includes: according to Determine a reprojection error function, and select the reprojection error that minimizes the reprojection error of the reprojection error function as the optimal camera pose, where: is the reprojection error function, is the initial camera pose between the i-th frame and the i+1-th frame to be matched, is the matching feature point of the i+1th frame to be matched, is the matching feature point of the i-th frame to be matched, k is the total number of frames, argmin() is to minimize the reprojection error, is the squared L2 norm.
9. A camera pose estimation system based on recursive gated convolution, characterized in that: The system comprises: A coarse-level feature map and a fine-level feature map extraction module, used to extract features from a group of images to be matched based on recursive gated convolution, and obtain a group of coarse-level feature maps and a fine-level feature map; A relative position code determination module, used to determine the relative position code in the one-dimensional vector according to the one-dimensional vector corresponding to the coarse-level feature map; A fused feature matrix determination module, used to obtain a set of fused feature matrices according to the coarse-level feature map and the relative position code; An initial matching set determination module, used to perform primary matching on a score matrix between a group of fused feature matrices to determine an initial matching set; A secondary matching set determination module, used to map the primary matching set to a set of the detailed feature maps respectively, extract a set of local feature maps, perform secondary matching through a central vector of the set of local feature maps, and determine a secondary matching set; The camera pose estimation module is used to extract a group of matching feature points from the secondary matching set and perform camera pose estimation based on the group of matching feature points.
10. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Semi-dense feature image matching method and device based on high-order space interaction
CN117496206A
