This is the official implementation for the CVPR 2025 paper:
AnyCam: Learning to Recover Camera Poses and Intrinsics from Casual Videos
Felix Wimbauer1,2,3, Weirong Chen1,2,3, Dominik Muhle1,2, Christian Rupprecht3, and Daniel Cremers1,2
1Technical University of Munich, 2MCML, 3University of Oxford
If you find our work useful, please consider citing our paper:
@inproceedings{wimbauer2025anycam,
title={AnyCam: Learning to Recover Camera Poses and Intrinsics from Casual Videos},
author={Wimbauer, Felix and Chen, Weirong and Muhle, Dominik and Rupprecht, Christian and Cremers, Daniel},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
year={2025}
}
WARNING: This is a preliminary code release with no guarantees. The repository is still Work in Progress (WiP) and a lot of cleaning-up and documenting will happen in the future.
To set up the environment, follow these steps individually or see below:
-
Create a new conda environment with Python 3.11:
conda create -n anycam python=3.11
-
Activate the conda environment:
conda activate anycam
-
Install pytorch according to your CUDA version:
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124
-
Install the corresponding cudatoolkit for compilation:
conda install -c nvidia cuda-toolkit
-
Install the required packages from
requirements.txt
:pip install -r requirements.txt
Combined, this yields the following comand. Building might take a few minutes.
conda create -n anycam python=3.11 -y && \
conda activate anycam && \
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 && \
conda install -c nvidia cuda-toolkit -y && \
pip install -r requirements.txt
- Sometimes, the evo package recognizes valid pose matrices as invalid during eval. You can simply comment out the check in the package.
We use a slightly customized fork of UniMatch. Furthermore, we use the minipytorch3d variant by VGGSfM. Currently, the official UniDepth repository does not offer backward-compability. Therefore, I created a custom fork, which should be stable.
To download pretrained models, you can use the download_checkpoints.sh
script. Follow these steps:
-
Open a terminal and navigate to the root directory of the repository.
-
Run the
download_checkpoints.sh
script with the desired model name. For example, to download the finalanycam_seq8
model, use the following command:./download_checkpoints.sh anycam_seq8
This will download and unpack the pretrained model into the pretrained_models
directory. You can then use the downloaded model for evaluation or further training.
To train the AnyCam model, run the following command:
python train_anycam.py -cn anycam_training
To evaluate the AnyCam model, run the following command:
python anycam/scripts/evaluate_trajectories.py -cn evaluate_trajectories ++model_path=pretrained_models/anycam_seq8
You can also enable the with_rerun
option during evaluation to plot the process to rerun.io:
python anycam/scripts/evaluate_trajectories.py -cn evaluate_trajectories ++model_path=pretrained_models/anycam_seq8 ++fit_video.ba_refinement.with_rerun=true
You can use the Jupyter notebook anycam/scripts/anycam_4d_plot.ipynb
for visualizing the results.
For more details, refer to the individual scripts and configuration files in the repository.