Visual repositioning method and system
By combining the 2D feature point saliency information screening and the scene coordinate regression network, the PnP algorithm is used to solve the pose, which solves the problems of high computational cost and poor robustness in the existing technology, and achieves efficient and accurate visual relocation.
Patent Information
- Application Number
- CN202410354909.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-27
- Publication Date
- 2024-08-30
AI Technical Summary
Existing visual relocation methods have high computational costs and time costs, and the obtained correspondence relationships are not robust. As the model grows, outlier noise points increase, resulting in an increase in the time cost of the positioning task.
A visual relocation method based on 2D feature point saliency information screening is adopted, the scene coordinate regression network is used to predict 3D scene coordinates, and the pose is solved through the PnP algorithm to reduce invalid calculations and mismatches, and reduce computing resource requirements.
It reduces the calculation and time costs in positioning tasks, improves the accuracy of relocation results, reduces the number of outliers, saves computing resources, and avoids mismatching in traditional methods.
Smart Images

Figure CN118570295A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a visual repositioning method and system. Background Art
[0002] Visual relocalization is the task of calculating the six-degree-of-freedom pose of a given query image in a known environment through visual information. Many structural systems are formed based on the construction of scene models, the matching of environmental information, and the solution of camera pose.
[0003] From the perspective of environmental information matching technology, traditional visual relocalization methods are usually based on 3D structural features, which rely on the 2D to 3D mapping relationship between 2D image positions and 3D scene coordinates. In this type of scheme, the mapping relationship is usually obtained by matching local features, and many matching and filtering techniques have been proposed on this basis, which can achieve efficient and robust urban-scale positioning, such as Active Search (AS).
[0004] In recent years, some researchers have also begun to apply image retrieval technology to visual relocalization. They use 2D (two-dimensional) databases to represent environmental information. The pose recovery of the query image can be directly approximated by the most similar retrieval database image. Since compact image global descriptors are used for matching, image retrieval methods can be extended to very large environments. Among them, the image descriptor can be structure-based or learned using deep neural networks; the retrieval method can be combined with structure-based methods or relative pose estimation to predict more accurate poses.
[0005] However, in actual application deployment, on the one hand, such methods must maintain a 3D model online, resulting in an increase in the requirements for memory and computing resources as the positioning range increases, and the descriptor matching step to obtain the corresponding relationship is also an expensive and time-consuming procedure; on the other hand, the corresponding relationship obtained by such methods is not robust, and as the model grows, the number of outlier noise points also increases, which requires the RANSAC (Random Sample Consensus) algorithm to spend more time, thereby increasing the time cost required for the positioning task. Summary of the invention
[0006] One of the purposes of the present invention is to provide a visual repositioning method to solve the problem of high computational cost and time cost in the prior art; the second purpose is to provide a visual repositioning system.
[0007] In order to achieve the above object, the technical solution adopted by the present invention is as follows: In a first aspect, a visual relocalization method comprises: Select 2D key points based on the saliency information of each 2D feature point in the query image; Using a scene coordinate regression network to predict 3D scene coordinates that match the 2D key points; wherein the scene coordinate regression network completes learning of the 3D scene in an offline stage and introduces a geometric constraint strategy in the offline learning process; A PnP algorithm based on a random sampling consistency scheme is adopted to solve the pose according to the 2D key points and the corresponding 3D scene coordinates to obtain the six-degree-of-freedom pose of the query image.
[0008] In a second aspect, a visual relocalization system is provided, applying the method described in the first aspect, comprising: The key point selection module is used to select 2D key points based on the saliency information of each 2D feature point in the query image; A scene coordinate regression module, which is used to carry a scene coordinate regression network and use the scene coordinate regression network to predict 3D scene coordinates that match the 2D key points; and is also used for offline learning of the 3D scene by the scene coordinate regression network, wherein a geometric constraint strategy is introduced in the offline learning process; The camera pose solving module is used for performing pose solving according to the 2D key points and the corresponding 3D scene coordinates based on the PnP algorithm of the random sampling consistency scheme, and outputting the six-degree-of-freedom pose of the query image.
[0009] Beneficial effects of the present invention: The present invention provides a visual relocation method and system; the method uses saliency information to filter out 2D key points of a query image, thereby reducing the participation of 2D feature points of useless image regions in subsequent calculations, acting as an external point filter, and using a scene coordinate regression network that introduces a geometric constraint strategy in an offline learning process to predict corresponding 3D scene coordinates, effectively avoiding the phenomenon of mismatching in the traditional descriptor matching process, and not requiring the use of a large amount of matching relationships to establish a pose hypothesis pool, and finally performing pose solving based on the PnP algorithm according to the 2D key points and the corresponding 3D scene coordinates to obtain the six-degree-of-freedom pose of the query image. Compared with the prior art, the present invention can reduce the number of outliers in the positioning task and enable the network to learn from some valuable regions in the image, greatly reducing the number of matching pairs and the amount of calculation, saving computing resources, and achieving high precision of the relocation result. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 Schematic diagram of the flow of the visual relocation method in Example 1 of the present invention; Figure 2 A schematic diagram of the process of constructing a saliency training set in Example 1 of the present invention; Figure 3 This is a schematic diagram of the visualization result of the 2D key points selected in Example 1 of the present invention; Figure 4 is another schematic flow chart of the visual relocation method in Embodiment 1 of the present invention; Figure 5 Schematic diagram of the structure of the scene coordinate regression network in Example 1 of the present invention; Figure 6 A schematic diagram of the process of generating conditional parameters in Example 1 of the present invention; Figure 7 This is a schematic diagram of the sparse reconstruction results on the Cambridge landmark dataset Great Court in Example 2 of the present invention; Figure 8 Schematic diagram of the structure of the visual relocation system in Example 3 of the present invention; Fig. 9 Schematic diagram of the hardware entity of the electronic device in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0011] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0012] The drawings are for illustrative purposes only and should not be construed as limiting the present patent; In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; the same or similar reference numerals correspond to the same or similar parts; It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0013] The technical solution of the present invention will be further described below in conjunction with the accompanying drawings and embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.
[0014] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0015] Example 1 This embodiment proposes a visual relocalization method, referring to FIG1 , including: Select 2D key points based on the saliency information of each 2D feature point in the query image; Using a scene coordinate regression network to predict 3D scene coordinates that match the 2D key points; wherein the scene coordinate regression network completes learning of the 3D scene in an offline stage and introduces a geometric constraint strategy in the offline learning process; A PnP (Perspective-n-Point) algorithm based on a random sampling consistency scheme is adopted to solve the pose according to the 2D key points and the corresponding 3D scene coordinates to obtain the six-degree-of-freedom pose of the query image.
[0016] This embodiment proposes a visual relocalization algorithm framework based on salient scene coordinate regression, which selects 2D key points through salient information, and predicts the corresponding 3D scene coordinates through a scene coordinate regression network that introduces a geometric constraint strategy in the offline learning process, which is equivalent to using highly distinguishable image areas to reduce outliers in the positioning task, effectively avoiding the phenomenon of mismatching in the traditional descriptor matching process, and does not require a large number of matching relationships to establish a pose hypothesis pool. Compared with the prior art, this embodiment focuses more on the accuracy of the scene coordinate network itself, adds geometric constraints and matching point pairs after saliency screening, and obtains more accurate positioning results with fewer numbers. It does not require a pose optimization module, and can obtain smaller positioning errors while requiring less calculation, thereby reducing calculation costs and time costs.
[0017] It should be understood that the 2D feature points are pixel points that reflect feature information in an image.
[0018] It should be emphasized that the scene coordinate regression network with added geometric constraints combined with the extraction of 2D key points plays a role in removing outliers in actual performance, so that after obtaining the matching relationship, a pose optimization module similar to DSAC is not needed. Unlike the early absolute pose regressor, which regards the prediction of pose as a regression task and is accompanied by serious overfitting problems, the scene coordinate regression method used in the present invention can effectively avoid the overfitting problem, which makes the migration between scenes and the application of large-scale scenes more accurate.
[0019] In some examples, SR (Spectral Residual), FT (Frequency-tuned) algorithms and / or deep learning methods may be used to obtain saliency information of each 2D feature point.
[0020] In some preferred embodiments, the selection of the 2D key points includes: Extracting a saliency map of the query image using a saliency model; wherein the saliency map includes a plurality of the 2D feature points; Normalizing the pixel values of the saliency map, and obtaining the saliency information of the 2D feature points by using a non-maximum suppression method; The 2D key point is selected from the 2D feature points according to the saliency information and a preset saliency threshold.
[0021] It should be understood that the pixel value is the color intensity of each 2D feature point in the corresponding color channel; In some examples, the saliency map has only a single channel, a black and white channel, that is, a grayscale map, and its pixel values are grayscale values; In some other examples, the saliency map has three channels of red, green, and blue, that is, an RGB map, and its pixel values are RGB values.
[0022] It should be noted that, since the points required in feature point detection are sparse feature points, the higher the pixel value in the normalized image, the greater its saliency information (saliency value).
[0023] In some optional embodiments, referring to FIG. 2 , the training process of the saliency model includes: Acquire a first 2D training image, and extract geometric feature information of the first 2D training image; wherein the geometric feature information includes a plurality of the 2D feature points; Performing semantic segmentation on the first 2D training image to obtain a semantic segmentation result; Using the semantic segmentation result, filtering the geometric feature information based on a preset semantic weight to obtain an initial saliency map; Performing Gaussian blurring on the initial saliency map to obtain a saliency map for training; combining the first 2D training image and the corresponding training saliency map into a saliency training set; An initial saliency model is established, and the saliency model is trained on the saliency training set.
[0024] In some examples, a superpoint algorithm is used to extract geometric feature information of an image.
[0025] In some examples, semantic segmentation is performed on each of the first 2D training images using the global semantic label scores generated by the semantic segmentation network RefineNet, and the semantic segmentation results include semantic masks and semantic categories. For each input image, RefineNet provides instance segmentation of semantic categories such as traffic lights, traffic signs, roads, buildings, sidewalks, parking lots, railroad tracks, fences, bridges, telephone poles, pole groups, vegetation, and terrain. ; The process of filtering the geometric feature information using the semantic segmentation result is as follows:
[0026] In the formula, Represents the semantic mask of interest; Representing the geometric feature information; Represents instances of the semantic category of interest A collection of; represents the preset semantic weight; Denotes the initial saliency map.
[0027] Furthermore, the process of performing Gaussian blurring on the initial saliency map is expressed as: GaussianBlur( , kernel, sigmaX).
[0028] In some examples, DINet is adopted as the saliency model.
[0029] It should be understood that DINet is a saliency model based on deep learning, which can effectively capture background features of different scales, and greatly reduce the computational efficiency by using multiple sets of parallel dilated convolutional networks with different expansion rates, while enriching the diversity of receptive fields in feature maps. The saliency map of the dataset suitable for visual location recognition tasks is obtained by filtering the extracted geometric feature information through the results of semantic segmentation and the saliency model. .
[0030] In some other examples, the ITTI model is used as the saliency model.
[0031] It should be noted that variants of the neural network model described in this embodiment can also be applied to this embodiment.
[0032] In a specific implementation process, the visualization result of the 2D key points selected by the saliency model is as follows: Figure 3 As shown. It should be noted that the points represented in the heat map represent the positions of 2D key points rather than the significance values (i.e., significance information) of the pixels at that position. In the traditional method, all regions in the image are equally important, while the method of the present invention selects the most valuable 2D feature points for positioning from the image region. These feature points are very distinctive, so the significance information plays an important role in the prediction of 2D key points. The significance map predicted by the significance model is spliced with the original image and different weights are given to the significance values, as shown in the left column of Figure 3. It can be seen that the 2D feature points in the figure that are fixed and suitable for positioning tasks such as some buildings and street lights belong to the area of high significance values, that is, the selected 2D key points. The results of the significance value after non-maximum suppression and the original image are projected and analyzed, as shown in the right column of Figure 3. It can be seen that these points all cleverly fall in the area of the edge focus of the building, avoiding low-value areas such as the sky, lawn and pedestrians in the picture.
[0033] In some optional embodiments, the learning process of the scene coordinate regression network includes: Acquire a second 2D training image; wherein at least some pixels in the second 2D training image are annotated with real label information related to the corresponding 3D scene, and the real label information includes real 3D scene coordinates and real category labels; Using the scene coordinate regression network, the pixels in the second 2D training map are classified from coarse to fine levels, a category label is assigned to the pixels, and the 3D scene coordinates of the pixels are predicted; A loss function is established using the real label information, and the scene coordinate regression network is iteratively trained according to the loss function; wherein the loss function is provided with a geometric constraint strategy.
[0034] It should be noted that when the scene coordinate regression network is used online, its input is a combination of a query image and its corresponding 2D key points. In the scene coordinate regression network, classification is performed from coarse to fine levels, category labels are assigned to pixels in the query image, and the corresponding 3D scene coordinates of the 2D key points are predicted as output, see Figure 4.
[0035] It should be understood that the scene coordinate regression network performs both a classification task (i.e., assignment of category labels) and a regression task (i.e., regression of 3D scene coordinates).
[0036] Furthermore, the loss function includes the corresponding weight product of the classification loss function, the regression loss function and the geometric constraint loss function; wherein the corresponding weight of the regression loss function and / or the geometric constraint loss function is greater than the corresponding weight of the classification loss function.
[0037] It should be emphasized that the geometric constraint strategy is the setting of the geometric constraint loss function.
[0038] In some examples, the loss function is expressed as follows:
[0039] In the formula, Represents the corresponding weights of each sub-loss function (i.e., classification loss function, regression loss function, and geometric constraint loss function); Indicates the corresponding The classification loss function of categories; represents the regression loss function; represents the geometric constraint loss function.
[0040] It should be noted that since the regression task still occupies a dominant position in the entire visual relocalization task, followed by the geometric constraint implemented by the reprojection error, and finally the loss function of the classification item, their corresponding weights are also sorted according to their importance.
[0041] In a specific implementation, in the training of the scene coordinate regression network, the weight of the scene classification loss is The value of is set to 1, while the weights of regression loss and geometric constraints It is set to 10. When training the indoor dataset 7Scenes, we used the Adam optimizer with a learning rate of 10-4 for 300,000 iterations and halved the learning rate in the last 200,000 iterations. For the outdoor dataset Cambridge Landmark, 600,000 iterations were performed.
[0042] Furthermore, the real label information also includes a real category label; The classification loss function is defined in the form of cross entropy, and its formula is as follows:
[0043] In the formula, Indicates the corresponding The classification loss function of categories; Indicates Samples corresponding to categories The true category label of Expressing the Samples are predicted as categories The probability value of .
[0044] Furthermore, the regression loss function is defined in the form of Euclidean distance, and its formula is as follows:
[0045] In the formula, represents the regression loss function; Represents the real 3D scene coordinates; Represents the predicted 3D scene coordinates.
[0046] It should be noted that for the regression task, this embodiment minimizes the predicted 3D scene coordinates and real 3D scene coordinates This is performed using the Euclidean distance between .
[0047] Furthermore, during the learning process of the scene coordinate regression network, the pixel points marked with the real 3D scene coordinates are the 2D key points selected using the saliency model and the non-maximum suppression method.
[0048] It should be emphasized that the above embodiment adds a feature point detection process based on saliency information to the relocalization task based on the scene coordinate regression network, and judges the importance of the feature point in the task by the level of saliency information, thereby screening out 2D key points and sending them to the scene coordinate regression network for learning. Experiments show that the method can reduce the number of outliers in the localization task and enable the network to learn from some valuable areas in the image.
[0049] In some examples, the 2D key points are combined with the corresponding images into an intermediate tensor as input to the scene coordinate regression network.
[0050] It should be emphasized that during training and learning, only the salient points (i.e., the 2D key points) with salient values greater than a certain threshold in the saliency map will enter the scene coordinate regression network for learning, and learning to select good features to avoid occlusion and other unreliable areas, such as the sky, streets, trees, bushes, pedestrians, and cars. Feature points are used for relocation tasks. It is similar in online use, and only images and 2D key points will enter the scene coordinate regression network. Therefore, compared with the dense scene coordinate regression network, our algorithm obtains significantly fewer matching pairs and calculations, but the quantity is reduced, and the quality of selection is greatly improved, so that the 3D scene coordinate regression network can only learn from some valuable areas in the image.
[0051] Furthermore, the camera projection equation is introduced into the geometric constraint loss function, and its formula is as follows:
[0052] In the formula, represents the geometric constraint loss function; represents the selected 2D key point; represents the camera projection equation; Indicates the camera internal parameters; Represents the real camera translation parameters; Represents the real camera pose parameters; Represents the predicted 3D scene coordinates.
[0053] It should be noted that the prior art generally uses a differentiable RANSAC model to add a pose optimization process, which obtains a pose hypothesis pool based on the 2D-3D matching relationship established by the previous scene coordinates, and then selects the best pose that meets the model. The method described in this embodiment uses a priori pose and a 3D scene coordinate regression model, adds the camera projection equation to the scene coordinate network to form a geometric constraint, and does not require a pose optimization module, which is very reasonable and has room for development.
[0054] Furthermore, the scene coordinate regression network includes a basic regression network, a classification network and a conditional parameter generation network, see FIG5 ; wherein, The basic regression network is used to extract features from the input image and to regress the 3D scene coordinates of the pixel points; The classification network is used to assign the category labels to the pixels in the input image according to the hierarchy, and transfer the category labels to the conditional parameter generation network; The conditional parameter generation network is used to generate adjustment parameters according to the category label and return them to the basic regression network for 3D scene coordinate regression.
[0055] In some examples, the classification network completes the classification of points in the image from coarse to fine based on K-means (K-means algorithm).
[0056] In some examples, the classification network is provided with two classification layers (coarse-grained layer and fine-grained layer), corresponding to which two category labels, Region Labels (corresponding to a coarse-grained layer) and Subregion Labels (corresponding to a fine-grained layer), are generated; Region Labels corresponds to a coarser classification, which is demonstratively divided into four categories, including road surface, building, obstacle and others; Subregion Labels are more detailed, including vehicles, sidewalks, bus stops, etc. The basic regression network generates Scene Coordinates (i.e., the 3D scene coordinates); It can be understood that the classification branches of the upper two layers use the category label as the final output, and the basic regression layer uses the scene 3D coordinates as the final output. This coarse-to-fine network design, with the support of perfect data, can make the network have a smaller receptive field in the finer output layer, that is, the network can obtain more global information while also distinguishing local information in the deeper feature map, preventing overfitting; In addition, in order to enable the label information (i.e., Region Labels) generated by the coarse-grained layer to be used in the prediction of the fine-grained layer, the conditional parameters are set to generate the network to receive the input of the category label, and then generate two conditional parameters and , which are feature maps with the same dimensions as the input features, and the conditional layer (Cond) applies these two conditional parameters to the output given by the previous convolution layer, see Figure 6, and the way it works is shown in the following formula:
[0057] in Represents the Hadamard product, which is the multiplication of corresponding matrices.
[0058] It should be noted that the conditional parameter generation network all uses 1×1 convolution, which ensures that each pixel is conditioned on its own position label and does not affect the prediction of surrounding pixels.
[0059] In some examples, the basic regression network adopts a VGG-like architecture, and uses ELU instead of ReLU as the activation function of the regression network. It should be emphasized that for scene coordinate regression tasks, ordinary regression networks are trained faster under ReLU, while the network proposed in this embodiment has additional conditional layers and classification branches, and performs better under ELU.
[0060] In a specific implementation process, HSCNet (Hierarchical Scene Coordinate Prediction) is used as the scene coordinate regression network.
[0061] Example 2 In this embodiment, the method proposed in Embodiment 1 is tested on the Cambridge landmarks dataset and the 7Scenes dataset to verify its effectiveness.
[0062] The dataset used includes scenes such as different landmark buildings in the city, as well as changes in weather and light. In addition, the indoor dataset also includes different application scenarios such as offices, kitchens, and living rooms, which can effectively test the algorithm. The operating system is Ubuntu 16.04, the graphics card is NVIDIA GeForce RTX 2070, and the CPU is AMD Ryzen 5-2600 (8GB).
[0063] At the same time, this embodiment also compares the proposed visual relocalization method with some other existing algorithms. Among them, the active search algorithm (AS) is currently the most accurate and representative traditional geometry-based method; PoseNet (pose prediction network) and VLocNet are currently the most accurate methods based on deep learning pose regressors. These two methods directly perform pose regression through prior poses. DSAC++ and DSAC* are algorithms based on deep learning scene coordinate regression. They directly obtain 2D-3D matching relationships and use them for pose solving. However, this type of algorithm does not have a significant mechanism. It believes that all coordinate points obtained through the network are valuable for positioning tasks and brings all matching point pairs obtained in the scene coordinate regression network into a pose optimization module based on differentiable RANSAC for calculation; HSCNet is the baseline algorithm selected in this embodiment. It is a solution that focuses more on the scene coordinate regression network itself, but it does not add significant information. In addition, this embodiment uses HSCNet as the baseline algorithm, and uses the camera's projection equation to establish geometric constraints, and uses significance to guide the establishment of 2D-3D matching relationships.
[0064] The positioning results on the Cambridge landmarks dataset are shown in Table 1, which shows the median positioning error (including translation error and rotation error) of different algorithms in different scenarios on the dataset. In general, the proposed algorithm performs at a leading level in all scenarios.
[0065] Table 1. Cambridge landmark dataset positioning results
[0066] As can be seen from Table 1, the algorithm proposed in Example 1 (referred to as "Ours" in Table 1) has a lower median error than other algorithms in the four scenes of the dataset. In addition, this embodiment uses HSCNet as the baseline. Compared with the baseline, after adding the prediction of 2D key points based on saliency information, the median error of the algorithm is further reduced, which first verifies the effectiveness of the algorithm proposed in this chapter. From the perspective of method category, AS is a traditional structure-based solution. Its main contribution is that it proposes an algorithm for efficiently establishing a 2D-3D matching relationship. Therefore, its overall performance is very good. From the data, this type of algorithm has little difference between the various scenes in the dataset and is generally good. However, due to the need to establish a matching relationship from a huge 3D model, its computing time and memory are not the best choice. For example, AS takes about 400ms to run a frame, while the running time of the algorithm proposed in the present invention is about 20ms.
[0067] The algorithm proposed in the present invention focuses more on the scene coordinate network itself and the selection of 2D key points. Our work shows that the improvement of this single component can improve the positioning performance and exceed the level of previous advanced algorithms in some fields. Compared with traditional algorithms such as AS, this algorithm does not need to maintain the 3D model of the scene and the related feature points and their descriptors online. Therefore, the work that needs to balance the search speed and accuracy in the traditional method will not appear in this algorithm. The algorithm proposed in the present invention directly predicts the significant 2D key points through two neural networks and sends them into the scene coordinate network to calculate the matching 3D scene coordinates, without the need for matching calculations between descriptors. Obviously, this algorithm has a speed advantage. The advantage of deep learning in running speed cannot be ignored, and the directly obtained 2D-3D matching relationship is also more robust. The core of the whole system lies in whether the 3D scene coordinate network can converge in certain scenes. Compared with the direct pose regressor method, our algorithm only learns a part of the entire positioning network. Directly calculating the pose from the camera's pictures is a task that can be accomplished for deep learning, but this task is obviously too complicated, especially the pose solution part. There are too many nonlinear factors, which makes the neural network very easy to fall into overfitting.
[0068] The algorithm used in this example has a good improvement on HSCNet in the four scenes of the data set. The median error of the proposed algorithm in the four scenes is at a small level. Compared with the closest baseline algorithm, the proposed algorithm in this chapter obtains fewer matching points but achieves higher positioning accuracy. The proposed algorithm reconstructs details in some small-scale scenes with dense architectural features such as King's College and Old Hospital, which are significantly better than those in large-scale or sparsely featured scenes such as Shop Facade and Great Court, as shown in Figure 7.
[0069] The positioning results on the indoor dataset 7Scenes are shown in Table 2. First, overall, the translation error of the indoor dataset is one order of magnitude lower than that of the outdoor dataset due to the smaller scene scale, while the difference in rotation error is not much.
[0070] Table 2 Positioning results of 7Scenes dataset
[0071] Specifically, as a traditional method, AS, it can be seen that the algorithm based on the traditional method has actually achieved a very small median error effect, and the gap between it and other algorithms is not large. This is mainly because the scale of feature points in indoor data sets is smaller than that of outdoor scenes, so that the disadvantages of traditional methods are offset by the advantages of the environment. From the perspective of learning-based methods, methods such as PoseNet that learn the entire positioning algorithm process have higher median positioning errors in different scenes than methods that learn part of the method (such as the scene coordinate regression method proposed in the present invention). From the perspective of stability, its average positioning accuracy is also much lower. Although the positioning accuracy of methods based on partial learning in different scenes is a bit different, it is generally better than methods such as PoseNet.
[0072] The method verified in this embodiment (denoted as Ours in Table 2) can obtain the smallest median positioning error in almost every scene on the indoor dataset, and its average positioning accuracy is significantly better than other algorithms. It obtains lower median error and higher average positioning accuracy by virtue of fewer 2D-3D matching relationships. Compared with the baseline algorithm, it increases the screening of significant areas and obtains lower median errors in the 7 scenes of the indoor dataset.
[0073] In addition, in the prior art, NG-RANSAC (Neural-Guided RANSAC) proposes an extension of the classic RANSAC algorithm, which guides the sampling of RANSAC hypotheses by training a network. Through this network, outlier points are given low weights, while inliers are given high weights. This type of method realizes the algorithm architecture of relocalization by combining the architecture of DSAC* for scene regression and NG-RANSAC for pose hypothesis sampling. The method verified in this embodiment focuses more on scene coordinate regression itself, but at the same time uses a saliency model to filter points in the localization task. This process is the same as the purpose of NG-RANSAC to a certain extent. The median localization error of the method verified in this embodiment is compared with that of the NG-RANSAC algorithm on Cambridge landmark data, as shown in Table 3. It can be seen that by using reliable and saliency 2D key points, the method achieves the best localization in the Old Hospital scene, and successfully avoids selecting correspondences that fall on occluded areas, cars, trees, bushes, repeated plane areas, and reflective windows. By learning to avoid these areas in these scenarios, a large number of outlier sources can be avoided, thereby improving the accuracy of positioning.
[0074] Table 3 Comparison of positioning errors of NG-RANSAC algorithm on Cambridge landmark dataset
[0075] It should be understood that the method performs localization by selecting a set of 2D-3D matching points with high discrimination, and the selected 2D key points are located in the highly identifiable parts of the image. This step helps to select a set of minimum number of corresponding points while ensuring a low level of outliers.
[0076] To show the importance of the selected 2D keypoints, the pose localization error is compared by selecting two sets of corresponding points, each with 200 pairs of matching points. The first set is selected from the points with a predicted saliency value above 0.7, while the other is made up of points with a saliency value of 0.4 after non-maximum suppression. This is done by directly running OpenCV's PnP-RANSAC implementation for 100 iterations with a reprojection error of 3px. The results are shown in Table 4.
[0077] Table 4. Localization error of different saliency thresholds on the Cambridge landmark dataset
[0078] It can be seen that the key points selected in the setting one selected in this embodiment basically belong to the reliable area. In most cases, trees, sidewalks, streets, reflective windows and the sky with similar appearance are avoided, which helps the network learn the scenes corresponding to the reliable areas and reliably predict the corresponding three-dimensional coordinates. Therefore, the corresponding positioning error of the algorithm proposed in the present invention will also be reduced. On the contrary, if more significant points fall in the above-mentioned area, it will make it difficult for the network to reliably predict the three-dimensional scene coordinates, which in turn reduces the accuracy of positioning. Compared with DSAC++ and DSAC*, which select thousands of key points, these results further illustrate that it is not the number of matching points that plays a key role in the positioning process, but the quality of the matching points.
[0079] Example 3 This embodiment proposes a visual re-localization system, which applies the method described in Embodiment 1, referring to FIG8 , and includes: The key point selection module is used to select 2D key points based on the saliency information of each 2D feature point in the query image; A scene coordinate regression module, which is used to carry a scene coordinate regression network and use the scene coordinate regression network to predict 3D scene coordinates that match the 2D key points; and is also used for offline learning of the 3D scene by the scene coordinate regression network, wherein a geometric constraint strategy is introduced in the offline learning process; The camera pose solving module is used for performing pose solving according to the 2D key points and the corresponding 3D scene coordinates based on the PnP algorithm of the random sampling consistency scheme, and outputting the six-degree-of-freedom pose of the query image.
[0080] It can be understood that the options in the aforementioned embodiments are also applicable to this embodiment.
[0081] Example 4 This embodiment proposes a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor, so that the processor executes part or all of the steps of the method described in Example 1.
[0082] It is understood that the storage medium may be transient or non-transient. Exemplarily, the storage medium includes, but is not limited to, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0083] In some examples, a computer program product is provided, which can be implemented in hardware, software or a combination thereof. As a non-limiting example, the computer program product can be embodied as the storage medium, or as a software product, such as an SDK (Software Development Kit).
[0084] In some examples, a computer program is provided, comprising a computer-readable code, and when the computer-readable code is run in a computer device, a processor in the computer device executes a part or all of the steps in the method.
[0085] In a specific implementation process, all or part of the modules of the computer program are implemented using the algorithm interface of OpenCV.
[0086] This embodiment also proposes an electronic device, refer to Figure 9, including a memory and a processor, the memory stores at least one instruction, at least one program, code set or instruction set, and the processor implements part or all of the steps of the method described in Example 1 when executing the at least one instruction, at least one program, code set or instruction set.
[0087] Exemplarily, the electronic device may be installed on the vehicle side in the form of an on-board electronic device.
[0088] Exemplarily, the processor may be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA).
[0089] In some examples, a hardware entity of the electronic device is provided, including: a processor, a memory, and a communication interface; wherein the processor generally controls the overall operation of the electronic device; The communication interface is used to enable the electronic device to communicate with other terminals or servers through a network; The memory is configured to store instructions and applications executable by the processor, and can also cache data to be processed or processed by the processor and various modules in the electronic device (including but not limited to image data, audio data, voice communication data and video communication data), which can be implemented through flash memory (FLASH) or random access memory (RAM).
[0090] Furthermore, data may be transmitted between the processor, the communication interface and the memory via a bus, which may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together.
[0091] It can be understood that the options in the above-mentioned embodiment 1 or embodiment 2 are also applicable to this embodiment, so they are not described again here.
[0092] Obviously, the above embodiments of the present invention are only examples for clearly illustrating the present invention, and are not intended to limit the implementation methods of the present invention. It should be understood that in various embodiments of the present disclosure, the size of the sequence numbers of the above steps / processes does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment. It should also be understood that the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms. For ordinary technicians in the field, other different forms of changes or modifications can be made on the basis of the above description. It is not necessary and impossible to list all the implementation methods here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A visual relocalization method, characterized in that: include: Select 2D key points based on the saliency information of each 2D feature point in the query image; Using a scene coordinate regression network to predict 3D scene coordinates that match the 2D key points; wherein the scene coordinate regression network completes learning of the 3D scene in an offline stage and introduces a geometric constraint strategy in the offline learning process; A PnP algorithm based on a random sampling consistency scheme is adopted to solve the pose according to the 2D key points and the corresponding 3D scene coordinates to obtain the six-degree-of-freedom pose of the query image.
2. A visual relocation method according to claim 1, characterized in that: The selection of the 2D key points includes: Extracting a saliency map of the query image using a saliency model; wherein the saliency map includes a plurality of the 2D feature points; Normalizing the pixel values of the saliency map, and obtaining the saliency information of the 2D feature points by using a non-maximum suppression method; The 2D key point is selected from the 2D feature points according to the saliency information and a preset saliency threshold.
3. A visual relocation method according to claim 2, characterized in that: The training process of the saliency model includes: Acquire a first 2D training image, and extract geometric feature information of the first 2D training image; wherein the geometric feature information includes a plurality of the 2D feature points; Performing semantic segmentation on the first 2D training image to obtain a semantic segmentation result; Using the semantic segmentation result, filtering the geometric feature information based on a preset semantic weight to obtain an initial saliency map; Performing Gaussian blurring on the initial saliency map to obtain a saliency map for training; combining the first 2D training image and the corresponding training saliency map into a saliency training set; An initial saliency model is established, and the saliency model is trained on the saliency training set.
4. A visual relocation method according to claim 2, characterized in that: The learning process of the scene coordinate regression network includes: Acquire a second 2D training image; wherein at least some pixels in the second 2D training image are annotated with real label information related to the corresponding 3D scene, and the real label information includes real 3D scene coordinates and real category labels; Using the scene coordinate regression network to classify the pixels in the second 2D training map from coarse to fine levels, assigning category labels to the pixels, and predicting the 3D scene coordinates of the pixels; A loss function is established using the real label information, and the scene coordinate regression network is iteratively trained according to the loss function; wherein the loss function is provided with a geometric constraint strategy.
5. A visual relocation method according to claim 4, characterized in that: The loss function includes the corresponding weight product of the classification loss function, the regression loss function and the geometric constraint loss function; wherein the corresponding weight of the regression loss function and / or the geometric constraint loss function is greater than the corresponding weight of the classification loss function.
6. A visual relocation method according to claim 5, characterized in that: Include at least one of the following: (1) The real label information also includes the real category label; The classification loss function is defined in the form of cross entropy, and its formula is as follows: In the formula, Indicates the corresponding The classification loss function of categories; Indicates Samples corresponding to categories The true category label of Indicates Samples are predicted as categories The probability value of . (2) The regression loss function is defined in the form of Euclidean distance, and its formula is as follows: In the formula, represents the regression loss function; Represents the real 3D scene coordinates; Represents the predicted 3D scene coordinates.
7. A visual relocation method according to claim 5, characterized in that: During the learning process of the scene coordinate regression network, the pixel points marked with the real 3D scene coordinates are the 2D key points selected using the saliency model and the non-maximum suppression method.
8. A visual relocation method according to claim 7, characterized in that: The camera projection equation is introduced into the geometric constraint loss function, and its formula is as follows: In the formula, represents the geometric constraint loss function; represents the selected 2D key point; represents the camera projection equation; Indicates the camera internal parameters; Represents the real camera translation parameters; Represents the real camera pose parameters; Represents the predicted 3D scene coordinates.
9. A relocation method according to any one of claims 4 to 8, characterized in that: The scene coordinate regression network includes a basic regression network, a classification network and a conditional parameter generation network; wherein, The basic regression network is used to extract features from the input image and to regress the 3D scene coordinates of the pixel points; The classification network is used to assign the category labels to the pixels in the input image according to the hierarchy, and transfer the category labels to the conditional parameter generation network; The conditional parameter generation network is used to generate adjustment parameters according to the category label and return them to the basic regression network for 3D scene coordinate regression.
10. A visual relocation system, using the method according to any one of claims 1 to 9, characterized in that: include: The key point selection module is used to select 2D key points based on the saliency information of each 2D feature point in the query image; A scene coordinate regression module, which is used to carry a scene coordinate regression network and use the scene coordinate regression network to predict 3D scene coordinates that match the 2D key points; and is also used for offline learning of the 3D scene by the scene coordinate regression network, wherein a geometric constraint strategy is introduced in the offline learning process; The camera pose solving module is used for performing pose solving according to the 2D key points and the corresponding 3D scene coordinates based on the PnP algorithm of the random sampling consistency scheme, and outputting the six-degree-of-freedom pose of the query image.
Citation Information
Patent Citations
Deep learning and geometric algorithm combined non-cooperative target relative pose estimation method
CN111862126A
Safe driving monitoring method using feature adaptive weighting
CN114241456A
Visual positioning method for assisting airport unmanned vehicle based on meta-learning
CN115615446A
Visual positioning method and system based on multi-feature fusion
CN116843754A
Visual relocation method based on saliency scene coordinate regression
CN120147419A
Cited By
Camera repositioning method based on key point guidance
CN119323601A
Scene coordinate regression network training method, scene coordinate regression network positioning method and scene coordinate regression network training device
CN120976314A
