# DIR-SLAM: Dynamic Interference Removal for Real-Time VSLAM in Dynamic Environments

Authors: Xiaomin Ma; Ye Yang; Lei Zhu; Yingmin Yi; Jing Xin; Xueping Su; Minqi Li
Journal: Mobile Information Systems
 (2023)

---

## Abstract

Traditional visual simultaneous localization and mapping (VSLAM) systems mostly rely on the static-world assumption, which limits their applications in real-world scenarios with dynamic objects. When there are dynamic objects in the scene, the localization accuracy of the system decreases seriously. In this paper, in order to minimize the interference of dynamic objects in vision localization, we propose a real-time and robust dynamic interference removal (DIR) method, which is based on both prior knowledge and geometry information. Our approach employs a novel lightweight CNN network to output semantic labels and extends the semantics based on the correlations of descriptors to generate a segmented mask. We design a geometric consistency check module to remove the dynamic interference, which computes the bundle adjustment to predetermine the static keypoints, and then the semantic weighted epipolar constraint is used to identify the dynamic outliers. The proposed method is integrated into the front end of ORB-SLAM2 to filter out the dynamic keypoints which are associated with the known and unknown dynamic objects. We conduct experiments on the public TUM RGB-D dataset, the qualitative and quantitative results prove that the DIR method can improve the performance of the state-of-the-art VSLAM system in dynamic scenarios.


---

## Body

## 1. Introduction

A mobile robot is an intelligent system that integrates multiple functions such as environment perception, dynamic anticollision, and motion control. To ensure the various capabilities of a mobile robot, visual simultaneous localization and mapping (VSLAM) are considered fundamental issues. In recent decades, VSLAM systems [1–7] based on visual sensors have attracted increasing attention and been well studied, with a rather satisfactory performance that can facilitate high-level tasks [8–10]. Typically, some well-performing VSLAM systems have been developed, such as ORB-SLAM2 [3] and LSD-SLAM [2]. Given a sequence of images, these systems can jointly estimate the camera pose and generate a continuous camera trajectory. However, the vast majority of the VSLAM systems are based on the assumption of static environments, which estimate the pose through a static feature set. As a consequence, they are vulnerable to unexpected changes in surroundings, such as dynamics, especially humans. In these scenarios, dynamic content affects the whole process of VSLAM, which inevitably degrades localization accuracy and reliability.To address these problems, many algorithms have been adopted to make the existing VSLAM systems dynamic-object-aware [8, 11–19]. Algorithms such as random sample consensus (RANSAC) [20, 21] are employed to reject outliers, which can weaken the dynamic interference by optimizing the feature set. However, these algorithms tend to fail when moving objects occupy a major part of the camera field of view. Compared with the method of purely optimizing features, distinguishing the content of a scene as static or dynamic benefits visual localization in dynamic scenarios [8, 11–14].With the development of machine learning, VSLAM systems combined with deep learning methods are well developed [15–19]. Advanced convolutional neural network (CNN) architectures such as Mask R-CNN[22], YOLO [23], and SegNet [24] are applied to effectively obtain prior knowledge, which is used to classify the objects of scenes. However, these methods handle the known objects and ignore the unknown dynamic objects, which are labeled as background. Therefore, it is not enough to judge the objects only by prior knowledge. In addition, most of these methods suffer from high computational costs and easily cause information loss. Therefore, robustness and low computation cost are two challenges for such approaches.In this paper, we propose a real-time and robust dynamic interference removal (DIR) method for dynamic scenarios, which mainly includes a semantic part and a geometric consistency check module. The former is composed of a novel semantic segmentation network and dynamic correlation region, which were introduced to provide a pixel-wise classification and extend the semantics of the local areas which are correlated with dynamic objects. The latter uses bundle adjustment and semantic weighted epipolar constraint to identify and reject the dynamic outliers. The main contributions of the proposed method are summarized as follows:(1)
We propose a novel lightweight semantic segmentation network built on MobileNetV2 [25], called De-MNetV2, which is more sensitive to dynamic objects and inconspicuous details. To obtain the dynamic content completely, we define the local areas which are correlated with dynamic pixels as the dynamic correlation region and extend the corresponding semantics of this region.(2)
We design an efficient geometric consistency check module, which is based on the bundle adjustment (BA) and the epipolar geometry constraint with semantic weights. The former is computed to predetermine static keypoints for avoiding information loss, and the latter is used to robustly identify the dynamic keypoints on the known and unknown objects.(3)
We insert the proposed method into ORB-SLAM2 [3], which is called DIR-SLAM (Dynamic Interference Removal SLAM system). Experiments on the widely used TUM RGB-D benchmark dataset [26] prove convincingly that visual localization accuracy in dynamic environments can be greatly boosted.The rest of this article is organized as follows: Section2 summarizes various dynamic SLAM methods and presents the essence of VSLAM problems in dynamic environments. Section 3 describes the theoretical content and verification of the proposed method. Section 4 shows the experimental results and analysis. We draw some conclusions and deliver future work in Section 5.


## 2. Related Work

In dynamic environments, some areas of the image may be taken up by dynamic pixels. As a result, the visual localization accuracy cannot be guaranteed resulting from the fusion of the dynamic content. To address this problem, we give a comprehensive analysis of the existing dynamic VSLAM algorithms in Section2 and explain the nature of dynamic VSLAM problems in Section 2.2.


### 2.1. Existing Dynamic VSLAM Algorithms

The direct methods mainly depend on the temporal or spatial coherence of dynamic points, such as the comparison of geometric structures [8, 11–14]. Jaimez et al. [11] use the K-means clustering algorithm and reprojection errors to classify geometric clusters as static or dynamic, then the dense dynamic points are removed. Scona et al. [8] employ both sensor information fusion and points of static probability to optimize the robot’s pose. Sun et al. [14] designed a motion removal method to address the problem of RGB-D SLAM in dynamic environments, which can estimate the possible foreground points by dense optical flow computing. According to the 3D information provided by the RGB-D camera, the depth information can be regarded as the only classification criterion. Li and Lee [12] present a static weighting method for handling depth edge points to indicate the likelihood of one point being part of the static environment, which can improve the tracking and mapping performance.Despite being suitable for dynamic environments, these methods use all pixels in the image for pose estimation; therefore, projection errors caused by interference such as camera noise and illumination changes cannot be properly handled, and thus reliable localization results are often not consistently achieved. In addition, geometric structures can only determine the moving objects and not the moveable objects, such as people who keep things static in their environment. Therefore, it is necessary to introduce prior knowledge to infer the moveable objects.With the prosperity of deep learning technologies, the feature-based VSLAM combined with deep-learning methods which can provide prior knowledge have developed rapidly to infer the dynamic objects with impressive performance [15–18]. Yu et al. [15] employ SegNet to obtain the semantics and check the moving consistency, then optimize the localization by filtering keypoints on humans. Bescos et al. [16] combine multiview geometry models and Mask R-CNN for detecting dynamic objects and use the region growth algorithm to remove all the dynamic points in the mapping process to estimate static maps. Cheng et al. [17] jointly employ YOLO3, Faster R-CNN, and SSD detection models as the prior knowledge generation module, and then a Bayesian framework is applied to determine and discard dynamic regions.


