Skip to content

a keras implement of emotion classifier, train on FER2013 and FERPLUS datasets

Notifications You must be signed in to change notification settings

YouYouExcellent/keras_emotion_classify

Repository files navigation

keras_emotion_classify

a keras implement of emotion classifier.

联系作者

Test environment

  • python 3.7.3
  • keras 2.2.4
  • OpenCV 4.0.0
  • tensorflow 1.12.0
  • cuda 10.0.130
  • cudnn 7.5.1

DATASETs

FER2013 dataset

How to run?

  1. Download dataset FER2013.
  2. process dataset.
python prepare_data.py
  1. train your model.
python emotion_train.py --dataset data/fer2013 --checkpoint ckpt/CapsuleNet -b 128 --network CapsuleNet

Dataset summary

Results

all networks run 70 epochs.

Network optimizer learning rate acc val_acc
VGG16 adam 0.0001 89% 64%
VGG19 adam 0.0001 89% 64%
ResNet50 adam 0.0001 75% 50%
DenseNet121 adam 0.0001 91% 55%
DenseNet201 adam 0.0001 92% 55%
MobileNetV2 adam 0.0001 65% 47%
CapsuleNet adam 0.0001 95% 66%
CapsuleResNet adam 0.0001 88% 63%
DenseNet201 adam 0.002 88% 63%
CapsuleNet adam 0.0005 92% 65%
CapsuleResNet adam 0.0005 86% 64%
VGG16 sgd 0.01 93% 62%

FERPLUS dataset

How to run?

  1. Download dataset FERPlus.
git clone https://github.com/microsoft/FERPlus.git
  1. process dataset.
cd FERPlus/src
python generate_training_data.py -d /dst/dataset/path/ferplus -fer you/fer2013/dataset/path/fer2013.csv -ferplus ../fer2013new.csv
cd you/own/path/keras_emotion_classify
python prepare_ferplus_data.py --image /dst/dataset/path/ferplus --label FERPlus/data --dst final/dst/path
  1. train your model.
python emotion_train.py --dataset final/dst/path --checkpoint ckpt/CapsuleNet -b 128 --network CapsuleNet

Dataset summary

Results

all networks run 70 epochs.

Network optimizer learning rate acc val_acc
CapsuleNet adam 0.0001 96% 82%
VGG16 adam 0.0001 95% 81%

mAP

use CapsuleNet model

emotion angry disgust fear happy sad surprise neutral contempt
AP 65% 0.97% 26.4% 89.9% 25.4% 77.8% 74.9% 26.3%

mAP = 48.3%