Home

Awesome

PUMP: pyramidal and uniqueness matching priors for unsupervised learning of local features

image

Official repository for the following paper:

@inproceedings{cvpr22_pump,
  author    = {Jerome Revaud, Vincent Leroy, Philippe Weinzaepfel, Boris Chidlovskii},
  title     = {PUMP: pyramidal and uniqueness matching priors for unsupervised learning of local features},
  booktitle = {CVPR},
  year      = {2022},
}

image

License

Our code is released under the CC BY-NC-SA 4.0 License (see LICENSE for more details), available only for non-commercial use.

Requirements

Online Demo

You can try the online demo hosted at Hugging Face. WARNING: this online demo runs on CPU at low image resolution (no multi-scale, no rotation), due to limited memory and computational resources.

Warping Demo

python demo_warping.py

You should see the following result: image

Test usage

We provide 4 variations of the pairwise matching code, named test_xxxscale_yyy.py:

For most cases, you want to use test_multiscale.py:

python test_multiscale.py 
    --img1 path/to/img1
    --img2 path/to/img2
    --resize 600 # important, see below
    --post-filter 
    --output path/to/correspondences.npy

It outputs a numpy binary file with the field file_data['corres'] containing a list of correspondences. The row format is [x1, y1, x2, y2, score, scale_rot_code]. Use core.functional.decode_scale_rot(code) --> (scale, angle_in_degrees) to decode the scale_rot_code.

Optional parameters:

Visualization of results:

python -m tools.viz --img1 path/to/img1 --img2 path/to/img2 --corres path/to/correspondences.npy

Reproducing results on the ETH-3D dataset

  1. Download the ETH-3D dataset from their website and extract it in datasets/eth3d/

  2. Run the code python run_ETH3D.py. You should get results slightly better than reported in the paper.

Training PUMP from scratch

  1. Download the training data with

    bash download_training_data.sh
    

    This consists of web images from this paper for the self-supervised loss (as in R2D2) and image pairs from the SfM120k dataset with automatically extracted pixel correspondences. Note that correspondences are not used in the loss, since the loss is unsupervised. They are only necessary so that random cropping produces pairs of crops at least partially aligned. Therefore, correspondences do not need to be 100% correct or even pixel-precise.

  2. Run python train.py --save-path <output_dir>/

    Note that the training code is quite rudimentary (only supports nn.DataParallel, no support for DataDistributed at the moment, and no validation phase neither).

  3. Move and rename your final checkpoint to checkpoints/NAME.pt and test it with

    python test_multiscale.py ... --desc NAME