### 2.2. VSLAM Problems in Dynamic Environments

In feature-based VSLAM systems, the interference caused by dynamic objects is multifaceted and mainly reflected in keypoints, descriptors, and geometric structures. Dynamic keypoints on the moving objects, lead to inaccurate landmarks of tracking. Meanwhile, because the patch-based descriptors are constructed by sampling neighboring points of an area [27], thus the descriptors will contain dynamic content when dynamic keypoints exist in the area, which is not conducive to feature matching and pose estimation. Finally, the dynamic keypoints destroy the consistency and cause conflicts in geometric structures, which directly reduce the accuracy of visual localization.The essence of VSLAM problems in dynamic environments is observations; hence, we filter out unreliable observations to remove dynamic interference. As we discussed in Section2.1, since the objects with high-dynamic probability easily cause pose estimation errors and trajectory tracking failures, we contend it is essential to use the deep learning networks to prior infer the moveable objects. However, the prediction results of the network are often inaccurate, hence the geometric structures cannot be ignored, which express the consistency of points. Figure 1 shows that dynamic keypoints can destroy the epipolar geometry constraints.Figure 1
The dynamic interference to geometric structures. Assume thatP is a moving point, which moves to P′ in image I2. p2 is the dynamic keypoint which is matched with p1. O2 is the true camera pose. O2′ is estimated by the matched keypoints.Compared with the methods mentioned in Section2.1, our proposed method falls into the feature-based VSLAM combined with deep-learning methods and we describe the detailed characteristics in Section 3.


## 2.1. Existing Dynamic VSLAM Algorithms

The direct methods mainly depend on the temporal or spatial coherence of dynamic points, such as the comparison of geometric structures [8, 11–14]. Jaimez et al. [11] use the K-means clustering algorithm and reprojection errors to classify geometric clusters as static or dynamic, then the dense dynamic points are removed. Scona et al. [8] employ both sensor information fusion and points of static probability to optimize the robot’s pose. Sun et al. [14] designed a motion removal method to address the problem of RGB-D SLAM in dynamic environments, which can estimate the possible foreground points by dense optical flow computing. According to the 3D information provided by the RGB-D camera, the depth information can be regarded as the only classification criterion. Li and Lee [12] present a static weighting method for handling depth edge points to indicate the likelihood of one point being part of the static environment, which can improve the tracking and mapping performance.Despite being suitable for dynamic environments, these methods use all pixels in the image for pose estimation; therefore, projection errors caused by interference such as camera noise and illumination changes cannot be properly handled, and thus reliable localization results are often not consistently achieved. In addition, geometric structures can only determine the moving objects and not the moveable objects, such as people who keep things static in their environment. Therefore, it is necessary to introduce prior knowledge to infer the moveable objects.With the prosperity of deep learning technologies, the feature-based VSLAM combined with deep-learning methods which can provide prior knowledge have developed rapidly to infer the dynamic objects with impressive performance [15–18]. Yu et al. [15] employ SegNet to obtain the semantics and check the moving consistency, then optimize the localization by filtering keypoints on humans. Bescos et al. [16] combine multiview geometry models and Mask R-CNN for detecting dynamic objects and use the region growth algorithm to remove all the dynamic points in the mapping process to estimate static maps. Cheng et al. [17] jointly employ YOLO3, Faster R-CNN, and SSD detection models as the prior knowledge generation module, and then a Bayesian framework is applied to determine and discard dynamic regions.


## 2.2. VSLAM Problems in Dynamic Environments

In feature-based VSLAM systems, the interference caused by dynamic objects is multifaceted and mainly reflected in keypoints, descriptors, and geometric structures. Dynamic keypoints on the moving objects, lead to inaccurate landmarks of tracking. Meanwhile, because the patch-based descriptors are constructed by sampling neighboring points of an area [27], thus the descriptors will contain dynamic content when dynamic keypoints exist in the area, which is not conducive to feature matching and pose estimation. Finally, the dynamic keypoints destroy the consistency and cause conflicts in geometric structures, which directly reduce the accuracy of visual localization.The essence of VSLAM problems in dynamic environments is observations; hence, we filter out unreliable observations to remove dynamic interference. As we discussed in Section2.1, since the objects with high-dynamic probability easily cause pose estimation errors and trajectory tracking failures, we contend it is essential to use the deep learning networks to prior infer the moveable objects. However, the prediction results of the network are often inaccurate, hence the geometric structures cannot be ignored, which express the consistency of points. Figure 1 shows that dynamic keypoints can destroy the epipolar geometry constraints.Figure 1
The dynamic interference to geometric structures. Assume thatP is a moving point, which moves to P′ in image I2. p2 is the dynamic keypoint which is matched with p1. O2 is the true camera pose. O2′ is estimated by the matched keypoints.Compared with the methods mentioned in Section2.1, our proposed method falls into the feature-based VSLAM combined with deep-learning methods and we describe the detailed characteristics in Section 3.


## 3. DIR-SLAM

### 3.1. Method Overview

ORB-SLAM2 [3] is the most used solution for visual localization and has shown excellent performance in most practical situations. However, in dynamic environments, it suffers a lot. Therefore, we propose a dynamic interference removal method (DIR), which is named DIR-SLAM. The flowchart of DIR-SLAM is shown in Figure 2.Figure 2
The framework of DIR-SLAM. We insert the DIR method into the front end of ORB-SLAM2 and serve as a preprocessing stage to remove dynamic interference. Tracking, back end, and mapping threads are the same as ORB-SLAM2.Figure3 illustrates the details of the DIR method. It contains the following four sections: (1) semantic part; (2) dynamic correlation region; (2) feature matching; (3) geometric consistency check module. In the semantic part, we design a lightweight semantic segmentation network to output the semantic labels, which are arranged according to the likelihood of movement from 0 (background) to 20 (person). Then, the semantic content is extended according to the dynamic correlation region and generates a segmented mask. The dynamic correlation region is defined in Section 3.3. We use the segmented mask to provide semantic weights. For feature matching, the keypoints are tracked between the current frame and the previous frame by optical flow [28] to generate initial feature matches. In the geometric consistency check module, the BA is computed first to reserve static keypoints which are consistent with the previous camera pose and then the epipolar geometry constraint with semantic weights is calculated to identify and reject the dynamic outliers.Figure 3
The flow of the DIR method in 2 consecutive RGB color frames.Fc indicates the current frame, Fp indicates the previous frame. The method requires (1) feature matches between Fc and Fp; (2) the segmented mask obtained by prior semantic information from both De-MNetV2 and dynamic correlation region; (3) the pose of the previous frame Fp.


### 3.2. Semantic Segmentation

