This is the official Code for the paper Rotation Synchronization via Deep Matrix Factorization presented at ICRA 2023.
Our current implementation is based off Implicit Regularization in Deep Matrix Factorization . Please use python 3.7 to run this code.
The basic libraries are listed in requirements.txt
. You can install them by running the following command.
pip install -r requirements.txt
Another way to do this is by using the setup bash script. This will install the required libraries and download and arrange the datasets. This can be done by running the following command.
bash setup.sh
For our experiments, we use the 1DSfM dataset and synthetic datasets. The 1DSfM dataset can be downloaded from here.
The general structure of the datasets and configs for a particular dataset is as follows.
.
└── DMF-Synch
├── datasets
│ ├── data-real
│ │ ├── [dataset]_gt.pt ------> Ground truth relative rotations (noisy)
│ │ ├── [dataset]_obs.pt -----> Observed indices
│ │ └── [dataset]_unobs.pt ---> Unobserved indices
│ └── data-real-mat
│ └── [dataset].mat --------> Ground truth absolute rotations
└── configs
└── data-real
└── [dataset].toml --------> Config file
The easiest way to setup the 1DSfM dataset is to run the bash script setup.sh
. Please note that this will download and arrange all the 15 datasets contained in the 1DSfM dataset. The configs for each dataset in 1DSfM are already present in the configs folder.
To generate the synthetic datasets, you'll first have to generate the ground truths and the mask using the MATLAB script synth_real.m
located in the MATLAB-scripts
folder.
This script has several paramerters that can be changed. The parameters are as follows:
ncams_c
: Number of camerasprob_out
: Fraction of outlierssigma_a
: Noise in degreesfraction_missing
: Fraction of missing data
After setting the parameters and running the MATLAB script, to generate the final datasets and configs, please run the following command.
python gen_synth.py
If you just want to run one experiment, use the following command as an example.
python3 main.py --print_config --log_dir ./logs \
--config configs/mat-real/Alamo.toml, \
--config configs/opt/SGD.toml, \
--set depth 2, \
--set lr 0.001, \
--set initialization gaussian, \
--set init_scale 1.e-3
To run multiple experiments with multiple hyperparameters sequentially, you can use ./scripts/run.rb
(please make sure Ruby is installed and gem install colorize --user
). The code will log into ~/logs
by default.
./scripts/run.rb --n_jobs 1 --name mat-cmpl --template 'python3 main.py \
--print_config --log_dir ./logs/ --config configs/data-real/CONFIG, \
--config configs/opt/SGD.toml, --set depth DEPTH --set lr LR \
--set init_scale SCALE --set n_iters 100000 --set initialization INIT'\
--replace LR=0.3 \
--replace DEPTH=2,3 \
--replace SCALE=1.e-3 \
--replace CONFIG=Alamo.toml, Ellis_Island.toml\
--replace INIT=gaussian
If you found our work useful and use it in your research, please consider citing our paper.
@misc{tejus2023rotation,
title={Rotation Synchronization via Deep Matrix Factorization},
author={Gk Tejus and Giacomo Zara and Paolo Rota and Andrea Fusiello and Elisa Ricci and Federica Arrigoni},
year={2023},
eprint={2305.05268},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
If you have any questions regarding the code, please raise an issue or reach out to me.