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
Owner
Rafael Azevedo
Computer Engineering student at State University of Feira de Santana. Software developer at Globo.
Rafael Azevedo
Python scripts for performing lane detection using the LSTR model in ONNX

ONNX LSTR Lane Detection Python scripts for performing lane detection using the Lane Shape Prediction with Transformers (LSTR) model in ONNX. Requirem

Ibai Gorordo 29 Aug 30, 2022
ToFFi - Toolbox for Frequency-based Fingerprinting of Brain Signals

ToFFi Toolbox This repository contains "before peer review" version of the software related to the preprint of the publication ToFFi - Toolbox for Fre

4 Aug 31, 2022
ReGAN: Sequence GAN using RE[INFORCE|LAX|BAR] based PG estimators

Sequence Generation with GANs trained by Gradient Estimation Requirements: PyTorch v0.3 Python 3.6 CUDA 9.1 (For GPU) Origin The idea is from paper Se

40 Nov 03, 2022
[NeurIPS 2021] Deceive D: Adaptive Pseudo Augmentation for GAN Training with Limited Data

Near-Duplicate Video Retrieval with Deep Metric Learning This repository contains the Tensorflow implementation of the paper Near-Duplicate Video Retr

Liming Jiang 238 Nov 25, 2022
An implementation for Neural Architecture Search with Random Labels (CVPR 2021 poster) on Pytorch.

Neural Architecture Search with Random Labels(RLNAS) Introduction This project provides an implementation for Neural Architecture Search with Random L

18 Nov 08, 2022
Semantic Segmentation of images using PixelLib with help of Pascalvoc dataset trained with Deeplabv3+ framework.

CARscan- Approach 1 - Segmentation of images by detecting contours. It failed because in images with elements along with cars were also getting detect

Padmanabha Banerjee 5 Jul 29, 2021
Asterisk is a framework to generate high-quality training datasets at scale

Asterisk is a framework to generate high-quality training datasets at scale

Mona Nashaat 44 Apr 25, 2022
Action Recognition for Self-Driving Cars

Action Recognition for Self-Driving Cars This repo contains the codes for the 2021 Fall semester project "Action Recognition for Self-Driving Cars" at

VITA lab at EPFL 3 Apr 07, 2022
A simple log parser and summariser for IIS web server logs

IISLogFileParser A basic parser tool for IIS Logs which summarises findings from the log file. Inspired by the Gist https://gist.github.com/wh13371/e7

2 Mar 26, 2022
Hyperparameter Optimization for TensorFlow, Keras and PyTorch

Hyperparameter Optimization for Keras Talos • Key Features • Examples • Install • Support • Docs • Issues • License • Download Talos radically changes

Autonomio 1.6k Dec 15, 2022
Implementation of "Debiasing Item-to-Item Recommendations With Small Annotated Datasets" (RecSys '20)

Debiasing Item-to-Item Recommendations With Small Annotated Datasets This is the code for our RecSys '20 paper. Other materials can be found here: Ful

Microsoft 34 Aug 10, 2022
Fast RFC3339 compliant Python date-time library

udatetime: Fast RFC3339 compliant date-time library Handling date-times is a painful act because of the sheer endless amount of formats used by people

Simon Pirschel 235 Oct 25, 2022
Python script for performing depth completion from sparse depth and rgb images using the msg_chn_wacv20. model in ONNX

ONNX msg_chn_wacv20 depth completion Python script for performing depth completion from sparse depth and rgb images using the msg_chn_wacv20 model in

Ibai Gorordo 19 Oct 22, 2022
Official PyTorch Implementation for "Recurrent Video Deblurring with Blur-Invariant Motion Estimation and Pixel Volumes"

PVDNet: Recurrent Video Deblurring with Blur-Invariant Motion Estimation and Pixel Volumes This repository contains the official PyTorch implementatio

Junyong Lee 98 Nov 06, 2022
Unsupervised Attributed Multiplex Network Embedding (AAAI 2020)

Unsupervised Attributed Multiplex Network Embedding (DMGI) Overview Nodes in a multiplex network are connected by multiple types of relations. However

Chanyoung Park 114 Dec 06, 2022
FANet - Real-time Semantic Segmentation with Fast Attention

FANet Real-time Semantic Segmentation with Fast Attention Ping Hu, Federico Perazzi, Fabian Caba Heilbron, Oliver Wang, Zhe Lin, Kate Saenko , Stan Sc

Ping Hu 42 Nov 30, 2022
RepVGG: Making VGG-style ConvNets Great Again

RepVGG: Making VGG-style ConvNets Great Again (PyTorch) This is a super simple ConvNet architecture that achieves over 80% top-1 accuracy on ImageNet

2.8k Jan 04, 2023
Structured Edge Detection Toolbox

################################################################### # # # Structure

Piotr Dollar 779 Jan 02, 2023
[CVPR 2021] Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

[CVPR 2021] Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

Fudan Zhang Vision Group 897 Jan 05, 2023
Deploy optimized transformer based models on Nvidia Triton server

Deploy optimized transformer based models on Nvidia Triton server

Lefebvre Sarrut Services 1.2k Jan 05, 2023