1. Introduction
In recent years, intelligent robots have become increasingly prevalent in everyday life, transforming both work and living environments. As a prerequisite for autonomous robot localization and navigation, simultaneous localization and mapping (SLAM) technology has garnered significant attention [Reference Bresson, Alsayed, Yu and Glaser1]. The fundamental goal of SLAM is to use sensor data (e.g., cameras, LIDAR) to determine the robot’s position in real time and construct a detailed map of its surroundings in an environment with no a priori map. SLAM can be divided into two primary categories based on sensor types: visual SLAM and laser SLAM. Visual SLAM, in particular, offers advantages such as lower cost, rich visual information, and ease of integration with other sensors compared to laser SLAM.
Classical visual SLAM consists of five primary modules: sensor data acquisition, front-end visual odometry, back-end (nonlinear) optimization, loop closure, and map construction. The algorithms for visual odometry are mainly categorized into feature-point and direct methods [Reference Chen, Sheng, Yang, Su and Liang2]. The feature-based approach, known for its stability and resistance to lighting variations and dynamic objects, is the dominant method. Among them, ORB-SLAM1-3 [Reference Mur-Artal, Montiel and Tardos3–Reference Campos, Elvira, Rodríguez, Montiel and Tardós5] is a widely recognized classic visual SLAM algorithm based on the feature-point method, which relies on extracting ORB (Oriented FAST and Rotated BRIEF) features [Reference Rublee, Rabaud, Konolige and Bradski6] for matching and position estimation, thus enabling camera localization and map construction. However, this method is computationally intensive and prone to losing useful information. In contrast, the direct method estimates camera motion based on pixel brightness information, eliminating the need to compute keypoints and descriptors, thereby avoiding some limitations of the feature-point approach. Examples of direct-method visual SLAM algorithms include LSD-SLAM [Reference Engel, Schöps and Cremers7], SVO [Reference Forster, Pizzoli and Scaramuzza8], and DTAM [Reference Newcombe, Lovegrove and Davison9].
However, traditional visual SLAM algorithms typically rely on static environment assumptions to ensure robustness [Reference Macario Barros, Michel, Moline, Corre and Carrel10]. With the diversification of application scenarios, particularly in dynamic environments, these algorithms face significant challenges. The movement of dynamic objects – such as pedestrians and vehicles – often interferes with the localization and mapping accuracy of the SLAM system. These dynamic objects cause mismatches in feature points, potentially leading to position drift and map inconsistency, thus undermining system stability and robustness. Moreover, as the positions of dynamic objects change across image frames, accurately distinguishing between static and dynamic feature points while maintaining real-time performance remains a major challenge in current visual SLAM research [Reference Saputra, Markham and Trigoni11].
To contextualize our contributions, we highlight that while YOLO-based models have been applied in SLAM for object detection (e.g., [Reference Wu, Guo, Gao, You, Liu and Chen12] uses YOLOv5 with geometric constraints), integrating a segmentation head into a lightweight YOLOv7 framework specifically for dynamic SLAM is, to our knowledge, a novel contribution in its combined approach. Recent studies like [Reference Kan, Shi, Yang and Hu13] focus on lightweight detection using models like YOLO-Pose-Regression (YPR) but lack semantic segmentation, which is critical for precise object boundary delineation needed to accurately filter dynamic feature points. This omission can hinder accuracy in complex environments where dynamic objects partially occlude static backgrounds. Our approach uniquely combines YOLOv7’s [Reference Wang, Bochkovskiy and Liao14] efficiency (further enhanced with Ghost convolution) with a segmentation head for fine-grained dynamic object identification and pixel-level feature rejection. This addresses both accuracy and computational constraints in dynamic settings, offering an advantage over methods relying solely on detection bounding boxes or computationally heavier segmentation networks like Mask R-CNN used in DynaSLAM [Reference Bescos, Fácil, Civera and DynaSLAM15].
To tackle these challenges, this paper introduces a dynamic feature-point rejection approach. Our system integrates a lightweight YOLOv7 target detection model with a segmentation head, optical flow tracking, and multi-view geometry [Reference Sturm16] to accurately detect dynamic objects – defined as moving physical entities in the environment. By screening and rejecting dynamic feature points at the pixel level using segmentation masks, it minimizes their impact on SLAM localization and mapping while preserving valuable static points often contained within dynamic object bounding boxes. Additionally, the system generates 3D point cloud maps using only static feature points. The main contributions of this paper are as follows:
-
1. A novel visual SLAM system integrating lightweight detection, segmentation, and geometric constraints that improves robustness and accuracy in dynamic environments compared to baseline methods.
-
2. A lightweight YOLOv7-based detection network, enhanced with a segmentation head and optimized using Ghost convolution and CBAM attention, for efficient and precise pixel-level delineation of dynamic objects in SLAM.
-
3. A leakage detection and compensation method using Lucas-Kanade optical flow and multi-view geometry to identify and mitigate the impact of missed or potentially dynamic feature points.
This paper is organized as follows: Section 2 reviews the current state of dynamic SLAM research and its challenges. Section 3 presents the system design and core algorithms of the proposed SLAM system. Section 4 covers experimental setup and result analysis. Finally, Section 5 concludes the paper and discusses future research directions.
2. Related works
The development of dynamic SLAM systems is a crucial area of research, driven by the challenges posed by dynamic objects in real-world environments [Reference Al-Tawil, Hempel, Abdelrahman and Al-Hamadi17]. Handling dynamic objects effectively and improving system robustness and stability in such environments have become central issues. This section reviews the primary methods and recent advancements in dynamic SLAM, focusing on techniques that address dynamic object processing and enhance the robustness of SLAM systems in dynamic settings. Dynamic SLAM approaches can currently be classified into three main categories: geometric methods, deep learning-based methods, and hybrid approaches combining both.
2.1. Geometric methods
Geometric methods rely on the assumption that only static feature points comply with the geometric constraints (e.g., epipolar constraints) of SLAM algorithms, distinguishing dynamic objects from static backgrounds. KIM et al. [Reference Kim and Kim18] introduced a nonparametric background subtraction model that accounts for the camera’s self-motion, computes a background model using depth information, and performs image motion estimation. Dai et al. [Reference Dai, Zhang, Li, Fang and Scherer19] proposed a method leveraging geometric priors to separate static objects by identifying adjacency between map points and removing irrelevant edges. Wang et al. [Reference Wang, Wan, Wang and Di20] developed a dynamic target recognition approach combining feature consistency detection and depth image clustering with RGB-D sensors. Xu et al. [Reference Xu, Yu, Xing, Zhang and Pan21] used feature triangles to detect dynamic objects through changes between keyframes. While computationally efficient in some cases, these methods often depend on predefined thresholds or specific motion models, leading to false positives (static points misclassified as dynamic) or missed detections (dynamic points retained), especially in scenes with complex motions or subtle dynamics. These geometric techniques inspired our use of multi-view geometry as a complementary check in our system.
2.2. Deep learning methods
With rapid advancements in deep learning, numerous dynamic SLAM approaches have adopted these techniques to automatically recognize potentially dynamic objects based on semantic categories, avoiding some of the thresholding issues of purely geometric methods. Li et al. [Reference Li, Chen, Xu, Huang, Li, Cai, Yang, Xiong, Liu and Li22] utilized the SegNet semantic segmentation network [Reference Badrinarayanan, Kendall and Cipolla23] to distinguish dynamic objects (like people) from static backgrounds. VINCENT et al. [Reference Vincent, Labbé, Lauzon, Grondin, Comtois-Rivet and Michaud24] employed YOLACT [Reference Bolya, Zhou, Xiao and Lee25] for real-time dynamic object instance segmentation, integrating an extended Kalman filter for tracking and categorizing objects as “moving” or “idle” to exclude them from visual odometry and RTAB-MAP [Reference Labbé and Michaud26] loop closure. However, relying solely on semantics can be problematic: potentially dynamic objects might be temporarily static, and removing all points associated with them can unnecessarily deplete features. Furthermore, deep learning methods require substantial labeled data for training and significant computational resources for inference [Reference Guo, Lei, Li, Yan and Li27, Reference Tan, Guo, Gao and Zhang28]. Simple networks may lack accuracy, while complex ones (like Mask R-CNN [Reference He, Gkioxari, Dollár and Girshick29]) can compromise real-time performance, a critical requirement for SLAM. Our approach builds on these methods by employing a lightweight YOLOv7 model [Reference Wang, Bochkovskiy and Liao14] with optimizations to balance accuracy and efficiency.
2.3. Methods combining geometry and deep learning
Recent studies increasingly integrate geometric and deep learning techniques to leverage their complementary strengths in dynamic SLAM. Yu et al. [Reference Yu, Liu, Liu, Xie, Yang, Wei and Fei30] proposed DS-SLAM, based on ORB-SLAM2 [Reference Mur-Artal and Tardós4], combining semantic segmentation (SegNet) and optical flow to detect moving points within potentially dynamic object masks, aiming to reduce dynamic object interference effectively. Bescos et al.’s DynaSLAM [Reference Bescos, Fácil, Civera and DynaSLAM15] uses Mask R-CNN [Reference He, Gkioxari, Dollár and Girshick29] for instance segmentation and multi-view geometry to check the consistency of points belonging to potentially dynamic objects, excelling in complex traffic scenes but at a higher computational cost. RDS-SLAM [Reference Liu and Miura31], built on ORB-SLAM3 [Reference Campos, Elvira, Rodríguez, Montiel and Tardós5], enhances recognition accuracy by modeling dynamic objects with movement probabilities and tracking keypoints probabilistically. Wu et al. [Reference Wu, Guo, Gao, You, Liu and Chen12] introduced YOLO-SLAM using YOLOv5 [Reference Jocher, Chaurasia, Stoken, Borovec, Kwon, Michael, Liu, Abhiram and Skalski32] for object detection and novel geometric constraints based on bounding boxes. Huang et al. [Reference Huang, Xia and Kang33] combined YOLOv5, Kalman filtering, and the Hungarian algorithm with multi-view geometry for improved mapping. More recently, Kan et al. [Reference Kan, Shi, Yang and Hu13] proposed YPR-SLAM using YOLO-Pose-Regression for lightweight human detection combined with geometric constraints, while Zhong et al. [Reference Zhong, Hong, Jia, Wang and Wang34] introduced DynaTM-SLAM focusing on fast filtering and object-based localization. These hybrid approaches represent the state-of-the-art, but often face trade-offs between the accuracy of dynamic point identification, computational efficiency, and robustness across diverse scenarios. Our system draws from these hybrid approaches by integrating lightweight detection and segmentation with geometric constraints for enhanced performance and efficiency in dynamic environments.
2.4. Limitations of existing dynamic SLAM methods
Although the methods discussed above have advanced dynamic SLAM, they exhibit several limitations that motivate our work:
-
• Geometric methods (e.g., [Reference Kim and Kim18], [Reference Xu, Yu, Xing, Zhang and Pan21]) often rely on predefined thresholds or simple motion models, making them sensitive to parameter tuning and prone to failure in complex scenes with varied object motions, potentially causing false positives or missed detections.
-
• Deep learning methods that use only semantics (e.g., [Reference Li, Chen, Xu, Huang, Li, Cai, Yang, Xiong, Liu and Li22]) can incorrectly discard static objects belonging to dynamic classes (like a parked car or a sitting person). Methods relying solely on detection bounding boxes (e.g., [Reference Wu, Guo, Gao, You, Liu and Chen12]) may remove large background areas containing useful static features. High-performance segmentation networks (e.g., Mask R-CNN in [Reference Bescos, Fácil, Civera and DynaSLAM15]) improve precision but often impose significant computational overhead, hindering real-time operation [Reference Vincent, Labbé, Lauzon, Grondin, Comtois-Rivet and Michaud24].
-
• Hybrid approaches (e.g., [Reference Bescos, Fácil, Civera and DynaSLAM15], [Reference Yu, Liu, Liu, Xie, Yang, Wei and Fei30], [Reference Kan, Shi, Yang and Hu13]) attempt to balance these issues but still face challenges. For instance, DynaSLAM’s Mask R-CNN increases computational load. DS-SLAM’s optical flow can falter in low-texture regions or with fast motion. Lightweight detection-only methods [Reference Kan, Shi, Yang and Hu13] might lack the precision of segmentation for filtering points near object boundaries.
-
• Overall Trade-off: A persistent challenge across all categories is balancing computational efficiency (real-time performance) with the accuracy and robustness of dynamic object identification and feature rejection, especially in cluttered indoor environments with diverse object types and motions [Reference Macario Barros, Michel, Moline, Corre and Carrel10]. Many methods enhance accuracy at the cost of speed, or vice versa.
These gaps highlight the need for a dynamic SLAM system that integrates accurate, pixel-level dynamic feature rejection using efficient deep learning models combined with robust geometric verification, which is the focus of our proposed approach.
Despite advancements in dynamic SLAM, challenges remain in achieving real-time performance, optimizing network architectures, and ensuring accurate dynamic object recognition. Geometric methods’ dependence on thresholds and limited adaptability further hinder their effectiveness across diverse scenarios. To address these shortcomings, we propose a semantic visual SLAM system tailored for dynamic environments, extending ORB-SLAM2 with a lightweight YOLOv7 model (enhanced with segmentation), optical flow, and multi-view geometry. This approach efficiently rejects dynamic feature points, enhancing both robustness and mapping accuracy, as detailed in the following sections.
3. System description
This section describes the overall framework of the proposed visual SLAM system for dynamic environments. The system design revolves around three key components. First, the system architecture is outlined, consisting of five parallel threads: object detection, dynamic feature point rejection, tracking, local mapping, and loop closure. The object detection thread is then discussed in detail, as it provides essential semantic information to support the other system modules in dynamic settings. Following this, a novel dynamic feature point filtering method is introduced. This method integrates semantic data with geometric constraints to more accurately differentiate between dynamic and static feature points, thereby enhancing the system’s stability and robustness in dynamic environments.
3.1. Overall system framework
The proposed Dynamic Visual SLAM system builds upon the traditional ORB-SLAM2 framework, which is effective in static environments. ORB-SLAM2 operates with three main parallel threads: tracking, local mapping, and loop closure, ensuring global consistency in both the camera trajectory and the map. Our proposed SLAM system introduces two additional threads: object detection and dynamic feature point rejection. These new threads are designed to address errors caused by dynamic objects, ultimately enhancing the accuracy of position estimation.
In our system, the object detection thread uses the lightweight YOLOv7 model with an added segmentation head to detect dynamic objects, generating bounding boxes and pixel-level masks. These are typically used to identify potentially dynamic objects, such as humans, particularly in indoor environments based on semantic priors. The bounding boxes help broadly locate regions potentially containing dynamic features, while the masks provide precise outlines of the dynamic objects. Next, ORB feature points are extracted from each image frame, including both static and dynamic points. The dynamic feature point rejection thread combines the bounding box and mask information, uses optical flow tracking to handle potential leakage/fast motion, and employs multi-view geometry as a final check to effectively separate dynamic from static feature points within the masks. Only the static feature points are retained, which are then passed to the tracking, local mapping, and loop closure threads. This process aims to preserve more static background points compared to bounding-box-based removal, while remaining consistent with the core ORB-SLAM2 pipeline for map building and optimization using reliable static features. The overall system framework is shown in Figure 1, with the specific dynamic feature point rejection process depicted in Figure 2.
The overall framework based on ORB-SLAM2 framework, colored parts are additions.

