Spaces:
Runtime error
A newer version of the Gradio SDK is available:
5.33.0
title: Face Recognition
emoji: π
colorFrom: gray
colorTo: red
sdk: gradio
sdk_version: 3.16.2
app_file: app.py
pinned: false
license: mit
Face Recognition ML pipeline
This project is composed by three different components: feature pipeline, model retraining and inference pipeline. The pipeline diagram can be seen below.
Feature pipeline
This pipeline is hosted on a GCP (Google Cloud Platform) instance and performs the following tasks:
- Receive an image from the user (from a Gradio UI).
- Create multiple different versions of the images by applying filters, rotating it, brighten it, etc...
- For each of the resulting images, generate an embedding using the Histogram of Gradients (HOG) method
- Upload the original image and the embeddings to a GCP bucket.
- Trigger model retraining.
Model retraining
Once the training pipeline is called, the embeddings are taken from the bucket, and the training of the KNN classifier is performed. The model is then stored on the local device as our inference pipeline uses the same GCP instance to run the inference.
Inference pipeline
Our inference pipeline is in real-time, hence the Gradio UI shows the live webcam with all the predictions on each face. Note: This is not a very well trained model, and hence there would be several false positives.
Gradio public links:
Project structure
- The dataset is stored in
./dataset/<first name of the person>
. - The feature pipeline creates a 128d vector for each image in the dataset folder along with some augmentations. Once this is done, the encodings are stored in the file
./encodings.pkl
. - The training pipeline then makes use of the encoding file and trains a knn classifier and stores the model in the file
./model.pkl
. The training file also stores the labels (before using a label encoder) in the file 'labels.pkl'. - The inference pipeline makes use of all these files and runs the inference in the gradio UI.