Consecutive frames captured by a moving camera are inevitably blurred or appeared ghosting, which requires higher scene parsing ability. In addition, frequently changing details of dynamic objects lead to strong interference and inconspicuous pixels in frames. Therefore, it is worthwhile to capture details. To address these problems, we propose a developed MobileNetV2 [25] network, i.e., De-MNetV2. The network structure of De-MNetV2 is shown in Figure 4.Figure 4
The overview of De-MNetV2. The network is built on MobileNetV2. The PSP header is the same as the pyramid pooling module (PPM) of PSPNet [29]. DConv is the dilated convolution, and d is the dilation rate. Conv2d is the fully connected layer with 1×1 convolution kernel, and s represents the step size. After DConv layer, the batch normalization [30] layer is connected, extra batch normalization and ReLU activation are added after each Conv2d layer.Figure4 shows the pyramid pooling module (PPM) of PSPNet [29] is connected with the backbone, namely, the PSP header, which gathers global context information and provides a complete understanding of the scene. Considering that the low-level layers of the network are rich in spatial details [31], we insert two skip connection branches to fuse the low-level features for increasing details, which benefits high-level features. The branches first extract the low-level features through dilation convolution, and then we use the fully connected layer for the dimensions consistently. Finally, the details from branches and the global context information provided by the PSP header are superposed and sent to the decoder to predict the semantic labels.The PSP Header can both develop adaptability and scene parsing in dynamic environments to reduce mismatches and confusion categories. Meanwhile, the details can benefit the network by enhancing the classification performance. We hold the opinion that these improvements are useful for classifications in dynamic environments.


### 3.3. Dynamic Correlation Region

In feature-based VSLAM methods, the camera pose is estimated by matching the descriptors of keypoints, such as ORB [32], SIFT [33], and FREAK [34]. Here, we take the ORB algorithm as an example to illustrate the correlation between dynamic points and neighbors. Next, we define the areas affected by dynamic objects as the dynamic correlation region.The ORB algorithm uses Rotation-Aware BRIEF (rBRIEF) descriptor. To generate the rBRIEF descriptor, a pixel-wise circular sampling patch centered at the keypoint is first rotated according to the orientation of the keypoint to guarantee rotation invariance. The circular patch centered at the keypoint is shown in Figure5.Figure 5
Orientation calculation within a circular area of radiusr. O is the center of the patch and the centroid is C. When a dynamic object appears, the centroid C will drift to C′ resulting from the changes in intensity.In Figure5, assumingO is static, the orientation angle θ of O is calculated by [35](1)θ=atan2m01,m10,where m01,m10 are defined as follows [35]:(2)mpq=∑x,yxpyqIx,y.It can be seen thatθ is closely relevant to the intensity Ix,y of the patch. Hence, when O is moving, centroid C becomes to C′ and θ drifts to θ′. The orientation deviation angle β can be expressed as follows:(3)β=absθ′−θ.In these cases, the rBRIEF descriptor will contain dynamic content, which can affect feature matching. To validate the influence, we simulate the orientation calculation process of rBRIEF descriptor. Pairs of frames are captured from different conditions to represent the various dynamic environments. We show the comparative results in Figure6. First, we gray the image and filter it with the Gaussian kernel 7×7. The orientation is computed by (2), and the angular deviation β between image pairs of each pixel is calculated by equation (3). For more intuitively, β value between 0°,360° is scaled to the red color channel of 0,255 and represented by a mask. The redder the color, the more severe the angular deviation, which shows the stronger the impact of dynamic objects.Figure 6
The deviation angles in different conditions. From left to right: the original image, the comparison image with dynamic objects,β mask, β mask superimposed with the original image, and the partially enlarged diagram of the yellow rectangle. Finally, the white circle is the patch that the radius is r.Simulation results indicate that dynamic objects can inevitably affect static points. Especially in the circular neighboring areas with the radiusr. We notice that dynamic semantics should occupythese areas, which will better play the role of prior knowledge. Hence, we define these areas as the dynamic correlation region.According to (1) and (2), we employ the morphological dilation algorithm to extend the semantics of dynamic objects for covering the dynamic correlation region. The dilation kernel k can be explained by(4)k=patch_size=2⋅r−1.Then, the segmented mask of the frame is updated. Without loss of generality, if another feature extractor is adopted, parameterk just needs to be adjusted based on the patch size.


### 3.4. Geometric Consistency Check Module

We design an adaptive geometric consistency check module between two consecutive frames, which can be applied in scenarios with known and unknown dynamic objects to robustly remove the dynamic interference. First, we compute BA [36] to estimate the static keypoints, which are consistent with the previous camera pose. Then, the epipolar geometry constraint with semantic weights is calculated to identify and reject dynamic outliers.As shown in Figure7, we assume that the keypoint pc in the current frame Fc is matched with pp in the previous frame Fp, which means the camera observes Pw. The coordinates of the matched pair can be expressed as pc=ucvc1 and pp=upvp1. Since the pose of the previous frame is known, according to the reprojection model, we can respect the observed point to the world coordinate frame and compute the corresponding 3D coordinates Pw=XwYwZw. Thus, the reprojection error between pc and pp is calculated as follows:(5)pc−πcPw,Tp≤ε,where πc is the projection function of the current frame and Tp is the pose of the previous frame. We set a small value to ε (1.0), thus the keypoints that satisfy equation (5) are considered static, which are directly reserved as inliers. For other matched pairs, the epipolar line lc of the keypoint pc is calculated as follows:(6)lc=F⋅ppT=F⋅upvp1T=ABCT,where F∈R3×3 denotes the fundamental matrix and A, B, and C denote real vectors. Then, the distance from the pc to the epipolar line lc is denoted by the following equation:(7)d=pcFppTA2+B2.Figure 7
The camera coordinate frames of the current frame and previous frame.Because of the sensor errors and dynamic interference, keypoints deviate from the epipolar lines. The larger the distanced, the more likely the keypoint is to be dynamic. Here, we employ the prior semantic information to weigh the distance d, where the label values are arranged according to the likelihood of movement from low (0) to high (20). Therefore, the label of higher motion probability covers lower ones after the semantic extension in Section 3.3. We assign the label values and corresponding semantic weights as shown in Figure 8.Figure 8
Illustration of semantic weights for each category of objects. We assign the semantic weights for objects according to the likelihood of movements. Here, the weights for static, low dynamic, medium dynamic, and high dynamic are, respectively, assigned to 1, 2, 5, and 10.As shown in Figure8, the semantic weight increases with the likelihood of the object moving. We employ the segmented mask to provide the semantic weight Wpc ofpc. The final distance function is calculated as follows:(8)dc=Wpc⋅d.dc is used to identify and reject dynamic outliers. When dc is larger than a certain threshold (1.0), the keypoint is considered a dynamic point and is rejected.We extract the results of the single-step of geometric consistency check module as shown in Figure9. In Figure 9(a) the green points are predetermined inliers by BA. These keypoints are recognized as static and have priority reserved for avoiding information loss. In Figure 9(b), the distance of semantic weighted epipoplar geometry is computed, and the filtered dynamic keypoints are shown as red points. Blue points represent the remaining static keypoints, which are employed to track the pose.Figure 9
The single-step results of the geometric consistency check module: (a) the predetermined static keypoints by BA; (b) the results of dynamic outliers rejection superimposed with the segmented masks.
(a)(b)


## 3.1. Method Overview

