Skip to content

cvg/ActLoc

Repository files navigation

ActLoc:
Learning to Localize on the Move via Active Viewpoint Selection

Jiajie Li* · Boyang Sun* · Luca Di Giammarino · Hermann Blum · Marc Pollefeys

example
We present ActLoc, a learning-based approach for active viewpoint selection. ActLoc selects viewing directions at given locations that maximize visual localization performance.

🔄 Updates


🛠️ Setup

Our code has been tested on a workstation running Ubuntu 22.04 with an NVIDIA RTX 4090 (24GB) GPU and CUDA 12.4.

We recommend creating the environment from the provided environment.yml file:

# create environment
conda env create -f environment.yml

# activate environment
conda activate actloc_env

Example Data Download

We provide one example scene from HM3D:

chmod +x download_example_data.sh && ./download_example_data.sh

You can also download the example data from here and put it in the root folder of this repo to use for demos.


Quick Start

Single Viewpoint Selection

This script takes an SfM model and a list of waypoints as input, and predicts the optimal camera pose (extrinsic matrix) for each one individually.

python demo_single.py \
    --sfm-dir ./example_data/reference_sfm \
    --waypoints-file ./example_data/waypoints.txt \
    --checkpoint ./checkpoints/trained_actloc.pth \
    --output-file ./example_data/selected_poses.npz

Expected Output: This will create a file named selected_poses.npz in the example_data directory, which contains the calculated poses.

Multiple Viewpoints Selection with Motion Constraints

To choose viewpoint that balances localization performance and rotation continuity, run:

python demo_multi.py \
    --sfm-dir ./example_data/reference_sfm \
    --waypoints-file ./example_data/waypoints.txt \
    --checkpoint ./checkpoints/trained_actloc.pth \
    --output-file ./example_data/selected_poses_multi.npz \
    --lamda 0.02

Visualization

To visualize the scene and the prediction results:

python vis.py \
    --meshfile ./example_data/scene.glb \
    --waypoints-file ./example_data/waypoints.txt \
    --poses-file ./example_data/selected_poses.npz 

or:

python vis.py \
    --meshfile ./example_data/scene.glb \
    --waypoints-file ./example_data/waypoints.txt \
    --poses-file ./example_data/selected_poses_multi.npz 

example

Render Images from Predicted Poses

To see the observation ath selected poses, use the selected_poses.npz file generated to render images from the 3D mesh.

python capture_predicted_views.py \
    --mesh-file ./example_data/scene.glb \
    --poses-file ./example_data/selected_poses.npz \
    --output-folder ./example_data/best_viewpoint_images

Expected Output: This will create a new folder named best_viewpoint_images containing the rendered images for each successful waypoint. This process might take a while.


📝 Roadmap

  • Single-viewpoint Selection Inference Code Release
  • Single-viewpoint Selection Demo Release
  • Path Planning Inference Code Release
  • Path Planning Demo Release
  • Test Data and Evaluation Script Release
  • Training Data and Training Script Release

Citation

If you find our paper useful, please consider citing:

@misc{li2025actloclearninglocalizeactive,
      title={ActLoc: Learning to Localize on the Move via Active Viewpoint Selection}, 
      author={Jiajie Li and Boyang Sun and Luca Di Giammarino and Hermann Blum and Marc Pollefeys},
      year={2025},
      eprint={2508.20981},
      archivePrefix={arXiv},
      primaryClass={cs.RO},
      url={https://arxiv.org/abs/2508.20981}, 
}

About

[CoRL 2025] ActLoc: Learning to Localize on the Move via Active Viewpoint Selection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •