Face recognition system using MTCNN, FACENET, SVM and FAST API to track participants of Big Brother Brasil in real time.

Overview

BBB Face Recognizer

Face recognition system using MTCNN, FACENET, SVM and FAST API to track participants of Big Brother Brasil in real time.

Cam frame visualization

Instalation

Install dependencies using requirements.txt

pip install -r requirements.txt

Usage

To use the project successfully, you need to follow the steps below.

1. Dataset

It is needed to build a dataset through the dataset_generator.py script.

This script builds a dataset with train and validation directories according by user labeling, using real time cam frames from reality show.

On execute will be created a directory on src folder with the following structure:

dataset
└── train
    └── label1
    └── label2
    └── label3
    └── ...
└── val
    └── label1
    └── label2
    └── label3
    └── ...

And you will be able to populate the train dataset.

If you want populate validation dataset use "-val" as first command line argument.

As the screenshot below, insert the label number that matches with shown face and repeat this process until you have enough data.

Dataset Labeling

For each label input, the .jpg image will be auto stored on respective dataset.

If you don't recognize the shown face, just leave blank input to skip.

2. Model

Now is needed to generate a model through the model_generator.py script.

Upon successful execution, the accuracy and confusion matrix of train and validation will be presented, and a directory will be created in the src folder with the following structure:

model_files
└── label_encoder.joblib
└── metrics.txt
└── model.joblib

This joblib files will be loaded by face_predictor.py to use generated model.

3. API

Lastly the API can be started.

For development purpose run the live server with commands below.

cd src
uvicorn api:app --reload

Upon successful run, access in your browser http://127.0.0.1:8000/cams to get a json response with list of cams with recognized faces, like presented below.

[
  {
    "name": "BBB 22 - Câmera 1",
    "location": "Acompanhe a Casa",
    "snapshot_link": "https://live-thumbs.video.globo.com/bbb01/snapshot/",
    "slug": "bbb-22-camera-1",
    "media_id": "244881",
    "stream_link": "https://globoplay.globo.com/bbb-22-camera-1/ao-vivo/244881/?category=bbb",
    "recognized_faces": [
      {
        "label": "arthur",
        "probability": 64.19885945991763,
        "coordinates": {
          "topLeft": [
            118,
            45
          ],
          "bottomRight": [
            240,
            199
          ]
        }
      },
      {
        "label": "eliezer",
        "probability": 39.81395352766756,
        "coordinates": {
          "topLeft": [
            380,
            53
          ],
          "bottomRight": [
            460,
            152
          ]
        }
      },
      {
        "label": "scooby",
        "probability": 37.971779438946054,
        "coordinates": {
          "topLeft": [
            195,
            83
          ],
          "bottomRight": [
            404,
            358
          ]
        }
      }
    ],
    "scrape_timestamp": "2022-03-01T22:24:41.989674",
    "frame_timestamp": "2022-03-01T22:24:42.307244"
  },
  ...
]

To see all provided routes access the documentation auto generated by FAST API with Swagger UI.

For more details access FAST API documentation.

If you want to visualize the frame and face recognition on real time, set VISUALIZATION_ENABLED to True in the api.py file (use only for development), for each cam frame will be apresented like the first screenshot.

TO DO

  • cam_scraper.py: upgrade scrape_cam_frame() to get a high definition cam frame.
  • api.py: return cam list by label based on probability
  • api.py: use a database to store historical data
  • face_predictor.py: predict emotions
You might also like...
Jetson Nano-based smart camera system that measures crowd face mask usage in real-time.
Jetson Nano-based smart camera system that measures crowd face mask usage in real-time.

MaskCam MaskCam is a prototype reference design for a Jetson Nano-based smart camera system that measures crowd face mask usage in real-time, with all

Face-Recognition-based-Attendance-System - An implementation of Attendance System in python.

Face-Recognition-based-Attendance-System A real time implementation of Attendance System in python. Pre-requisites To understand the implentation of F

Object tracking and object detection is applied to track golf puts in real time and display stats/games.

Putting_Game Object tracking and object detection is applied to track golf puts in real time and display stats/games. Works best with the Perfect Prac

A large-scale face dataset for face parsing, recognition, generation and editing.
A large-scale face dataset for face parsing, recognition, generation and editing.