ORB-SLAM2 [3] is the most used solution for visual localization and has shown excellent performance in most practical situations. However, in dynamic environments, it suffers a lot. Therefore, we propose a dynamic interference removal method (DIR), which is named DIR-SLAM. The flowchart of DIR-SLAM is shown in Figure 2.Figure 2
The framework of DIR-SLAM. We insert the DIR method into the front end of ORB-SLAM2 and serve as a preprocessing stage to remove dynamic interference. Tracking, back end, and mapping threads are the same as ORB-SLAM2.Figure3 illustrates the details of the DIR method. It contains the following four sections: (1) semantic part; (2) dynamic correlation region; (2) feature matching; (3) geometric consistency check module. In the semantic part, we design a lightweight semantic segmentation network to output the semantic labels, which are arranged according to the likelihood of movement from 0 (background) to 20 (person). Then, the semantic content is extended according to the dynamic correlation region and generates a segmented mask. The dynamic correlation region is defined in Section 3.3. We use the segmented mask to provide semantic weights. For feature matching, the keypoints are tracked between the current frame and the previous frame by optical flow [28] to generate initial feature matches. In the geometric consistency check module, the BA is computed first to reserve static keypoints which are consistent with the previous camera pose and then the epipolar geometry constraint with semantic weights is calculated to identify and reject the dynamic outliers.Figure 3
The flow of the DIR method in 2 consecutive RGB color frames.Fc indicates the current frame, Fp indicates the previous frame. The method requires (1) feature matches between Fc and Fp; (2) the segmented mask obtained by prior semantic information from both De-MNetV2 and dynamic correlation region; (3) the pose of the previous frame Fp.


## 3.2. Semantic Segmentation

Consecutive frames captured by a moving camera are inevitably blurred or appeared ghosting, which requires higher scene parsing ability. In addition, frequently changing details of dynamic objects lead to strong interference and inconspicuous pixels in frames. Therefore, it is worthwhile to capture details. To address these problems, we propose a developed MobileNetV2 [25] network, i.e., De-MNetV2. The network structure of De-MNetV2 is shown in Figure 4.Figure 4
The overview of De-MNetV2. The network is built on MobileNetV2. The PSP header is the same as the pyramid pooling module (PPM) of PSPNet [29]. DConv is the dilated convolution, and d is the dilation rate. Conv2d is the fully connected layer with 1×1 convolution kernel, and s represents the step size. After DConv layer, the batch normalization [30] layer is connected, extra batch normalization and ReLU activation are added after each Conv2d layer.Figure4 shows the pyramid pooling module (PPM) of PSPNet [29] is connected with the backbone, namely, the PSP header, which gathers global context information and provides a complete understanding of the scene. Considering that the low-level layers of the network are rich in spatial details [31], we insert two skip connection branches to fuse the low-level features for increasing details, which benefits high-level features. The branches first extract the low-level features through dilation convolution, and then we use the fully connected layer for the dimensions consistently. Finally, the details from branches and the global context information provided by the PSP header are superposed and sent to the decoder to predict the semantic labels.The PSP Header can both develop adaptability and scene parsing in dynamic environments to reduce mismatches and confusion categories. Meanwhile, the details can benefit the network by enhancing the classification performance. We hold the opinion that these improvements are useful for classifications in dynamic environments.


## 3.3. Dynamic Correlation Region

In feature-based VSLAM methods, the camera pose is estimated by matching the descriptors of keypoints, such as ORB [32], SIFT [33], and FREAK [34]. Here, we take the ORB algorithm as an example to illustrate the correlation between dynamic points and neighbors. Next, we define the areas affected by dynamic objects as the dynamic correlation region.The ORB algorithm uses Rotation-Aware BRIEF (rBRIEF) descriptor. To generate the rBRIEF descriptor, a pixel-wise circular sampling patch centered at the keypoint is first rotated according to the orientation of the keypoint to guarantee rotation invariance. The circular patch centered at the keypoint is shown in Figure5.Figure 5
Orientation calculation within a circular area of radiusr. O is the center of the patch and the centroid is C. When a dynamic object appears, the centroid C will drift to C′ resulting from the changes in intensity.In Figure5, assumingO is static, the orientation angle θ of O is calculated by [35](1)θ=atan2m01,m10,where m01,m10 are defined as follows [35]:(2)mpq=∑x,yxpyqIx,y.It can be seen thatθ is closely relevant to the intensity Ix,y of the patch. Hence, when O is moving, centroid C becomes to C′ and θ drifts to θ′. The orientation deviation angle β can be expressed as follows:(3)β=absθ′−θ.In these cases, the rBRIEF descriptor will contain dynamic content, which can affect feature matching. To validate the influence, we simulate the orientation calculation process of rBRIEF descriptor. Pairs of frames are captured from different conditions to represent the various dynamic environments. We show the comparative results in Figure6. First, we gray the image and filter it with the Gaussian kernel 7×7. The orientation is computed by (2), and the angular deviation β between image pairs of each pixel is calculated by equation (3). For more intuitively, β value between 0°,360° is scaled to the red color channel of 0,255 and represented by a mask. The redder the color, the more severe the angular deviation, which shows the stronger the impact of dynamic objects.Figure 6
The deviation angles in different conditions. From left to right: the original image, the comparison image with dynamic objects,β mask, β mask superimposed with the original image, and the partially enlarged diagram of the yellow rectangle. Finally, the white circle is the patch that the radius is r.Simulation results indicate that dynamic objects can inevitably affect static points. Especially in the circular neighboring areas with the radiusr. We notice that dynamic semantics should occupythese areas, which will better play the role of prior knowledge. Hence, we define these areas as the dynamic correlation region.According to (1) and (2), we employ the morphological dilation algorithm to extend the semantics of dynamic objects for covering the dynamic correlation region. The dilation kernel k can be explained by(4)k=patch_size=2⋅r−1.Then, the segmented mask of the frame is updated. Without loss of generality, if another feature extractor is adopted, parameterk just needs to be adjusted based on the patch size.


## 3.4. Geometric Consistency Check Module

We design an adaptive geometric consistency check module between two consecutive frames, which can be applied in scenarios with known and unknown dynamic objects to robustly remove the dynamic interference. First, we compute BA [36] to estimate the static keypoints, which are consistent with the previous camera pose. Then, the epipolar geometry constraint with semantic weights is calculated to identify and reject dynamic outliers.As shown in Figure7, we assume that the keypoint pc in the current frame Fc is matched with pp in the previous frame Fp, which means the camera observes Pw. The coordinates of the matched pair can be expressed as pc=ucvc1 and pp=upvp1. Since the pose of the previous frame is known, according to the reprojection model, we can respect the observed point to the world coordinate frame and compute the corresponding 3D coordinates Pw=XwYwZw. Thus, the reprojection error between pc and pp is calculated as follows:(5)pc−πcPw,Tp≤ε,where πc is the projection function of the current frame and Tp is the pose of the previous frame. We set a small value to ε (1.0), thus the keypoints that satisfy equation (5) are considered static, which are directly reserved as inliers. For other matched pairs, the epipolar line lc of the keypoint pc is calculated as follows:(6)lc=F⋅ppT=F⋅upvp1T=ABCT,where F∈R3×3 denotes the fundamental matrix and A, B, and C denote real vectors. Then, the distance from the pc to the epipolar line lc is denoted by the following equation:(7)d=pcFppTA2+B2.Figure 7
The camera coordinate frames of the current frame and previous frame.Because of the sensor errors and dynamic interference, keypoints deviate from the epipolar lines. The larger the distanced, the more likely the keypoint is to be dynamic. Here, we employ the prior semantic information to weigh the distance d, where the label values are arranged according to the likelihood of movement from low (0) to high (20). Therefore, the label of higher motion probability covers lower ones after the semantic extension in Section 3.3. We assign the label values and corresponding semantic weights as shown in Figure 8.Figure 8
Illustration of semantic weights for each category of objects. We assign the semantic weights for objects according to the likelihood of movements. Here, the weights for static, low dynamic, medium dynamic, and high dynamic are, respectively, assigned to 1, 2, 5, and 10.As shown in Figure8, the semantic weight increases with the likelihood of the object moving. We employ the segmented mask to provide the semantic weight Wpc ofpc. The final distance function is calculated as follows:(8)dc=Wpc⋅d.dc is used to identify and reject dynamic outliers. When dc is larger than a certain threshold (1.0), the keypoint is considered a dynamic point and is rejected.We extract the results of the single-step of geometric consistency check module as shown in Figure9. In Figure 9(a) the green points are predetermined inliers by BA. These keypoints are recognized as static and have priority reserved for avoiding information loss. In Figure 9(b), the distance of semantic weighted epipoplar geometry is computed, and the filtered dynamic keypoints are shown as red points. Blue points represent the remaining static keypoints, which are employed to track the pose.Figure 9
The single-step results of the geometric consistency check module: (a) the predetermined static keypoints by BA; (b) the results of dynamic outliers rejection superimposed with the segmented masks.
(a)(b)