The process of removing dynamic feature points.

Improved network framework of YOLOv7, where the colored modules are improved modules.

3.2. Lightweight target detection network
To meet the real-time demands in resource-limited environments, this paper proposes a lightweight YOLOv7 [Reference Wang, Bochkovskiy and Liao14] architecture aimed at removing feature points from dynamic objects (e.g., pedestrians, vehicles, etc.). YOLOv7 was chosen as the base model due to its state-of-the-art performance in balancing detection speed and accuracy at the time of development [Reference Olorunshola, Irhebhude and Evwiekpaefe35]. While other fast detectors like YOLOv5 [Reference Jocher, Chaurasia, Stoken, Borovec, Kwon, Michael, Liu, Abhiram and Skalski32] or SSD [Reference Winata and Oh36] exist, YOLOv7 provided a strong foundation for integrating the required segmentation head and optimizations. The architecture, enhanced with a segmentation head, is shown in Figure 3. The original structure of YOLOv7 consists of three major modules: Backbone, Neck, and Head.
To enhance real-time performance, this paper replaces the traditional convolution with Ghost convolution [Reference Woo, Park, Lee and Kweon37] in the backbone network, an existing technique also used in SLAM contexts [Reference Winata and Oh36] to reduce computational requirements. The number of parameters and the computational requirements of Ghost convolution are significantly reduced compared with the traditional convolution. Firstly, the comparison of the number of parameters
$P_{\text{conv}}$
for traditional convolution and
$P_{\text{Ghost}}$
for Ghost convolution is as follows:
where
$C$
and
$C'$
represent the input and output feature map channels,
$k$
is the kernel size,
$m$
is the number of channels of the initial feature map generated by standard convolution in GhostConv, and
$n$
and
$d$
refer to additional feature maps and kernel sizes for the cheap linear operations. In Ghost convolution, the computational requirements are reduced by generating fewer intrinsic feature maps (
$m$
) and augmenting them with cheaper operations. The ratio
$R_{\text{cg}}$
of the number of parameters for conventional convolution and Ghost convolution is:
This shows that when
$C'$
is large and
$m$
is small (typically
$m \approx C'/2$
), the number of parameters of Ghost convolution is significantly lower than that of normal convolution, thus reducing the overall number of parameters of the network model. In addition, the computational effort (FLOPs) of Ghost convolution is lower than that of the conventional convolution, with the computational effort being respectively:
where
$H'$
and
$W'$
are the height and width of the output feature map. The ratio
$R_{\text{g}}$
of normal convolution and Ghost convolution computation is approximately:
This confirms that Ghost convolution reduces both the number of parameters and computational effort, contributing to balancing real-time performance and detection accuracy in our system. To address potential accuracy loss from using lightweight convolutions, we incorporate the existing CBAM attention mechanism [Reference Woo, Park, Lee and Kweon37], a widely used module that enhances feature representation by focusing on important channel and spatial features, as seen in prior computer vision and SLAM works.
CBAM combines channel attention with spatial attention to improve feature detection by the following steps. First, applying the channel attention module to the input feature map
$F$
to obtain the channel attention map
$M_c$
, computed as:
where
$AP$
and
$MP$
denote average pooling and max pooling operations, respectively,
$FC$
is the fully connected layer, and
$\sigma$
is the Sigmoid activation function. Then, using the spatial attention module to generate the spatial attention map
$N$
by global average pooling:
where
$AL$
is average pooling along the channel dimension. Finally, multiplying the channel and spatial attention maps element-by-element to obtain the final feature map
$F_a = M \times N$
.
To assess the impact of these modifications (GhostConv “G” and CBAM “C”) on the YOLOv7 model’s performance and complexity, we conducted an ablation study. The experiments were performed using the COCO 2017 dataset (118,287 training images, 5,000 validation images) within the PyTorch 1.9.0 framework on an NVIDIA RTX 3090 GPU. We trained the models for 100 epochs with a batch size of 16 and an input image size of 640
$\times$
640, employing standard hyperparameters typical for object detection tasks. We evaluated Precision (P), Recall (R), mean Average Precision (mAP@0.5), and the number of parameters (
$P_a$
). The results, shown in Table I, demonstrate that combining GhostConv and CBAM (YOLOv7+G+C) achieves a good balance, significantly reducing parameters compared to the original YOLOv7 while maintaining high mAP, even slightly improving it over the baseline, indicating the effectiveness of the attention mechanism in compensating for the lightweight convolution.
Ablation study results on COCO 2017 Subset. G denotes GhostConv replacement, C denotes CBAM integration. Standard training settings were used. P, R, mAP measured at IoU threshold 0.5.