CelebAMask-HQ [Paper] [Demo] CelebAMask-HQ is a large-scale face image dataset that has 30,000 high-resolution face images selected from the CelebA da

DVG-Face: Dual Variational Generation for Heterogeneous Face Recognition, TPAMI 2021

DVG-Face: Dual Variational Generation for HFR This repo is a PyTorch implementation of DVG-Face: Dual Variational Generation for Heterogeneous Face Re

OpenPose: Real-time multi-person keypoint detection library for body, face, hands, and foot estimation
OpenPose: Real-time multi-person keypoint detection library for body, face, hands, and foot estimation

Build Type Linux MacOS Windows Build Status OpenPose has represented the first real-time multi-person system to jointly detect human body, hand, facia

A real-time speech emotion recognition application using Scikit-learn and gradio
A real-time speech emotion recognition application using Scikit-learn and gradio

Speech-Emotion-Recognition-App A real-time speech emotion recognition application using Scikit-learn and gradio. Requirements librosa==0.6.3 numpy sou

A real-time motion capture system that estimates poses and global translations using only 6 inertial measurement units
A real-time motion capture system that estimates poses and global translations using only 6 inertial measurement units

TransPose Code for our SIGGRAPH 2021 paper "TransPose: Real-time 3D Human Translation and Pose Estimation with Six Inertial Sensors". This repository

Face Recognition plus identification simply and fast | Python
Face Recognition plus identification simply and fast | Python

PyFaceDetection Face Recognition plus identification simply and fast Ubuntu Setup sudo pip3 install numpy sudo pip3 install cmake sudo pip3 install dl

Owner
Rafael Azevedo
Computer Engineering student at State University of Feira de Santana. Software developer at Globo.
Rafael Azevedo
BigbrotherBENL - Face recognition on the Big Brother episodes in Belgium and the Netherlands.

BigbrotherBENL - Face recognition on the Big Brother episodes in Belgium and the Netherlands. Keeping statistics of whom are most visible and recognisable in the series and wether or not it has an impact on who wins.

Frederik 2 Jan 4, 2022
Pretrained Pytorch face detection (MTCNN) and recognition (InceptionResnet) models

Face Recognition Using Pytorch Python 3.7 3.6 3.5 Status This is a repository for Inception Resnet (V1) models in pytorch, pretrained on VGGFace2 and

Tim Esler 3.3k Jan 4, 2023
Face-Recognition-Attendence-System - This face recognition Attendence system using Python

Face-Recognition-Attendence-System I have developed this face recognition Attend

Riya Gupta 4 May 10, 2022
Face Detection and Alignment using Multi-task Cascaded Convolutional Networks (MTCNN)

Face-Detection-with-MTCNN Face detection is a computer vision problem that involves finding faces in photos. It is a trivial problem for humans to sol

Chetan Hirapara 3 Oct 7, 2022
Real-Time-Student-Attendence-System - Real Time Student Attendence System

Real-Time-Student-Attendence-System The Student Attendance Management System Pro

Rounak Das 1 Feb 15, 2022
Face Library is an open source package for accurate and real-time face detection and recognition

Face Library Face Library is an open source package for accurate and real-time face detection and recognition. The package is built over OpenCV and us

null 52 Nov 9, 2022
ThunderSVM: A Fast SVM Library on GPUs and CPUs

What's new We have recently released ThunderGBM, a fast GBDT and Random Forest library on GPUs. add scikit-learn interface, see here Overview The miss

Xtra Computing Group 1.4k Dec 22, 2022
face_recognization (FaceNet) + TFHE (HNP) + hand_face_detection (Mediapipe)

SuperControlSystem Face_Recognization (FaceNet) 面部识别 (FaceNet) Fully Homomorphic Encryption over the Torus (HNP) 环面全同态加密 (TFHE) Hand_Face_Detection (M

liziyu0104 2 Dec 30, 2021
Patient-Survival - Using Python, I developed a Machine Learning model using classification techniques such as Random Forest and SVM classifiers to predict a patient's survival status that have undergone breast cancer surgery.

Patient-Survival - Using Python, I developed a Machine Learning model using classification techniques such as Random Forest and SVM classifiers to predict a patient's survival status that have undergone breast cancer surgery.

Nafis Ahmed 1 Dec 28, 2021