Ethnicity Classifier
This project aims to use FastAI models trained on Face Data dataset to perform facial recognition and classification tasks. The goal is to leverage the capabilities of FastAI to accurately identify and categorize faces(also gender and age).
Architecture
Built with
The project leverages a variety of technologies and tools to achieve its goals. The main components of the tech stack include:
FastAI:
- FastAI is used for building and training the deep learning models. It provides high-level abstractions for common deep learning tasks, making it easier to implement state-of-the-art models with minimal code.
Flask:
- Flask is used to serve the trained model as a web application. It provides a lightweight and flexible framework for building web APIs and serving static files.
Svelte:
- Svelte is used for building the front-end of the web application. It is a modern JavaScript framework that compiles components into highly efficient imperative code, providing a fast and responsive user interface.
Jupyter Notebooks:
- Jupyter Notebooks are used for experimentation and prototyping. They allow for interactive development and visualization of results, making it easier to iterate on model improvements.
Dataset
The dataset utilized for model training and evaluation is Fairface.
A Multi-Task Cascaded Convolutional Network (MTCNN) was used to detect and crop faces from images. The models were exclusively trained on facial data.
FastAI Architecture
Model V1
- Architecture: ResNet34
- Training:
- Fine-tuning for 10 epochs with a base learning rate of 1e-3.
- Metrics:
accuracy_multi
- Model saved as
fairface_v1.pkl
and fairface_v1.pth
.
Model V2
- Architecture: ResNet34
- Training:
- Fine-tuning for 10 epochs with a base learning rate of 1e-3.
- First 3 epochs with frozen layers.
- Metrics:
partial(accuracy_multi, thresh=0.5)
- Model saved as
fairface_v2.pkl
and fairface_v2.pth
.
Model V3
- Architecture: ResNet50
- Training:
- Fine-tuning for 12 epochs with a base learning rate of 1e-3.
- Callbacks:
SaveModelCallback
, EarlyStoppingCallback
, ReduceLROnPlateau
- Metrics:
partial(accuracy_multi, thresh=0.5)
- Model saved as
fairface_v3.pkl
and fairface_v3.pth
.
Screenshots