Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/compvis/metric-learning-divide-and-conquer
Source code for the paper "Divide and Conquer the Embedding Space for Metric Learning", CVPR 2019
https://github.com/compvis/metric-learning-divide-and-conquer
few-shot-learning metric-learning pytorch
Last synced: 9 days ago
JSON representation
Source code for the paper "Divide and Conquer the Embedding Space for Metric Learning", CVPR 2019
- Host: GitHub
- URL: https://github.com/compvis/metric-learning-divide-and-conquer
- Owner: CompVis
- License: lgpl-3.0
- Created: 2019-03-03T00:05:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-24T18:27:47.000Z (about 5 years ago)
- Last Synced: 2023-11-07T17:54:55.112Z (about 1 year ago)
- Topics: few-shot-learning, metric-learning, pytorch
- Language: Python
- Size: 33.2 KB
- Stars: 263
- Watchers: 21
- Forks: 43
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Divide and Conquer the Embedding Space for Metric Learning
## About
This repository contains the code for reproducing the results for [Divide and Conquer the Embedding Space for Metric Learning](http://openaccess.thecvf.com/content_CVPR_2019/papers/Sanakoyeu_Divide_and_Conquer_the_Embedding_Space_for_Metric_Learning_CVPR_2019_paper.pdf) (CVPR 2019) with the datasets [In-Shop Clothes](http://mmlab.ie.cuhk.edu.hk/projects/DeepFashion/InShopRetrieval.html), [Stanford Online Products](http://cvgl.stanford.edu/projects/lifted_struct/) and [PKU VehicleID](https://www.pkuml.org/resources/pku-vehicleid.html).
**Paper**: [pdf](http://openaccess.thecvf.com/content_CVPR_2019/papers/Sanakoyeu_Divide_and_Conquer_the_Embedding_Space_for_Metric_Learning_CVPR_2019_paper.pdf)
**Supplementary**: [pdf](http://openaccess.thecvf.com/content_CVPR_2019/supplemental/Sanakoyeu_Divide_and_Conquer_CVPR_2019_supplemental.pdf)We also applied our method to the [Humpback Whale Identification Challenge](https://www.kaggle.com/c/humpback-whale-identification/overview) at Kaggle and finished at 10th place out of 2131.
**Slides**: [link](https://slides.com/asanakoy/metric-learning-kaggle-whales)## Requirements
- Python version 3.6.6 or higher
- SciPy and scikit-learn packages
- PyTorch ([pytorch.org](http://pytorch.org))
- Faiss with GPU support ([Faiss](https://github.com/facebookresearch/faiss))
- download and extract the datasets for [In-Shop Clothes](http://mmlab.ie.cuhk.edu.hk/projects/DeepFashion/InShopRetrieval.html), [Stanford Online Products](http://cvgl.stanford.edu/projects/lifted_struct/) and [PKU VehicleID](https://www.pkuml.org/resources/pku-vehicleid.html)## Usage
The following command will train the model with Margin loss on the In-Shop Clothes dataset for 200 epochs and a batch size of 80 while splitting the embedding layer with 8 clusters and finetuning the model from epoch 190 on. You can use this command to reproduce the results of the paper for the three datasets by changing simply `--dataset=inshop` to `--dataset=sop` (Stanford Online Products) or `--dataset=vid` (Vehicle-ID).
```
CUDA_VISIBLE_DEVICES=0 python experiment.py --dataset=inshop \
--dir=test --exp=0 --random-seed=0 --nb-clusters=8 --nb-epochs=200 \
--sz-batch=80 --backend=faiss-gpu --embedding-lr=1e-5 --embedding-wd=1e-4 \
--backbone-lr=1e-5 --backbone-wd=1e-4 --finetune-epoch=190
```The model can be trained without the proposed method by setting the number of clusters to 1 with `--nb-clusters=1`.
For faster clustering we run Faiss on GPU. If you installed Faiss without GPU support use flag `--backend=faiss`.
## Expected ResultsThe model checkpoints and log files are saved in the selected log-directory. You can print a summary of the results with `python browse_results `.
You will get slightly higher results than what we have reported in the paper. For SOP, In-Shop and Vehicle-ID the R@1 results should be somewhat around 76.40, 87.36 and 91.54.
## Related Repos
- Collection of baselines for metric learning from @Confusezius [[PyTorch](https://github.com/Confusezius/Deep-Metric-Learning-Baselines)]
## License
You may find out more about the license [here](LICENSE)
## Reference
If you use this code, please cite the following paper:
Artsiom Sanakoyeu, Vadim Tschernezki, Uta Büchler, Björn Ommer. "Divide and Conquer the Embedding Space for Metric Learning", CVPR 2019.
```
@InProceedings{dcesml,
title={Divide and Conquer the Embedding Space for Metric Learning},
author={Sanakoyeu, Artsiom and Tschernezki, Vadim and B\"uchler, Uta and Ommer, Bj\"orn},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
year={2019},
}
```