This is a simple face recognition mini project that was completed by a team of 3 members in 1 week's time

Overview

PeekingDuckling

1. Description

This is an implementation of facial identification algorithm to detect and identify the faces of the 3 team members Clarence, Eric Lee and Eric Kwok from other detected faces (Others).

We will be using the PeekingDuck framework for this mini project.

1.1 Example

Face recognition example

2. Usage

2.1 Running the PeekingDuck nodes directly

python -m src.runner
usage: runner.py [-h] [--type {live_video,recorded_video,live_video_and_save}] [--input_filepath INPUT_FILEPATH] [--input_source INPUT_SOURCE] [--save_video_path SAVE_VIDEO_PATH] [--fps FPS]

Facial Recoginition algorithm

optional arguments:
  -h, --help            show this help message and exit
  --type {live_video,recorded_video,live_video_and_save}
                        Whether to use live webcam video or from a recorded video, or from a live webcam video and saving the recorded frames as a video file.
  --input_filepath INPUT_FILEPATH
                        The path to your video files if --type is 'recorded_video'
  --input_source INPUT_SOURCE
                        Input source integer value. Refer to cv2 VideoCapture class. Applicable for --type ['live_video' | 'live_video_and_save']
  --save_video_path SAVE_VIDEO_PATH
                        Path for video to be saved. Applicable for --type 'live_video_and_save'
  --fps FPS             Frames per second for video to be saved. Applicable for --type 'live_video_and_save'

2.2 Using the PeekingDuck from the web interface

python -m src.camera

2.3 Face recognition using only 1 photo

python -m src.app

On a separate terminal, issue the following command

python -m src.python_client <path_to_your_image>

3. Model

3.1 Face Detection

In this repository, we will be using the the library from PeekingDuck to perform facial detection.

For the face detection, the MTCNN pretrained model from the PeekingDuck's framework was being implemented.

3.2 Face Identification

For face identification, cropped images (224 x 224) obtained from Face detection stage is passed to the pretrained RESNET50 model (trained on VGGFace2 dataset) with a global average pooling layer to obtain the Face Embedding. The face embedding is then used to compare to the database of face embeddings obtained from the members to verify if the detected face belongs to one of the 3 members.
Face classification Comparison of the face embedding is done using a 1-NN model, and a threshold is set using cosine similarity, below which the image will be classified as 'others'

The face embeddings were built using 651 images from Clarence, 644 images from Eric Kwok and 939 images from Eric Lee.

A low dimensional representation of the face embedding database of the 3 members using the first 2 principal components from the PCA of the face embeddings can be found in the image below.
PCA of members' face embeddings

Augmentation to have the 4 extra images per image using random rotations of (+/-) 20 degrees and random contrasting were used in building the database so that it can be more robust. The PCA of the augmented database can be seen in the image below
PCA of members' face embeddings with augmentation

4. Performance

The facial classification algorithm was able to achieve an overall accuracy of 99.4% and a weighted F1 score of 99.4% with 183 test images from Clarence, 179 from Eric Kwok, 130 from Eric Lee and 13,100 images from non-members obtained from this database.

Below shows the confusion matrix from the test result.
confusion matrix of test result.

The test was conducted with the tuned threshold on the validation dataset, and the performance of the model with various thresholds can be seen in the graph below. The threshold that yields the best performance is around 0.342.
Performance vs various thresholds

5. Authors and Acknowledgements

The authors would like to thank the mentor Lee Ping for providing us with the technical suggestions as well as the inputs on the implementation of this project.

Authors:

References (Non exhausive)

