Doppelgangers++: Improved Visual Disambiguation with Geometric 3D Features
Doppelgangers++: Improved Visual Disambiguation with Geometric 3D Features
Yuanbo Xiangli, Ruojin Cai, Hanyu Chen, Jeffrey Byrne, Noah Snavely
Implementation of Doppelganger++, an enhanced pairwise image classifier that excels in visual disambiguation across diverse and challenging scenes. Doppelgangers++ seamlessly integrates with SfM pipelines such as COLMAP and MASt3R-SfM, producing correct and complete reconstructions.
git clone --recursive https://github.com/doppelgangers25/doppelgangers-plusplus.git
cd doppelgangers-plusplusconda create -n doppelgangers_pp python=3.11 cmake=3.14.0
conda activate doppelgangers_pp
conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia # use the correct version of cuda for your system
pip install -r requirements.txt
pip install -r dust3r/requirements.txt
pip install -r dust3r/requirements_optional.txt# DUST3R relies on RoPE positional embeddings for which you can compile some cuda kernels for faster runtime.
cd dust3r/croco/models/curope/
python setup.py build_ext --inplace
cd ../../../../pip install cython
git clone https://github.com/jenicek/asmk
cd asmk/cython/
cythonize *.pyx
cd ..
pip install . # or python3 setup.py build_ext --inplace
cd ..installation page, we used vesion 3.10.Create a fata folder inside the project path:
mkdir data
mkdir data/pairs_metadataNext, download the Doppelgangers dataset (Cai et al.) and VisymScenes data, and place them under a desired direcory, e.g. data/.
The final folder layout should look like:
…Follow the data download and preparation of Doppelgangers: Learning to Disambiguate Images of Similar Structures. Or following the instructions:
train_set_noflip.tar.gztrain_set_flip.tar.gz and MegaDepth subset: train_megadepth.tar.gz. flip_augmentation.py to perform the image flip augmentation on the provided base images. To use this script, please modify the configuration options at the beginning of the script and run with python flip_augmentation.py.test_set.tar.gzpairs_metadata.tar.gzOrganize the data directory with:
mv data/doppelgangers/pairs_metadata/* data/pairs_metadata/
rm -rf data/doppelgangers/pairs_metadatahuggingface. Recover original files with script:…test_pairs_visym.npy and train_pairs_visym.npy, put them under data/pairs_metadata.Download the checkpoints from huggingface and put them under a desired path, e.g. checkpoints/.
The general idea is to first perform feature extraction and matching, which generates a list of image pairs. Then use our visual disambiguation model on these image pairs to remove the ones with lower probability (i.e. more likely to be a doppelganger). Finally, run mapper on the filter image pairs for reconstruction.
We provide example scripts of integrating our visual disambiguation model into SfM pipelins:
python colmap_usage.py --colmap_exe_command colmap \
--input_image_path /path/to/your/images \
--output_path /path/to/output/directory \
--threshold 0.8 \
--pretrained checkpoints/checkpoint-dg+visym.pth \Download both the trainingfree.pth and codebook.pkl files following MASt3R-SfM's instruction, and put them in the same directory.
mkdir -p checkpoints/
wget https://download.europe.naverlabs.com/ComputerVision/MASt3R/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric_retrieval_trainingfree.pth -P checkpoints/
wget https://download.europe.naverlabs.com/ComputerVision/MASt3R/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric_retrieval_codebook.pkl -P checkpoints/Then run:
python mast3r_sfm_usage.py \
--input_image_path /path/to/your/images \
--output_path /path/to/output/directory \
--pretrained checkpoints/checkpoint-dg+visym.pth \
--retrieval_model checkpoints/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric_retrieval_trainingfree.pth \
--threshold 0.8Given an image pair, we first create a symmetrized version of the pair and feed it into the frozen MASt3R model. Multi-layer features are extracted from each decoder branch, concatenated, and fed into two learnable doppelganger classification heads. Each head generates predictions supervised by cross-entropy loss.
To train the model, first download a pretrained MASt3R model, for example MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth:
mkdir -p checkpoints/
wget https://download.europe.naverlabs.com/ComputerVision/MASt3R/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth -P checkpoints/An example training script:
…To evaluate a model, use test.py, and specify the pretrained model path, e.g. checkpoints/checkpoint-dg+visym.pth. Change teston value in test_dataset to switch test sets.
…If you find our work helpful, please consider citing:
@misc{xiangli2024doppelgangersimprovedvisualdisambiguation,
title={Doppelgangers++: Improved Visual Disambiguation with Geometric 3D Features},
author={Yuanbo Xiangli and Ruojin Cai and Hanyu Chen and Jeffrey Byrne and Noah Snavely},
year={2024},
eprint={2412.05826},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2412.05826},
}No open issues yet, or sync has not completed.