mrpositron / face_emotion_detection

face detection and emotion classification using yolov3 tiny

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facial Emotion Detection and Recognition

Facial Emotion Detection and Recognition using YOLOv3 tiny architecture in PyTorch.

Note: I used colab to run python scripts with GPU

All files can be found here: https://drive.google.com/open?id=1Y6vVI9YfqX-7RebCCZy9xOHQB3yhaDZy
Test data: https://drive.google.com/drive/folders/1fQ2xkaZxEPY3ZNjcAE3zFLsegoCfolom
Test data with bounding boxes: https://drive.google.com/drive/folders/1fU2_YEWLFHmFbJKHzUzeg38TGal0LUJU
Training data: https://drive.google.com/drive/folders/1-L_OliRDtxtL_7qGjkGTK6_P4ZpraeTJ

Main functions and architectures were taken from https://github.com/eriklindernoren/PyTorch-YOLOv3

test.py, train.py and detect.py were simplified and decreased in the content from the github repo defined above and adapted to our task. Furthermore, slight changes in utils/datasets.py have been made. Data have been pre-processed to meet our requirements. You can find training data and its structure from the link above.

Run $sudo pip3 install -r requirements.txt
In order to meet all requirements

What each .py file do:

1)train.py -> trains the network.
2)test.py -> is used to do testing on a validation set.
3)detect.py -> is used to do predictions on a test set

How to train the network?

  1. First of all, please download all the files from the google drive by the first link on the top of the Readme
  2. Run $cd yolo_pytorch
  3. Run $python train.py [--epochs EPOCHS] [--batch_size BATCH_SIZE] [--model_def MODEL_DEF] [--data_config DATA_CONFIG]
  4. train.py will save weights in .pth file with the format "epoch_" + str(epoch) +".pth", there will also be .txt file with corresponding loss for each .pth file, in "epoch_" + str(epoch) + "_loss.txt" format

How to detect pictures in test set?

  1. As I mentioned above, please download all the files from the google drive by the first link on the top of the Readme
  2. Run $cd yolo_pytorch
  3. Run $python detect.py [--image_folder IMAGE_FOLDER] [--model_def MODEL_DEF] [--weights_path WEIGHTS_PATH] [--class_path CLASS_PATH] [--conf_thres CONF_THRES] [--nms_thres NMS_THRES] [--batch_size BATCH_SIZE] [--img_size IMG_SIZE]
    Note: in [--weights_path WEIGHTS_PATH], please write the recent path of recent .pth file. If not, network trained with 60 epochs (small.pth) will be used
  4. It will save picture with a bounding boxes in yolo_pytorch/data/outcome/

alt text
Face detection and emotion classification on an image from the test data

About

face detection and emotion classification using yolov3 tiny


Languages

Language:Python 100.0%