This project aims to classify faces into different categories such as age, gender, and race, using the FairFace dataset. The model used is a MobileNet V3 Large pretrained on ImageNet dataset, and the last layer is modified and adapted to the current FairFace dataset.
To install the required packages, run the following command:
sh runthis.sh
To use the model for inference, run the following command:
python inference.py
This will load the checkpoint file and run inference on the test dataset. The results will be saved to a CSV file.
To use the model for training, run the following command:
python train.py
This will start the training process using the FairFace dataset. The training process will be logged to TensorBoard, and the best model will be saved to a checkpoint file.
The training process consists of the following steps:
- Load the FairFace dataset and create the dataloaders.
- Initialize the model and move it to the GPU.
- Define the loss function and optimizer.
- Train the model for a given number of epochs.
- Evaluate the model on the test dataset.
- Save the best model checkpoint.
The results of the training process can be viewed using TensorBoard. To start TensorBoard, run the following command:
tensorboard --logdir runs
Then open your web browser and go to http://localhost:6006.
This project is licensed under the MIT License - see the LICENSE file for details.
I would like to thank the FairFace team for making their dataset available, and the PyTorch team for making their library so easy to use. I would also like to thank my mentors and classmates for their feedback and support during the development of this project.