




技术领域technical field
本发明涉及一种机器人恢复跟踪的方法,尤其涉及一种基于随机森林的小场景下机器人导航跟踪恢复方法。The invention relates to a method for recovering tracking of a robot, in particular to a method for recovering robot navigation and tracking in a small scene based on random forest.
背景技术Background technique
随着机器人技术的发展,机器人的自动寻路和建图功能在机器人技术中有着重要的地位,这个过程中机器人需要知道自己相对于现实世界的位置和和自身的姿态,所以机器人的跟踪问题一直是一个机器人学中的热点问题。With the development of robotics, the automatic pathfinding and mapping functions of robots play an important role in robotics. In this process, the robot needs to know its position relative to the real world and its own posture, so the tracking problem of the robot has always been It is a hot issue in robotics.
随着vSLAM(Visual Simultaneous Localization and Mapping)技术的发展,在机器人跟踪失败后,恢复机器人跟踪变得非常重要,对此,人们也研究出了许多种跟踪恢复的方法。跟踪恢复的重点在于计算出机器人在跟踪失败后的正确6D位姿,得到正确的6D位置后,机器人就能够知道自己相对于现实世界的正确位姿,从而恢复跟踪。With the development of vSLAM (Visual Simultaneous Localization and Mapping) technology, it is very important to recover the robot tracking after the robot tracking fails. For this, many methods of tracking recovery have also been studied. The focus of tracking recovery is to calculate the correct 6D pose of the robot after tracking failure. After obtaining the correct 6D position, the robot can know its correct pose relative to the real world and resume tracking.
S.Se和D.G.Lowe等人提出的基于局部特征的方法,其思想是先提取已知位姿的图像和未知位姿的图像特征点,并计算描述子,利用P3P算法和RANSAC算法进行位姿计算和优化,这种方法的缺点在于通常使用SIFT特征或SURF特征,而这些特征的计算以及其描述子的计算耗时长,实时性无法保证。The method based on local features proposed by S.Se and D.G.Lowe et al. The idea is to first extract image feature points of known poses and image feature points of unknown poses, calculate descriptors, and use P3P algorithm and RANSAC algorithm to perform pose Calculation and optimization, the disadvantage of this method is that SIFT features or SURF features are usually used, and the calculation of these features and the calculation of their descriptors takes a long time, and the real-time performance cannot be guaranteed.
G.Klein和D.Murray提出的基于关键帧的方法,通过查询已知图像与关键帧的相似性,推断出一个假设位姿,速度快,但当未知图像与已知图像相似性差距很大时,假设位姿与真实位姿可能相差较大。The key frame-based method proposed by G.Klein and D.Murray, by querying the similarity between the known image and the key frame, infers a hypothetical pose, which is fast, but when the similarity between the unknown image and the known image is very different When , the assumed pose may be quite different from the real pose.
剑桥大学的Alex Kendall,Matthew Grimes和Roberto Cipolla提出的PoseNet利用深度学习,利用一张RGB图直接预测图像位姿,但是这种方法由于其计算复杂度高,耗时长,精度较低而无法满足实时跟踪恢复的要求。The PoseNet proposed by Alex Kendall, Matthew Grimes and Roberto Cipolla of Cambridge University uses deep learning to directly predict the image pose using an RGB image, but this method cannot meet real-time requirements due to its high computational complexity, long time, and low accuracy. Track recovery requirements.
发明内容SUMMARY OF THE INVENTION
本发明的目的就在于提供一种解决上述问题,利用RGB-D图计算训练特征和训练标签,训练随机森林预测3D场景坐标,再通过坐标关系恢复跟踪,从而使恢复简单、时间段、精度高的基于随机森林的小场景下机器人导航跟踪恢复方法。The purpose of the present invention is to provide a solution to the above problems, using RGB-D map to calculate training features and training labels, training random forests to predict 3D scene coordinates, and then recovering tracking through the coordinate relationship, so that recovery is simple, time period, and high precision. A random forest-based robot navigation tracking recovery method in small scenes.
为了实现上述目的,本发明采用的技术方案是这样的:一种基于随机森林的小场景下机器人导航跟踪恢复方法,包括以下步骤:In order to achieve the above-mentioned purpose, the technical solution adopted in the present invention is as follows: a random forest-based robot navigation tracking recovery method in a small scene, comprising the following steps:
(1)选定一需要跟踪的场景,使用RGB-D相机对场景进行M次随机拍摄,得到M组图像,每组图像包括一RGB图和一深度图;(1) Select a scene that needs to be tracked, and use an RGB-D camera to randomly shoot the scene M times to obtain M groups of images, each group of images including an RGB image and a depth image;
(2)利用三维重建算法获取每组图像的变换矩阵,共得到M个变换矩阵;(2) Obtain the transformation matrix of each group of images by using the three-dimensional reconstruction algorithm, and obtain M transformation matrices in total;
(3)获得训练标签和训练特征;(3) Obtain training labels and training features;
(31)从第一组图像的RGB图中随机采样数个像素点,计算每个像素点对应的3D世界坐标和随机特征,且该像素点的3D世界坐标和随机特征一一对应;(31) randomly sample several pixel points from the RGB diagram of the first group of images, calculate the 3D world coordinates and random features corresponding to each pixel point, and the 3D world coordinates of this pixel point and the random features are in one-to-one correspondence;
(32)将剩下的M-1组图像,按步骤(31)的方法,得到随机采样的像素点,以及与像素点对应的3D世界坐标和随机特征,并以3D世界坐标作为模型的训练标签,以随机特征作为模型的训练特征;(32) According to the method of step (31), obtain randomly sampled pixels, 3D world coordinates and random features corresponding to the pixels, and use the 3D world coordinates as the model's Training labels, using random features as the training features of the model;
(4)用训练标签和训练特征训练一随机森林模型T;(4) train a random forest model T with training labels and training features;
(41)将所有训练特征排序,从排序后的训练特征随机挑选数个训练特征构成随机集合,预设采用树平衡方法的层数为A层,数的深度阈值为B层,A<B;(41) Sorting all training features, randomly selecting several training features from the sorted training features to form a random set, the preset number of layers using the tree balancing method is layer A, and the depth threshold of the number is layer B, A<B;
(42)采用树平衡方法获取第1到第A层的节点的分裂参数,采用最小化空间方差方法获取第A+1层到第B层的节点的分裂参数;(42) adopting the tree balance method to obtain the splitting parameters of the nodes from the 1st to the Ath layer, and adopting the minimized spatial variance method to obtain the splitting parameters of the nodes from the A+1th layer to the Bth layer;
(43)每一层的分裂节点构成随机森林模型T;(43) The split nodes of each layer constitute a random forest model T;
(5)机器人开始跟踪,若跟踪失败,采用RGB-D相机对场景进行1次拍摄,得到一组图像,该组图像包括一RGB图和一深度图;(5) The robot starts tracking. If the tracking fails, the RGB-D camera is used to shoot the scene once to obtain a group of images, and the group of images includes an RGB image and a depth image;
(6)从该组图像的的RGB图中随机采样数个像素点,计算每个像素点对应的随机特征,并将所有随机特征送入T中,输出所有随机特征对应的3D世界坐标;(6) randomly sample several pixel points from the RGB image of the group of images, calculate the random feature corresponding to each pixel point, and send all the random features into T, and output the 3D world coordinates corresponding to all the random features;
(7)根据步骤(6)得到的3D世界坐标获得一预测变换矩阵;(7) obtain a prediction transformation matrix according to the 3D world coordinates obtained in step (6);
(8)机器人获取步骤(7)的预测变换矩阵,确定自身位姿,导航跟踪恢复完成。(8) The robot obtains the predicted transformation matrix in step (7), determines its own pose, and completes the recovery of navigation and tracking.
作为优选:所述步骤(2)中,对每组图像采用KinectFusion三维重建方法获取变换矩阵。Preferably, in the step (2), the KinectFusion three-dimensional reconstruction method is used to obtain the transformation matrix for each group of images.
作为优选:所述步骤(31)具体为:Preferably: the step (31) is specifically:
选取一个像素点,采用下式计算该像素点3D世界坐标X,并根据3D世界坐标X计算该像素点的世界坐标W1;Select a pixel, use the following formula to calculate the 3D world coordinate X of the pixel, and calculate the world coordinate W1 of the pixel according to the 3D world coordinate X;
X=K-1*P*D(P);X=K-1 *P*D(P);
W1=HX;W1 =HX;
其中,K为相机的内参矩阵,K-1表示内参矩阵的逆矩阵,P为该像素点的向量,D(P)为该像素点对应深度图中的深度值,H为该像素点所在的RGB图对应的变换矩阵;Among them, K is the internal parameter matrix of the camera, K-1 represents the inverse matrix of the internal parameter matrix, P is the vector of the pixel, D(P) is the depth value in the depth map corresponding to the pixel, and H is the location of the pixel. The transformation matrix corresponding to the RGB image;
采用下式计算该像素点的随机特征Fp,Use the following formula to calculate the random feature Fp of the pixel point,
其中,c1和c2表示RGB图像中3个图像通道中随机两个通道,I(P,c1)表示向量P处通道c1上的像素值,δ表示像素坐标上的2D偏移量。where c1 and c2 represent random two channels among the 3 image channels in the RGB image, I(P, c1 ) represents the pixel value on channel c1 at vector P, and δ represents the 2D offset in pixel coordinates .
作为优选:所述步骤(42)中:As preferably: in the step (42):
树平衡方法获取第1到第A层的节点的分裂参数具体为:The tree balance method obtains the splitting parameters of the nodes from the 1st to the Ath layer as follows:
A1.构建第一层的节点;A1. Construct the nodes of the first layer;
对随机集合内每个训练特征采用下式计算其平衡参数Qb,选出最小的Qb所对应的训练特征,将其作为第一层的节点的分裂参数;For each training feature in the random set, the following formula is used to calculate its balance parameter Qb , and the training feature corresponding to the smallest Qb is selected as the splitting parameter of the nodes of the first layer;
式中,SL为当前训练特征左边的训练特征个数,SR为当前训练特征右边的训练特征个数;In the formula,SL is the number of training features on the left side of the current training feature, andSR is the number of training features on the right side of the current training feature;
A2.将用作上一层节点分裂参数的训练特征的左、右两边训练特征分别构成一数据集,利用A1同样的方法找出每个数据集中最小的Qb所对应的训练特征,将其作为下一层节点的分裂参数;A2. The left and right sides of the training features used as the training features of the node splitting parameters of the previous layer form a data set respectively, and the same method as A1 is used to find the training feature corresponding to the smallest Qb in each data set. As the splitting parameter of the next layer of nodes;
A3.重复步骤A2,直到找到A层的节点;A3. Repeat step A2 until the node of layer A is found;
最小化空间方差方法获取第A+1层到第B层的节点的分裂参数具体为:The method of minimizing spatial variance obtains the splitting parameters of the nodes from layer A+1 to layer B as follows:
B1.将A层所有分裂节点两端的训练特征分别构成一数据集,对数据集内每个训练特征采用下式计算空间方差Qv,找出该数据集中Qv最小的训练特征,将其作为A+1层的节点的分裂参数;B1. The training features at both ends of all split nodes in layer A are formed into a data set respectively, and the following formula is used to calculate the spatial variance Qv for each training feature in the data set, and the training feature with the smallest Qv in the data set is found and used as The splitting parameters of the nodes in the A+1 layer;
其中in
其中n表示树的节点索引,m表示计算得到的训练标签,S表示随机选择的已标记好的像素点(p,m)的集合,Sn表示在节点n处的完整集合,L表示左子树,R表示右子树,表示左子树或者右子树的集合,表示S中m的均值;where n represents the node index of the tree, m represents the calculated training label, S represents the set of randomly selected marked pixels (p, m), Sn represents the complete set at node n, and L represents the left child tree, R represents the right subtree, represents the set of left subtree or right subtree, represents the mean of m in S;
B2.按照B1的方法,计算第A+2层到B层节点的分裂参数。B2. According to the method of B1, calculate the splitting parameters of the nodes from layer A+2 to layer B.
作为优选:步骤(7)中,获得一预测变换矩阵的具体方法为:As a preference: in step (7), the specific method for obtaining a prediction transformation matrix is:
对3D世界坐标用Kabsch方法计算得出位姿矩阵,并用RANSAC算法优化位姿矩阵最终得到预测变换矩阵。The pose matrix is calculated by the Kabsch method for the 3D world coordinates, and the RANSAC algorithm is used to optimize the pose matrix to finally obtain the predicted transformation matrix.
与现有技术相比,本发明的优点在于:不需要进行特征点和描述子的计算,不需要对图片进行匹配,只需要提前训练一个随机森林模型。且本发明中,构建随机森林模型的方法很特殊,采用了树平衡方法和最小化空间方差方法共同来构建随机森林模型,且在树平衡方法中,根据我们自己的公式和方法来获取Qb,最终本方法在实际使用时可以缩短时间,与深度学习的方法相比,准确性更高,训练和测试时间也更短。Compared with the prior art, the present invention has the advantages that it does not need to calculate feature points and descriptors, does not need to match pictures, and only needs to train a random forest model in advance. And in the present invention, the method of constructing the random forest model is very special. The tree balancing method and the minimizing spatial variance method are used to construct the random forest model. In the tree balancing method, Qb is obtained according to our own formula and method. , and finally this method can shorten the time in actual use, and compared with the deep learning method, the accuracy is higher, and the training and testing time is also shorter.
附图说明Description of drawings
图1为本发明流程图;Fig. 1 is the flow chart of the present invention;
图2为实施例2中角度真值与估值对比图;Fig. 2 is the comparison diagram of angle true value and estimated value among the
图3为实施例2中位移真值与估值对比图;Fig. 3 is the comparison diagram of displacement true value and estimated value in
图4为图2中角度真值与估值误差图;Fig. 4 is the angle true value and the estimation error diagram in Fig. 2;
图5为图4中位移真值与估值误差图。FIG. 5 is a diagram of the true value of the displacement and the estimated error in FIG. 4 .
具体实施方式Detailed ways
下面将结合附图对本发明作进一步说明。The present invention will be further described below with reference to the accompanying drawings.
实施例1:参见图1,一种基于随机森林的小场景下机器人导航跟踪恢复方法,包括以下步骤:Embodiment 1: Referring to FIG. 1 , a method for restoring robot navigation and tracking in a small scene based on random forests includes the following steps:
(1)选定一需要跟踪的场景,使用RGB-D相机对场景进行M次随机拍摄,得到M组图像,每组图像包括一RGB图和一深度图;(1) Select a scene that needs to be tracked, and use an RGB-D camera to randomly shoot the scene M times to obtain M groups of images, each group of images including an RGB image and a depth image;
(2)利用三维重建算法获取每组图像的变换矩阵,共得到M个变换矩阵;(2) Obtain the transformation matrix of each group of images by using the three-dimensional reconstruction algorithm, and obtain M transformation matrices in total;
(3)获得训练标签和训练特征;(3) Obtain training labels and training features;
(31)从第一组图像的RGB图中随机采样数个像素点,计算每个像素点对应的3D世界坐标和随机特征,且该像素点的3D世界坐标和随机特征一一对应;(31) randomly sample several pixel points from the RGB diagram of the first group of images, calculate the 3D world coordinates and random features corresponding to each pixel point, and the 3D world coordinates of this pixel point and the random features are in one-to-one correspondence;
(32)将剩下的M-1组图像,按步骤(31)的方法,得到随机采样的像素点,以及与像素点对应的3D世界坐标和随机特征,并以3D世界坐标作为模型的训练标签,以随机特征作为模型的训练特征;(32) According to the method of step (31), obtain randomly sampled pixels, 3D world coordinates and random features corresponding to the pixels, and use the 3D world coordinates as the model's Training labels, using random features as the training features of the model;
(4)用训练标签和训练特征训练一随机森林模型T;(4) train a random forest model T with training labels and training features;
(41)将所有训练特征排序,从排序后的训练特征随机挑选数个训练特征构成随机集合,预设采用树平衡方法的层数为A层,数的深度阈值为B层,A<B;(41) Sorting all training features, randomly selecting several training features from the sorted training features to form a random set, the preset number of layers using the tree balancing method is layer A, and the depth threshold of the number is layer B, A<B;
(42)采用树平衡方法获取第1到第A层的节点的分裂参数,采用最小化空间方差方法获取第A+1层到第B层的节点的分裂参数;(42) adopting the tree balance method to obtain the splitting parameters of the nodes from the 1st to the Ath layer, and adopting the minimized spatial variance method to obtain the splitting parameters of the nodes from the A+1th layer to the Bth layer;
(43)每一层的分裂节点构成随机森林模型T;(43) The split nodes of each layer constitute a random forest model T;
(5)机器人开始跟踪,若跟踪失败,采用RGB-D相机对场景进行1次拍摄,得到一组图像,该组图像包括一RGB图和一深度图;(5) The robot starts tracking. If the tracking fails, the RGB-D camera is used to shoot the scene once to obtain a group of images, and the group of images includes an RGB image and a depth image;
(6)从该组图像的的RGB图中随机采样数个像素点,计算每个像素点对应的随机特征,并将所有随机特征送入T中,输出所有随机特征对应的3D世界坐标;(6) randomly sample several pixel points from the RGB image of the group of images, calculate the random feature corresponding to each pixel point, and send all the random features into T, and output the 3D world coordinates corresponding to all the random features;
(7)根据步骤(6)得到的3D世界坐标获得一预测变换矩阵;(7) obtain a prediction transformation matrix according to the 3D world coordinates obtained in step (6);
(8)机器人获取步骤(7)的预测变换矩阵,确定自身位姿,导航跟踪恢复完成。(8) The robot obtains the predicted transformation matrix in step (7), determines its own pose, and completes the recovery of navigation and tracking.
本实施例中:所述步骤(2)中,对每组图像采用KinectFusion三维重建方法获取变换矩阵。In this embodiment, in the step (2), the KinectFusion three-dimensional reconstruction method is used to obtain a transformation matrix for each group of images.
所述步骤(31)具体为:Described step (31) is specifically:
选取一个像素点,采用下式计算该像素点3D世界坐标X,并根据3D世界坐标X计算该像素点的世界坐标W1;Select a pixel, use the following formula to calculate the 3D world coordinate X of the pixel, and calculate the world coordinate W1 of the pixel according to the 3D world coordinate X;
X=K-1*P*D(P);X=K-1 *P*D(P);
W1=HX;W1 =HX;
其中,K为相机的内参矩阵,K-1表示内参矩阵的逆矩阵,P为该像素点的向量,D(P)为该像素点对应深度图中的深度值,H为该像素点所在的RGB图对应的变换矩阵;Among them, K is the internal parameter matrix of the camera, K-1 represents the inverse matrix of the internal parameter matrix, P is the vector of the pixel, D(P) is the depth value in the depth map corresponding to the pixel, and H is the location of the pixel. The transformation matrix corresponding to the RGB image;
采用下式计算该像素点的随机特征Fp:Use the following formula to calculate the random feature Fp of the pixel point:
其中,c1和c2表示RGB图像中3个图像通道中随机两个通道,I(P,c1)表示向量P处通道c1上的像素值,δ表示像素坐标上的2D偏移量。where c1 and c2 represent random two channels among the 3 image channels in the RGB image, I(P, c1 ) represents the pixel value on channel c1 at vector P, and δ represents the 2D offset in pixel coordinates .
所述步骤(42)中:In the step (42):
树平衡方法获取第1到第A层的节点的分裂参数具体为:The tree balance method obtains the splitting parameters of the nodes from the 1st to the Ath layer as follows:
A1.构建第一层的节点;A1. Construct the nodes of the first layer;
对随机集合内每个训练特征采用下式计算其平衡参数Qb,选出最小的Qb所对应的训练特征,将其作为第一层的节点的分裂参数;For each training feature in the random set, the following formula is used to calculate its balance parameter Qb , and the training feature corresponding to the smallest Qb is selected as the splitting parameter of the nodes of the first layer;
式中,SL为当前训练特征左边的训练特征个数,SR为当前训练特征右边的训练特征个数;In the formula,SL is the number of training features on the left side of the current training feature, andSR is the number of training features on the right side of the current training feature;
A2.将用作上一层节点分裂参数的训练特征的左、右两边训练特征分别构成一数据集,利用A1同样的方法找出每个数据集中最小的Qb所对应的训练特征,将其作为下一层节点的分裂参数;A2. The left and right sides of the training features used as the training features of the node splitting parameters of the previous layer form a data set respectively, and the same method as A1 is used to find the training feature corresponding to the smallest Qb in each data set. As the splitting parameter of the next layer of nodes;
A3.重复步骤A2,直到找到A层的节点;A3. Repeat step A2 until the node of layer A is found;
最小化空间方差方法获取第A+1层到第B层的节点的分裂参数具体为:The method of minimizing spatial variance obtains the splitting parameters of the nodes from layer A+1 to layer B as follows:
B1.将A层所有分裂节点两端的训练特征分别构成一数据集,对数据集内每个训练特征采用下式计算空间方差Qv,找出该数据集中Qv最小的训练特征,将其作为A+1层的节点的分裂参数;B1. The training features at both ends of all split nodes in layer A are formed into a data set respectively, and the following formula is used to calculate the spatial variance Qv for each training feature in the data set, and the training feature with the smallest Qv in the data set is found and used as The splitting parameters of the nodes in the A+1 layer;
其中in
其中n表示树的节点索引,m表示计算得到的训练标签,S表示随机选择的已标记好的像素点(p,m)的集合,Sn表示在节点n处的完整集合,L表示左子树,R表示右子树,表示左子树或者右子树的集合,表示S中m的均值;where n represents the node index of the tree, m represents the calculated training label, S represents the set of randomly selected marked pixels (p, m), Sn represents the complete set at node n, and L represents the left child tree, R represents the right subtree, represents the set of left subtree or right subtree, represents the mean of m in S;
B2.按照B1的方法,计算第A+2层到B层节点的分裂参数。B2. According to the method of B1, calculate the splitting parameters of the nodes from layer A+2 to layer B.
步骤(7)中,获得一预测变换矩阵的具体方法为:In step (7), the specific method of obtaining a prediction transformation matrix is:
对3D世界坐标用Kabsch方法计算得出位姿矩阵,并用RANSAC算法优化位姿矩阵最终得到预测变换矩阵。The pose matrix is calculated by the Kabsch method for the 3D world coordinates, and the RANSAC algorithm is used to optimize the pose matrix to finally obtain the predicted transformation matrix.
本发明中,所有坐标都采用齐次坐标的记法;而且,本实施例中,不采取对所有像素点都进行计算的策略,而仅仅计算被随机选中的像素点的随机特征,计算好的随机特征和训练标签一一对应并组合成队列,用于训练随机森林。In the present invention, all coordinates adopt the notation of homogeneous coordinates; moreover, in this embodiment, the strategy of calculating all pixels is not adopted, but only the random features of randomly selected pixels are calculated. A one-to-one correspondence between random features and training labels is combined into a queue for training random forests.
本实施例提到了一个平衡参数Qb,这样做的好处在于,不用真实的计算出左右子树的节点个数就可以推断出子树是否平衡,减小了计算的时间复杂度,缩短训练时间,并且,当左右子树大致平衡时,可以杜绝任意一边子树深度差异过大导致的数据部分过拟合或欠拟合,最后选择计算结果最小的随机特征作为节点分裂的分裂参数,值得说明的一点是,左右子树节点个数都应大于设定的最小节点个数。This embodiment mentions a balance parameter Qb , which has the advantage of inferring whether the subtree is balanced without actually calculating the number of nodes in the left and right subtrees, which reduces the computational time complexity and shortens the training time. , and when the left and right subtrees are roughly balanced, the data partial overfitting or underfitting caused by the large difference in the depth of any subtree can be avoided. Finally, the random feature with the smallest calculation result is selected as the splitting parameter for node splitting, which is worth explaining. The point is that the number of nodes in the left and right subtrees should be greater than the minimum number of nodes set.
本实施例中,最小化空间方差方法是在第A+1层到第B层使用,当层数大于A时,我们采用此方法来获得分类参数。而全部采用最小化空间方差的方式来生成随机森林是传统的随机森林生成方式。本发明对其进行了改进,仅仅在A+1层到B层的时候使用,其余采用树平衡方法。In this embodiment, the method of minimizing spatial variance is used in layers A+1 to B. When the number of layers is greater than A, we use this method to obtain classification parameters. And all the methods of minimizing the spatial variance to generate random forests are the traditional random forest generation methods. The present invention improves it, and it is only used from the A+1 layer to the B layer, and the rest adopts the tree balance method.
本实施例中,为了更好的说明树平衡方法,我们举例如下:In this embodiment, in order to better illustrate the tree balancing method, we give an example as follows:
我们假设步骤(41)中得到很多个训练特征,随机抽取10个进行排序,预设采用树平衡方法的层数为2层,则当层数小于等于2时,采用树平衡方法,其余层采用最小化空间方差方法。训练特征见下表1:We assume that many training features are obtained in step (41), 10 are randomly selected for sorting, and the number of layers using the tree balancing method is preset to be 2. When the number of layers is less than or equal to 2, the tree balancing method is used, and the remaining layers use the Minimize spatial variance method. The training features are shown in Table 1 below:
表1:随机抽取10个训练特征排序后的表Table 1: The sorted table of 10 training features randomly selected
(1)采用Qb的计算公式,对10个训练特征就行计算,找出随机特征6的Qb最小,就用6作为分裂参数,左边的数据集为1、2、3、4、5,右边的数据集为8、9、10,左边的数据集给左子树,右边的给右子树,第一层因为只有一个节点,所以第一层建完了。(1) Using the calculation formula of Qb , just calculate the 10 training features, find out the Qb of the random feature 6 is the smallest, and use 6 as the splitting parameter, the data set on the left is 1, 2, 3, 4, 5, The dataset on the right is 8, 9, and 10, the dataset on the left is given to the left subtree, and the dataset on the right is given to the right subtree. Because the first layer has only one node, the first layer is completed.
(2)开始建第二层:因为层数还在两层内,所以左右子树各自用上一层分给自己的特征集合来进行同样的操作,这样各自会选出自己的节点,假设左子树选出的3,右子树选出的8,这样,就会得到4个集合,把他们分别给节点自己的左右子树,然后开始建第三层。(2) Start building the second layer: Because the number of layers is still within two layers, the left and right subtrees each use the feature set assigned to them by the previous layer to perform the same operation, so that each will select its own node. 3 is selected by the subtree, and 8 is selected by the right subtree. In this way, 4 sets will be obtained, and they will be given to the left and right subtrees of the node, and then the third layer will be built.
(3)第三层:层数大于2层了,所以用最小化空间方差的方法找Qv,以最小的Qv对应的训练特征来作为分裂参数。(3) The third layer: The number of layers is greater than 2, so the method of minimizing the spatial variance is used to find Qv , and the training feature corresponding to the smallest Qv is used as the splitting parameter.
这样一直重复,直到达到阈值B。This is repeated until threshold B is reached.
实施例2:参见图1到图5,本实施例的一种基于随机森林的小场景下机器人导航跟踪恢复方法,包括以下步骤:Embodiment 2: Referring to FIG. 1 to FIG. 5 , a random forest-based robot navigation tracking recovery method in a small scene in this embodiment includes the following steps:
(1)选定一需要跟踪的场景,使用RGB-D相机对场景进行M次随机拍摄,得到M组图像,每组图像包括一RGB图和一深度图;本实施例直接采用斯坦福大学的公开数据集4-Scenes中的室内图像集kitchen,图像大小为640*480,训练图片550组RGB-D图,测试图片共520组RGB-D图,室内图像集kitchen均包含变换矩阵的信息,我们将其作为真值;(1) Select a scene to be tracked, use an RGB-D camera to randomly shoot the scene M times, and obtain M groups of images, each group of images includes an RGB image and a depth image; this embodiment directly adopts Stanford University. The indoor image set kitchen in the public dataset 4-Scenes has an image size of 640*480, 550 sets of RGB-D images for training images, and 520 sets of RGB-D images for test images. The indoor image set kitchen contains transformation matrix information. , we take it as the truth value;
(2)(3)(4)与实施例1相同,最终得到一随机森林模型T;(2) (3) (4) is the same as in Example 1, and finally a random forest model T is obtained;
(5)机器人开始跟踪,若跟踪失败,采用RGB-D相机对场景进行1次拍摄,得到一组图像,该组图像包括一RGB图和一深度图。在这里,为了说明本实施例的效果,我们采用以下手段:(5) The robot starts tracking. If the tracking fails, the RGB-D camera is used to shoot the scene once to obtain a set of images, which includes an RGB image and a depth image. Here, in order to illustrate the effect of this embodiment, we adopt the following means:
从室内图像集kitchen中,随机抽取多张测试图片,送入步骤(4)得到的随机森林模型T中进行测试,输出每组图片的预测变换矩阵,将其作为图像变换矩阵的估值;From the indoor image set kitchen, randomly select a plurality of test pictures, send them to the random forest model T obtained in step (4) for testing, and output the predicted transformation matrix of each group of pictures, which is used as the evaluation of the image transformation matrix;
实验结果分析:Analysis of results:
为了方便对比,将变换矩阵解析成俯仰角、偏航角、滚转角、X方向、Y方向、Z方向6个值。图2是本发明实施例2中,520组图片计算出来的角度真值与估值的对比图,图3为本发明实施例2中,520组图片计算出来的位移真值与估值对比图;由于相似度特别高,我们补充了图4和图5,其中,图4为图2中角度真值与估值误差图,图5为图4中位移真值与估值误差图。For the convenience of comparison, the transformation matrix is parsed into 6 values of pitch angle, yaw angle, roll angle, X direction, Y direction, and Z direction. Fig. 2 is a comparison diagram of the angle true value and estimated value calculated by 520 groups of pictures in the second embodiment of the present invention, and Fig. 3 is a comparison diagram of the displacement true value and the estimated value calculated by 520 groups of pictures in the second embodiment of the present invention ; Due to the extremely high similarity, we supplemented Figure 4 and Figure 5, in which Figure 4 is the graph of the true value of the angle and the estimated error in Figure 2, and Figure 5 is the graph of the true value of the displacement and the estimated error in Figure 4.
从图2到图5中可以看出,估值曲线和真值曲线重合度高,说明估计的位姿与真实位姿相似度高,角度误差值大部分位于-5°到+5°范围内,位移误差大部分位于-0.05m到+0.05m范围内,估值与真值相差小,误差范围也比较小,说明算法鲁棒性较好,算法运行的输出结果稳定,利用估值来恢复跟踪,能取得较好的效果。It can be seen from Figure 2 to Figure 5 that the estimated curve and the true value curve have a high degree of coincidence, indicating that the estimated pose is highly similar to the real pose, and most of the angular error values are in the range of -5° to +5° , most of the displacement errors are in the range of -0.05m to +0.05m, the difference between the estimated value and the true value is small, and the error range is also relatively small, indicating that the algorithm has good robustness and the output result of the algorithm operation is stable, and the estimated value is used to restore Tracking can achieve better results.
实施例3:本发明与其他经典的算法相比较,本方法应用效果显著。Embodiment 3: Compared with other classical algorithms, the application effect of this method is remarkable.
参见表2,角度使用5°标准,位移使用5cm标准,本方法测试结果达到92.7%的准确率,效果显著。See Table 2, the angle uses the 5° standard, the displacement uses the 5cm standard, the test result of this method reaches an accuracy rate of 92.7%, and the effect is remarkable.
表2不同方法的结果对比Table 2 Comparison of the results of different methods
表2中,基于关键帧的方法使用的是全局关键帧匹配的方法,基于局部特征的方法分别采用了ORB特征和SIFT特征两种图像特征,利用深度学习的方法角度误差大于5°,位移误差大于50cm,所以在表中没有列出。In Table 2, the key frame-based method uses the global key frame matching method, the local feature-based method uses two image features, ORB feature and SIFT feature, respectively. The angle error of the deep learning method is greater than 5°, and the displacement error It is larger than 50cm, so it is not listed in the table.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention shall be included in the protection of the present invention. within the range.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910593421.2ACN110400349B (en) | 2019-07-03 | 2019-07-03 | Robot navigation tracking recovery method in small scene based on random forest |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910593421.2ACN110400349B (en) | 2019-07-03 | 2019-07-03 | Robot navigation tracking recovery method in small scene based on random forest |
| Publication Number | Publication Date |
|---|---|
| CN110400349A CN110400349A (en) | 2019-11-01 |
| CN110400349Btrue CN110400349B (en) | 2022-04-15 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910593421.2AExpired - Fee RelatedCN110400349B (en) | 2019-07-03 | 2019-07-03 | Robot navigation tracking recovery method in small scene based on random forest |
| Country | Link |
|---|---|
| CN (1) | CN110400349B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113255490A (en)* | 2021-05-15 | 2021-08-13 | 成都理工大学 | Unsupervised pedestrian re-identification method based on k-means clustering and merging |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108898623A (en)* | 2018-05-24 | 2018-11-27 | 北京飞搜科技有限公司 | Method for tracking target and equipment |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9940553B2 (en)* | 2013-02-22 | 2018-04-10 | Microsoft Technology Licensing, Llc | Camera/object pose from predicted coordinates |
| US9626766B2 (en)* | 2014-02-28 | 2017-04-18 | Microsoft Technology Licensing, Llc | Depth sensing using an RGB camera |
| US9613298B2 (en)* | 2014-06-02 | 2017-04-04 | Microsoft Technology Licensing, Llc | Tracking using sensor data |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108898623A (en)* | 2018-05-24 | 2018-11-27 | 北京飞搜科技有限公司 | Method for tracking target and equipment |
| Title |
|---|
| 基于树结构分层随机森林在非约束环境下的头部姿态估计;刘袁缘等;《电子与信息学报》;20150315(第03期);第39-47页全文* |
| 基于深度优先随机森林分类器的目标检测;马娟娟等;《中国惯性技术学报》;20180815(第04期);第104-109页全文* |
| Publication number | Publication date |
|---|---|
| CN110400349A (en) | 2019-11-01 |
| Publication | Publication Date | Title |
|---|---|---|
| JP7635230B2 (en) | Systems and methods for virtual and augmented reality | |
| Brachmann et al. | Learning less is more-6d camera localization via 3d surface regression | |
| CN111862213A (en) | Positioning method and apparatus, electronic device, computer-readable storage medium | |
| CN114782691A (en) | Robot target identification and motion detection method based on deep learning, storage medium and equipment | |
| CN111583340B (en) | Method for reducing monocular camera pose estimation error rate based on convolutional neural network | |
| CN110853075A (en) | A visual tracking and localization method based on dense point cloud and synthetic view | |
| CN111899280A (en) | Monocular vision odometer method adopting deep learning and mixed pose estimation | |
| CN107392964A (en) | The indoor SLAM methods combined based on indoor characteristic point and structure lines | |
| CN101739721B (en) | Time change and disordered multi-image-based four-dimensional modeling method | |
| CN113205595A (en) | Construction method and application of 3D human body posture estimation model | |
| CN108171249B (en) | RGBD data-based local descriptor learning method | |
| CN114758152A (en) | A Feature Matching Method Based on Attention Mechanism and Neighborhood Consistency | |
| CN109389156B (en) | Training method and device of image positioning model and image positioning method | |
| CN116563340B (en) | Visual SLAM method based on deep learning under dynamic environment | |
| CN113379842B (en) | A SLAM localization method for weak texture and dynamic scene vision based on RGBD camera | |
| CN114663880B (en) | Three-dimensional object detection method based on multi-level cross-modal self-attention mechanism | |
| CN111582232A (en) | A SLAM method based on pixel-level semantic information | |
| CN108151728A (en) | A kind of half dense cognitive map creation method for binocular SLAM | |
| CN111105439A (en) | A Simultaneous Localization and Mapping Method Using Residual Attention Mechanism Network | |
| CN114119669A (en) | A Graph Matching Target Tracking Method and System Based on Shuffle Attention | |
| CN113449612A (en) | Three-dimensional target point cloud identification method based on sub-flow sparse convolution | |
| CN114693951A (en) | An RGB-D Saliency Object Detection Method Based on Global Context Information Exploration | |
| CN117036590A (en) | Multi-view outdoor three-dimensional scene reconstruction method and system | |
| CN110400349B (en) | Robot navigation tracking recovery method in small scene based on random forest | |
| CN115861563A (en) | A 3D Reconstruction Method for Graph Topologically Rigid Point Cloud Registration |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20220415 | |
| CF01 | Termination of patent right due to non-payment of annual fee |