All Projects → susantabiswas → FaceRecog

susantabiswas / FaceRecog

Licence: MIT license
Realtime Facial recognition system using Siamese neural network

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to FaceRecog

Facial-Recognition-Using-FaceNet-Siamese-One-Shot-Learning
Implementation of Facial Recognition System Using Facenet based on One Shot Learning Using Siamese Networks
Stars: ✭ 104 (+121.28%)
Mutual labels:  face-recognition, face-detection, facenet, siamese-network
easy-real-time-face-recognition-python
No description or website provided.
Stars: ✭ 30 (-36.17%)
Mutual labels:  realtime, face-recognition, opencv-python
DeepFaceRecognition
Face Recognition with Transfer Learning
Stars: ✭ 16 (-65.96%)
Mutual labels:  face-recognition, face-detection, facenet
clockon-clockoff-face-recognition
Face Recognize application. Using FaceNet and CoreML
Stars: ✭ 21 (-55.32%)
Mutual labels:  face-recognition, face-detection, facenet
facenet-darknet-inference
Face recognition using facenet
Stars: ✭ 29 (-38.3%)
Mutual labels:  face-recognition, face-detection, facenet
compreface-javascript-sdk
JavaScript SDK for CompreFace - free and open-source face recognition system from Exadel
Stars: ✭ 19 (-59.57%)
Mutual labels:  face-recognition, face-detection, facenet
Facenet
Face recognition using Tensorflow
Stars: ✭ 12,189 (+25834.04%)
Mutual labels:  face-recognition, face-detection, facenet
Computer-Vision-Project
The goal of this project was to develop a Face Recognition application using a Local Binary Pattern approach and, using the same approach, develop a real time Face Recognition application.
Stars: ✭ 20 (-57.45%)
Mutual labels:  realtime, face-recognition
Facemoji Kit
Face tracker with blend shapes coefficients, 3D head pose and dense mesh in real-time on iOS, Android, Mac, PC and Linux.
Stars: ✭ 158 (+236.17%)
Mutual labels:  realtime, face-detection
Face-Recognition
A Java application for Face Recognition under expressions, occlusions and pose variations.
Stars: ✭ 55 (+17.02%)
Mutual labels:  face-recognition, face-detection
Face-Recognition-Raspberry-Pi-64-bits
Recognize 2000+ faces on your Raspberry Pi 4 with database auto-fill and anti-spoofing
Stars: ✭ 48 (+2.13%)
Mutual labels:  face-recognition, face-detection
Detect-Facial-Features
Code example demonstrating how to detect eyes, nose, lips, and jaw with dlib, OpenCV, and Python
Stars: ✭ 42 (-10.64%)
Mutual labels:  face-recognition, face-detection
bob
Bob is a free signal-processing and machine learning toolbox originally developed by the Biometrics group at Idiap Research Institute, in Switzerland. - Mirrored from https://gitlab.idiap.ch/bob/bob
Stars: ✭ 38 (-19.15%)
Mutual labels:  face-recognition, face-detection
TD-OpenCV3TOP
Touchdesigner OpenCV3 C++ TOP for FaceDetect
Stars: ✭ 90 (+91.49%)
Mutual labels:  realtime, face-detection
Awesome Face recognition
papers about Face Detection; Face Alignment; Face Recognition && Face Identification && Face Verification && Face Representation; Face Reconstruction; Face Tracking; Face Super-Resolution && Face Deblurring; Face Generation && Face Synthesis; Face Transfer; Face Anti-Spoofing; Face Retrieval;
Stars: ✭ 3,220 (+6751.06%)
Mutual labels:  face-recognition, face-detection
Facepapercollection
A collection of face related papers
Stars: ✭ 241 (+412.77%)
Mutual labels:  face-recognition, face-detection
Facerecognition
Nextcloud app that implement a basic facial recognition system.
Stars: ✭ 226 (+380.85%)
Mutual labels:  face-recognition, face-detection
real-time-face-recognition
Real Time Face Recognition using FaceNet and OpenCV
Stars: ✭ 19 (-59.57%)
Mutual labels:  facenet, opencv-python
FaceIDLight
A lightweight face-recognition toolbox and pipeline based on tensorflow-lite
Stars: ✭ 17 (-63.83%)
Mutual labels:  face-recognition, face-detection
deep utils
An open-source toolkit which is full of handy functions, including the most used models and utilities for deep-learning practitioners!
Stars: ✭ 73 (+55.32%)
Mutual labels:  face-recognition, face-detection

HitCount Language grade: Python Maintainability Tests Build Status codecov

Facial Recognition System

This face recognition library is built with ease and customization in mind. There are numerous control parameters to control how you want to use the features, be it face detection, face recognition on videos, or with a webcam.
At its core, the facial recognition system uses Siamese Neural network. Over the years there have been different architectures published and implemented. The library uses dlib's face recognition model, which is inspired from ResNet-34 network. The modified ResNet-34 has 29 Convolutional layers. The model achieved 99.38% accuracy on LFW dataset.

There are 4 different face detectors for usage. Wrappers for video and webcam processing are provided for convenience.

Table of Contents

Sample Output

Processed Video


Processed Images

Architecture

architecture

