Skip to content

yliess86/TripletFace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Triplet loss for facial recognition.

Triplet Face

The repository contains code for the application of triplet loss training to the task of facial recognition. This code has been produced for a lecture and is not going to be maintained in any sort.

TSNE_Latent

Architecture

The proposed architecture is pretty simple and does not implement state of the art performances. The chosen architecture is a fine tuning example of the resnet18 CNN model. The model includes the freezed CNN part of resnet, and its FC part has been replaced to be trained to output latent variables for the facial image input.

The dataset needs to be formatted in the following form:

dataset/
| test/
| | 0/
| | | 00563.png
| | | 01567.png
| | | ...
| | 1/
| | | 00011.png
| | | 00153.png
| | | ...
| | ...
| train/
| | 0/
| | | 00001.png
| | | 00002.png
| | | ...
| | 1/
| | | 00001.png
| | | 00002.png
| | | ...
| | ...
| labels.csv        # id;label

Install

Install all dependencies ( pip command may need sudo ):

cd TripletFace/
pip3 install -r requirements.txt

Usage

For training:

usage: train.py [-h] -s DATASET_PATH -m MODEL_PATH [-i INPUT_SIZE]
                [-z LATENT_SIZE] [-b BATCH_SIZE] [-e EPOCHS]
                [-l LEARNING_RATE] [-w N_WORKERS] [-r N_SAMPLES]

optional arguments:
  -h, --help            show this help message and exit
  -s DATASET_PATH, --dataset_path DATASET_PATH
  -m MODEL_PATH, --model_path MODEL_PATH
  -i INPUT_SIZE, --input_size INPUT_SIZE
  -z LATENT_SIZE, --latent_size LATENT_SIZE
  -b BATCH_SIZE, --batch_size BATCH_SIZE
  -e EPOCHS, --epochs EPOCHS
  -l LEARNING_RATE, --learning_rate LEARNING_RATE
  -w N_WORKERS, --n_workers N_WORKERS
  -r N_SAMPLES, --n_samples N_SAMPLES

References

  • Resnet Paper: Arxiv
  • Triplet Loss Paper: Arxiv
  • TripletTorch Helper Module: Github

Todo ( For the students )

Deadline Decembre 14th 2019 at 12am

The students are asked to complete the following tasks:

  • Fork the Project
  • Improve the model by playing with Hyperparameters and by changing the Architecture ( may not use resnet )
  • JIT compile the model ( see Documentation )
  • Add script to generate Centroids and Thesholds using few face images from one person
  • Generate those for each of the student included in the dataset
  • Add inference script in order to use the final model
  • Change README.md in order to include the student choices explained and a table containing the Centroids and Thesholds for each student of the dataset with a vizualisation ( See the one above )
  • Send the github link by mail

About

Triplet loss for facial recognition.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages