Robot tracking method, system, storage medium and electronic device based on slam
By storing the mapping relationship between image frames and target grids in the SLAM system and using feature extraction and matching networks, the problems of time-consuming and error-prone keyframe search are solved, and fast and accurate robot localization and map building are achieved.
Patent Information
- Application Number
- CN202310576958.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-19
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-05-19
AI Technical Summary
Existing SLAM technology suffers from time-consuming bag-of-words search and inaccurate candidate keyframes when there are many keyframes, resulting in large cumulative errors in map construction.
During path tracking, the relevant information of the stored image frames is mapped to the target grid. Keyframes are quickly determined through the mapping relationship. The offset value is calculated using a pre-trained feature extraction and matching network to construct a 3D map.
It reduces the search time and cumulative error of keyframes, improves the accuracy of keyframes, and enhances the precision of robot localization and the accuracy of map construction.
Smart Images

Figure CN116597330B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a SLAM-based robot tracking method, system, storage medium, and electronic device. Background Technology
[0002] Drones, intelligent robots, and other devices typically use SLAM (Simultaneous Localization and Mapping) technology to track and locate their own position based on sensor data during movement and to build a three-dimensional map of the environment.
[0003] Currently, related technologies use descriptors output by the SuperPoint network to train a bag-of-words system. During tracking and localization, the bag-of-words system can find a set of candidate keyframes with the same feature descriptors, and the system can locate its own position based on this set of candidate keyframes. However, when the number of keyframes is large, the bag-of-words search time increases significantly, and the candidate keyframes found are inaccurate, thus increasing the cumulative error in map construction. Summary of the Invention
[0004] This application provides a SLAM-based robot tracking method, system, storage medium, and electronic device. To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general description, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its sole purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.
[0005] In a first aspect, embodiments of this application provide a SLAM-based robot tracking method, the method comprising:
[0006] During path tracking, the current image frame at the current location point and the previous key frame at the previous location point are obtained.
[0007] Based on the current image frame and the previous keyframe, the target grid to which the current positioning point belongs is determined from the multiple grids included in the two-dimensional map of the robot's current environment.
[0008] Use the current image frame as the keyframe at the current location point, and store the relevant information of the current image frame and the mapping relationship between it and the target mesh.
[0009] Optionally, based on the current image frame and the previous keyframe, the target grid to which the current positioning point belongs is determined from multiple grids included in the 2D map of the robot's current environment, including:
[0010] Calculate the position information corresponding to the current image frame based on the current image frame and the previous keyframe;
[0011] The target grid to which the location information belongs is determined from multiple grids divided by a two-dimensional map of the robot's current environment;
[0012] Use the target grid to which the location information belongs as the target grid to which the current location point belongs.
[0013] Optionally, based on the current image frame and the previous keyframe, calculate the position information corresponding to the current image frame, including:
[0014] Input the current image frame and the previous keyframe into a pre-trained feature extraction network, and output the feature points and descriptors corresponding to the current image frame and the previous keyframe;
[0015] Input the feature points and descriptors corresponding to the current image frame and the previous keyframe into a pre-trained feature matching network, and output the matching result between the current image frame and the previous keyframe;
[0016] Based on the matching results between the current image frame and the previous keyframe, determine the target matching point pair between the current image frame and the previous keyframe;
[0017] If the number of target matching point pairs is greater than a preset threshold, the offset value of the current image frame relative to the previous keyframe is calculated based on each matching point pair.
[0018] Based on the offset value, calculate the position information corresponding to the current image frame.
[0019] Optionally, the feature matching network includes an attention map neural network and an optimal matching layer, wherein the optimal matching layer includes the Dual-Softmax algorithm;
[0020] The feature points and descriptors corresponding to the current image frame and the previous keyframe are input into a pre-trained feature matching network, which outputs the matching results between the current image frame and the previous keyframe, including:
[0021] The feature vector matrix is obtained by encoding the feature points and descriptors corresponding to the current image frame and the previous keyframe through an attention map neural network.
[0022] The matching result score matrix of the feature vector matrix is calculated by using the Dual-Softmax algorithm through the best matching layer, so as to obtain the matching result between the current image frame and the previous keyframe.
[0023] Optionally, each pair of matching points includes a first matching feature point and a second matching feature point; the first matching feature point belongs to the current image frame, and the second matching feature point belongs to the previous keyframe.
[0024] For each matching point pair, the offset value of the current image frame relative to the previous keyframe is calculated, including:
[0025] From each pair of matching points, select the matching point pairs with map points corresponding to the second matching feature point. The map points are map points in the 3D map constructed during the path tracking process.
[0026] Based on the coordinates of the first matching feature point in the current image frame and the coordinates of the second matching feature point in the previous keyframe of each selected matching point pair, the rotation and displacement of each selected matching point pair are calculated respectively.
[0027] Based on rotation and displacement, the offset of the current image frame relative to the previous keyframe is calculated.
[0028] Optionally, the method also includes:
[0029] Determine the matching point pair to which the second matching feature point belongs if there is no map point;
[0030] Map points are constructed based on the first and second matching feature points in the matching point pairs to which the second matching feature point to which no map point exists;
[0031] Add the constructed map points to the set of 3D map points in the robot's current environment.
[0032] Optionally, the target grid to which the location information belongs can be determined from multiple grids divided from the two-dimensional map of the robot's current environment, including:
[0033] In the mapping relationship, determine the first grid corresponding to the keyframe information of the previous keyframe;
[0034] Based on the grid position of the first grid and the position information corresponding to the current image frame, the target grid to which the position information belongs is determined.
[0035] Optionally, the method also includes:
[0036] If the number of target matching point pairs is less than or equal to a preset threshold, read the target movement distance saved in the robot chassis data at the time closest to the current time.
[0037] Determine the robot's current actual position based on the target movement distance;
[0038] The robot's current actual position is used as the position information corresponding to the previous keyframe, and the position information corresponding to the previous keyframe is used as the initial position for robot initialization. After the initialization is completed, path tracking continues.
[0039] Optionally, before obtaining the current image frame at the current location point and the previously determined keyframe at the previous location point, the method further includes:
[0040] In response to the robot power-on command, read the robot's historical position saved at the last power-off moment;
[0041] In a two-dimensional map of the robot's current environment, identify multiple target map grids in the neighborhood of the robot's historical location;
[0042] Obtain the keyframes corresponding to each target map grid;
[0043] The robot's current position information is determined based on the keyframes corresponding to each target map grid and the currently acquired image frames;
[0044] The currently acquired image frame is used as a keyframe, and the mapping relationship between the relevant information of the currently acquired image frame and the grid to which the current location information belongs is stored.
[0045] Optionally, in a two-dimensional map of the robot's current environment, determine multiple target map grids in the neighborhood of the robot's historical location, including:
[0046] In the two-dimensional map of the robot's current environment, determine the map grid corresponding to the robot's historical position, and take the position point of the map grid corresponding to the robot's historical position as the center point;
[0047] Based on the preset scanning radius, multiple map grids around the center point are scanned in the two-dimensional map of the robot's current environment to obtain multiple target map grids in the neighborhood.
[0048] Secondly, embodiments of this application provide a SLAM-based robot tracking system, the system comprising:
[0049] An image sensor is used to acquire the current image frame at the current location point and the previous key frame at the previous location point during path tracking.
[0050] The processor is used to determine the target grid to which the current positioning point belongs from multiple grids in the two-dimensional map of the robot's current environment, based on the current image frame and the previous keyframe.
[0051] The memory is used to use the current image frame as the keyframe at the current positioning point and to store the relevant information of the current image frame and the mapping relationship between it and the target grid.
[0052] Thirdly, embodiments of this application provide a computer storage medium storing multiple instructions adapted for loading and execution of the above-described method steps by a processor.
[0053] Fourthly, embodiments of this application provide an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed by the above-described method steps.
[0054] The technical solutions provided in this application embodiment may include the following beneficial effects:
[0055] In this embodiment, the application stores the mapping relationship between the relevant information of the image frame and the target grid during the tracking process. Therefore, in the subsequent tracking process, the relevant information of an image frame is determined in the mapping relationship through the target grid where the robot is located, and then the key frame is obtained. At this time, the search time for the relevant information of an image frame is short, which reduces the search time of the key frame. At the same time, the accuracy of the single key frame is high, thereby reducing the cumulative error of map construction.
[0056] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0057] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0058] Figure 1 This is a flowchart illustrating a SLAM-based robot tracking method provided in an embodiment of this application;
[0059] Figure 2 This is a schematic diagram of the network structure of a pre-trained feature extraction network provided in this application;
[0060] Figure 3 This is a schematic diagram of the network structure of a pre-trained feature matching network provided in this application;
[0061] Figure 4 This is a schematic diagram of a matching point pair provided in this application;
[0062] Figure 5 This is a schematic block diagram illustrating a SLAM-based robot tracking process provided in an embodiment of this application.
[0063] Figure 6 This is a schematic diagram of the structure of a SLAM-based robot tracking system provided in an embodiment of this application;
[0064] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0065] The following description and accompanying drawings fully illustrate specific embodiments of this application to enable those skilled in the art to practice them.
[0066] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0067] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of systems and methods consistent with some aspects of this application as detailed in the appended claims.
[0068] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0069] Currently, related technologies use the descriptors output by the SuperPoint network to train a bag of words. During the tracking and localization process, the bag of words can be used to find a set of candidate keyframes with the same feature descriptors, and the location can be determined based on the set of candidate keyframes.
[0070] The inventors of this application have noticed that during robot tracking, a set of candidate keyframes with the same feature descriptors can be found through the bag-of-words method. When the number of keyframes in this set is large, the time consumed by the bag-of-words search will increase significantly. At the same time, the candidate keyframes found are inaccurate, thereby increasing the cumulative error of map construction.
[0071] To address the issues of long keyframe search time and large cumulative errors in map construction, the inventors of this application discovered that during the tracking process, the mapping relationship between relevant information of image frames and target grids is stored. In subsequent tracking processes, the relevant information of an image frame is determined through this mapping relationship using the target grid where the robot is located, thereby obtaining a keyframe. In this case, the search time for relevant information of an image frame is short, reducing the search time for keyframes. At the same time, the accuracy of a unique keyframe is high, reducing the cumulative errors in map construction.
[0072] This application provides a SLAM-based robot tracking method, system, storage medium, and electronic device to solve the problems existing in the aforementioned related technologies. The following will be discussed in conjunction with the appendix... Figure 1 - Appendix Figure 5 This application provides a detailed description of the SLAM-based robot tracking method provided in its embodiments. This method can be implemented using a computer program and can run on a SLAM-based robot tracking system based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone utility application.
[0073] Please see Figure 1 This document provides a flowchart illustrating a SLAM-based robot tracking method as described in an embodiment of this application. Figure 1 As shown, the method in this application embodiment may include the following steps:
[0074] S101, During the path tracking process, acquire the current image frame at the current positioning point and the previous key frame that has been determined at the previous positioning point.
[0075] Here, the current location point is the actual position of the robot on the 3D map of its environment after moving a preset distance based on the previous keypoint. The current image frame is an image captured by the robot's camera at the actual location point. The previous keyframe can be determined by the grid position of the previous keypoint.
[0076] In this embodiment of the application, when determining the current positioning point, the position of the previous key point is first obtained, and then the movement distance recorded in the chassis data is read. This movement distance is the robot movement distance between the acquisition of the previous key frame and the acquisition of the current image frame. Finally, based on the position of the previous key point and the movement distance, the position of the current positioning point is determined.
[0077] In this embodiment of the application, when determining the previous keyframe, the first grid of the two-dimensional map of the robot's environment is first determined. Then, the relevant information of the image frame corresponding to the first grid can be determined from the pre-constructed mapping relationship between the relevant information of the image frame and the grid. Next, the image frame is obtained as the previous keyframe based on the relevant information of the image frame.
[0078] In one possible implementation, during the tracking process, the robot can acquire the current image frame at the current location point and the previous keyframe that has been determined at the previous location point.
[0079] S102, Based on the current image frame and the previous keyframe, determine the target grid to which the current positioning point belongs from the multiple grids included in the two-dimensional map of the robot's current environment;
[0080] In this embodiment, when determining the target grid to which the current positioning point belongs from multiple grids in the 2D map of the robot's current environment based on the current image frame and the previous keyframe, the location information corresponding to the current image frame is first calculated based on the current image frame and the previous keyframe. Then, the target grid to which the location information belongs is determined from the multiple grids in the 2D map of the robot's current environment. Finally, the target grid to which the location information belongs is taken as the target grid to which the current positioning point belongs. This application can quickly calculate the location information of the current image frame using the current image frame and the previous keyframe, avoiding the need for the robot to locate itself using hardware sensors, thereby reducing the robot's positioning cost.
[0081] In this embodiment, when calculating the position information corresponding to the current image frame based on the current image frame and the previous keyframe, the current image frame and the previous keyframe are first input into a pre-trained feature extraction network, which outputs the feature points and descriptors corresponding to the current image frame and the previous keyframe. Then, the feature points and descriptors corresponding to the current image frame and the previous keyframe are input into a pre-trained feature matching network, which outputs the matching result corresponding to the current image frame and the previous keyframe. Next, based on the matching result corresponding to the current image frame and the previous keyframe, the target matching point pairs between the current image frame and the previous keyframe are determined. If the number of target matching point pairs is greater than a preset threshold, the offset value of the current image frame relative to the previous keyframe is calculated based on each matching point pair. Finally, based on the offset value, the position information corresponding to the current image frame is calculated. The pre-trained feature matching network can accurately determine the matching and unmatched feature points, thereby avoiding the mismatch problem that occurs when judging whether they are the same feature point by the distance of descriptors in the prior art, thus improving the accuracy of image matching.
[0082] Specifically, the pre-trained feature extraction network is the SuperPoint network, and its structure is as follows: Figure 2As shown, the current image frame and the previous keyframe are first encoded by the encoder. Then, after processing by the feature point decoder and descriptor decoder, the feature points and descriptors corresponding to the current image frame and the previous keyframe are obtained. A self-supervised training method is used when training the SuperPoint network. For example, during training, basic shape elements are first used as the training set to train the basic model MagicPoint. Then, each image in the real image dataset undergoes n homography transformations (including cropping, translation, scaling, rotation, etc.) to obtain n transformed images. Next, MagicPoint is used to extract feature points from the transformed images, and then the transformation is reversed and mapped back to obtain the final feature point image. The feature points at each position are then filtered by thresholding to obtain the generated dataset. Finally, the generated dataset is used to train SuperPoint to obtain the final network model.
[0083] Specifically, the pre-trained feature matching network is a SuperGlue network, which includes an attention map neural network and an optimal matching layer. The optimal matching layer uses the Dual-Softmax algorithm. The network structure is as follows: Figure 3 As shown, the specific processing procedure of the SuperGlue network is as follows: The feature points and descriptors corresponding to the current image frame and the previous keyframe are encoded using an attention map neural network to obtain a feature vector matrix; the matching result score matrix of the feature vector matrix is calculated using the Dual-Softmax algorithm through the optimal matching layer to obtain the matching result between the current image frame and the previous keyframe. In this application, the Sinkhorn algorithm in the optimal matching layer of the prior art is modified to a simpler Dual-Softmax algorithm. Since the loss in the Dual-Softmax algorithm is based on symmetric cross-entropy loss, the Softmax Loss is calculated from both the row and column directions of the matrix to improve the final matching accuracy and reduce the number of mismatches.
[0084] In this embodiment, when determining the target matching point pair between the current image frame and the previous keyframe based on the matching result corresponding to the current image frame and the previous keyframe, the matching result is a score matrix. The rows and columns of this matrix represent the feature points of the two input images (e.g., the current image frame and the previous keyframe). The entire matrix represents the matching score between each feature point in the first input image and each feature point in the second input image. For example, a cell (i, j) in the matrix represents the matching score between feature point i in the first image and feature point j in the second image. By setting a score threshold, point pairs higher than the threshold are considered matching points, while point pairs lower than the threshold are not matching points. Finally, all point pairs higher than the threshold are taken as the target matching point pairs between the current image frame and the previous keyframe.
[0085] In this embodiment of the application, each matching point pair includes a first matching feature point and a second matching feature point; the first matching feature point belongs to the current image frame, and the second matching feature point belongs to the previous keyframe.
[0086] Specifically, when calculating the offset of the current image frame relative to the previous keyframe based on each matching point pair, firstly, matching point pairs with map points corresponding to the second matching feature point are selected from each pair. These map points are map points in the 3D map constructed during path tracking. Then, based on the coordinates of the first matching feature point in the current image frame and the coordinates of the second matching feature point in the previous keyframe for each selected pair, the rotation and displacement of each selected pair are calculated. Finally, based on the rotation and displacement, the offset of the current image frame relative to the previous keyframe is calculated. This application can quickly calculate the offset of the current image frame relative to the previous keyframe by selecting matching point pairs with map points corresponding to the second matching feature point.
[0087] For example, suppose that in a certain pair of matching points, feature point i in the current image frame and feature point j in the previous keyframe are a matching pair, and feature point j has a corresponding map point m. This means that feature point i also corresponds to map point m. By using the pixel positions of feature points i and j in the current image frame and the previous keyframe among these multiple matching points, the offset value of the current image frame relative to the previous keyframe can be accurately calculated, thus obtaining the position (x, y) of the current frame in the real world, i.e., the robot's position in the real world is (x, y). The calculated position is compared with the chassis movement data, and the chassis data is corrected based on the difference between the two.
[0088] Furthermore, in some matching point pairs, the second matching feature point does not correspond to a map point. A map can be constructed using such matching point pairs. First, the matching point pairs to which the second matching feature point to which the map point does not exist are identified. Then, based on the first and second matching feature points in the matching point pairs to which the second matching feature point to which the map point does not exist, map points are constructed. Finally, the constructed map points are added to the 3D map point set of the robot's current environment. The map points can be constructed using triangulation. This application constructs map points using matching point pairs to which the second matching feature point to which the map point does not exist, enriching existing 3D map information and making the 3D map of the robot's environment more detailed, thus improving the accuracy of robot navigation.
[0089] For example Figure 4As shown, K1-K7 are target matching point pairs between the current image frame and the previous keyframe. In this case, the second matching feature points belonging to the previous keyframe in target matching point pairs K2 and K3 correspond to map points. The position information corresponding to the current image frame can be calculated based on K2 and K3. The second matching feature points belonging to the previous keyframe in target matching point pairs K1 and K4-K7 do not correspond to map points. In this case, map points can be established based on target matching point pairs K1 and K4-K7, combined with triangulation (a basic mathematical calculation method commonly used in SLAM).
[0090] In one possible implementation, when determining the target grid to which the location information belongs from multiple grids divided from a two-dimensional map of the robot's current environment, the first grid corresponding to the keyframe information of the previous keyframe is first determined in the mapping relationship; then, based on the grid position of the first grid and the location information corresponding to the current image frame, the target grid to which the location information belongs is determined. This application, through a pre-established mapping relationship between image information of image frames and grids, can quickly determine the target grid to which the location information belongs, reducing the time spent determining the target grid and improving the robot's responsiveness.
[0091] In another possible implementation, when determining the target grid to which the location information belongs from multiple grids divided from the two-dimensional map of the robot's current environment, since the location range of each grid is determined after the two-dimensional map is divided into grids, after obtaining the current location information, the location range of the grid to which the location information is located is determined, and the grid in that location range is determined as the target grid to which the location information belongs.
[0092] In this embodiment of the application, during the SLAM system tracking process, when encountering significant changes in spatial information in a particular scene, such as a robot moving from the living room to another room, the feature point matching between the current image frame and the previous keyframe may become scarce or nonexistent. In this case, tracking can be performed using pre-saved chassis information to prevent tracking interruption. Specifically, the process is as follows: First, if the number of target matching point pairs is less than or equal to a preset threshold, the target movement distance saved in the robot chassis data at the closest possible moment is read; then, based on the target movement distance, the robot's current actual position is determined; finally, the robot's current actual position is used as the position information corresponding to the previous keyframe, and the position information corresponding to the previous keyframe is used as the initial position for robot initialization; and after the initialization is completed, path tracking continues.
[0093] The chassis movement data is continuously corrected based on the calculation results of the SLAM system, thus maintaining a high level of accuracy during normal operation. When the SLAM system loses tracking, it immediately reads the chassis movement data and uses this data as the robot's position in the real world at that moment. This position is then used as the initial position, and the robot is re-initialized. After initialization, it re-enters tracking mode. Because both initializations use chassis movement data, the 3D coordinates of the map points established by the two initializations have a correct correspondence, preventing significant errors that could lead to 3D map inaccuracies.
[0094] In this embodiment of the application, when performing robot initialization, the environmental range of the robot's movement is first input into the entire SLAM system. The SLAM system will automatically divide the environmental range into multiple small intervals. After the robot starts, the camera on the robot will capture the first image frame at the starting position p1. Then, after the robot moves a small distance, it will capture the second image frame at position p2. Then, the initialization is performed based on these two image frames.
[0095] The initialization process involves: acquiring and dividing the map of the robot's operating area into multiple sub-regions; acquiring the first image frame P1 captured upon startup, and the second image frame P2 captured while controlling the robot to move a preset distance; inputting the first image frame P1 and the second image frame P2 into a pre-trained feature extraction network, which outputs the feature points and descriptors corresponding to the first image frame P1 and the second image frame P2; and inputting the feature points and descriptors corresponding to the first image frame P1 and the second image frame P2 into a pre-trained feature matching network, which outputs the matching results corresponding to the first image frame P1 and the second image frame P2. After obtaining the matching results, the distance d that the robot moved when acquiring these two image frames can be obtained based on the data of the robot's chassis wheels, i.e., the distance between p1 and p2. After determining the matching points between the two image frames through the matching results, the distance d between p1 and p2 is used as a scale to construct map points through triangulation (a basic mathematical calculation method commonly used in SLAM), thus obtaining a 3D map of the robot's environment.
[0096] Furthermore, after obtaining the 3D map, the actual positions of the first and second robots corresponding to the first and second image frames are determined, and the first grid corresponding to the first image frame is determined based on the actual position of the first robot, and the second grid corresponding to the second image frame is determined based on the actual position of the second robot; the image frames of the first and second image frames are used as the first and second keyframes, and the mapping relationship between the relevant information of the first image frame and the first grid is stored, and the mapping relationship between the relevant information of the second image frame and the second grid is stored.
[0097] Among them, map points refer to the three-dimensional points in the real world space obtained by the above calculations of feature points in the image frame. The coordinates of this three-dimensional point can represent the position information of a certain point in the three-dimensional space. After obtaining multiple map points, a coarse-grained three-dimensional map can be described. A three-dimensional map refers to using multiple map points to represent a three-dimensional space. The three-dimensional coordinates of the map points are used to describe the position and outline of various objects in the real world in the system.
[0098] Specifically, when determining the actual positions of the first and second robots corresponding to the first and second image frames, assuming the position of the first image frame on the large map is set to (0, 0), the position point (x1, y1) of the second image frame can be obtained based on the distance d traveled. 2 +1 2 = 2 Assuming that the location point (0, 0) is located in the center of the large map, the location of the cell where the location point (x1, y1) is located can be calculated based on the set cell size.
[0099] For example, assuming the grid size is set to 1m×1m, and the grid coordinates of the position point (0,0) are (100,100), then the grid index of the position point (x1,y1) is (100+(x1 / 1),100+(y1 / 1)), and the results of x1 / 1 and y1 / 1 are rounded down.
[0100] S103, use the current image frame as the key frame at the current positioning point, and store the relevant information of the current image frame and the mapping relationship between the target grid.
[0101] In this embodiment of the application, the current image frame is used as the key frame at the current positioning point. The key frame can be stored in the storage space. Subsequently, the key frame can be directly queried in the storage space based on the relevant information of the image frame. Then, the mapping relationship between the relevant information of the current image frame and the target grid is stored.
[0102] Therefore, after the robot has traversed the entire 3D map of its operating environment, each map grid records different keyframe information. This allows for the direct reading of keyframes to calculate the robot's actual position during subsequent restarts after shutdown, such as in relocalization scenarios.
[0103] In this embodiment, when the robot is powered off and then powered on again, the previously saved last position data (x1, y1) is read first. If the robot was moved a distance to (x2, y2) when it was powered off, the recorded position will not match the actual position, resulting in a positioning error. Therefore, the robot needs to be repositioned upon powering on again. The specific steps of repositioning are as follows: First, in response to the robot's power-on command, the robot's historical position saved at the last power-off moment is read; then, in the two-dimensional map of the robot's current environment, multiple target map grids in the vicinity of the robot's historical position are determined; second, the keyframes corresponding to each target map grid are obtained; then, based on the keyframes corresponding to each target map grid and the currently acquired image frame, the robot's current position information is determined; finally, the currently acquired image frame is used as a keyframe, and the mapping relationship between the relevant information of the currently acquired image frame and the grid to which the current position information belongs is stored. By storing the relevant information of the current image frame and the mapping relationship between the target grids, this application allows for quick retrieval of the required information based on the map area during reading, avoiding multiple traversals and effectively improving the system's operating speed.
[0104] Specifically, when determining multiple target map grids in the neighborhood of the robot's historical position within a 2D map of the robot's current environment, the process begins by first identifying the map grid corresponding to the robot's historical position within the 2D map of the current environment, and then using the location point of that map grid as the center point. Next, based on a preset scanning radius, multiple map grids surrounding the center point are scanned within the 2D map of the robot's current environment, resulting in multiple target map grids in the neighborhood. This application, by using the location point of the map grid corresponding to the robot's historical position as the center point and combining it with a preset scanning radius, can obtain multiple keyframes, providing a data foundation for relocalization and making the calculated actual robot position more accurate.
[0105] For example, firstly, using the map grid (i, j) corresponding to the saved historical robot position (x1, y1) as the center point, find a total of (2r+1)*(2r+1) surrounding map grids based on the radius length r, and read out the keyframe data stored in them. Then, acquire an image frame at the current position, and match the current image frame with the keyframes in the aforementioned (2r+1)*(2r+1) map grids. The matching result can be used to calculate the current actual position of the robot as (x2, y2). Then, use the currently acquired image frame as a keyframe, and store the mapping relationship between the relevant information of the currently acquired image frame and the grid to which the current position information belongs. Finally, use the relocation result to modify the robot's historical position to the calculated actual position, that is, to position the robot at the correct position (x2, y2), and then correctly perform subsequent path tracking.
[0106] For example Figure 5As shown, Figure 5 This application provides a schematic block diagram of a SLAM-based robot tracking process. First, in response to a robot power-on command, the robot starts and determines whether the environment is a 3D map, which involves the following two cases:
[0107] In the first scenario, where a 3D map of the robot's environment is unavailable, the robot is considered a new robot. In this case, robot initialization is initiated. During initialization, the map of the robot's operating area is divided into multiple sub-regions. The first image frame acquired upon startup and the second image frame acquired while controlling the robot to move a preset distance are then captured. These two image frames are then input into a pre-trained feature extraction network, which outputs the corresponding feature points and descriptors. Next, these feature points and descriptors are input into a pre-trained feature matching network, which outputs the matching results. The matching points between the two image frames are then determined based on the matching results. A 3D map of the robot's environment is then built based on the matching points and the robot's chassis wheel movement data. Finally, the second image frame is used as the previous keyframe for path tracking.
[0108] In the second scenario, if a 3D map of the robot's environment exists, it indicates that the robot was restarted after being powered off. In this case, robot relocalization is initiated first. During the relocalization process, the robot's historical position saved at the previous power-off moment is read. Then, in the 2D map of the robot's current environment, multiple target map grids in the neighborhood of the robot's historical position are identified. Next, the keyframes corresponding to each target map grid are acquired. Then, based on the keyframes corresponding to each target map grid and the currently acquired image frames, the robot's current position information is determined. Finally, the currently acquired image frames are used as keyframes, and the mapping relationship between the relevant information of the currently acquired image frames and the grid to which the current position information belongs is stored for path tracking.
[0109] Finally, during the path tracking process after relocation and initialization, the current image frame at the current location point and the previous keyframe at the previous location point are first acquired. Then, based on the current image frame and the previous keyframe, the target grid to which the current location point belongs is determined from the multiple grids included in the two-dimensional map of the robot's current environment. Next, the current image frame is used as the keyframe at the current location point, and the relevant information of the current image frame and the mapping relationship between the target grid are stored. Finally, the tracking continues until the three-dimensional map of the robot's environment is traversed.
[0110] This application can quickly calculate the position information of the current image frame by using the current image frame and the previous keyframe, avoiding the need for the robot to locate itself using hardware sensors, thereby reducing the robot's positioning cost.
[0111] By using a pre-trained feature matching network, matching and unmatched feature points can be accurately identified, thus avoiding the mismatch problem that occurs when judging whether they are the same feature point by the distance of descriptors in existing technologies, thereby improving the accuracy of image matching.
[0112] This application stores the mapping relationship between the relevant information of image frames and the target grid during the tracking process. Therefore, in the subsequent tracking process, the relevant information of an image frame is determined in the mapping relationship through the target grid where the robot is located, and then the key frame is obtained. At this time, the search time for the relevant information of an image frame is short, which reduces the search time of the key frame. At the same time, the accuracy of the single key frame is high, thereby reducing the cumulative error of map construction.
[0113] The following are system embodiments of this application, which can be used to execute the method embodiments of this application. For details not disclosed in the system embodiments of this application, please refer to the method embodiments of this application.
[0114] Please see Figure 6 This illustration shows a schematic diagram of a SLAM-based robot tracking system provided in an exemplary embodiment of this application. The SLAM-based robot tracking system can be implemented as all or part of an electronic device through software, hardware, or a combination of both. System 1 includes an image sensor 10, a processor 20, and a memory 30.
[0115] Image sensor 10 is used to acquire the current image frame at the current location point and the previous key frame at the previous location point during path tracking.
[0116] The processor 20 is used to determine the target grid to which the current positioning point belongs from multiple grids in the two-dimensional map of the robot's current environment based on the current image frame and the previous keyframe.
[0117] The memory 30 is used to use the current image frame as the keyframe at the current positioning point and to store the mapping relationship between the relevant information of the current image frame and the target grid.
[0118] Optional, processor 20 includes:
[0119] The calculation unit 201 is used to calculate the position information corresponding to the current image frame based on the current image frame and the previous key frame;
[0120] The first determining unit 202 is used to determine the target grid to which the location information belongs from multiple grids divided by the two-dimensional map of the robot's current environment;
[0121] The second determining unit 203 is used to determine the target grid to which the location information belongs as the target grid to which the current positioning point belongs.
[0122] Optionally, the computing unit 201 includes:
[0123] The first input subunit 2011 is used to input the current image frame and the previous keyframe into a pre-trained feature extraction network and output the feature points and descriptors corresponding to the current image frame and the previous keyframe.
[0124] The second input subunit 2012 is used to input the feature points and descriptors corresponding to the current image frame and the previous keyframe into the pre-trained feature matching network, and output the matching result corresponding to the current image frame and the previous keyframe.
[0125] The determination subunit 2013 is used to determine the target matching point pair between the current image frame and the previous key frame based on the matching result between the current image frame and the previous key frame.
[0126] The first calculation subunit 2014 is used to calculate the offset value of the current image frame relative to the previous keyframe based on each matching point pair when the number of target matching point pairs is greater than a preset threshold.
[0127] The second calculation subunit 2015 is used to calculate the position information corresponding to the current image frame based on the offset value.
[0128] It should be noted that the SLAM-based robot tracking system provided in the above embodiments is only illustrated by the division of the functional modules described above when executing the SLAM-based robot tracking method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the SLAM-based robot tracking system and the SLAM-based robot tracking method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0129] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0130] In this embodiment, the current image frame at the current location point and the previous keyframe at the previous location point are first acquired during the tracking process. Then, based on the current image frame and the previous keyframe, the target grid for the current location point is determined from multiple grids included in the two-dimensional map of the robot's current environment. Finally, the current image frame is used as a keyframe, and the mapping relationship between the relevant information of the current image frame and the target grid is stored. Because this application stores the mapping relationship between the relevant information of the image frame and the target grid during the tracking process, in subsequent tracking processes, the relevant information of an image frame is determined through this mapping relationship using the target grid where the robot is located, thereby obtaining the keyframe. At this time, the search time for the relevant information of an image frame is short, which reduces the search time for the keyframe. At the same time, the accuracy of the unique keyframe is high, reducing the cumulative error of map construction.
[0131] This application also provides a computer-readable medium having program instructions stored thereon, which, when executed by a processor, implement the SLAM-based robot tracking methods provided in the above-described method embodiments.
[0132] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the SLAM-based robot tracking methods of the various method embodiments described above.
[0133] Please see Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 7 As shown, the electronic device 1000 may include: at least one processor 1001, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002.
[0134] The communication bus 1002 is used to realize the connection and communication between these components.
[0135] The user interface 1003 may include a display screen and a camera. Optionally, the user interface 1003 may also include a standard wired interface and a wireless interface.
[0136] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0137] The processor 1001 may include one or more processing cores. The processor 1001 connects to various parts within the electronic device 1000 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and by calling data stored in the memory 1005. Optionally, the processor 1001 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1001 may integrate one or more of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip, without being integrated into the processor 1001.
[0138] The memory 1005 may include random access memory (RAM) or read-only memory. Optionally, the memory 1005 may include a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 1005 may also be at least one storage system located remotely from the aforementioned processor 1001. Figure 7 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a SLAM-based robot tracking application.
[0139] exist Figure 7In the illustrated electronic device 1000, the user interface 1003 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 1001 can be used to call the SLAM-based robot tracking application stored in the memory 1005 and specifically perform the following operations:
[0140] During path tracking, the current image frame at the current location point and the previous key frame at the previous location point are obtained.
[0141] Based on the current image frame and the previous keyframe, the target grid to which the current positioning point belongs is determined from the multiple grids included in the two-dimensional map of the robot's current environment.
[0142] Use the current image frame as the keyframe at the current location point, and store the relevant information of the current image frame and the mapping relationship between it and the target mesh.
[0143] In one embodiment, when the processor 1001 determines the target grid to which the current positioning point belongs from multiple grids in the two-dimensional map of the robot's current environment based on the current image frame and the previous keyframe, it specifically performs the following operations:
[0144] Calculate the position information corresponding to the current image frame based on the current image frame and the previous keyframe;
[0145] The target grid to which the location information belongs is determined from multiple grids divided by a two-dimensional map of the robot's current environment;
[0146] Use the target grid to which the location information belongs as the target grid to which the current location point belongs.
[0147] In one embodiment, when the processor 1001 calculates the position information corresponding to the current image frame based on the current image frame and the previous keyframe, it specifically performs the following operations:
[0148] Input the current image frame and the previous keyframe into a pre-trained feature extraction network, and output the feature points and descriptors corresponding to the current image frame and the previous keyframe;
[0149] Input the feature points and descriptors corresponding to the current image frame and the previous keyframe into a pre-trained feature matching network, and output the matching result between the current image frame and the previous keyframe;
[0150] Based on the matching results between the current image frame and the previous keyframe, determine the target matching point pair between the current image frame and the previous keyframe;
[0151] If the number of target matching point pairs is greater than a preset threshold, the offset value of the current image frame relative to the previous keyframe is calculated based on each matching point pair.
[0152] Based on the offset value, calculate the position information corresponding to the current image frame.
[0153] In one embodiment, when the processor 1001 executes the matching result between the current image frame and the previous keyframe by inputting the feature points and descriptors corresponding to the previous keyframe into a pre-trained feature matching network, it specifically performs the following operations:
[0154] The feature vector matrix is obtained by encoding the feature points and descriptors corresponding to the current image frame and the previous keyframe through an attention map neural network.
[0155] The matching result score matrix of the feature vector matrix is calculated by using the Dual-Softmax algorithm through the best matching layer, so as to obtain the matching result between the current image frame and the previous keyframe.
[0156] In one embodiment, when the processor 1001 calculates the offset value of the current image frame relative to the previous keyframe based on each matching point pair, it specifically performs the following operations:
[0157] From each pair of matching points, select the matching point pairs with map points corresponding to the second matching feature point. The map points are map points in the 3D map constructed during the path tracking process.
[0158] Based on the coordinates of the first matching feature point in the current image frame and the coordinates of the second matching feature point in the previous keyframe of each selected matching point pair, the rotation and displacement of each selected matching point pair are calculated respectively.
[0159] Based on rotation and displacement, the offset of the current image frame relative to the previous keyframe is calculated.
[0160] In one embodiment, the processor 1001 also performs the following operations:
[0161] Determine the matching point pair to which the second matching feature point belongs if there is no map point;
[0162] Map points are constructed based on the first and second matching feature points in the matching point pairs to which the second matching feature point to which no map point exists;
[0163] Add the constructed map points to the set of 3D map points in the robot's current environment.
[0164] In one embodiment, when the processor 1001 determines the target grid to which the location information belongs from multiple grids divided from a two-dimensional map of the robot's current environment, it specifically performs the following operations:
[0165] In the mapping relationship, determine the first grid corresponding to the keyframe information of the previous keyframe;
[0166] Based on the grid position of the first grid and the position information corresponding to the current image frame, the target grid to which the position information belongs is determined.
[0167] In one embodiment, the processor 1001 also performs the following operations:
[0168] If the number of target matching point pairs is less than or equal to a preset threshold, read the target movement distance saved in the robot chassis data at the time closest to the current time.
[0169] Determine the robot's current actual position based on the target movement distance;
[0170] The robot's current actual position is used as the position information corresponding to the previous keyframe, and the position information corresponding to the previous keyframe is used as the initial position for robot initialization. After the initialization is completed, path tracking continues.
[0171] In one embodiment, before the processor 1001 performs the operation of acquiring the current image frame at the current location point and the previously determined keyframe at the previous location point, it also performs the following operations:
[0172] In response to the robot power-on command, read the robot's historical position saved at the last power-off moment;
[0173] In a two-dimensional map of the robot's current environment, identify multiple target map grids in the neighborhood of the robot's historical location;
[0174] Obtain the keyframes corresponding to each target map grid;
[0175] The robot's current position information is determined based on the keyframes corresponding to each target map grid and the currently acquired image frames;
[0176] The currently acquired image frame is used as a keyframe, and the mapping relationship between the relevant information of the currently acquired image frame and the grid to which the current location information belongs is stored.
[0177] In one embodiment, when the processor 1001 determines multiple target map grids in the neighborhood of the robot's historical location in a two-dimensional map of the robot's current environment, it specifically performs the following operations:
[0178] In the two-dimensional map of the robot's current environment, determine the map grid corresponding to the robot's historical position, and take the position point of the map grid corresponding to the robot's historical position as the center point;
[0179] Based on the preset scanning radius, multiple map grids around the center point are scanned in the two-dimensional map of the robot's current environment to obtain multiple target map grids in the neighborhood.
[0180] In this embodiment, the current image frame at the current location point and the previous keyframe at the previous location point are first acquired during the tracking process. Then, based on the current image frame and the previous keyframe, the target grid for the current location point is determined from multiple grids included in the two-dimensional map of the robot's current environment. Finally, the current image frame is used as a keyframe, and the mapping relationship between the relevant information of the current image frame and the target grid is stored. Because this application stores the mapping relationship between the relevant information of the image frame and the target grid during the tracking process, in subsequent tracking processes, the relevant information of an image frame is determined through this mapping relationship using the target grid where the robot is located, thereby obtaining the keyframe. At this time, the search time for the relevant information of an image frame is short, which reduces the search time for the keyframe. At the same time, the accuracy of the unique keyframe is high, reducing the cumulative error of map construction.
[0181] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The SLAM-based robot tracking program can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.
[0182] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A SLAM-based robot tracking method, characterized in that, The method includes: During path tracking, the current image frame at the current location point and the previous key frame at the previous location point are obtained. Based on the current image frame and the previous keyframe, calculate the position information corresponding to the current image frame; determine the target grid to which the position information belongs from multiple grids divided by the two-dimensional map of the robot's current environment; and use the target grid to which the position information belongs as the target grid to which the current positioning point belongs. The step of calculating the position information corresponding to the current image frame based on the current image frame and the previous keyframe includes: The current image frame and the previous keyframe are input into a pre-trained feature extraction network, which outputs feature points and descriptors corresponding to the current image frame and the previous keyframe. The feature points and descriptors corresponding to the current image frame and the previous keyframe are then input into a pre-trained feature matching network, which outputs matching results between the current image frame and the previous keyframe. Based on the matching results, target matching point pairs between the current image frame and the previous keyframe are determined. If the number of target matching point pairs is greater than a preset threshold, the offset value of the current image frame relative to the previous keyframe is calculated for each matching point pair. Based on the offset value, the positional information corresponding to the current image frame is calculated. The feature matching network includes an attention map neural network and an optimal matching layer, where the optimal matching layer includes a Dual-Softmax algorithm. The current image frame is used as the keyframe at the current positioning point, and the relevant information of the current image frame and the mapping relationship between it and the target grid are stored.
2. The method according to claim 1, characterized in that, The step of inputting the feature points and descriptors corresponding to the current image frame and the previous keyframe into a pre-trained feature matching network, and outputting the matching result between the current image frame and the previous keyframe, includes: The attention map neural network encodes the feature points and descriptors corresponding to the current image frame and the previous keyframe to obtain a feature vector matrix; The matching result score matrix of the feature vector matrix is calculated by the Dual-Softmax algorithm through the optimal matching layer, so as to obtain the matching result between the current image frame and the previous keyframe.
3. The method according to claim 1, characterized in that, Each pair of matching points includes a first matching feature point and a second matching feature point; the first matching feature point belongs to the current image frame, and the second matching feature point belongs to the previous keyframe. The step of calculating the offset value of the current image frame relative to the previous keyframe based on each matching point pair includes: From each pair of matching points, select the matching point pairs with a second matching feature point corresponding to a map point, wherein the map point is a map point in the three-dimensional map constructed during the path tracing process; Based on the coordinates of the first matching feature point in the current image frame and the coordinates of the second matching feature point in the previous keyframe of each selected matching point pair, the rotation and displacement of each selected matching point pair are calculated respectively. Based on the rotation and displacement, the offset value of the current image frame relative to the previous keyframe is calculated.
4. The method according to claim 3, characterized in that, The method further includes: Determine the matching point pair to which the second matching feature point belongs if there is no map point; Map points are constructed based on the first and second matching feature points in the matching point pair to which the second matching feature point to which the non-existent map point belongs; Add the constructed map points to the set of 3D map points in the robot's current environment.
5. The method according to claim 1, characterized in that, Determining the target grid to which the location information belongs from multiple grids divided from a two-dimensional map of the robot's current environment includes: In the mapping relationship, the first grid corresponding to the keyframe information of the previous keyframe is determined; Based on the grid position of the first grid and the position information corresponding to the current image frame, the target grid to which the position information belongs is determined.
6. The method according to claim 1, characterized in that, The method further includes: If the number of target matching point pairs is less than or equal to a preset threshold, read the target movement distance saved in the robot chassis data at the time closest to the current time. Based on the target movement distance, determine the robot's current actual position; The robot's current actual position is used as the position information corresponding to the previous keyframe, and the position information corresponding to the previous keyframe is used as the initial position for robot initialization. After the initialization is completed, path tracking continues.
7. The method according to claim 1, characterized in that, Before obtaining the current image frame at the current location point and the previously determined keyframe at the previous location point, the method further includes: In response to the robot power-on command, read the robot's historical position saved at the last power-off moment; In a two-dimensional map of the robot's current environment, determine multiple target map grids in the neighborhood of the robot's historical location; Obtain the keyframes corresponding to each target map grid; The robot's current position information is determined based on the keyframes corresponding to each target map grid and the currently acquired image frames; The currently acquired image frame is used as a keyframe, and the mapping relationship between the relevant information of the currently acquired image frame and the grid to which the current location information belongs is stored.
8. The method according to claim 7, characterized in that, The step of determining multiple target map grids in the neighborhood of the robot's historical location within a two-dimensional map of the robot's current environment includes: In the two-dimensional map of the robot's current environment, determine the map grid corresponding to the robot's historical position, and take the position point of the map grid corresponding to the robot's historical position as the center point; Based on a preset scanning radius, multiple map grids around the center point are scanned in the two-dimensional map of the robot's current environment to obtain multiple target map grids in the neighborhood.
9. A SLAM-based robot tracking system implemented using the method described in any one of claims 1-8, characterized in that, The system includes: An image sensor is used to acquire the current image frame at the current location point and the previous key frame at the previous location point during path tracking. The processor is configured to determine the target grid to which the current positioning point belongs from multiple grids in the two-dimensional map of the robot's current environment, based on the current image frame and the previous keyframe. The memory is used to use the current image frame as the keyframe at the current positioning point and to store the mapping relationship between the relevant information of the current image frame and the target grid.
10. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the method as described in any one of claims 1-8.
11. An electronic device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed as described in any one of claims 1-8.
Citation Information
Patent Citations
Target tracking method, device and equipment and storage medium
CN111709973A