For face recognition, flow is:

media -> frame -> face detection -> Facial ROI -> Neural Network -> 128D facial encoding 

These are the major components:

  1. Face Detection: There are 4 different face detectors with different cropping options.
  2. Face Recognition: Responsible for handling facial recognition related functionalities like registering facial data etc.
  3. Storage: The system provides abstract definitions of cache and persistent storage. For usage, a simple cache using python's native data structure is provided along side a persistent storage system with JSON. If needed the abstract classes can be extended to integrate better storage systems.
  4. Utilities: Methods for handling image, video operations, validations, etc.

Setup

There are multiple ways to set this up.

Clone the repo and install dependencies.

git clone https://github.com/susantabiswas/FaceRecog.git
pip install -r requirements.txt

Docker Image

You can pull the docker image for this project and run the code there.
docker pull susantabiswas/face_recog:latest

Dockerfile

You can build the docker image from the docker file present in the repo.

docker build -t <name> .

Project Structure

FaceRecog/
├── Dockerfile
├── README.md
├── data/
├── docs/
├── face_recog/
│   ├── exceptions.py
│   ├── face_data_store.py
│   ├── face_detection_dlib.py
│   ├── face_detection_mtcnn.py
│   ├── face_detection_opencv.py
│   ├── face_detector.py
│   ├── face_recognition.py
│   ├── in_memory_cache.py
│   ├── json_persistent_storage.py
│   ├── logger.py
│   ├── media_utils.py
│   ├── persistent_storage.py
│   ├── simple_cache.py
│   └── validators.py
├── models/
│   ├── dlib_face_recognition_resnet_model_v1.dat
│   ├── mmod_human_face_detector.dat
│   ├── opencv_face_detector.pbtxt
│   ├── opencv_face_detector_uint8.pb
│   └── shape_predictor_5_face_landmarks.dat
├── requirements.txt
├── tests/
│   ├── conftest.py
│   ├── test_face_data_store.py
│   ├── test_face_detection_dlib.py
│   ├── test_face_detection_mtcnn.py
│   ├── test_face_detection_opencv.py
│   ├── test_face_recognition.py
│   ├── test_json_persistent_storage.py
│   ├── test_media_utils.py
│   └── test_simple_cache.py
└── video_main.py

Usage

Face Recognition

Depending on the use case, whether to aim for accuracy and stability or speed etc., you can pick the face detector. Also, there are customization options inside face detectors to decide the facial ROI.

To register a face using a webcam

# Inside project root
import video_main

# You can pick a face detector depending on Acc/speed requirements
face_recognizer = FaceRecognitionVideo(face_detector='dlib')
face_recognizer.register_face_webcam(name="Susanta")

To register a face using an image on disk

# Inside project root
import video_main

face_recognizer = FaceRecognitionVideo(face_detector='dlib')
face_recognizer.register_face_path(img_path='data/sample/conan.jpg', name="Conan")

To register a face using a loaded image

# Inside project root
from face_recog.media_utils import load_image_path
from face_recog.face_recognition import FaceRecognition

face_recognizer = FaceRecognition(
                    model_loc="models",
                    persistent_data_loc="data/facial_data.json",
                    face_detector="dlib",
                )
img = load_image_path("data/sample/1.jpg")
# Matches is a list containing information about the matches
# for each of the faces in the image
matches = face_recognizer.register_face(image=img, name=name)

Face recognition with a webcam feed

# Inside project root
import video_main

face_recognizer = FaceRecognitionVideo(face_detector='dlib')
face_recognizer.recognize_face_video(video_path=None, \
                                    detection_interval=2, save_output=True, \
                                    preview=True, resize_scale=0.25)

Face recognition on a video

# Inside project root
import video_main

face_recognizer = FaceRecognitionVideo(face_detector='dlib')
face_recognizer.recognize_face_video(video_path='data/trimmed.mp4', \
                                    detection_interval=2, save_output=True, \
                                    preview=True, resize_scale=0.25)

Face recognition using an image

# Inside project root
from face_recog.media_utils import load_image_path
from face_recog.face_recognition import FaceRecognition

face_recognizer = FaceRecognition(
                    model_loc="models",
                    persistent_data_loc="data/facial_data.json",
                    face_detector="dlib",
                )
img = load_image_path("data/sample/1.jpg")
# Matches is a list containing information about the matches
# for each of the faces in the image
matches = face_recognizer.recognize_faces(
                image=img, threshold=0.6
            )

There are 4 face detectors namely dlib (HOG, MMOD), MTCNN, OpenCV (CNN). All the face detectors are based on a common abstract class and have a common detection interface detect_faces(image).

# import the face detector you want, it follows absolute imports
from face_recog.media_utils import load_image_path
from face_recog.face_detection_dlib import FaceDetectorDlib

face_detector = FaceDetectorDlib(model_type="hog")
# Load the image in RGB format
image = load_image_path("data/sample/1.jpg")
# Returns a list of bounding box coordinates
bboxes = face_detector.detect_faces(image)

References

The awesome work Davis E. King has done: http://dlib.net/cnn_face_detector.py.html, https://github.com/davisking/dlib-models
You can find more about MTCNN from here: https://github.com/ipazc/mtcnn

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].