Home

Awesome

Deep Metric Learning Using Triplet Network

This code replicates the results from the paper “Deep metric learning using Triplet network” (http://arxiv.org/abs/1412.6622).

It can train a TripletNet on any of the {Cifar10/100, STL10, SVHN, MNIST} datasets.

Data

You can get the needed data using the following repos:

Dependencies

Models

Available models are at the “Models” directory. The basic Model.lua was used in the paper, while NiN based models achieve slightly better results.

Training

You can start training using:

th Main.lua -dataset Cifar10 -LR 0.1 -save new_exp_dir

Additional flags

FlagDefault ValueDescription
modelsFolder./Models/Models Folder
networkModel.luaModel file - must return valid network.
LR0.1learning rate
LRDecay0learning rate decay (in # samples
weightDecay1e-4L2 penalty on the weights
momentum0.9momentum
batchSize128batch size
optimizationsgdoptimization method
epoch-1number of epochs to train (-1 for unbounded)
threads8number of threads
typecudafloat or cuda
devid1device ID (if using CUDA)
loadnoneload existing net weights
savetime-identifiersave directory
datasetCifar10Dataset - Cifar10, Cifar100, STL10, SVHN, MNIST
normalize11 - normalize using only 1 mean and std values
whitenfalsewhiten data
augmentfalseAugment training data
preProcDir./PreProcData/Data for pre-processing (means,Pinv,P)