Since git LFS wasn't used huge files weren't provided along with this repository. Thus follow these steps to access all the functionality provided with this repository.
-
Clone this repository to you local system.
-
The dataset provided by the HumAIn team is in
JSON
format. The same can be found in thedatasets
dir. I have added a parent key nameddata
so to the provided data. If you have a test dataset inJSON
and want to use the same for evaluation make sure to add this parent key. -
To download images open
command prompt
orterminal
in the root of the cloned repository.python data_download.py -d datasets/Face_Recognition.json
-
To create a cleaner
json
file with annotations.python data_download.py -d datasets/Face_Recognition.json -n True
Download my trained model weight files
from here. The files should be in this relative path: face_detector\weights
-
In order to train my model for Age, Gender and Ethnicity prediction, I have used UTKFace dataset along side the data provided.
-
In order to train my model for Emotion prediction I have used the dataset from this Kaggle competition.
You can run
prepareUTKFaceData.py
(Optional)python prepareUTKFaceData.py -d path_to_downloaded_UTKFace_dataset
This will create a
face_dataset.csv
dataset along with a directory in the root namedUTKFaceimages
. Theface_dataset.csv
containsimage_id, age, gender, ethnicity
as input image name along with class label. TheUTKFaceimages
directory contain images withimage_id
. This renaming of file is done as a part of data preprocessing which makes it easier while preparing data for training.
Go to the root of this repository and open command prompt or in your terminal run main.py
script. You need to specify the path to the test image.
python main.py -i examples/example1.jpeg
If you want to see the bounding box detected you can run this.
python main.py -i examples/example1.jpeg -b True
This will do the following:
- Will import all the packages.
- Will build the model and load weights. This may take some time in the first time.
- With the given input image run the inference through Face Detector. This will output bounding boxes of the detected faces.
- It will use this output and crop the faces from the input image which will be the input to three parallel detectors.
- The result of the detector will be printed on the terminal.
You can find few other example images to test with.