3.3. Dynamic feature removal
In feature-based SLAM systems, the quality of the feature points is crucial for system stability and performance. To address this, this paper presents a robust feature point selection strategy that integrates semantic a priori with geometric information. The semantic a priori helps differentiate between static and dynamic objects, while the geometric constraints ensure the feature points are evenly distributed in space and possess strong geometric consistency.
In contrast to object detection, semantic segmentation offers precise pixel-level masks, allowing for a clearer distinction between feature points of dynamic and static objects. Object detection typically uses bounding boxes, which, although simpler, may include feature points from both dynamic objects and static ones, like furniture. This rough way of bounding box delineation leads to errors in feature point selection. Some studies such as Liu [Reference Liu, Zeng, Feng and Xu38] and Xiao [Reference Xiao, Wang, Qiu, Rong and Dynamic-SLAM39] chose to directly remove all feature points within the bounding box, but this approach significantly reduces the number of static feature points, especially when the bounding box occupies a large area, which may lead to the failure of the SLAM system.
To maintain as many static feature points as possible, this paper enhances the lightweight YOLOv7 model by incorporating semantic segmentation. This upgrade allows the model to not only detect dynamic objects but also generate pixel-level masks for them. By removing dynamic pixels while preserving static feature points within the dynamic object’s region, the system ensures that sufficient static points are retained for initial map estimation, even if a dynamic object occupies a large portion of the scene. This method greatly improves the robustness and accuracy of the geometrically constrained computations in dynamic SLAM scenarios. Figure 4 illustrates the performance of the YOLOv7 model with the added segmentation feature.
Results of dynamic mask segmentation.