## 4. Experiments

To prove the effectiveness of the proposed method in this paper, we conduct comparative experiments on the methods and evaluate the results quantitatively and qualitatively. In this section, we experimentally evaluate the effectiveness of the proposed method from the following two parts: (1) De-MNetV2 network; (2) DIR-SLAM.


### 4.1. De-MNetV2 Network

The De-MNetV2 network is trained on PASCAL VOC 2012 dataset [37]. The model can detect 20 classes that contain common dynamic objects, e.g., people, cats, and dogs, which suffices to meet the testing requirements of the TUM dataset [26]. If the environment is complex, the model should be trained on the COCO dataset [38] to classify more categories. The implementation is training on the public platform Keras with a GTX 2080Ti, Intel E5-2678 v3 CPU, and 64GB RAM. For data augmentation, we randomly scale (from 0.5 to 1.5) and left-right flip the input images. The images are cropped to 576×576 and grouped with batch size 6. We set the initial learning rate to 0.0001, which gradually decreases to 0 by following the “poly” strategy 1−iter/maxiterpower and power=0.9 [39]. The network is trained with Adam, of which the weight decay is set to 0.00001. The pixel-wise dice loss [40] is used as the loss function.We conduct the experiments with the evaluation metric mean Intersection Over Union (mIOU) and mean Pixel Accuracy (mPA). Table1 gives the comparison of semantic segmentation on the PASCAL VOC 2012 validation set.Table 1
Comparison on PASCAL VOC 2012 validation set.
NetworkHeaderParams (M)mIOU (%)mPA (%)MNetV2∗ASPP2.1574.9283.49PSP2.4173.6182.60De-MNetV2PSP2.5975.7584.061MNetV2∗: second last feature map is used for DeepLabv3 heads [39] or PSPNet heads, named, separately MobileNet + DeepLabV3 [25] and MobileNet + PSPNet. 2The output stride is fixed on 16. All the results come from our own experiments. 3All the networks are trained on the PASCAL VOC2012 train set without pretraining weights.Our network achieves mIOU of 75.75% and mPA of 84.06%. Compared with the original MobileNetV2, the mIOU of MobileNet + PSPNet is reduced by 2.31%. Because the multiscale pyramid pooling module abstracts the high-level features, which enhance scene parsing but reduce classification capabilities in lightweight networks. After the insertion of skip connection branches, the mIOU of De-MNetV2 is 2.14% higher than that of MobileNet + PSPNet, which indicates that the fusion of details from low-level layers can refine the high-level features and improve overall performance. Compared to MobileNet + DeepLabV3, which performs the best semantic segmentation performance in the original paper [25], our network is competitive.Figure10 lists the comparison of scene parsing ability and details between De-MNetV2 and MobileNet ∗ DeepLabV3. These results suggest that De-MNetV2 is more sensitive to dynamic objects, and the misclassifications and discontinuous labels are fewer. We suggest that the De-MNetV2 is more suitable for our requirements.Figure 10
Comparison of segmentation results. (a): the images are segmented by MobileNet + DeepLabV3 [25], which performs best in the original paper. (b): the images are segmented by our network.Table 2
Evaluation of ATE for the results of ORB-SLAM2, DS-SLAM, DynaSLAM, and DIR-SLAM (m).
SequencesORB-SLAM2DS-SLAM [15]DynaSLAM [16]DIR-SLAM (ours)ImprovementRMSESDRMSESDRMSESDRMSESDRMSE (%)SD (%)f3/w/half0.45250.26750.03030.01590.025—0.02750.013393.9295.03f3/w/rpy0.74380.36440.44420.23500.035—0.02980.018495.9994.95f3/w/static0.40740.12460.00810.00360.006—0.00620.002798.4897.83f3/w/xyz0.79780.45530.02470.01610.015—0.01470.006898.1698.51f3/w/half/v0.58990.3418————0.02180.012096.3096.49f3/w/rpy/v0.59350.3239————0.02910.018495.1094.32f3/w/static/v0.71890.1952————0.00870.004598.7997.69f3/w/xyz/v1.60460.6560————0.01160.005199.2899.22f3/s/half0.02440.0136——0.017—0.01270.006047.9555.88f3/s/rpy0.01970.0126——0.015—0.01930.01162.037.94f3/s/static0.00800.00370.00650.0033——0.00590.002826.2524.32f3/s/xyz0.00970.0049————0.00990.0049−2.060.00Table 3
Evaluation of RPE for the results of ORB-SLAM2, DS-SLAM, and DIR-SLAM (m).
SequencesORB-SLAM2DS-SLAM [15]DIR-SLAM (ours)ImprovementRMSESDRMSESDRMSESDRMSE (%)SD (%)f3/w/half0.35930.28730.02970.01520.02960.015491.7694.64f3/w/rpy0.44360.33310.15030.11680.04140.024990.6792.52f3/w/static0.21430.19370.01020.00480.00850.004096.0397.93f3/w/xyz0.42840.28770.03330.02290.01950.009095.4596.87f3/w/half/v0.28530.2291——0.02630.015990.7893.06f3/w/rpy/v0.34820.2855——0.03540.022389.8392.19f3/w/static/v0.24770.2188——0.01020.005595.8897.49f3/w/xyz/v0.42950.3816——0.01530.007296.4498.11f3/s/half0.02500.0182——0.01430.006642.8063.74f3/s/rpy0.02500.0148——0.02480.01410.804.73f3/s/static0.00940.00420.00780.00380.00730.003422.3419.05f3/s/xyz0.01210.0062——0.01270.0067−4.96−8.06From Tables2 and 3, we can see that DIR-SLAM gets competitive ATE and RPE values in most of the sequences, which shows that our method achieves excellent performance. The results illustrate that the proposed DIR method has an exponential growth rate compared to the original ORB-SLAM2 in high-dynamic scenarios, which is effective and excellent.Similar to the DS-SLAM, we segment the scene and use the epipolar constraints to determine and reject the dynamic outliers. The reasons our method outperforms DS-SLAM are because we extend the semantics in the dynamic correlation region to obtain the prior information more completely, and we use the semantic weights to make the movement of dynamic targets more obvious. Besides, we do not cluster the keypoints by pixels or geometric structures. All the keypoints are identified robustly and independently, the experimental results present the feasibility. Compared with the DynaSLAM, the experimental results show that our performance is very close. In the semantic part, DynaSLAM extends semantics similarly, but without going into further theoretical analysis. DynaSLAM relies on Mask R-CNN and multi-view geometry to improve semantics, which brings in expensive computational costs. Our method is implemented by a lightweight De-MNetV2 network and semantic extension of the dynamic correlation region, which are fast and efficient.We evaluate the accuracy of our system with different configurations, and the RMSE of ATE is shown in Table4. We test four different configurations of DIR-SLAM.(1)
MNetV2∗: MobileNet ∗ DeepLabV3 is used for semantic segmentation(2)
Correlation∗: the semantics do not extend to cover the dynamic correlation region(3)
Semantic∗: the semantic weights are not used(4)
BA∗: BA of the geometric consistency check module is not computedTable 4
Evaluation of ATE on the TUM RGB-D dataset using the proposed method with different configurations (m).
SequencesMNetV2∗Correlation∗Semantic∗BA∗DIR-SLAM (ours)f3/w/half0.02830.03040.03920.03060.0275f3/w/rpy0.02970.11860.18160.05740.0298f3/w/static0.00690.00840.00930.00850.0062f3/w/xyz0.01520.01590.06520.27290.0147f3/w/half/v0.02310.03160.03240.02910.0218f3/w/rpy/v0.03030.02800.02940.03060.0291f3/w/static/v0.00880.00840.00930.00880.0083f3/w/xyz/v0.01210.01150.34110.01250.0113f3/s/half0.01370.01440.01520.01460.0127f3/s/rpy0.02040.02130.02150.03410.0193f3/s/static0.00620.00630.00740.00640.0059f3/s/xyz0.01010.01070.00890.01140.0099Table4 shows that the results of DIR-SLAM are better than others. In view of Table 2, we notice that the experimental results of our method are not ideal in low-dynamic sequences. Due to robustness, ORB-SLAM2 is enough to overcome the dynamic interference caused by slight movements. For f3/s/xyz sequence, the ATE of ORB-SLAM2 is 0.0097 meter and better than our method. However, Table 4 shows that the DIR-SLAM configured with Semantic∗ outperforms others in this sequence, in which the semantic weights are removed. Hence, we consider that prior knowledge can lead to information loss. We use the BA to verify the consistency between keypoints and the pose of the previous frame, which predetermines the static keypoints and reduces information loss. In terms of experimental results of DIR-SLAM, the gaps between DIR-SLAM and ORB-SLAM2 in f3/s sequences are small.Figure11 shows the comparative results of trajectories in sequences. We use three types of lines to express the trajectory. It can be seen that the trajectory of DIR-SLAM is closer to the ground truth, which indicates that the localization results of DIR-SLAM are more precise. Although the experimental results have a certain degree of uncertainty, they still basically follow regularity. Based on the results of qualitative analysis, the DIR-SLAM is more suitable for high-dynamic scenarios with larger camera movements.Figure 11
Trajectories of high-dynamic sequences. Each diagram from top to down displays the trajectory generated by ground truth, DIR-SLAM, and ORB-SLAM2. (a) f3/w/half. (b) f3/w/rpy. (c) f3/w/static. (d) f3/w/xyz.
(a)(b)(c)(d)


