RAL2025: DSFormer: A Dual-Scale Cross-Learning Transformer for Visual Place Recognition

September 14, 2025 ยท View on GitHub

Introduction

The official repository of "DSFormer: A Dual-Scale Cross-Learning Transformer for Visual Place Recognition".

model

hdbsacnplaces

Environment Setup

  • Create conda enviromnet
conda create -n dsformer python=3.10

conda activate dsformer

pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118

pip install -r requirements.txt
cd DSFormer/models/rpe_ops

python setup.py install --user

Testing

  • Datasets

    MSLS

    Pittsburgh

    Tokyo24/7

    SFXL

  • Trained Models

    We provide pretrained model weights based on both ResNet50 and DINOv2 (ViT-B) backbones, with a global descriptor dimensionality of 512.

    DSFormer (ResNet50): Google Drive

    DSFormer (DINOv2 (ViT-B)): Google Drive

  • Run Testing

    python test.py --backbone ResNet50 --dataset_folder /path/to/yourpath --dataset_name msls --split val
    

Block Clustering

If you would like to use the the processed SFXL dataset based on Block Clustering for training your model, we provide two options:

    1. Directly use datasets/hdbscanplaces_datasets.py, and train_dataset_folder is the path of raw panoramic image dataset (~930G).
    from datasets.hdbscanplaces_dataset import HDBScanPlaces
    groups_num = 5
    groups = [HDBScanPlaces(train_dataset_folder='/path/your/raw_SFXL', 
                            focal_dist=args.focal_dist,
        					current_group=n // 2, 
                            min_images_per_class=10,
        					angle=[0, 90][n % 2])
        					for n in range(groups_num * 2)]
    
    1. A subset of approximately 4.2 million images(~188G) is extracted from the raw SFXL panoramic dataset using the Block Clustering.
    python extract_images.py --dataset_folder /path/your/raw_SFXL --extracted_folder /path/your/subset
    

    Use:

    from datasets.hdbscanplaces2_dataset import HDBScanPlaces
    groups_num = 5
    groups = [HDBScanPlaces(train_dataset_folder='/path/your/subset', 
        					current_group=n // 2, 
        					angle=[0, 90][n % 2])
        					for n in range(groups_num * 2)]
    

Acknowledgements

EigenPlaces implementation in PyTorch

CosPlace implementation in PyTorch

R2Former implementation in PyTorch

BoQ implementation in PyTorch

IRPE implementation in PyTorch

Cite

If you use this work, please cite:

@ARTICLE{jiang2025dsformer,
  author={Jiang, Haiyang and Piao, Songhao and Gao, Chao and Yu, Lei and Chen, Liguo},
  journal={IEEE Robotics and Automation Letters}, 
  title={DSFormer: A Dual-Scale Cross-Learning Transformer for Visual Place Recognition}, 
  year={2025},
  volume={10},
  number={10},
  pages={10799-10806},
  doi={10.1109/LRA.2025.3604761}}