However, since the segmentation accuracy of Ghost-YOLOv7 is found to be insufficient in the experimental process, there is a leakage detection of dynamic objects, which needs to be further improved. The leakage detection compensation strategy designed in this paper is mainly divided into two parts: the Lucas-Kanada optical flow tracking module and the mapping compensation part based on the constant velocity model. The Lucas-Kanada optical flow tracking module, on the one hand, tracks the dynamic features between frames, avoids the dynamic features from participating in the calculation of the basis matrix, and ensures the screening accuracy of the limit constraints. On the other hand, it serves as a supplement to the leakage detection compensation module of the constant velocity model. Complementary. In the following, the leakage compensation module based on the constant velocity model is emphasized.
Inspired by SG-SLAM [Reference Cheng, Sun, Zhang and Zhang40], the constant velocity model between neighboring frames is considered, the segmentation result of the previous frame is used to predict the segmentation result of the current frame, and a mask closure operation is used to recover the leakage-detection dynamic object masks, so as to improve the system stability. The algorithm mainly consists of leakage detection judgment, edge point projection, and mask recovery. Let the current frame index be
$k$
, and the previous and upper frames be
$k-1$
and
$k-2$
, respectively. The transformation matrices from the upper frame to the previous frame and from the previous to the current frame are
$T_{k-1,k-2}$
and
$T_{k,k-1}$
, respectively. According to the constant velocity model of ORB-SLAM2 [4], since the time intervals between adjacent frames are short, the pose transformations are approximately equal:
$T_{k,k-1} \approx T_{k-1,k-2}$
. If the number of dynamic objects detected in the current frame is fewer than those in the previous three frames, the dynamic objects in the current frame are considered missed, and mask edge projection is performed accordingly.
First, the mask edge points of the missed dynamic objects in the previous frame are calculated and projected to the world coordinate system (coordinate origin is
$O_w$
) by Eq. (9) to obtain
$ P_i = \left [ X_i, Y_i, Z_i, 1 \right ]^T$
.
\begin{equation} P_i=\left ( T_{cw}^{k} \right ) ^{-1}\left [ \begin{array}{c} \left ( u-c_u \right ) \times d/f_u\\ \left ( v-c_v \right ) \times d/f_v\\ d\\ 1\\ \end{array} \right ] \end{equation}
where
$T_{cw}^{k}$
denotes the bitmap of the
$ k$
-th frame image,
$(u,v)$
denotes the feature point,
$(c_u, c_v)$
is the optical center of the camera,
$(f_u,f_v)$
is the focal length of the camera, d denotes the depth of the feature point (u,v), and
$P_i \in \mathbb{R}^4$
denotes the chi-square coordinates of the feature point in the world coordinate system.
According to the ORB-SLAM2 [Reference Mur-Artal and Tardós4] constant velocity model, the
$ k$
-th frame bit pose can be calculated as:
With Eq. (10), the edge points of the ignored object in the world coordinate system are projected into the current frame (
$p_i$
denotes the pixel coordinates of the edge point projected to the current frame).
where
$K$
is the current frame’s internal reference matrix, and mask restoration is performed after obtaining the outline of the missed object in the current frame. Mask expansion is first implemented to increase the foreground size in the image and eliminate unreliable feature points. Next, mask filling is performed to ensure the continuity and integrity of the recovered leakage object mask. Finally, mask erosion is performed to correct the possible over-expansion caused by the expansion and to ensure that the mask better fits the contours of the actual object. In the subsequent dynamic feature rejection part, the system will combine the Lucas-Kanada method with the results of the leakage compensation module to reject the feature points belonging to the dynamic mask as needed to ensure the integrity of the leakage mask and the accuracy of the object edges.
When using semantic information to segment dynamic objects in the environment, it is necessary to detect and segment dynamic objects in conjunction with a priori information in advance. Therefore, semantic segmentation detection can only eliminate objects with a priori information that are highly dynamic, and semantic segmentation cannot accurately segment objects with low and potential dynamics. In real-world scenarios, it is often encountered that the motion of dynamic objects with static a priori information in the semantic library has an impact on the SLAM system’s mapping and localization. Therefore, we add a multi-view geometry module to the system, as shown in Figure 5.
Multiview geometry preserve static points:This module is executed when the percentage of dynamic target frames in the image exceeds a threshold.

