This is a Python program that detects faces in images/webcam live feed through haarcascade and recognizes emotion using Convolutional Neural Network.
- Install required libraries via pip
pip install -r requirements.txt
- Download syrex.weights file and put it into
EmotionRecognition/weights/folder
# emotion recognition on images
python3 detect.py \
--image=data/test.jpg \
--labels=data/data.labels \
--model=cfg/syrex.json \
--weights=weights/syrex.weights
# emotion recognition on live feed from webcam
python3 detect_realtime.py \
--labels=data/data.labels \
--model=cfg/syrex.json \
--weights=weights/syrex.weights- Prepare your data
- Put your images to the
EmotionRecognition/data/train/images/folder - Put your labels to the
EmotionRecognition/data/train/labels/folder
- Put your images to the
- In order to create csv file needed for training run:
# from EmotionRecognition/scripts/ python3 image2pixels.py \ --image_folder=data/train/images \ --label_folder=data/train/labels \ --output=data/train.csv \ --labels_decode=data/data.labels - Set train parameters in
EmotionRecognition/cfg/train.cfgfile - Run training:
python3 train.py \ --data=data/train.csv \ --weights_folder=weights/