### 4.2. DIR-SLAM

We have evaluated DIR-SLAM in the public TUM RGB-D dataset [26] and compared it with other state-of-the-art VSLAM systems [15, 16]. The runtime analysis is presented to show the efficiency of our method. Furthermore, we demonstrate the performance of our method with a Kinect V1 in a real environment.The descriptions of sequences for evaluation are as follows: The f3 sequences are dynamic object sequences, which contain four types of camera motions. (1) half (half sphere): the camera has been moved on a small half sphere of approximately one-meter diameter. (2) rpy: the camera has been rotated along the principal axes (roll-pitch-yaw) at the same position. (3) static: the camera has been kept in place manually. (4) xyz: the camera has manually been moved along three directions (xyz) while keeping the same orientation. Specifically, f3/s means f3_sitting sequences, which depict low-dynamic scenarios, and f3/w means f3_walking sequences, which depict high-dynamic scenarios. The suffixv represents validation sequences with undisclosed ground truth. Each sequence contains both RGB and depth images recorded at the full frame rate 30Hz of 640×480 size. We performed all the experiments in a notebook with 2.6 GHz Intel i7-9750H, 16 GB RAM, NVIDIA GTX1660Ti, and Ubuntu16.04.The quantitative evaluation indicators of the comparison, respectively, employ Absolute Trajectory Error (ATE) and Relative Pose Error (RPE). Our method is compared with other methods in terms of Root-Mean-Square Error (RMSE) and Standard Deviation (SD).We chose the most advanced dynamic VSLAM methods DS-SLAM [15], DynaSLAM [16], and the original ORB-SLAM2 [3], for performance comparisons. All the methods are based on ORB-SLAM2, and the comparison results are shown in Tables 2 and 3.Our system is a real-time semantic SLAM system. In order to show the efficiency, we compared the average computation time of major processing modules between DIR-SLAM and ORB-SLAM2. To find a relation of the computational cost and the amount of dynamic points, we choose the f3/w/static sequence and f3/w/xyz sequence for comparison. As mentioned in Section4.2, the motion in f3/w/xyz is more complicated because the camera is always moving. The results are shown in Table 5.Table 5
Comparison of average computation time (ms).
ModulesORB-SLAM2DIR-SLAM (ours)f3/w/staticf3/w/xyzf3/w/staticf3/w/xyzSemantic part——23.143923.0893Geometric consistency check——33.164742.8656Pose estimation13.661815.68196.61417.1349Tracking26.535927.600152.560461.2871The modules in Table5 correspond to Figure 3. Specifically, the semantic part runs in parallel with the system as a separate GPU thread. In the geometric consistency check module, f3/w/xyz takes more time than f3/w/static. Because the dynamic points in the f3/w/xyz sequence are more diffused, the fundamental matrix F takes more iteration time. In pose estimation, the DIR-SLAM is faster than the original ORB-SLAM2, due to dynamic outliers are rejected, the convergence rate of pose optimization is accelerating. Finally, tracking is the main thread to process every single frame, our method costs less than 100 ms and as fast as a human brain [41].


### 4.3. Robustness Test in a Real Environment

We integrate DIR-SLAM with ROS and conduct experiments in a real environment to demonstrate the robustness and real-time performance. Frames are captured by a Kinect V1 camera with640×480. The duration is about 2 minutes. Experimental results of DIR-SLAM during the real environment test are shown in Figure 12. The red points are dynamic keypoints, which are identified by the proposed method, and the blue points are static keypoints.Figure 12
Experimental results in a real environment: (a) known dynamic object: person; (b) unknown dynamic object: book.
(a)(b)In a real environment, a person holding a book is sitting in front of the camera, and the camera is holding static. Note that the person is labeled, but the book is not. In Figure12(a), when the person is moving meanwhile the book stays static, the dynamic keypoints are basically distributed in the person. In Figure 12(b), the book is moved but the person is not, so our method can identify the dynamic keypoints distributed in the book. We record the complete experimental test video: https://wo712268.lofter.com/post/1d4e8522_2b40b2d53.