To enhance the system’s efficiency, we avoid applying multi-view geometric constraints to every frame [Reference Huang, Xia and Kang33]. The ratio
$ T$
between the image frame area
$ s_1$
and the mask area
$ s_2$
is defined as
$ T = {s_1}/{s_2}$
. If
$ T \lt \theta$
(with
$ \theta = 0.6$
), all feature points on the mask are discarded, assuming there are sufficient static feature points for matching. On the other hand, when
$ T \gt \theta$
, dynamic feature points are filtered using multi-view geometry, ensuring both accuracy and real-time performance.
For filtering dynamic and static feature points, the similarity between the current frame and keyframes is calculated. The three keyframes most similar to the current one are selected based on a distance metric, defined as:
where
$ v_{\text{Trans}}$
is the normalized translation distance between two frames, and
$ v_{\text{Rot}}$
represents the normalized Euler angle rotation difference. The coefficients 0.7 and 0.3 are the weight factors for translation and rotation, respectively. The keyframes are then sorted based on
$ v_{\text{Dist}}$
, and the three closest ones are chosen as the reference system. Next, depth information from the selected reference frames is used to compute the 3D coordinates of feature points, which are then transformed into the world coordinate system. Feature points in the current frame
$ CF$
are kept if their view direction
$ \alpha$
is within 30
$^\circ$
of the reference frame
$ KF$
view. If the angle
$ \alpha$
exceeds 30
$^\circ$
(as shown in Figure 6(a)), the point is considered dynamic and discarded. The remaining mapped points are projected back into the current frame’s coordinate system. Points with depth values
$ Z'$
greater than zero and less than the projected depth
$ Z_{\text{proj}}$
are considered potentially dynamic, as they may be occluded by moving objects. The depth difference for these points is then calculated. If the depth difference is smaller than a predefined threshold, the variance of the depth in the region is checked. As shown in Figure 6(b), if the depth variance is below the threshold, the region is considered static; otherwise, the points are classified as dynamic.
Multi-view geometric dynamic feature judgment principle.

