sainimohit23 / FaceNet-Real-Time-face-recognition

66 stars 42 forks source link

FaceNet-with-TripletLoss

My implementation for face recognition using FaceNet model and Triplet Loss. I like to implement different deep learning models architectures. I also like to read about applications and implementations of deep learning models. I have typed this code in my free time as a self learning exercise. So, if you run into some performane issue, i am not an expert , i won't be able to help you. I also don't have hardware to extensively test a heavy model like FaceNet. So, hyperparameters are not tuned at all. Only thing I can assure you is that this implementation works.

Medium post

Dependencies

Usage

  1. Create a dataset of faces for each person and arrange them in below order.

    root folder 
    │
    └───Person 1
    │   │───IMG1
    │   │───IMG2
    │   │   ....
    └───Person 2
    |   │───IMG1
    |   │───IMG2
    |   |   ....
  2. Use align_dataset_mtcnn.py to prepare our dataset for training. Run the following command:

python align_dataset_mtcnn.py ./YOUR_DIRECTIORY_CONTAINING_DATA ./cropped

example:

Screenshot_99

  1. Run train_triplet.py to train the model. Make changes (if you want) in parameters.py to adjust training parameters.

  2. Run webcamFaceRecoMulti.py to recognize faces in real time. Note- Our dataset must have some images for this script to work.

Known issues/limitations:

Note:

Refrences