1. Introduction
Visual localization serves as a fundamental component of SLAM (simultaneous localization and mapping), enabling autonomous driving and mobile robotics to navigate and map unknown environments in real time. A typical visual SLAM pipeline consists of three stages: feature extraction, feature matching, and pose estimation, where the accuracy of pose estimation heavily depends on the quality of extracted keypoints in the first stage.
Traditional feature extraction methods, such as Harris [
1], FAST (Features from Accelerated Segment Test) [
2], SIFT (Scale-Invariant Feature Transform) [
3], and ORB (Oriented FAST and Rotated BRIEF) [
4], have long dominated this pipeline due to their simplicity and efficiency. Recent advances in deep learning have shown that convolutional neural networks can outperform handcrafted techniques in both keypoint detection [
5,
6] and descriptor generation [
7,
8], exhibiting greater resilience to appearance variations and implicitly learning invariances beyond gradient statistics. More recently, several works in semantic SLAM, such as SemanticFusion [
9], DS-SLAM [
10], and DynaSLAM [
11], have incorporated semantic information into localization, aiming to suppress dynamic regions and emphasize semantically meaningful structures.
Despite this progress, challenges remain in achieving robust feature extraction for localization. Traditional handcrafted methods, though efficient, are highly sensitive to illumination changes, viewpoint variations, and dynamic environments. CNN-based approaches alleviate some of these issues but often treat all feature responses uniformly, failing to distinguish between stable cues and unstable details. Semantic SLAM methods further improve robustness by masking dynamic objects, yet their reliance on coarse class-level segmentation prevents finer discrimination within the same semantic region, leaving residual noise to propagate into pose estimation. These limitations highlight the need for a more adaptive mechanism to model feature reliability at a finer granularity.
To address the limitations of CNN-based approaches in distinguishing stable from unstable visual cues, we introduce an attention-driven feature extraction framework. By assigning weights to different feature elements, they enhance the robustness and discriminative power of feature extraction, making them particularly effective in complex and dynamic scenarios. First, a BAM (Bottleneck Attention Module) [
12] is applied during the early feature extraction stage to emphasize locally stable keypoints and suppress noisy responses from dynamic regions. Subsequently, a CBAM (Convolutional Block Attention Module) [
13] is introduced within the branching process, where it simultaneously refines feature extraction and descriptor generation by adaptively modeling both spatial and channel-wise importance. This dual-attention design produces a more discriminative and reliable descriptor set, directly improving pose estimation accuracy while maintaining adaptability across diverse environmental conditions.
To overcome the limitations of semantic-guided methods that rely on coarse, class-level stability modeling [
9,
10,
11,
14], we further propose a fine-grained semantic refinement mechanism. This approach subdivides broad semantic classes into smaller, stability-homogeneous sub-clusters, enabling more accurate suppression of unstable regions such as reflective windows or vegetation while preserving robust structural cues. In addition, a lightweight, rule-based physical prior is incorporated: objects closer to the ground plane tend to be more stable than elevated or suspended structures, consistent with the observation that “lower-layer structures act as a foundation” [
15]. Rather than producing an explicit semantic map, these cues are implicitly embedded into the feature extraction process. The network directly outputs keypoints and descriptors enriched with fine-grained stability information, yielding a more discriminative representation while avoiding the computational overhead of dense semantic modeling. Our quantitative analysis confirms that this integration maintains high inference speeds and a low memory footprint, making it suitable for real-time applications. This implicit integration ensures that our method remains lightweight, yet significantly improves the robustness of feature extraction in dynamic and cluttered environments.
The main contributions of this paper are as follows:
We propose a physically guided, fine-grained stability modeling framework that dynamically adapts feature learning across semantic and geometric variations, surpassing prior static weighting schemes.
We introduce a dual-attention architecture to enhance keypoint stability and descriptor consistency in dynamic environments.
We embed semantic cues implicitly into the feature extraction pipeline, achieving robust and real-time localization without explicit segmentation.
The remainder of this article is organized as follows:
Section 1 reviews related work on feature detection and description.
Section 2 describes our proposed methodology in detail.
Section 3 presents extensive experiments and analysis.
Section 4 discusses current limitations and outlines future research directions, and finally,
Section 5 concludes the paper.
4. Experiments
We first give implementation details. Then, we test our method on visual localization tasks in
Section 4.1 and analyze the running time in
Section 4.2. Finally, we perform an ablation study in
Section 4.3.
Implementation Details. The training set comprises reference images from the Aachen v1.0 dataset together with additional web-collected images. As SFD2 [
14] and R2D2 [
24], we augment the training images via style transfer. To alleviate segmentation noise introduced by stylization, semantic labels for the stylized samples are inferred from their corresponding original images. The network is developed in PyTorch (>=1.8) and optimized with the Adam solver (
= 0.9,
= 0.9). Training is performed on one RTX 4090 GPU for 40 epochs with a mini-batch size of 4 and a weight-decay coefficient of
.
4.1. Localization Test
We tested our method on Aachen (v1.0 and v1.1) and RobotCar-Seasons datasets under various illumination, season, and weather conditions. Aachen v1.0 contains 4328 reference and 922 query images captured around the Aachen city center. Aachen v1.1 expands v1.0 by adding 2369 reference and 93 query images. RoCaS has 26,121 reference and 11,934 query images. It is challenging because of various conditions of day query images and poor lighting of night query images in suburban areas. Following the evaluation protocol of the long-term visual localization benchmark [
35], we report the success ratio at the error thresholds of (
m), (
m), (
m) as metric.
Baselines. We evaluate our model against recent methods that leverage semantic information, including LLN [
14,
29,
31,
33,
36,
37,
38,
39], as well as approaches based on learned feature representations [
3,
21,
22,
23,
24,
26,
40,
41]. Following established protocols, we employ the HLoc pipeline for 3D reconstruction and mutual nearest neighbor (MNN) matching. Furthermore, we compare our approach with state-of-the-art learned matchers [
42,
43,
44,
45,
46,
47,
48,
49]. All reported results are taken either from the visual benchmark [
35] or the original publications.
Quantitative Results.
Table 2,
Table 3 and
Table 4 present the localization accuracy on the Aachen (v1.0/v1.1) and RobotCar-Seasons benchmarks. Overall, our method consistently achieves the best or on-par performance across all datasets and conditions, particularly under challenging night and weather scenarios.
Comparison with semantic-based methods (S). Among methods explicitly leveraging semantic cues, LBR and SFD2 exhibit strong baselines due to their use of building-instance matching and stability-driven semantic weighting, respectively. While SFD2 assigns stability through a static, class-based mapping, our method learns a dynamic fine-grained stability field that adapts to intra-class variations and physical scene constraints. Built upon this principle, we introduce a fine-grained semantic weight allocation mechanism that refines class-level stability into sub-class semantics guided by geometric priors. This adaptive design enables the model to better capture subtle variations in motion, structure, and illumination, effectively suppressing unstable regions such as vegetation or reflective surfaces. As shown in
Table 2, our method slightly surpasses SFD2 in both day and night conditions on Aachen v1.0 and achieves consistent gains on Aachen v1.1 and RobotCar-Seasons, demonstrating improved robustness in dynamic and low-light environments.
Comparison with learned feature methods (L). Compared with learned feature extractors such as D2Net, R2D2, and ASLFeat achieve higher accuracy thanks to end-to-end descriptor optimization. However, these methods still struggle under illumination changes and dynamic interference. Our semantics-guided model yields superior accuracy and maintains high stability at night, outperforming all learned counterparts. The results confirm that incorporating fine-grained semantic priors within feature extraction effectively enhances descriptor discriminability and localization reliability.
Comparison with Advanced matchers (M). Modern matching frameworks like SuperGlue [
42], SGMNet [
43], and ClusterGNN [
44] improve correspondence consistency through graph reasoning or attention-based matching. Nevertheless, they often rely on computationally intensive post-matching modules. In contrast, our method achieves comparable or better performance using only simple mutual nearest neighbor (MNN) matching, validating that the proposed fine-grained semantic refinement and attention-based feature extraction already yield highly distinctive and geometrically stable features.
As shown in
Figure 6, our method achieves more accurate and denser feature correspondences compared to R2D2 and DISK, even under challenging day–night variations. While R2D2 and DISK rely on SuperGlue for correspondence estimation, they still suffer from sparse or unstable matches—R2D2 produces few correspondences in low-light scenes, whereas DISK yields more but less reliable ones. In contrast, our approach directly establishes correspondences using a nearest-neighbor matching strategy, enabled by semantically weighted feature extraction and fine-grained stability refinement. This design effectively suppresses unstable regions while preserving semantically consistent structures, leading to higher inlier ratios and improved robustness under illumination and nighttime conditions.
4.2. Visualization and Effectiveness of Fine-Grained Semantic Weighting
To further validate the effectiveness of the proposed fine-grained semantic weighting mechanism, we visualize the stability-aware segmentation and the corresponding weight heatmap, as shown in
Figure 7. The visualization consists of three parts: (i) the fine-grained semantic zone division obtained from self-supervised clustering, (ii) the computed stability heatmap based on semantic, geometric, and physical priors, and (iii) the resulting feature extraction map after applying the proposed weighting.
As observed, the fine-grained segmentation produces semantically coherent yet physically distinct regions, which allow the weighting process to better capture intra-class variations in stability. The stability heatmap assigns higher weights to geometrically grounded and static areas such as roads, walls, and building structures, while suppressing dynamic or weakly constrained regions. This adaptive weighting helps the network focus on physically reliable cues during training, leading to improved consistency in keypoint detection and descriptor learning, particularly under dynamic and low-light scenarios.
Quantitatively, this fine-grained weighting yields more stable localization performance across both static and dynamic sequences, demonstrating the advantage of incorporating physical priors and intra-class semantic distinctions into the feature extraction pipeline.
4.3. Ablation Study
Table 5 presents the ablation results on the Aachen_v1.1 dataset. Starting from the baseline with semantic weighting (SW), introducing the proposed fine-grained weighting (FW) leads to consistent improvements by modeling intra-class stability variations and integrating physical priors. Adding the dual attention (DA) module further enhances robustness by jointly refining spatial and channel-wise cues, allowing the network to better emphasize physically stable regions and suppress transient or ambiguous features. Together, SW, FW, and DA achieve the best performance, improving both day and night localization success ratios, especially under challenging illumination and dynamic conditions.
Table 6 further explores the impact of clustering granularity on the effectiveness of fine-grained weighting by varying the number of clusters
k for each semantic class. Increasing
k from 2 to 4 leads to a significant performance boost, particularly in night-time queries. This demonstrates that finer subdivisions allow the stability weights to better distinguish between reliable structural elements and unstable dynamic parts within the same semantic category. However, further increasing
k to 5 results in marginal performance saturation, suggesting that overly fragmented subdivisions may introduce noise or redundant spatial constraints.
Notably, since our clustering is performed as an offline pre-processing step based on spatial coordinates, it introduces zero computational overhead during the training phase while providing stable and consistent geometric guidance. Consequently, is chosen as our default configuration to balance structural granularity and training stability.
5. Limitations and Future Work
Despite the promising results achieved in urban long-term localization, several limitations of the proposed framework remain to be addressed in future research.
5.1. Offline Clustering vs. Online Adaptation
A primary constraint of the current implementation is that the fine-grained semantic sub-classes are generated via an offline k-means clustering process prior to training. While this approach ensures training stability and computational efficiency, it prevents the sub-class boundaries from adapting to the evolving feature space of the encoder during the self-supervised learning process. Future work will explore the integration of online or incremental clustering mechanisms to allow the semantic subdivisions to co-evolve with the feature representations.
5.2. Scope of Generalization
Our experimental evaluation has been primarily focused on urban driving scenarios (Aachen and RobotCar-Seasons), which are characterized by gravity-aligned camera orientations and consistent vertical scene layouts. The performance of the proposed physical priors, such as ground proximity, has not been explicitly validated in diverse domains like indoor environments, aerial platforms, or unstructured off-road scenes. In these scenarios, the “upright camera” assumption may not hold. We plan to extend our framework by incorporating IMU-based gravity estimation or learned spatial priors to enhance its versatility across cross-domain environments.
5.3. Extreme Meteorological Conditions
While our method demonstrates improved robustness to illumination and moderate seasonal shifts, its performance boundaries under more extreme weather conditions, such as dense fog, heavy snowfall, or sandstorms, have not been fully tested. The performance trend observed from the relatively clear Aachen dataset to the more challenging RobotCar-Seasons (which includes rain and light snow) suggests a potential degradation in localization precision when photometric information is severely compromised. Evaluating the model on specialized adverse-weather datasets and developing specialized stability-weighting strategies for these conditions remain key priorities for our future work.
5.4. Dependency on Pre-Trained Segmenters
Lastly, the quality of our fine-grained refinement depends on the initial masks provided by the semantic segmenter. In environments where the segmenter fails (e.g., highly unusual or textureless objects), the stability weights may be sub-optimal. Exploring joint learning of semantic segmentation and feature stability is a promising direction to improve the system’s end-to-end reliability.