Skip to content
This a an impletation of Deep Metric Learning via Facility Location on tensorflow
Branch: master
Clone or download
Weilin Cong
Weilin Cong update
Latest commit ec20b10 Nov 26, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
data_providers fix Nov 22, 2017
evaluation update Nov 27, 2017
metric_learning update Nov 24, 2017
pretrained_model/DenseNet-BC_growth_rate=12_depth=40_dataset_C100+ update Nov 22, 2017
.gitignore add eval Nov 19, 2017
LICENSE Initial commit Nov 19, 2017 update Nov 27, 2017 up Nov 24, 2017
requirements.txt update require Nov 20, 2017


This repository is an implementation of Deep Metric Learning via Facility Location on tensorflow. We build this on Cifar100 and Densenet-40. This paper is available here. For the loss layer implementation, look at here. For the Densenet implementation, look at here.

  Author    = {Hyun Oh Song and Stefanie Jegelka and Vivek Rathod and Kevin Murphy},
  Title     = {Deep Metric Learning via Facility Location},
  Booktitle = {Computer Vision and Pattern Recognition (CVPR)},
  Year      = {2017}


  1. Install prerequsites for tensorflow (see: tensorflow-gpu installation instructions).
  2. Run pip install -r requirements.txt get required support.

Training Procedure

  1. Modify for training-params and densenet-params. We pick Cifar100 as our training data, because it's tiny, save GPU-memory (when batch size 64, it cost about 4.6G GPU-Memory) and good for doing research.
  2. Run python, the data_provider with automaticlly handle data download and process. After that, start Densenet-Cluster-loss training.
  3. Download Downsampled Imagenet with size 32x32 from here. Modify train on Imagenet.

Feature Extraction after Training

  1. Modify extract feature embeddings on cifar test set, the embeddings is saved with .npy format used for evaluation process.

Clustering and Retrieval Evaluation

  1. Run python visualization/ can plot and save the cluster result on Cifar database. tSNE

Repository Information

  • Densenet tensorflow training code
  • Deep metric learning cluster loss code
  • Evaludation
    • NMI, Recall@K code
    • feature extraction code
    • feature visulization code (tSNE)
  • Dataset support
    • cifar-10
    • cifar-100
    • imagenet-32x32
You can’t perform that action at this time.