This is "Fewer is More: A Deep Graph Metric Learning Perspective Using Fewer Proxies", official pytorch implementation of ProxyGML loss for deep metric learning. The paper is accepted by NeurIPS 2020 (spotlight).
We recommended the following dependencies.
- PyTorch==1.2
- Pillow==5.2.0
- tqdm==4.26.0
- matplotlib==2.2.2
- pandas==0.23.4
- scipy==1.2.1
- scikit-learn==0.20.3
- scikit-image==0.14.2
- h5py==2.9.0
-
Download three public benchmarks for deep metric learning
- CUB-200-2011
- Cars-196 (Img, Annotation)
- Stanford Online Products (Link)
-
All datasets are preprocessed as follows ( take CUB200-2011 for eaxample) and stored in .\data
cub200
└───train
| └───0
| │ xxx.jpg
| │ ...
|
| ...
|
| └───99
| │ xxx.jpg
| │ ...
└───test
| └───100
| │ xxx.jpg
| │ ...
|
| ...
|
| └───199
| │ xxx.jpg
| │ ...
| ...
Note that a fine-grained combination of parameter N and parameter r resulted in better overall performance than that described in the paper.
python train.py -b 32 --gpu 2 --dataset cub200 --freeze_BN --epochs 50 --dim 512 --r 0.05 -C 100 --N 12 --weight_lambda 0.3 --centerlr 0.03 --rate 0.1 --new_epoch_to_decay 20 40python train.py -b 32 --gpu 2 --dataset cars196 --freeze_BN --epochs 50 --dim 512 --r 0.05 -C 98 --N 12 --weight_lambda 0.3 --centerlr 0.03 --rate 0.1 --new_epoch_to_decay 20 40python train.py -b 32 --gpu 2 --dataset online_products --epochs 50 --dim 512 --r 0.05 -C 11318 --N 1 --weight_lambda 0.0 --centerlr 0.3 --rate 0.1 --new_epoch_to_decay 20 40