Skip to content

osimeoni/DSM

 
 

Repository files navigation

Deep Spatial Matching (DSM)

This repository provides a MATLAB implementation of the the deep spatial matching (DSM) method introduced in our CVPR paper:

Local Features and Visual Words Emerge in Activations Siméoni O., Avrithis Y., Chum O., CVPR 2019 [arXiv]

Our method allows to refine image retrieval ranking. Initial ranking is based on image descriptors extracted from convolutional neural network activations by global pooling, as in recent state-of-the-art work. However, the same sparse 3D activation tensor is also approximated by a collection of local features. These local features are then robustly matched to approximate the optimal alignment of the tensors. This happens without any network modification, additional layers or training. No local feature detection happens on the original image. No local feature descriptors and no visual vocabulary are needed throughout the whole process.

Usage

This section introduces the different steps in order to run the evaluation presented in the paper.

This code borrows heavily from the CNN Image Retrieval framework published by Radenovic et al, which can be found at https://github.com/filipradenovic/cnnimageretrieval.

Prerequities

In order to run this toolbox you will need:

1. Models

The DSM method is used on 3 different sets of retrieval models:

  • MAC pooling: Please download the VGG16 and ResNet101 models retrained by us on the SfM-120k dataset using MAC pooling. [Link].
  • GeM pooling: Both VGG16 and ResNet101 trained using GeM pooling by Radenovic etal will be automatically downloaded by the script.
  • Off-the-shelf: Models trained on Imagenet [To come]

Make sure the models folders are placed in data/networks. Full paths should be as following : data/networks/dsm-retrained/dsm-retrained-mac-vgg.mat

2. Matlab

Launch matlab

>> run [MATCONVNET_ROOT]/matlab/vl_setupnn;

3. Setup

The following scripts sets matlab libraries correctly.

>> run [CNNIMAGERETRIEVAL_ROOT]/setup_dsm;

4. Evaluation

Code for evaluating the method can be found in the examples at: [CNNIMAGERETRIEVAL_ROOT]/examples/test_dsm.

In order to test the different models, please change the parameter params.network. The available options are

  • 'retrievalSfM120k-gem-vgg': the official VGG-GeM model trained by Radenovic etal.
  • 'retrievalSfM120k-gem-resnet101': the official ResNet101-GeM model trained by Radenovic etal.
  • 'dsm-retrained-mac-vgg': VGG-MAC retrained on the SfM-120k dataset by Simeoni etal.
  • 'dsm-retrained-mac-resnet101': ResNet101-MAC retrained on the SfM-120k dataset by Simeoni etal.
  • 'imagenet-vgg': VGG-MAC retrained on the SfM-120k dataset by Simeoni etal.
  • 'imagenet-resnet101': ResNet101-MAC retrained on the SfM-120k dataset by Simeoni etal.

Once set as desired, the script can be run using:

>> test_dsm

Citation

@inproceedings{SAC19,
 author = {Sim{\'e}oni O. and Avrithis, Y. and Chum, O.},
 title = {Local Features and Visual Words Emerge in Activations},
 booktitle = {CVPR},
 year = {2019}
}

Contact

oriane.simeoni at inria.fr

About

Deep Spatial Matching

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • MATLAB 100.0%