4. Experimental
To assess the effectiveness of the proposed dynamic SLAM framework, we conducted experiments using the TUM RGB-D dataset, which includes a variety of indoor scene sequences with corresponding RGB-D images and real camera motion trajectories. The dynamic object sequences in this dataset are categorized into two groups: low-dynamic and high-dynamic scenes. The high-dynamic sequences feature four types of camera motions: (1) *w/half*, where the camera follows a hemispherical path; (2) *w/rpy*, where the camera rotates around the xyz axes; (3) *w/static*, where the camera remains largely stationary with minimal movement; and (4) *w/xyz*, where the camera moves along the xyz axes. In these sequences, dynamic objects occupy a significant portion of the field of view, which complicates position estimation and presents substantial challenges for SLAM systems. The experiments were conducted on a personal computer with an Intel Core i7-8750H processor, 16 GB of RAM, and an NVIDIA GTX 1060 graphics card. These sequences were specifically chosen to evaluate the performance of the SLAM system in environments with varying levels of dynamic activity.
4.1. Experiments in the TUM dataset
The dynamic feature detection method proposed in this paper is built upon the front-end of ORB-SLAM2 [Reference Mur-Artal and Tardós4]. To evaluate its performance, we compare the trajectory and accuracy with ORB-SLAM2 [Reference Mur-Artal and Tardós4], DynaSLAM [Reference Bescos, Fácil, Civera and DynaSLAM15], and DS-SLAM [Reference Yu, Liu, Liu, Xie, Yang, Wei and Fei30], which are established dynamic SLAM approaches. DynaSLAM uses deep learning and multi-view geometry, while DS-SLAM combines semantic segmentation and optical flow for dynamic object handling. Additionally, we reference recent methods like [Reference Kan, Shi, Yang and Hu13] and [Reference Zhong, Hong, Jia, Wang and Wang34] to broaden the comparison. The accuracy of the estimated trajectories in dynamic settings is assessed using the EVO evaluation tool. Specifically, we use two key metrics: absolute trajectory error (ATE) and relative positional error (RPE) for quantitative analysis. Tables II, III, IV summarize the results, showing the ATE, relative translational error, and relative rotational error, respectively. We utilize root mean square error (RMSE) and standard deviation (SD) to characterize the system’s accuracy and stability. Our method demonstrates notable improvements over ORB-SLAM2 [Reference Mur-Artal and Tardós4] in all dynamic sequences, as evidenced by the last two columns of Tables II, III, IV, which highlight the enhancement in performance under varying levels of dynamics.
Absolute trajectory error (ATE RMSE & SD, in meters) comparison on TUM RGB-D dynamic sequences.

Relative pose error (RPE) – translation (RMSE & SD, in meters) comparison.

Relative pose error (RPE) – rotation (RMSE & SD, in degrees) comparison.

