This is the re-implementation of triplet loss function used in Google's FaceNet paper and VGG's DeepFace paper.
I use FaceScrub as traning dataset, you should modify sampledata.py
to fit your dataset.
Rebuild your caffe directory:
cd $CAFFEROOT$
cp Makefile.configexample Makefile.config
Remember to uncomment the line to makesure your python layers could be found:
WITH_PYTHON_LAYER := 1
Then build caffe and pycaffe:
make all -j8 & make pycaffe
-
Modify
sampledata.py
,config.py
andtrain.py
to fit your dataset and working environment. -
Pre-train your model with softmax loss.
-
Train triplet model based on your pre-trained model.
-
Learn to adjust parameters.