Giter Site home page Giter Site logo

facenet-real-time-face-recognition's Introduction

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

  • python 3.6
  • tensorflow v1.11
  • keras
  • openCV

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
|   |   ....
  1. 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:

  • The dataset must contain the images of atleast two different people to train the model. You can define your own generator function to train it for single person
  • Generator function might be slow when dataset has images of fewer number of people.
  • Code needs some refactoring.

Note:

  • It is not state of the art technique. So, dont't expect much from it.

  • Model is trained using triplet loss. According to experiments it is recommended to chose positive, negative and anchor images carefully/manually for better results. Here I used a generator which selects images for positive, negative and anchor randomly (I'm Lazy af). To know more about this I recommend you to watch this video.

Refrences

facenet-real-time-face-recognition's People

Contributors

sainimohit23 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.