## 4.1. De-MNetV2 Network

The De-MNetV2 network is trained on PASCAL VOC 2012 dataset [37]. The model can detect 20 classes that contain common dynamic objects, e.g., people, cats, and dogs, which suffices to meet the testing requirements of the TUM dataset [26]. If the environment is complex, the model should be trained on the COCO dataset [38] to classify more categories. The implementation is training on the public platform Keras with a GTX 2080Ti, Intel E5-2678 v3 CPU, and 64GB RAM. For data augmentation, we randomly scale (from 0.5 to 1.5) and left-right flip the input images. The images are cropped to 576×576 and grouped with batch size 6. We set the initial learning rate to 0.0001, which gradually decreases to 0 by following the “poly” strategy 1−iter/maxiterpower and power=0.9 [39]. The network is trained with Adam, of which the weight decay is set to 0.00001. The pixel-wise dice loss [40] is used as the loss function.We conduct the experiments with the evaluation metric mean Intersection Over Union (mIOU) and mean Pixel Accuracy (mPA). Table1 gives the comparison of semantic segmentation on the PASCAL VOC 2012 validation set.Table 1
Comparison on PASCAL VOC 2012 validation set.
NetworkHeaderParams (M)mIOU (%)mPA (%)MNetV2∗ASPP2.1574.9283.49PSP2.4173.6182.60De-MNetV2PSP2.5975.7584.061MNetV2∗: second last feature map is used for DeepLabv3 heads [39] or PSPNet heads, named, separately MobileNet + DeepLabV3 [25] and MobileNet + PSPNet. 2The output stride is fixed on 16. All the results come from our own experiments. 3All the networks are trained on the PASCAL VOC2012 train set without pretraining weights.Our network achieves mIOU of 75.75% and mPA of 84.06%. Compared with the original MobileNetV2, the mIOU of MobileNet + PSPNet is reduced by 2.31%. Because the multiscale pyramid pooling module abstracts the high-level features, which enhance scene parsing but reduce classification capabilities in lightweight networks. After the insertion of skip connection branches, the mIOU of De-MNetV2 is 2.14% higher than that of MobileNet + PSPNet, which indicates that the fusion of details from low-level layers can refine the high-level features and improve overall performance. Compared to MobileNet + DeepLabV3, which performs the best semantic segmentation performance in the original paper [25], our network is competitive.Figure10 lists the comparison of scene parsing ability and details between De-MNetV2 and MobileNet ∗ DeepLabV3. These results suggest that De-MNetV2 is more sensitive to dynamic objects, and the misclassifications and discontinuous labels are fewer. We suggest that the De-MNetV2 is more suitable for our requirements.Figure 10
Comparison of segmentation results. (a): the images are segmented by MobileNet + DeepLabV3 [25], which performs best in the original paper. (b): the images are segmented by our network.Table 2
Evaluation of ATE for the results of ORB-SLAM2, DS-SLAM, DynaSLAM, and DIR-SLAM (m).
SequencesORB-SLAM2DS-SLAM [15]DynaSLAM [16]DIR-SLAM (ours)ImprovementRMSESDRMSESDRMSESDRMSESDRMSE (%)SD (%)f3/w/half0.45250.26750.03030.01590.025—0.02750.013393.9295.03f3/w/rpy0.74380.36440.44420.23500.035—0.02980.018495.9994.95f3/w/static0.40740.12460.00810.00360.006—0.00620.002798.4897.83f3/w/xyz0.79780.45530.02470.01610.015—0.01470.006898.1698.51f3/w/half/v0.58990.3418————0.02180.012096.3096.49f3/w/rpy/v0.59350.3239————0.02910.018495.1094.32f3/w/static/v0.71890.1952————0.00870.004598.7997.69f3/w/xyz/v1.60460.6560————0.01160.005199.2899.22f3/s/half0.02440.0136——0.017—0.01270.006047.9555.88f3/s/rpy0.01970.0126——0.015—0.01930.01162.037.94f3/s/static0.00800.00370.00650.0033——0.00590.002826.2524.32f3/s/xyz0.00970.0049————0.00990.0049−2.060.00Table 3
Evaluation of RPE for the results of ORB-SLAM2, DS-SLAM, and DIR-SLAM (m).
SequencesORB-SLAM2DS-SLAM [15]DIR-SLAM (ours)ImprovementRMSESDRMSESDRMSESDRMSE (%)SD (%)f3/w/half0.35930.28730.02970.01520.02960.015491.7694.64f3/w/rpy0.44360.33310.15030.11680.04140.024990.6792.52f3/w/static0.21430.19370.01020.00480.00850.004096.0397.93f3/w/xyz0.42840.28770.03330.02290.01950.009095.4596.87f3/w/half/v0.28530.2291——0.02630.015990.7893.06f3/w/rpy/v0.34820.2855——0.03540.022389.8392.19f3/w/static/v0.24770.2188——0.01020.005595.8897.49f3/w/xyz/v0.42950.3816——0.01530.007296.4498.11f3/s/half0.02500.0182——0.01430.006642.8063.74f3/s/rpy0.02500.0148——0.02480.01410.804.73f3/s/static0.00940.00420.00780.00380.00730.003422.3419.05f3/s/xyz0.01210.0062——0.01270.0067−4.96−8.06From Tables2 and 3, we can see that DIR-SLAM gets competitive ATE and RPE values in most of the sequences, which shows that our method achieves excellent performance. The results illustrate that the proposed DIR method has an exponential growth rate compared to the original ORB-SLAM2 in high-dynamic scenarios, which is effective and excellent.Similar to the DS-SLAM, we segment the scene and use the epipolar constraints to determine and reject the dynamic outliers. The reasons our method outperforms DS-SLAM are because we extend the semantics in the dynamic correlation region to obtain the prior information more completely, and we use the semantic weights to make the movement of dynamic targets more obvious. Besides, we do not cluster the keypoints by pixels or geometric structures. All the keypoints are identified robustly and independently, the experimental results present the feasibility. Compared with the DynaSLAM, the experimental results show that our performance is very close. In the semantic part, DynaSLAM extends semantics similarly, but without going into further theoretical analysis. DynaSLAM relies on Mask R-CNN and multi-view geometry to improve semantics, which brings in expensive computational costs. Our method is implemented by a lightweight De-MNetV2 network and semantic extension of the dynamic correlation region, which are fast and efficient.We evaluate the accuracy of our system with different configurations, and the RMSE of ATE is shown in Table4. We test four different configurations of DIR-SLAM.(1)
MNetV2∗: MobileNet ∗ DeepLabV3 is used for semantic segmentation(2)
Correlation∗: the semantics do not extend to cover the dynamic correlation region(3)
Semantic∗: the semantic weights are not used(4)
BA∗: BA of the geometric consistency check module is not computedTable 4
Evaluation of ATE on the TUM RGB-D dataset using the proposed method with different configurations (m).
SequencesMNetV2∗Correlation∗Semantic∗BA∗DIR-SLAM (ours)f3/w/half0.02830.03040.03920.03060.0275f3/w/rpy0.02970.11860.18160.05740.0298f3/w/static0.00690.00840.00930.00850.0062f3/w/xyz0.01520.01590.06520.27290.0147f3/w/half/v0.02310.03160.03240.02910.0218f3/w/rpy/v0.03030.02800.02940.03060.0291f3/w/static/v0.00880.00840.00930.00880.0083f3/w/xyz/v0.01210.01150.34110.01250.0113f3/s/half0.01370.01440.01520.01460.0127f3/s/rpy0.02040.02130.02150.03410.0193f3/s/static0.00620.00630.00740.00640.0059f3/s/xyz0.01010.01070.00890.01140.0099Table4 shows that the results of DIR-SLAM are better than others. In view of Table 2, we notice that the experimental results of our method are not ideal in low-dynamic sequences. Due to robustness, ORB-SLAM2 is enough to overcome the dynamic interference caused by slight movements. For f3/s/xyz sequence, the ATE of ORB-SLAM2 is 0.0097 meter and better than our method. However, Table 4 shows that the DIR-SLAM configured with Semantic∗ outperforms others in this sequence, in which the semantic weights are removed. Hence, we consider that prior knowledge can lead to information loss. We use the BA to verify the consistency between keypoints and the pose of the previous frame, which predetermines the static keypoints and reduces information loss. In terms of experimental results of DIR-SLAM, the gaps between DIR-SLAM and ORB-SLAM2 in f3/s sequences are small.Figure11 shows the comparative results of trajectories in sequences. We use three types of lines to express the trajectory. It can be seen that the trajectory of DIR-SLAM is closer to the ground truth, which indicates that the localization results of DIR-SLAM are more precise. Although the experimental results have a certain degree of uncertainty, they still basically follow regularity. Based on the results of qualitative analysis, the DIR-SLAM is more suitable for high-dynamic scenarios with larger camera movements.Figure 11
Trajectories of high-dynamic sequences. Each diagram from top to down displays the trajectory generated by ground truth, DIR-SLAM, and ORB-SLAM2. (a) f3/w/half. (b) f3/w/rpy. (c) f3/w/static. (d) f3/w/xyz.
(a)(b)(c)(d)