During the tracking phase, we incorporate a dynamic feature thresholding model into the SLAM front-end to remove dynamic feature points. Experimental results show that ATE significantly outperforms ORB-SLAM2 [Reference Mur-Artal and Tardós4] in four highly dynamic scenarios. The optimized root mean square error (RMSE) reaches more than 96% at peak and at least 89% compared to ORB-SLAM2. Compared with other dynamic SLAM frameworks, our algorithm’s ATE outperforms DynaSLAM [Reference Bescos, Fácil, Civera and DynaSLAM15] for w/half and w/xyz sequences (e.g., 0.0264 m vs. 0.0279 m in w/half), and achieves competitive ATE results in w/rpy and w/static sequences, though DynaSLAM performs slightly better (e.g., 0.0414 m vs. 0.0517 m in w/rpy). Against DS-SLAM, our method shows superior ATE in high-dynamic sequences (e.g., 0.0159 m vs. 0.0264 m in w/half), but DS-SLAM excels in low-dynamic s/static (0.0065 m vs. 0.0073 m).
In the low-dynamic environment, the s/static sequence is selected for testing, featuring two people sitting at a table with slight body movement, alongside moving pedestrians. This scenario demands precise detection of subtle motion features. Compared with ORB-SLAM2 [Reference Mur-Artal and Tardós4], our algorithm achieves better accuracy (ATE 0.0073 m vs. 0.0089 m), while DynaSLAM’s ATE (0.0087 m) is closer to ORB-SLAM2’s, and DS-SLAM performs best (0.0065 m). Our method not only performs robustly in highly dynamic scenes but also effectively detects real moving objects in low-dynamic scenes, ensuring sufficient static feature points are extracted. DynaSLAM excels in high-dynamic sequences but struggles with subtle dynamics, whereas our method maintains robustness across both conditions.
To assess computational efficiency, we compared the average processing time per frame of our method (OurSLAM) with DynaSLAM [Reference Bescos, Fácil, Civera and DynaSLAM15] and ORB-SLAM2 on the TUM RGB-D dataset. The results are shown in Table V. OurSLAM reduces processing time by approximately 68% to 84% compared to DynaSLAM across all sequences. For instance, in the w/half sequence, OurSLAM achieves 0.3448 s per frame compared to DynaSLAM’s 1.1400 s, a reduction of about 69.8%. This efficiency stems from the lightweight YOLOv7 model and optimized geometric constraints, making OurSLAM significantly more suitable for real-time applications than DynaSLAM. However, ORB-SLAM2 remains the fastest, averaging around 0.03 s per frame (e.g., 0.0376 s in w/half), though it sacrifices accuracy in dynamic environments.
Computational time comparison (Average seconds per frame on TUM RGB-D).

Dynamic feature point removal and mapping on TUM “walking_xyz.” (a,c) ORB-SLAM2 retains features on the person. (b,d) OurSLAM removes features within the person mask. (e,g) ORB-SLAM2 map/trajectory shows significant errors due to dynamic points. (f,h) OurSLAM produces a cleaner map and more accurate trajectory.

In highly dynamic sequences such as w/half (abbreviated as w/half) and w/xyz (abbreviated as w/xyz), OurSLAM’s efficiency contributes to a lower absolute trajectory error (ATE). For example, in w/half, OurSLAM achieves an ATE of 0.0264 m compared to DynaSLAM’s 0.0279 m, thanks to rapid dynamic feature rejection using YOLOv7, outperforming DynaSLAM’s slower Mask R-CNN-based approach. In w/xyz, OurSLAM reduces ATE by 17% (0.0301 m vs. 0.0364 m) with faster processing (0.2423 s vs. 1.1270 s per frame), enabling accurate pedestrian removal, as shown in Figure 7. Conversely, in sequences with rotational motion or minimal dynamics, such as w/rpy (abbreviated as w/rpy) and w/static (abbreviated as w/static), DynaSLAM exhibits better ATE (e.g., 0.0414 m vs. 0.0517 m in w/rpy), likely due to its segmentation sensitivity, though at a higher computational cost. Figure 7 illustrates this with the w/xyz dataset: ORB-SLAM2 retains pedestrian features (Figure 7(a), (c)), causing trajectory errors (Figure 7(e), (g)), while OurSLAM removes them (Figure 7(b), (d)), yielding accurate maps and trajectories (Figure 7(f), (h)). Figure 8 further shows reduced ATE and relative positional error (RPE) in w/xyz and w/half compared to ORB-SLAM2, validating our approach’s effectiveness. OurSLAM thus balances robust performance and efficiency, excelling in real-time high-dynamic scenarios.
Although the TUM RGB-D dataset primarily features human dynamic objects, our YOLOv7 model, trained on COCO, can detect diverse objects like cars. While direct testing on non-human objects is limited by the dataset, OurSLAM’s generalizable rejection mechanism suggests potential effectiveness, unlike DynaSLAM’s more specific Mask R-CNN approach. Future work will explore this capability on datasets like KITTI.
Trajectory error plots (ATE and RPE trans.) comparing ORB-SLAM2 and OurSLAM on “walking_xyz” (top row) and “walking_half” (bottom row) sequences. Error plots show significantly lower errors for OurSLAM.

4.2. Dense point cloud diagram
In order to validate the map construction effect and accuracy of the proposed SLAM system in this paper, dense point cloud maps under the TUM dataset are constructed in this paper using the proposed dynamic environment SLAM system. In this paper, two scenarios, static and dynamic dataset under TUM dataset, are used to verify the mapping effect of the proposed SLAM system, and the same type of ORB-SLAM2 [Reference Mur-Artal and Tardós4] and DynaSLAM [Reference Bescos, Fácil, Civera and DynaSLAM15] are used to construct the dense point cloud maps under the same dataset, and the results of this paper’s SLAM system are verified to meet the requirements by analyzing and comparing the results. By analyzing and comparing the mapping results, it is verified that the proposed SLAM system in this paper meets the requirements.
Figure 9 shows the mapping results on the low-dynamic “sitting_static” sequence. ORB-SLAM2 (Figure 9(a)) fails to remove the dynamic objects (the seated person highlighted in the red box) and integrates them into the map, creating inaccuracies and ghosting artifacts. In contrast, OurSLAM (Figure 9(b)) successfully identifies the person using semantic segmentation and verifies their points are inconsistent or belong to a dynamic category, removing them from the final map while preserving the static background (table, monitor, walls), resulting in a cleaner and more accurate representation of the static environment.
Comparison of dense map building results in a low dynamic environment (“sitting_static”).

Comparison of dense map building results in a highly dynamic environment (“walking_xyz”).

