This repo contains code associated with the A-SCoRe paper
To use pnp ransac, you need to build the cython module:
cd ./pnpransac/
python setup.py build_ext --inplaceThen create the conda environment using the .yml config file:
conda env create -f environment.yml
conda activate ascore
Download the dataset from the project page
mkdir datasets/7scenes
export dataset=datasets/7scenes
for scene in chess fire heads office pumpkin redkitchen stairs; \
do wget http://download.microsoft.com/download/2/8/5/28564B23-0828-408F-8631-23B1EFF1DAC8/$scene.zip -P $dataset \
&& unzip $dataset/$scene.zip -d $dataset && unzip $dataset/$scene/'*.zip' -d $dataset/$scene; doneWe also provide the SfM models running SuperPoint configuration in this location
mkdir datasets/12scenes
export dataset=datasets/12scenes
for scene in apt1 apt2 office1 office2; \
do wget https://graphics.stanford.edu/projects/reloc/data/$scene.zip -P $dataset \
&& unzip $dataset/$scene.zip -d $dataset;
donemkdir datasets/Cambridge
export scenes=( "KingsCollege" "OldHospital" "StMarysChurch" "ShopFacade" "GreatCourt" )
export IDs=( "251342" "251340" "251294" "251336" "251291" )
for i in "${!scenes[@]}"; do
wget https://www.repository.cam.ac.uk/bitstream/handle/1810/${IDs[i]}/${scenes[i]}.zip -P $dataset \
&& unzip $dataset/${scenes[i]}.zip -d $dataset && rm $dataset/${scenes[i]}.zip; done
Coming
Training command:
python lightning/main.py --model sp_sg_attn \
--dataset 7Scenes \
--scene chess \
--device 0 \
--mode train \
--n_iter 300000 \
--batch_size 8 \
--num_workers 4 \
--aug True \
--data_path /path/to/metadata \
--img_path /path/to/image \
Evaluating command:
python lightning/main.py --model sp_sg_attn \
--dataset 7Scenes \
--scene chess \
--mode test \
--device 0 \
--n_iter 300000 \
--batch_size 8 \
--num_workers 4 \
--aug True \
--data_path /path/to/metadata \
--img_path /path/to/image \
--pretrained_ckpt /path/to/pretrained/model \
--validate_on_train False \
Training command
python lightning/main.py --model sp_sg_attn \
--dataset 7Scenes_SfM \
--loss regcoord_loss \
--scene chess \
--device 0 \
--mode train \
--n_iter 300000 \
--batch_size 8 \
--num_workers 4 \
--aug True \
--data_path /path/to/metadata \
--img_path /path/to/image \Evaluating command
python lightning/main.py --model sp_sg_attn \
--dataset 7Scenes_SfM \
--loss regcoord_loss \
--scene chess \
--mode test \
--device 0 \
--mode train \
--n_iter 300000 \
--batch_size 8 \
--num_workers 4 \
--aug True \
--data_path /path/to/metadata \
--img_path /path/to/image \If you find any part of this code useful, please cite:
Thanks to authors of these great opensource projects: Hloc, HSCNet, D2S for their contributions that we take inspiration from.