## 4.2. DIR-SLAM

We have evaluated DIR-SLAM in the public TUM RGB-D dataset [26] and compared it with other state-of-the-art VSLAM systems [15, 16]. The runtime analysis is presented to show the efficiency of our method. Furthermore, we demonstrate the performance of our method with a Kinect V1 in a real environment.The descriptions of sequences for evaluation are as follows: The f3 sequences are dynamic object sequences, which contain four types of camera motions. (1) half (half sphere): the camera has been moved on a small half sphere of approximately one-meter diameter. (2) rpy: the camera has been rotated along the principal axes (roll-pitch-yaw) at the same position. (3) static: the camera has been kept in place manually. (4) xyz: the camera has manually been moved along three directions (xyz) while keeping the same orientation. Specifically, f3/s means f3_sitting sequences, which depict low-dynamic scenarios, and f3/w means f3_walking sequences, which depict high-dynamic scenarios. The suffixv represents validation sequences with undisclosed ground truth. Each sequence contains both RGB and depth images recorded at the full frame rate 30Hz of 640×480 size. We performed all the experiments in a notebook with 2.6 GHz Intel i7-9750H, 16 GB RAM, NVIDIA GTX1660Ti, and Ubuntu16.04.The quantitative evaluation indicators of the comparison, respectively, employ Absolute Trajectory Error (ATE) and Relative Pose Error (RPE). Our method is compared with other methods in terms of Root-Mean-Square Error (RMSE) and Standard Deviation (SD).We chose the most advanced dynamic VSLAM methods DS-SLAM [15], DynaSLAM [16], and the original ORB-SLAM2 [3], for performance comparisons. All the methods are based on ORB-SLAM2, and the comparison results are shown in Tables 2 and 3.Our system is a real-time semantic SLAM system. In order to show the efficiency, we compared the average computation time of major processing modules between DIR-SLAM and ORB-SLAM2. To find a relation of the computational cost and the amount of dynamic points, we choose the f3/w/static sequence and f3/w/xyz sequence for comparison. As mentioned in Section4.2, the motion in f3/w/xyz is more complicated because the camera is always moving. The results are shown in Table 5.Table 5
Comparison of average computation time (ms).
ModulesORB-SLAM2DIR-SLAM (ours)f3/w/staticf3/w/xyzf3/w/staticf3/w/xyzSemantic part——23.143923.0893Geometric consistency check——33.164742.8656Pose estimation13.661815.68196.61417.1349Tracking26.535927.600152.560461.2871The modules in Table5 correspond to Figure 3. Specifically, the semantic part runs in parallel with the system as a separate GPU thread. In the geometric consistency check module, f3/w/xyz takes more time than f3/w/static. Because the dynamic points in the f3/w/xyz sequence are more diffused, the fundamental matrix F takes more iteration time. In pose estimation, the DIR-SLAM is faster than the original ORB-SLAM2, due to dynamic outliers are rejected, the convergence rate of pose optimization is accelerating. Finally, tracking is the main thread to process every single frame, our method costs less than 100 ms and as fast as a human brain [41].


## 4.3. Robustness Test in a Real Environment

We integrate DIR-SLAM with ROS and conduct experiments in a real environment to demonstrate the robustness and real-time performance. Frames are captured by a Kinect V1 camera with640×480. The duration is about 2 minutes. Experimental results of DIR-SLAM during the real environment test are shown in Figure 12. The red points are dynamic keypoints, which are identified by the proposed method, and the blue points are static keypoints.Figure 12
Experimental results in a real environment: (a) known dynamic object: person; (b) unknown dynamic object: book.
(a)(b)In a real environment, a person holding a book is sitting in front of the camera, and the camera is holding static. Note that the person is labeled, but the book is not. In Figure12(a), when the person is moving meanwhile the book stays static, the dynamic keypoints are basically distributed in the person. In Figure 12(b), the book is moved but the person is not, so our method can identify the dynamic keypoints distributed in the book. We record the complete experimental test video: https://wo712268.lofter.com/post/1d4e8522_2b40b2d53.


## 5. Conclusion

In this article, we propose a real-time semantic DIR-SLAM to address the problems of visual localization in dynamic environments. As we depicted before, we reject all the dynamic keypoints on account of prior knowledge and geometry constraints. We use ORB-SLAM2 [3] as the system framework and perform experiments on the public TUM RGB-D dataset [26]. From the results, we notice that our system can outperform high-dynamic scenarios more than low-dynamic scenarios, and robustly take effect on unknown environments.However, the errors still exist. The method cannot well deal with the trajectory deviation caused by the camera moving. To handle the pose estimation errors caused by the rapid and large changes of views, we intend to attempt an affine-invariant feature extractor that is more adaptable to the movements of the camera. Besides, we aim to join the semantic mapping and background repairing methods to DIR-SLAM to realize real-time dense mapping.



---

*Source: 1145346-2023-02-04.xml*