Owner
Eric Kwok
I am currently an AI apprentice at AISG and my main focus is in the area of CV. I also have an interest and some experience in the field of robotics.
Eric Kwok
Official PyTorch implementation of "Uncertainty-Based Offline Reinforcement Learning with Diversified Q-Ensemble" (NeurIPS'21)

Uncertainty-Based Offline Reinforcement Learning with Diversified Q-Ensemble This is the code for reproducing the results of the paper Uncertainty-Bas

43 Nov 23, 2022
Evidential Softmax for Sparse Multimodal Distributions in Deep Generative Models

Evidential Softmax for Sparse Multimodal Distributions in Deep Generative Models Abstract Many applications of generative models rely on the marginali

Stanford Intelligent Systems Laboratory 9 Jun 06, 2022
Deeplab-resnet-101 in Pytorch with Jaccard loss

Deeplab-resnet-101 Pytorch with Lovász hinge loss Train deeplab-resnet-101 with binary Jaccard loss surrogate, the Lovász hinge, as described in http:

Maxim Berman 95 Apr 15, 2022
This code is an implementation for Singing TTS.

MLP Singer This code is an implementation for Singing TTS. The algorithm is based on the following papers: Tae, J., Kim, H., & Lee, Y. (2021). MLP Sin

Heejo You 22 Dec 23, 2022
UniLM AI - Large-scale Self-supervised Pre-training across Tasks, Languages, and Modalities

Pre-trained (foundation) models across tasks (understanding, generation and translation), languages (100+ languages), and modalities (language, image, audio, vision + language, audio + language, etc.

Microsoft 7.6k Jan 01, 2023
Pytorch implementation of XRD spectral identification from COD database

XRDidentifier Pytorch implementation of XRD spectral identification from COD database. Details will be explained in the paper to be submitted to NeurI

Masaki Adachi 4 Jan 07, 2023
Контрольная работа по математическим методам машинного обучения

ML-MathMethods-Test Контрольная работа по математическим методам машинного обучения. Вычисление основных статистик, диаграмм и графиков, проверка разл

Stas Ivanovskii 1 Jan 06, 2022
Implementation of 'lightweight' GAN, proposed in ICLR 2021, in Pytorch. High resolution image generations that can be trained within a day or two

512x512 flowers after 12 hours of training, 1 gpu 256x256 flowers after 12 hours of training, 1 gpu Pizza 'Lightweight' GAN Implementation of 'lightwe

Phil Wang 1.5k Jan 02, 2023
RGB-D Local Implicit Function for Depth Completion of Transparent Objects

RGB-D Local Implicit Function for Depth Completion of Transparent Objects [Project Page] [Paper] Overview This repository maintains the official imple

NVIDIA Research Projects 43 Dec 12, 2022
Hyperbolic Hierarchical Clustering.

Hyperbolic Hierarchical Clustering (HypHC) This code is the official PyTorch implementation of the NeurIPS 2020 paper: From Trees to Continuous Embedd

HazyResearch 154 Dec 15, 2022
PyTorch implementation of neural style transfer algorithm

neural-style-pt This is a PyTorch implementation of the paper A Neural Algorithm of Artistic Style by Leon A. Gatys, Alexander S. Ecker, and Matthias

770 Jan 02, 2023
A simple library that implements CLIP guided loss in PyTorch.

pytorch_clip_guided_loss: Pytorch implementation of the CLIP guided loss for Text-To-Image, Image-To-Image, or Image-To-Text generation. A simple libr

Sergei Belousov 74 Dec 26, 2022
FCAF3D: Fully Convolutional Anchor-Free 3D Object Detection

FCAF3D: Fully Convolutional Anchor-Free 3D Object Detection This repository contains an implementation of FCAF3D, a 3D object detection method introdu

SamsungLabs 153 Dec 29, 2022
Dynamic Multi-scale Filters for Semantic Segmentation (DMNet ICCV'2019)

Dynamic Multi-scale Filters for Semantic Segmentation (DMNet ICCV'2019) Introduction Official implementation of Dynamic Multi-scale Filters for Semant

23 Oct 21, 2022
StyleSwin: Transformer-based GAN for High-resolution Image Generation

StyleSwin This repo is the official implementation of "StyleSwin: Transformer-based GAN for High-resolution Image Generation". By Bowen Zhang, Shuyang

Microsoft 349 Dec 28, 2022
Instance-Dependent Partial Label Learning

Instance-Dependent Partial Label Learning Installation pip install -r requirements.txt Run the Demo benchmark-random mnist python -u main.py --gpu 0 -

17 Dec 29, 2022
Code for "Optimizing risk-based breast cancer screening policies with reinforcement learning"

Tempo: Optimizing risk-based breast cancer screening policies with reinforcement learning Introduction This repository was used to develop Tempo, as d

Adam Yala 12 Oct 11, 2022
PINN Burgers - 1D Burgers equation simulated by PINN

PINN(s): Physics-Informed Neural Network(s) for Burgers equation This is an impl

ShotaDEGUCHI 1 Feb 12, 2022
Nicholas Lee 3 Jan 09, 2022
Code and datasets for the paper "Combining Events and Frames using Recurrent Asynchronous Multimodal Networks for Monocular Depth Prediction" (RA-L, 2021)

Combining Events and Frames using Recurrent Asynchronous Multimodal Networks for Monocular Depth Prediction This is the code for the paper Combining E

Robotics and Perception Group 69 Dec 26, 2022