Figure 10 compares mapping results on the highly dynamic “walking_xyz” sequence. DynaSLAM (Figure 10(a)), while attempting to remove the walking person, exhibits noticeable ghosting artifacts (remnants of the dynamic object in the map, highlighted in the red box). This might be due to slight inaccuracies in pose estimation caused by its higher computational requirements (see Table V) potentially leading to delays in processing frames or minor inconsistencies in the segmentation and inpainting process over time. OurSLAM (Figure 10(b)), benefiting from its efficient dynamic feature rejection, completely removes the highly dynamic person, leaving almost no ghosting artifacts and providing a clear map of the static background structure. This demonstrates the effectiveness of our integrated approach in handling highly dynamic scenes for accurate mapping.
4.3. Experimentation in real environments
To qualitatively assess the proposed SLAM algorithm’s performance in a real-world indoor setting beyond benchmark datasets, we conducted two experiments using an Intel RealSense D435i RGB-D camera connected to the laptop specified earlier. These experiments aim to visually demonstrate the system’s capability in handling dynamic objects, including those with static semantic priors that start moving. Quantitative evaluation with ground truth is challenging in unstructured real-time scenarios, so this section focuses on qualitative observations.
First, the camera was held moving through a lab environment while a person walked back and forth across the field of view, representing a typical high-dynamic scenario. Second, we tested the system’s ability to handle objects with static priors that become dynamic. In this test, the camera moved while a person initially stood still holding a water cup (both potentially detectable) and then the person walked across the scene carrying the cup.
Dynamic feature point rejection in a real environment. (a) View from the camera with a person walking. (b) OurSLAM running, showing tracked features (green dots). Features on the walking person (within the detected mask, not shown explicitly) are correctly excluded from tracking.

As shown in Figure 11(b), during the first experiment, the proposed SLAM algorithm successfully tracked static features in the background environment while effectively ignoring or rejecting features associated with the walking person. The visualization shows a stable set of features tracked on the static parts of the scene, demonstrating the system’s ability to filter out the high-dynamic human motion in real time.
Handling dynamic objects with static priors. (a) Scene where a person walks while holding a cup. (b) OurSLAM correctly identifies both the person and the cup as dynamic (due to association with the moving person and geometric inconsistency) and excludes their features from tracking.

In the second experiment (Figure 12), when the person holding the cup was stationary, features on both might initially be tracked (similar to Figure 11(b) but including the cup). However, once the person started walking, the system detected the motion inconsistency of features on both the person and the cup they were carrying. Figure 12(b) illustrates that features on the moving cup were successfully eliminated along with features on the person. This indicates that the system does not rely solely on semantic priors (“cup” is usually static) but uses the geometric and motion consistency checks (optical flow, multi-view geometry) to correctly identify and reject features on objects that become dynamic through interaction.
These qualitative results suggest that the proposed SLAM system functions effectively in real indoor environments, robustly handling both common dynamic objects like people and objects that unexpectedly become dynamic, meeting the practical requirements for dynamic feature removal.
5. Summary and outlook
In this work, we presented a visual SLAM system designed to improve robustness and accuracy in dynamic environments. The core contribution is an effective dynamic feature rejection strategy that integrates a lightweight YOLOv7 network (enhanced with a segmentation head and optimized with Ghost convolution and CBAM) with optical flow tracking and multi-view geometric constraints. This combination allows for efficient, pixel-level identification and removal of dynamic feature points while maximizing the retention of useful static features, even those located near or within the bounding regions of dynamic objects. Our experiments on the TUM RGB-D dataset demonstrate that the proposed system (OurSLAM) significantly outperforms the baseline ORB-SLAM2 and achieves competitive, sometimes superior, accuracy compared to state-of-the-art dynamic SLAM methods like DynaSLAM and DS-SLAM, particularly in highly dynamic scenes. Crucially, OurSLAM achieves this performance with substantially lower computational requirements compared to methods using heavier segmentation networks like Mask R-CNN, making it more suitable for real-time robotics applications. Qualitative tests in real-world scenarios further validated its effectiveness in handling various dynamic situations.
However, while the method demonstrates significant improvements, limitations remain. Performance can still degrade in scenarios with extreme dynamics, severe occlusions, or very low-texture environments where feature tracking (both ORB and optical flow) becomes unreliable. The accuracy is also dependent on the performance of the underlying YOLOv7 model and the quality of the segmentation masks. Future work will focus on several areas: (1) Refining the dynamic feature rejection logic, perhaps by incorporating more sophisticated motion models or probabilistic filtering. (2) Enhancing robustness to challenging conditions like poor illumination or texture. (3) Conducting extensive evaluations on more diverse datasets (e.g., KITTI [Reference Geiger, Lenz and Urtasun41]) featuring a wider range of dynamic objects like vehicles. (4) Exploring further optimizations for deployment on computationally constrained robotic platforms. (5) Releasing the source code to facilitate further research and community adoption.
Author contributions
All authors contributed to the study’s conception and design. Yewei Shen conducted data gathering, implementation, experiments, and wrote the article. Xinguang Zhang supervised the project and reviewed the manuscript.
Financial support
This research received no specific grant from any funding agency, commercial, or not-for-profit sectors.
Competing interests
The authors declare no conflicts of interest exist.
Ethical approval
Not applicable. This study used publicly available datasets (TUM RGB-D) and conducted experiments in a lab environment with consenting participants.




