- Tensorflow (tested on
v1.10.0
) pip install -r requirements.txt
- CUHK03
- Market-1501
- Small NORB ( parts 1, 2, 3, 4, 5, 6 )
- Sprites
- CUB-200 with Inception V3 Features (in root folder, run
sh data/download_cub.sh
)
These scripts each extract one npz
type file into the data/
subfolder.
- CUHK03:
python data/cuhk03.py <path-to-cuhk03_release>/
- Market-1501:
python data/market1501.py <path-to-Market-1501-v15.09.15>/
- Small NORB:
python data/small_norb.py <path-to-small_norb>/
- Sprites:
python data/sprites.py <path-to-nips2015_analogy>/sprites/
- CUB-200 needs no further extraction
The configurations used in the paper are available in the example_configs
subfolder. For example, to train a sprite model with a factor-aware oracle and F-Statistic loss embedding:
python embedding.py @example_configs/f/sprites_factor/opts.txt -c train
Configurations from the paper:
cub200/<f,triplet,histogram,lsss,binomial_dev>
cuhk03/<f,triplet,histogram,lsss,binomial_dev>
sprites/class/f **class-aware training for sprites**
sprites/factor/<f,triplet,histogram> **factor-aware training for sprites**
market1501/<f,triplet,histogram,lsss,binomial_dev>
small_norb/<f,triplet,histogram>
Each of these examples only trains the first split. To train a split j
, change the -xvs j
parameter.
Run python embedding.py @path/to/model/opts.txt -me -1 -c test
.
Recall@K results for train/val/test splits will be saved to path/to/model/test.txt
.
This only works for the data sets with factor labels (Sprites and Small-NORB)
Run the following two scripts:
- Modularity:
python eval/modularity.py @path/to/model/opts.txt -me -1 -c test
(Modularity scores (for each dimension) will be saved topath/to/model/modularity_test.txt
) - Explicitness:
python eval/explicitness.py @path/to/model/opts.txt -me -1 -c test
(Explicitness scores (for each factor) will be saved topath/to/model/explicitness_test.txt
)