Vision-inertial slam positioning method based on learning feature and attention matching
By combining a lightweight detection-description network and an attention-based feature matching network, the problem of feature detection and localization accuracy in visual-inertial SLAM systems in complex scenes is solved, achieving stable feature matching and high-precision localization in scenes with drastic lighting changes, weak textures, and repetitive structures.
Patent Information
- Application Number
- CN202611541865.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-03
- Publication Date
- 2026-11-27
AI Technical Summary
Existing visual-inertial SLAM systems struggle to stably detect and describe features under degraded perception conditions such as drastic changes in lighting, motion blur, weak textures, and repetitive structures. Furthermore, they misjudge loop closures in repetitive texture scenes, resulting in low positioning accuracy.
A lightweight detection-description network constructed with deformable convolution is used to extract feature points. This network is combined with an attention-based feature matching network to achieve dense feature correspondence. Stable feature matching and high-precision localization are achieved by predicting pyramid levels and one-to-one occupancy constraints, combined with visual-inertial tight coupling optimization.
In scenarios with drastic lighting changes, weak textures, and repetitive structures, the stability and localization accuracy of feature point detection are improved, the risk of false positives and loop closures is reduced, and localization accuracy is improved while maintaining real-time operation.
Smart Images

Figure CN123175261A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of synchronous localization and mapping technology for robots and autonomous systems, specifically to a visual-inertial SLAM localization method and system based on learned features and attention matching. Background Technology
[0002] Visual Simultaneous Localization and Mapping (SLAM) is widely used in robots, drones, vehicles, and augmented reality devices, enabling them to estimate their pose and build environmental maps in real time in unknown environments. Feature-based sparse SLAM systems, such as ORB-SLAM3, use handcrafted features (e.g., ORB) for feature detection and description, and establish feature correspondences using nearest neighbor descriptor distance matching. They are also equipped with a bag-of-words (BBO) model trained on handcrafted feature descriptors for loop closure detection and relocalization.
[0003] Chinese patent application (publication number: CN122650919A) discloses a visual-inertial synchronous localization and mapping method based on adaptive depth feature enhancement. It employs a SuperPoint network to extract image feature points and original descriptors, dynamically determines the number of target features in the current frame based on the feature tracking efficiency of the previous frame, and uses a hierarchical square cover algorithm for spatial filtering. The filtered feature points and descriptors are then input into a FeatureBooster module, which integrates geometric attributes through self-boosting and aggregates image context information through cross-boosting to obtain enhanced descriptors. K-means clustering is then used to construct a floating-point bag-of-words model to retrieve loop closure candidate frames, and global optimization is performed after calculating the relative pose based on the Sim(3) model. This scheme aims to improve feature tracking stability and reduce trajectory drift error in weakly textured environments without significantly increasing computational overhead.
[0004] Chinese patent application (publication number: CN122760682A) discloses a method for visual relocalization of unmanned aerial vehicles (UAVs) that fuses binary descriptors with a vocabulary tree. This method utilizes a deep learning feature extraction network to generate floating-point global descriptors for images, which are then compressed into binary descriptors via a learnable binarization layer. A multi-level vocabulary tree index is pre-trained. The binary descriptor of the query image is fed into the index, and the Hamming distance is calculated layer by layer from top to bottom. The nearest branch is selected and descends to the leaf node. After filtering the candidate image set, candidate frames are output based on a word frequency-inverse document frequency weighted score. Local feature matching and geometric verification are then performed between the candidate frames and the query image to output the six-DOF relocalization pose. This scheme aims to achieve high-precision, low-storage, and fast visual position recognition.
[0005] Although the above schemes all use learned features or vocabulary tree retrieval for visual localization and mapping, none of them have disclosed the introduction of attention-based matchers into the matching process of visual inertial SLAM. Specifically, there are the following shortcomings: First, the feature processing of CN122650919A stops at the extraction and enhancement of descriptors, and its geometric verification of loop closure candidates is still bag-of-words matching plus Sim(3). The pose solving method neither uses an attention matcher to establish dense feature correspondences between the current frame and candidate frames, nor performs restricted matching of map points within the projection neighborhood. Therefore, in perceptual aliasing scenarios such as repetitive textures and corridors, it easily misclassifies frames that look similar but are not from the same location as loops. Once a misclassified loop enters pose graph optimization, the drift is reversed and distributed onto the existing map, causing overall image jitter. Furthermore, this scheme actively avoids such matching methods to avoid computational overhead. Its background technology lists complex deep matching networks as a flaw in existing technologies, indicating that its matching accuracy is achieved at the cost of computational power. Secondly, this scheme does not disclose applying a one-to-one occupancy constraint to the map points participating in the matching before pose solving. Once a mismatch occurs in projection matching where one map point corresponds to multiple feature points, the pose solving fails. Thirdly, CN122760682A The disclosed components are the retrieval files for the loop closure detection module in the synchronous localization and mapping system. Candidate frame verification employs brute-force matching and ratio testing followed by random consistency checking. Retrieval and verification are sequential and do not involve tracking or local mapping stages. Therefore, loop closure and relocation after tracking loss still belong to two separate logics, requiring separate adjustments to retrieval parameters and decision thresholds, preventing reuse. Fourth, neither of the above two schemes discloses the introduction of the map point prediction pyramid level's scale into the acceptance decision of projection matching. When the same decision scale is used for far and near points, the reliability of matching decreases with changing viewpoints. Furthermore, existing feature-based SLAM conventionally establishes feature correspondences using nearest neighbor descriptor distances. This approach suffers from decreased matching reliability in scenes with drastic lighting changes, motion blur, weak textures, and repetitive structures, making it difficult to support the required correspondence accuracy for the aforementioned stages.
[0006] The information disclosed in this background section is only for understanding the background of the inventive concept, and therefore may include information that does not constitute prior art. Summary of the Invention
[0007] To address the shortcomings of the existing technologies, the technical problem to be solved by this invention is: how to enable a visual inertial system to stably detect and describe features, reliably determine whether to revisit the same location, and achieve sufficiently high positioning accuracy while maintaining real-time operation, under conditions of degraded perception conditions such as drastic changes in lighting, motion blur, weak texture and repetitive structures, and the possible lack of depth information and scale reference.
[0008] To solve the above-mentioned technical problems, the present invention provides a visual inertial positioning method, comprising the following steps:
[0009] Step 1: Acquire image data and inertial measurement data, wherein the image data and inertial measurement data come from any one of five sensor configurations: monocular, monocular inertial, binocular, binocular inertial, and RGB-D.
[0010] Step 2: A lightweight detection-description network constructed using deformable convolution is used to extract the coordinates and descriptors of feature points, and the coordinates and descriptors of the feature points are used as a shared feature source throughout the entire process;
[0011] Step 3: After the lightweight detection-description network, an attention feature matching network is connected in series. The pairing result is based on the coordinates of the feature points on both sides and the descriptors on both sides as input and output. This replaces the nearest neighbor descriptor distance matching and is used for inter-frame matching and frame-to-graph matching in the tracking stage, as well as new map point triangulation in the local mapping stage.
[0012] Step 4: Project map points onto the target keyframe based on the known pose to obtain a projection point set. Remove map points with non-positive depth, those outside the frame, those outside the visible range, and those with excessively large angles between the line of sight and the normal. Record the prediction pyramid level of each retained map point in the target keyframe. Feed the projection point set along with its descriptor and the feature points of the target keyframe along with their descriptors into the attention feature matching network to complete the matching in the projection neighborhood. Determine the pixel residual decision radius according to the scaling factor corresponding to the prediction pyramid level. When the pixel distance between the projection point and the paired feature point does not exceed the decision radius, the match is accepted, and a one-to-one occupancy constraint is applied to the accepted map points.
[0013] Step 5: Obtain loop closure candidate keyframes from the keyframe database, and use the attention feature matching network to establish dense feature correspondences between the current keyframe and the loop closure candidate keyframes; perform pose estimation based on random consistency check on the obtained correspondences to eliminate outliers; when the number of inlier correspondences reaches a set threshold, determine that the loop closure candidate keyframe is a valid loop closure, and add the loop closure constraint to the pose graph.
[0014] Step 6: Visual-inertial tight coupling optimization in the form of pre-integration is adopted, which jointly optimizes the motion constraints obtained by integrating inertial measurements between keyframes and the visual reprojection error in local bundle adjustment.
[0015] Furthermore, the method further includes: using the descriptors output by the lightweight detection-description network as training corpus to perform hierarchical K-means clustering to construct a hierarchical visual vocabulary and establish an inverted index; assigning feature points of each keyframe to the leaf nodes of the vocabulary to form the bag-of-words vector of the keyframe, wherein the leaf nodes of the vocabulary are used as visual words; and retrieving the loop closure candidate keyframes based on the bag-of-words vector and the inverted index.
[0016] Furthermore, in step 5, bag-of-words matching and attention matching are performed in parallel within the same co-visibility relation group, and the matching results of the two are selected based on the scores; so that loop closure and relocation after tracking loss share the same hybrid location identification link.
[0017] Furthermore, step 2 also includes: calculating the mean and variance of the response values of the feature points in the current frame, and calculating a retention threshold in combination with the number of map points that were accepted for matching in the previous key frame, and retaining only feature points whose response values are not lower than the retention threshold; the feedback term in the retention threshold, which is composed of the number of map points that were accepted for matching in the previous key frame, increases monotonically with the number.
[0018] Furthermore, the retrieval of the loop-closure candidate keyframes includes: taking a set proportion of the current maximum number of shared visual words as the admission threshold instead of a fixed value, and retaining only candidate keyframes whose number of shared visual words with the current keyframe exceeds the admission threshold for similarity scoring; and first scoring the bag-of-words similarity between the current keyframe and the candidate keyframes, then sorting them according to the cumulative similarity of the co-visual neighbor groups of the candidate keyframes, and taking the candidate keyframes with the highest cumulative scores as the final candidates.
[0019] Furthermore, the method also includes: when the number of map keyframes is less than a set first threshold, loop closure detection is not performed and the result is directly output; in the stereo configuration, when the number of keyframes is less than a set second threshold, the keyframe is directly inserted into the keyframe database; in the monocular inertial configuration, loop closure detection is not performed before the second stage initialization is completed.
[0020] Furthermore, the elimination condition in step 4 also includes that the inner product of the line of sight and the normal of the map point is not less than a certain proportion of the distance from the map point to the camera center; step 4 also includes: before using the matching result for pose solving, first align the length of the matching result array to the number of feature points in the current keyframe and verify that the length is consistent. If the length is inconsistent, return zero matching number.
[0021] Furthermore, the attention feature matching network generates the pairing results based on the similarity between descriptors, and the similarity is measured by Euclidean distance or cosine distance; the lightweight detection-description network in step 2 and the attention feature matching network in step 3 are loaded in independent inference sessions, and a GPU execution provider can be selected and the extended memory allocation strategy can be turned off to avoid memory overflow. The number of threads for feature extraction is determined by hardware concurrency.
[0022] Furthermore, the method also includes: when tracking is lost and relocation fails, if there is a co-visibility relationship with an adjacent sub-map, map merging is triggered, and deduplication of map points is completed through projection fusion.
[0023] This invention also provides a visual-inertial positioning system, comprising: a sensor layer for acquiring image data and inertial measurement data; a learning feature extraction module for extracting the coordinates and descriptors of feature points using a lightweight detection-description network constructed with deformable convolution and using it as a shared feature source throughout the entire process; an attention feature matching module for pairing the coordinates of feature points on both sides and the descriptors on both sides as input and output, replacing nearest neighbor descriptor distance matching; a projection neighborhood matching module for projecting map points onto target keyframes based on known poses and completing matching within the projection neighborhood, determining pixel residuals according to the prediction pyramid level and applying a one-to-one occupancy constraint to the map points; an attention geometric verification module for establishing dense feature correspondences between loop closure candidate keyframes and the current keyframe and determining valid loop closures through random consistency pose verification; and a visual-inertial tight coupling module for jointly optimizing the motion constraints obtained by integrating inertial measurements between keyframes and the visual reprojection error in local bundle adjustment.
[0024] The present invention also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the visual inertial positioning method described above.
[0025] The present invention also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the visual-inertial positioning method.
[0026] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0027] The output of the deformable convolutional lightweight detection-description network is uniformly used as the feature representation for four stages: tracking, local mapping, relocalization, and loop closure. Then, an attention feature matching network is connected in series. The descriptors are semantically consistent across stages, keyframes can be directly compared, and map points do not exhibit representation drift when transferred across stages. Moreover, compared with handmade features, this lightweight detection-description network has stronger invariance under drastic changes in lighting, viewpoint changes, and motion blur, and the detected feature points are more stable in scenes with weak texture and repetitive structures.
[0028] After obtaining the candidate keyframes for loop closures, the attention feature matching network establishes a dense correspondence between the current keyframe and the candidate frames. Then, after random consistency pose verification, the attention mechanism utilizes descriptor similarity and global context to filter out candidates that are similar in appearance but not in the same location in scenes with repeated textures and perceptual aliasing. The risk of misjudged loop closures entering the pose graph and being assigned to the whole image after optimization is reduced.
[0029] The map points are first projected onto the target keyframe according to their pose. The cross-attention feature matching network uses the set of projected points as one side to match within the projection neighborhood. The search space is limited but the computational cost is controllable. The pixel residual judgment radius is given according to the scaling factor corresponding to the prediction pyramid level to determine whether the match is accepted or not. Different judgment scales are used for far points and near points. A one-to-one occupancy constraint is applied to the map points. The correspondence required for pose solution is both limited and unambiguous.
[0030] It retains the pre-integrated form of visual-inertial tight coupling optimization and allows the same set of features and matching pipelines to run through five sensor configurations: monocular, monocular inertial, binocular, binocular inertial, and RGB-D. In the monocular configuration, inertial data provides scale observability, and tracking is uninterrupted during rapid motion or brief visual degradation. The multiple configurations share a single pipeline so that only inference parameters need to be adjusted when deployed to different computing power platforms.
[0031] The descriptors output by this lightweight detection-description network are used to train a hierarchical K-means vocabulary tree, and keyframe bag-of-words vectors and inverted indexes are constructed using family-of-words descriptors. This allows bag-of-words retrieval and attention matching to be based on the same descriptor semantic space. The pairing results of the two branches can be directly compared and selected based on the score. There is no representational barrier between the bag-of-words domain and the attention domain. When the feature network is changed, the location recognition link can be transferred along with the feature source.
[0032] Bag-of-words matching and attention matching are performed in parallel within the same co-visibility relation group and are selected based on scores. Coarse retrieval is responsible for narrowing down the candidate range, while fine matching is responsible for improving the pairing quality. The two complement each other on the same decision chain. Loop closure and relocation after tracking loss share the same hybrid location identification link, requiring only one set of retrieval parameters and decision thresholds to be maintained. Attached Figure Description
[0033] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.
[0034] Figure 1 This is a schematic diagram of the main process of the visual-inertial positioning method.
[0035] Figure 2 This is a schematic diagram showing the module relationships of a visual inertial positioning system. Detailed Implementation
[0036] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings and specific embodiments. The described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0037] I. Overall Plan
[0038] like Figure 2 As shown, the visual-inertial positioning system of the present invention includes a sensor layer, a learning feature extraction module, an attention feature matching module, a projection neighborhood matching module, an attention geometric verification module, and a visual-inertial tightly coupled module.
[0039] The sensor layer receives camera image streams and inertial measurement data streams. The learning feature extraction module uses a lightweight detection-description network constructed with deformable convolutions to extract feature point coordinates, response values, and descriptors from the input image; its output serves as a shared feature source throughout the entire process. The attention feature matching module uses the coordinates of the feature points on both sides and the descriptors on both sides as input and output pairing results, replacing the original nearest neighbor matching based on descriptor distance. The projection neighborhood matching module projects map points onto the target keyframe based on the known pose and completes matching within the projection neighborhood, determining pixel residuals according to the prediction pyramid level and imposing a one-to-one occupancy constraint on the map points. The attention geometric verification module establishes a dense feature correspondence between the loop closure candidate keyframe and the current keyframe, determines valid loop closures through random consistency pose verification, and then adds the valid loop closure constraints to the pose graph for global optimization. The vision-inertial tight coupling module jointly optimizes the motion constraints obtained by integrating inertial measurements between keyframes and the visual reprojection error in local bundle adjustment.
[0040] like Figure 1 As shown, the visual inertial positioning method of the present invention is executed sequentially according to steps 1 to 6.
[0041] Step 1: Acquire image data and inertial measurement data. This step aims to provide a time-aligned multi-source data foundation for subsequent feature extraction and matching. The system receives the current frame image according to the camera calibration parameters; if the sensor configuration includes an inertial unit, it synchronously receives inertial acceleration and angular velocity and aligns them with the image in time. The image data and inertial measurement data can come from any of the following five sensor configurations: monocular, monocular inertial, binocular, binocular inertial, and RGB-D.
[0042] Step 2 involves using a lightweight detection-description network constructed with deformable convolutions to extract the coordinates and descriptors of feature points. This step aims to provide a unified source of semantic features for tracking, local mapping, relocalization, and loop closure. Specifically, the image is expanded from grayscale to three channels, scaled to the network's agreed input size, and converted into a floating-point tensor before being fed into the network's forward inference, yielding three sets of outputs: feature point coordinates, response values, and descriptors. The feature point coordinates are normalized coordinates and need to be calculated back to the original image pixel coordinates. This output serves as a shared feature source throughout the entire process.
[0043] Step 3: An attention feature matching network is cascaded after the lightweight detection-description network. The coordinates of two frames or two sets of feature points are normalized according to the image width and height, and packaged together with the descriptors on both sides as inference input. The attention feature matching network outputs the pairing result forward. This pairing result is used for inter-frame matching between the current frame and the previous frame, frame-to-graph matching between the current frame and the local map during the tracking stage, and triangulation of new map points during the local mapping stage.
[0044] Step 4: Project map points onto the target keyframe based on the known pose to obtain a projection point set. This step aims to provide an unambiguous projection-observation correspondence for pose solving within a limited search space. Specifically, map points in the world coordinate system are transformed to the camera coordinate system of the target keyframe according to the known pose. Map points with non-positive depth, those outside the frame, those whose depth exceeds the visible range of the map point, and those with excessively large angles between the line of sight and the normal are removed. For each retained map point, its prediction pyramid level in the target keyframe is recorded. The projection point set, along with its descriptor, and the feature points of the target keyframe, along with their descriptors, are fed into an attention feature matching network to complete matching within the projection neighborhood. Subsequently, the pixel residual decision radius is determined according to the scaling factor corresponding to the prediction pyramid level. When the pixel distance between the projection point and the paired feature point does not exceed the decision radius, the match is accepted, and a one-to-one occupancy constraint is applied to the accepted map point to prevent the same map point from being accepted a second time.
[0045] Step 5: Obtain loop closure candidate keyframes from the keyframe database. This step aims to suppress loop closure misjudgments in perceptual aliasing scenarios through dense matching and consistency verification. An attention-based feature matching network is used to establish dense feature correspondences between the current keyframe and the loop closure candidate keyframes; pose estimation based on random consistency verification is performed on the obtained correspondences to eliminate outliers; when the number of inlier correspondences reaches a set threshold, the loop closure candidate keyframe is determined to be a valid loop closure, and the loop closure constraint is added to the pose graph. After tracking loss, the same candidate acquisition and attention verification process is also used for relocalization; the subsequent action is to restore the pose of the current frame and integrate it into the original map.
[0046] Step 6 employs a pre-integrated form of visual-inertial tight coupling optimization, which jointly optimizes the motion constraints obtained by integrating inertial measurements between keyframes with the visual reprojection error in local bundle adjustment to suppress rapid motion, transient visual degradation, and drift under weak texture, and to provide scale observability in monocular configuration.
[0047] II. Symbols and Formulas
[0048] The symbols used in this embodiment will be explained below.
[0049] in, This represents the pixel coordinates of the feature points in the original image coordinate system. This represents the image width and height used for normalization. This represents the normalized coordinates output by the detection network (within a range of 1). ), Indicates the camera's focal length. Indicates the pixel coordinates of the camera's principal point. This represents the three-dimensional coordinates of a map point in the camera coordinate system. Represents the horizontal and vertical pixel coordinates of the projection point. This represents the pixel distance between the projected point and the corresponding feature point. The coordinates of the projection point obtained by expression (4) This represents the coordinates of the paired feature points on the target keyframe. Indicates the predicted pyramid level The corresponding scaling factor; the coordinate and distance symbols mentioned above are measured in pixels, and the three-dimensional coordinates are measured in meters.
[0050] This represents the arithmetic mean of the response values of all feature points in the current frame. Indicate its variance; This represents the compression factor of the variance term within the response value threshold, and is set to 0.6. This represents the magnitude of the matching quantity feedback term, which is 0.02. This indicates the steepness of the matching quantity feedback term, set to 0.02; This indicates the number of map points that were accepted for matching in the previous keyframe, in units of points; The threshold value for the number of matching feedback items is 270. This indicates the threshold for retaining feature point response values; This indicates the pixel residual judgment factor; except for the number of map points, the above statistical and threshold symbols are dimensionless.
[0051] This represents the maximum number of shared visual words in candidate keyframes, expressed in units of words. This represents the percentage of words accepted for sharing visual recognition, set to 0.8. This represents the minimum number of shared visual words required to participate in the loop closure candidate scoring, expressed in words. This indicates the number of interior points that passed the geometric verification, expressed in units of points. This represents the minimum number of interior points required to determine a valid loop closure, expressed in units of points. This represents the bag-of-words similarity between the candidate keyframe and the current keyframe; This represents the minimum similarity required to determine a valid loop closure. The result indicates a valid loop closure determination, and can be either 0 or 1; the similarity and determination result symbols mentioned above are dimensionless.
[0052] Before being fed into the attention feature matching network, the coordinates of the feature points on both sides are first translated to the origin by the image center and then divided by half of the longer side of the image, so that the feature points of different resolutions and aspect ratios fall on the same coordinate scale, as shown in Equation (1):
[0053]
[0054] For example, take , , When the denominator is 320, we get .
[0055] Lightweight Detection - The output of the description network is The normalized coordinates of the interval need to be calculated back to the pixel coordinates of the original image to ensure that the stored coordinates of the keyframes and map points are aligned with the actual pixels, as shown in Equation (2):
[0056]
[0057] In one alternative implementation, the response values of all feature points in the current frame are statistically analyzed and a retention threshold is calculated. Only feature points with response values not lower than the threshold are retained, as shown in equation (3):
[0058]
[0059] In equation (3), The first term scales the threshold with the dispersion of the current frame response; the second term is based on... As a turning point, following A monotonically increasing feedback item, when Significantly smaller than When this term approaches zero, the amount subtracted is minimal, the threshold is relatively raised, and only a small number of feature points with the highest response values are retained. Significantly greater than When this term approaches its upper limit of amplitude. The amount subtracted increases, the threshold decreases relatively, and more feature points are retained. near At that time, this item is approximately half of its amplitude. Accordingly, when the previous frame's matching is sparse, the number of features is tightened to maintain stability; when the previous frame's matching is abundant, the number of features is increased to obtain more sufficient constraints. This adaptive threshold is a switchable preferred branch; when bypassing this branch, a fixed threshold is used for operation.
[0060] After transforming the map points to the target keyframe camera coordinate system, the pixel positions are calculated according to the pinhole imaging model, as shown in equation (4):
[0061]
[0062] In equation (4), before projection, map points with non-positive depth, those falling outside the image, those whose depth exceeds the visible range of the map point, and those with excessively large angles between the line of sight and the normal are removed. For example, take... , , , At that time, , .
[0063] The matching acceptance or rejection is determined by the scaling factor corresponding to the prediction pyramid level, which determines the pixel residual decision radius. The matching is only accepted when the pixel distance between the projected point and the paired feature point does not exceed this radius, as shown in Equation (5):
[0064]
[0065] In equation (5), The projection point obtained by equation (4) Feature points on the target keyframe that are paired by the attention feature matching network The scaling factor corresponding to the pyramid level for this map point in this keyframe is predicted. The decision radius adaptively scales with the prediction level, using a looser radius for matching on smaller, more distant points and a tighter radius for matching on larger, closer points.
[0066] Candidate keyframe admission control is shown in equation (6):
[0067]
[0068] In equation (6), only the number of shared visual words that is strictly greater than 1 is retained. Candidate keyframes are entered into the similarity score, and the current maximum number of shared visual words is used as an adaptive baseline instead of a fixed threshold, so that the leniency of the retrieval automatically changes with the scene repetition.
[0069] The loop closure validity determination gate is shown in equation (7):
[0070]
[0071] Equation (7) gives the complete judgment form when further introducing bag-of-words vector retrieval; the number of inliers reaching the threshold is the basic condition for determining the validity of a loop, and on this basis, the similarity of the bag of words also needs to reach the threshold to avoid misjudgment in perceptual aliasing scenarios based on a single criterion. In the implementation without introducing bag-of-words retrieval, the validity of a loop is determined solely by the number of inliers.
[0072] III. Key Technical Parameters
[0073] The key technical parameters involved in this embodiment are explained as follows: the normalized reference side length is taken as the longer side of the image, which is used as the denominator reference of equation (1); the response value variance compression coefficient. A value of 0.6 is used to control the magnitude of threshold scaling with dispersion; the amplitude of the matching quantity feedback is also used. 0.02 is taken as the maximum reduction of the feedback item; the number of matches reflects the feedback steepness. Taking 0.02 determines the speed of the transition of the feedback item near the inflection point; matching the quantity inflection benchmark. Take 270 as the turning points of the feedback items; pixel residual judgment factor. The value can be 3 to 10 depending on the configuration; values can be set separately for the tracking and loopback phases; shared visual word admission ratio. Set to 0.8; descriptor dimension is set to 128, determined by the lightweight detection-description network; network input size is set to... The target size is scaled for preprocessing; the descriptor distance ratio threshold is set to 0.6 for verifying the nearest and second nearest neighbor distance ratios; the starting keyframe number for loop closure detection is 12, which is a threshold for map immaturity, with an additional 5 set in a stereo configuration; minimum number of interior points. The decision is given by the configuration.
[0074] The above values are merely examples and are not intended to limit the scope of the claims. , , , , , , , The threshold and coefficients are taken from the parameter tuning results and are empirical values that can be adjusted within a given range. Increasing the range allows for more flexible pairing and a higher number of matches, but also increases the risk of mismatches. Decrease and conversely increase; Increasing the value of the feedback term will shift the inflection point to the right. The larger the value, the stricter the candidate admission criteria and the fewer candidates will enter the geometric verification. and A higher value results in a more conservative loop closure determination, a lower false loop closure rate but a higher false negative rate; both should be adjusted in pairs. Camera internal parameters , , , Obtained from camera calibration, , The actual image size is used, and the descriptor dimension and network input size are determined by the selected network model structure.
[0075] IV. First Implementation Example: Indoor Monocular Inertial Configuration
[0076] This embodiment is an indoor corridor and lobby inspection scenario. The camera is equipped with an inertial unit, the movement speed is relatively fast, and there are drastic changes in lighting near the window. The system operates in monocular inertial configuration: Step 1 receives images and inertial data; Step 2 outputs feature points and 128-dimensional descriptors by a lightweight detection-description network, and uses the adaptive threshold branch of Equation (3) to automatically adjust the number of retained feature points according to the dispersion of the current frame response and the number of matches in the previous frame; Step 3 establishes a correspondence with the previous frame using an attention feature matching network, and retains the ratio threshold of the nearest neighbor and second nearest neighbor descriptor distances (taken as 0.6) as a verification of the pairing results; Step 4 completes the matching in the projection neighborhood, and the elimination condition includes that the inner product of the line of sight and the normal of the map point is not less than a certain proportion of the distance, and before using the matching results for pose solving, the length of the matching result array is aligned to the number of feature points in the current keyframe and the length is verified to be consistent; In addition, a hierarchical K-means vocabulary tree is trained with the descriptor and an inverted index is established. During retrieval, the threshold for the number of shared visual words is taken as 0.8 of the current maximum number of shared visual words. First, score the similarity based on the bag-of-words, then sort the candidates based on the cumulative similarity of the co-visual neighbor groups of the candidate keyframes and select the candidates with the highest cumulative scores; step 6 uses inertial pre-integration constraints and visual reprojection error for joint optimization, with the scale given by inertial data under monocular vision.
[0077] In this embodiment, the lightweight detection-description network and the attention feature matching network use Euclidean distance or cosine distance to measure the distance between descriptors, which is different from the Hamming distance of handmade binary features.
[0078] This embodiment was tested on the public dataset EuRoC. Compared with the baseline open source system, the absolute trajectory error was reduced by an average of about 61%. It outperformed the baseline in 9 out of 11 sequences and was about 24% lower than the open source SLAM system with the same learning feature.
[0079] V. Second Implementation Example: Indoor Binocular Inertial Configuration
[0080] This embodiment describes an indoor UAV inspection scenario. The binocular camera baseline is fixed and equipped with an inertial unit, and there are rapid rotations and brief texture loss. The system operates in a binocular inertial configuration. The main difference from the first embodiment lies in the map point generation method: In step 3, in addition to matching between the current frame and the previous frame, and between the current frame and the local map, feature correspondence is established between the left and right images of the same keyframe using the attention feature matching network. Based on this, triangulation is performed to obtain new map points with a true scale, improving the success rate of map point generation in weak texture areas. In step 4, projection neighborhood matching determines the pixel residuals for the left and right eye observations and applies a one-to-one occupancy constraint to the map points. In step 6, the motion constraints obtained from inertial pre-integration and the visual reprojection error are jointly optimized in local bundle adjustment, where the binocular baseline provides a scale reference, and the inertial data further suppresses drift under rapid rotation. In step 5, loop closure and relocalization still use the attention matching verification link.
[0081] This embodiment was tested on the public dataset EuRoC with a binocular inertial configuration. Compared with the baseline open-source system, it achieved lower absolute trajectory error in 6 out of 11 sequences, with an average reduction of about 29%. Compared with the open-source SLAM system with the same learning feature, the error was about 17% lower, with an average absolute trajectory error of 0.025 meters, which was the lowest among all the methods participating in the comparison.
[0082] VI. Third Implementation Example: Relocation and Backtracking Branch After Tracking Loss
[0083] This embodiment describes a close-range scanning scenario using an indoor handheld RGB-D configuration, which involves occlusion, rapid turning, and weakly textured walls. The system operates in RGB-D configuration. When the device turns away from the known map, the number of matches obtained from the projection neighborhood matching in step 4 no longer meets the tracking conditions. Instead of directly re-initializing or losing localization as is the practice in traditional systems, the system directly proceeds to step 5: obtaining candidate keyframes from the keyframe database, establishing a correspondence between the current frame and the candidate frames using an attention feature matching network, and determining the threshold according to equation (7). This embodiment uses the vocabulary tree retrieval method of the first embodiment, so it adopts a double threshold form of the number of interior points and the similarity of the bag of words. After a hit, the system restores the pose of the current frame based on the candidate keyframe and accesses the original map without re-initialization or entering the map merging branch.
[0084] This embodiment also illustrates several branches and deployment details: when the number of map keyframes is less than 12, loop closure detection is not performed and the result is directly output; in the stereo configuration, when the number of keyframes is less than 5, the keyframe is directly inserted into the keyframe database; in the monocular inertial configuration, loop closure detection is not performed before the second stage initialization is completed; the lightweight detection-description network and the attention feature matching network are loaded in independent inference sessions, and a GPU execution provider can be selected and the extended memory allocation strategy can be turned off to avoid memory overflow. The number of threads for feature extraction is determined by the hardware concurrency; when tracking is lost and relocalization fails, if there is a co-view relationship with the adjacent sub-map, map merging is triggered, and deduplication of map points is completed through projection fusion.
[0085] The embodiment was tested on the public dataset TUM RGB-D, and the mean absolute trajectory error was 0.032 meters, which was the lowest among all control methods. The baseline open source system failed to track on some sequences, while this solution worked on all evaluated sequences.
[0086] VII. Technical Effects
[0087] This scheme uses the absolute trajectory error (ATE) as the positioning accuracy evaluation index. This index is the root mean square distance between each point after the estimated trajectory and the actual trajectory are aligned in time. The smaller the value, the higher the positioning accuracy.
[0088] Tests on publicly available datasets show that the indoor monocular inertial configuration reduces the absolute trajectory error by an average of approximately 61% compared to the baseline open-source system; the binocular inertial configuration reduces it by an average of approximately 29%; and the indoor RGB-D configuration has the lowest average absolute trajectory error of 0.032 meters among all control methods. On a publicly available dataset specifically evaluating robustness, our approach achieved the lowest trajectory error in 6 out of 8 sequences. For example, the error was 0.095 meters in the corridor-eng sequence, while the corresponding errors for the control feature-based SLAM methods were 0.282 meters and 0.398 meters, respectively. The baseline open-source system failed in 4 sequences on this dataset, a failure rate of 50%, while our approach had no failed sequences.
[0089] In terms of computational overhead, based on a desktop platform with an Intel i7 processor, an RTX 4070 graphics card, and 16 GB of memory, the baseline open-source system has an average processing time of 19.9 milliseconds per frame, while this solution takes 31.9 milliseconds. This means that an additional 10 milliseconds of overhead is introduced in exchange for an approximately 30% improvement in accuracy, and the runtime is about 20% lower than another control learning feature SLAM system.
[0090] The above embodiments are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent changes or modifications made in accordance with the spirit and essence of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A visual-inertial positioning method, characterized in that, Includes the following steps: Step 1: Acquire image data and inertial measurement data, wherein the image data and inertial measurement data come from any one of five sensor configurations: monocular, monocular inertial, binocular, binocular inertial, and RGB-D. Step 2: A lightweight detection-description network constructed using deformable convolution is used to extract the coordinates and descriptors of feature points, and the coordinates and descriptors of the feature points are used as a feature source shared throughout the entire process; Step 3: After the lightweight detection-description network, an attention feature matching network is connected in series. The pairing result is based on the coordinates of the feature points on both sides and the descriptors on both sides as input and output. This replaces the nearest neighbor descriptor distance matching and is used for inter-frame matching and frame-to-graph matching in the tracking stage, as well as new map point triangulation in the local mapping stage. Step 4: Project map points onto the target keyframe based on the known pose to obtain a projection point set. Remove map points with non-positive depth, those outside the frame, those outside the visible range, and those with excessively large angles between the line of sight and the normal. Record the prediction pyramid level of each retained map point in the target keyframe. Feed the projection point set along with its descriptor and the feature points of the target keyframe along with their descriptors into the attention feature matching network to complete the matching in the projection neighborhood. Determine the pixel residual decision radius according to the scaling factor corresponding to the prediction pyramid level. When the pixel distance between the projection point and the paired feature point does not exceed the decision radius, the match is accepted, and a one-to-one occupancy constraint is applied to the accepted map points. Step 5: Obtain loop closure candidate keyframes from the keyframe database, and use the attention feature matching network to establish a dense feature correspondence between the current keyframe and the loop closure candidate keyframes; Perform pose estimation based on random consistency check on the obtained corresponding points to eliminate outliers; when the number of corresponding inliers reaches a set threshold, the candidate keyframe for loop closure is determined to be a valid loop closure, and the loop closure constraint is added to the pose graph. Step 6: Visual-inertial tight coupling optimization in the form of pre-integration is adopted, which jointly optimizes the motion constraints obtained by integrating inertial measurements between keyframes and the visual reprojection error in local bundle adjustment.
2. The visual-inertial positioning method according to claim 1, characterized in that, Also includes: Using the descriptors output by the lightweight detection-description network as training corpus, hierarchical K-means clustering is performed to construct a hierarchical visual vocabulary and an inverted index is established; The feature points of each keyframe are assigned to the leaf nodes of the vocabulary to form the bag-of-words vector of that keyframe, wherein the leaf nodes of the vocabulary are used as visual words. The loop closure candidate keyframes are retrieved based on the bag-of-words vector and the inverted index.
3. The visual-inertial positioning method according to claim 2, characterized in that, In step 5, bag-of-words matching and attention matching are performed in parallel within the same co-visibility relation group, and the matching results of the two are selected based on the scores. This allows the loop closure and relocation after tracking loss to share the same hybrid location identification link.
4. The visual-inertial positioning method according to claim 1, characterized in that, Step 2 further includes: calculating the mean and variance of the response values of the feature points in the current frame, and calculating a retention threshold based on the number of map points accepted for matching in the previous key frame, retaining only feature points whose response values are not lower than the retention threshold; the feedback term in the retention threshold, which is composed of the number of map points accepted for matching in the previous key frame, increases monotonically with the number of map points accepted for matching in the previous key frame. When the number of map points accepted for matching in the previous key frame is less than a set turning point benchmark, the feedback term approaches zero, and the retention threshold is relatively raised to retain only high response points. When the number of map points is greater than the turning point benchmark, the feedback term approaches a set amplitude, and the retention threshold is relatively lowered to retain more feature points.
5. The visual-inertial positioning method according to claim 2, characterized in that, The process of retrieving the loopback candidate keyframes includes: setting the shared visual word count threshold as a predetermined proportion of the current maximum shared visual word count instead of a fixed value, retaining only candidate keyframes whose shared visual word count with the current keyframe exceeds the threshold for similarity scoring; and first scoring the bag-of-words similarity between the current keyframe and the candidate keyframes, then sorting the candidate keyframes by the cumulative similarity of their co-visual neighbor groups, and selecting the candidate keyframes with the highest cumulative scores as the final candidates.
6. The visual-inertial positioning method according to claim 1, characterized in that, Also includes: When the number of map keyframes is less than the set first threshold, loop closure detection is not performed and the result is output directly; in the stereo configuration, when the number of keyframes is less than the set second threshold, the keyframe is directly inserted into the keyframe database; in the monocular inertial configuration, loop closure detection is not performed before the second stage initialization is completed.
7. The visual-inertial positioning method according to claim 1, characterized in that, The elimination conditions in step 4 also include: the inner product of the line of sight and the normal of the map point is not less than a certain proportion of the distance from the map point to the camera center; step 4 also includes: before using the matching results for pose solving, first align the length of the matching result array to the number of feature points in the current keyframe and verify that the length is consistent. If the length is inconsistent, return zero matching number.
8. The visual-inertial positioning method according to claim 1, characterized in that, The attention feature matching network generates the pairing results based on the similarity between descriptors, and the similarity is measured by Euclidean distance or cosine distance. The lightweight detection-description network in step 2 and the attention feature matching network in step 3 are loaded in independent inference sessions. A GPU execution provider can be selected and the extended memory allocation strategy can be turned off to avoid memory overflow. The number of threads for feature extraction is taken as the hardware concurrency.
9. The visual-inertial positioning method according to claim 1, characterized in that, Also includes: If tracking is lost and relocation fails, map merging is triggered if there is a shared view relationship with an adjacent sub-map. Deduplication of map points is accomplished through projection fusion.
10. A visual inertial positioning system, characterized in that, include: The sensor layer is used to acquire image data and inertial measurement data; The learning feature extraction module is used to extract the coordinates and descriptors of feature points using a lightweight detection-description network constructed with deformable convolutions, and to serve as a shared feature source throughout the entire process; The attention feature matching module is used to pair the feature point coordinates on both sides and the descriptors on both sides as input and output, replacing the nearest neighbor descriptor distance matching. The projection neighborhood matching module is used to project map points onto the target keyframe based on the known pose and complete the matching within the projection neighborhood. It determines the pixel residuals according to the prediction pyramid level and applies a one-to-one occupancy constraint to the map points. The attention geometry verification module is used to establish a dense feature correspondence between the loop closure candidate keyframe and the current keyframe and to determine the valid loop closure through random consistency pose verification. The visual-inertial tightly coupled module is used to jointly optimize the motion constraints obtained by integrating inertial measurements between keyframes and the visual reprojection error in local bundle adjustment.
11. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the visual inertial positioning method as described in any one of claims 1 to 9.
12. A computer-readable storage medium storing computer instructions thereon, characterized in that, When executed by the processor, this instruction implements the steps of the visual inertial positioning method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Visual inertia synchronous positioning and mapping method based on adaptive depth feature enhancement
CN122650919A
Binary descriptor and vocabulary tree fusion retrieval method for visual relocation of unmanned aerial vehicle
CN122760682A
