Skip to main content

Face recognition based on Facenet

Project description

Face Recognition

Face Recognition Based on Facenet

Built using Facenet’s state-of-the-art face recognition built with deep learning. The model has an accuracy of 99.2% on the Labeled Faces in the Wild benchmark.

Features

  • Out of Box Working Face Recognition

  • Choose Any Pre-Trained Model from Facenet

  • For training just provide the proper folder structure

  • Faster than other available solutions

Prerequisites

  • You need Python(2.6 to 3.5) installed

  • X-based System supported (does work on Windows but not tested)

Installing

pip install facenet_recognition
Setup

Create setup as follows:

  1. Create input directory eg: input_images

  2. Create aligned images directory eg: aligned_images Create this directory we will store aligned images here

  3. Create pre-trained model directory eg: pretrained_facenet_model Download Pre-Trained model from `Facenet` and keep it in the pre_model directory

  4. Create my trained classifier directory eg: my_classifier In this directory we will save our trained model

Let’s Begin

For Facial Recognition we need to align images as follows:

import facenet_recognition
facenet_recognition.align_input('input_images','aligned_images')

Above command will create our input images into aligned format and save it in given aligned images folder

Train & Test Classifier on Images

After we have aligned images now we can train our classifier.

pre_model='./pretrained_facenet_model/20170511-185253.pb' #locaiton of pret-trained model from Facenet
my_class ='./my_classifier/my_classifier.pkl' #location where we want to save
test_classifier_type = 'svm' #type of model either svm or nn
weight= './my_classifier/model_small.yaml' #local stored weights

facenet_recognition.test_train_classifier(aligned_images,pre_model,my_class,weight,test_classifier_type,nrof_train_images_per_class=30, seed=102)

Mininum Required Image per person: 1 Number of Images for Training per Person: 30 (configurable)

Train Classifer on Images(only Training)

This API is used to Train our Classifier on Aligned Images

pre_model='./pretrained_facenet_model/20170511-185253.pb' #locaiton of pret-trained model from Facenet
my_class ='./my_classifier/my_classifier.pkl' #location where we want to save
test_classifier_type = 'nn' #type of model either svm or nn
weight= './my_classifier/model_small.yaml' #local stored weights

facenet_recognition.create_classifier(aligned_images,pre_model,my_class,weight,test_classifier_type)

Mininum Required Image per person: 1 Number of Images for Training per Person: 30 (fixed)

Test Classifer on Images

This API is used to test our Trained Classifer

pre_model='./pretrained_facenet_model/20170511-185253.pb' #locaiton of pret-trained model from Facenet
my_class ='./my_classifier/my_classifier.pkl' #location where we want to save
test_classifier_type = 'nn' #type of model either svm or nn
weight= './my_classifier/model_small.yaml' #local stored weights

facenet_recognition.test_classifier(aligned_images,pre_model,my_class,weight,test_classifier_type)

Mininum Required Image per person: 1

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Big Thanks to David Sandberg for Facent

  • Inspired by Dlib based library face_recognition

History

0.1.4 (2018-28-03)

  • First beta release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facenet_recognition-0.1.4.tar.gz (1.9 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page