This repository contains an implementation of the distillation method mentioned in this paper. Using the code from this repository, you can train a lightweight network to recognize faces for embedded devices.
- Download dataset from here.
- Extract images using this.
- Get the labels for each image and create annotations.csv using: create_annotation.ipynb
- Or get download dataset from here to skip above 2 steps.
- Create a folder in home directory by the name of CASIA_dataset
- Save the Images Folder and annotations.csv in it
Create folder for saving model:
mkdir output_logs
Start training using:
python3 train.py
Flag | Default Value | Description |
---|---|---|
batchsize | 8 | batch size |
epochs | 10 | number of epochs to train |
lr | 0.001 | learning rate |
lmda | 0.25 | lambda |
device | cpu | device using (eg. cuda , mps) |
save-dir | output_logs | folder to save model |
workers | 0 | number of workers |
Evaluate using:
python3 eval.py
Flag | Default Value | Description |
---|---|---|
batchsize | 8 | batch size |
device | cpu | device using (eg. cuda , mps) |
workers | 0 | number of workers |
test-size | 0.1 | size of dataset for evaluation |
model-path | None (required) | path of model for evaluation |
Trained for 30 epochs
Evaluated on 50k random samples
Lambda | 0 | 0.25 | 0.75 |
---|---|---|---|
Accuracy | 98.87% | 98.95% | 99.08% |
Paramshivay, Supercomputer of IIT BHU (Varanasi) was used for training of this model.
Install miniconda locally for more reliable experience and easy package managing.
Download Miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Install Miniconda
bash Miniconda3-latest-Linux-x86_64.sh
Activate Miniconda
source miniconda3/bin/activate
To get a node with 1 gpu and 20 cores for 1 hour for running the code live.
(Interactive session will over as soon as time is over or your terminal is disconnected from HPC and execution will be interupted.)
srun --partition=gpu --nodes=1 --gres=gpu:1 --time=01:00:00 --ntasks-per-node=20 --pty bash -i
Submit the Job to SLURM for completion.
(No need to be connected to HPC for file to keep executing)
sbatch script.sh