The repo for 2021 Fall CS269 Final Project: Learning Face Emotions with Deformable Model.
- Group Member: Yu Hou, Xueer Li, Zongnan Bao, Xiaoyang Yu, Felix Zhang
- FER2013
- 48x48
- large
- 28709 training images
- 3589 validation images
- 7 labels
- FER_CK_PLUS
- 48x48
- large
- 8 labels, ignoring
contemptsince it's not in FER2013 - The rest:
anger,disgust,fear,happiness,sadness,surprise,neutrality - cleaned version of FER2013, plus CK+ images and a dataset called kdef?
- higher quality than FER2013
- CK_PLUS
- 256x256
- small
- 297 training images
- 32 validation images
- 7 labels:
anger,disgust,fear,happiness,sadness,surprise,neutrality - unstable validation metrics since validations set is fairly small :(
- achieves highest accuracy (easist to train?)
- NOTE: be sure to add
-resize 224if you want to use CK_PLUS(256x256) on models that expect 224 input, another option is to add-rcrop_size 224
- Deep_Emotion
- have both 224x224-input version and 48x48-input version.
- if choosing 224x224 as input, large portion of parameters will be in fc layers.
- added BatchNorm after every Conv/FC compared to original deep emotion.
- Deep_Emotion224
- dedicated for 224x224 input.
- added/re-ordered layers, so that parameters are more evenly spread between Conv and FC layer.
- No significant performance boost.
- VGG
- really big model, might overfit.
- need to experiment more on this type of network
- Simple_CNN
- 3 Conv layers + 2 FC layers
- simple network to test avoid overfitting
- Deformable Convolution Layers
- Can be enabled by setting
-dcor--de_conv - Improves
val accby roughly 3%~4%. - Theoretically improves localization ability of the model.
- Can be enabled by setting
- Wider Deep Emotion
- Can be enabled by setting
-wideor--wide - Original deep emotion has
channel=10for Conv layers, enabling this changeschannel=64, have bigger model capacity.
- Can be enabled by setting
- Dropout Layer
- By default there's 1 dropout layer after 1st fc layer.
- Can add 1 extra by setting
-n_drop 2, will be after 2nd(final) fc layer - All dropout rates are controlled by
-drop X, X in [0, 1], 0=no dropout
- Learning Rate Scheduler
- Can be enabled by setting
-lrsc - Uses PyTorch's
ReduceLROnPlateau() - With
patience=20andmin_lr=1e-7
- Can be enabled by setting
- Weight Decay
- Can be enabled by setting
-wd Xor--weight_decay X - X default =
1e-4 - L2 Regularization, reduce overfitting.
- Can be enabled by setting
- Data Augmentations
RandomHorizontalFlip(0.5)- Can be enabled by setting
-hflip
- Can be enabled by setting
RandomCrop(X)- Can be enabled by setting
-rcrop, X can be set by-rcrop_size X - X => int, Cropped to size (X,X)
- Can be enabled by setting
RandomColorJitter(X,Y,Z)- Can be enabled by setting
-rjitter - X in [0,1], jittering brightness, can be set by
-rjitter_b X
- Can be enabled by setting
- Data Processing
Resize- Can be set by
-resize X - Both training and validation images will be resized to (X, X)
- Can be set by
-dspecifies the directory stored specific dataset, likefer2013/,fer_ckplus_kef/andCK_PLUS/. I put all those data under./data/, so-d data/CK_PLUSif we want to useCK_PLUS.-ds, acutually a little bit redundant? specifies which dataset we want to use, astr, can only be one of {FER2013,FER_CKPLUS,CK_PLUS}-mspecifies model we want to use, can only be one of {de,de224,vgg,simple}- Example: if want to run on dataset
CK_PLUSusingDeep Emotionwith some tricks added, we can:
python train.py -d data/CK_PLUS -ds CK_PLUS -m de -dc -wide -n_drop 2 -drop 0.4 -rcrop -rcrop_size 224 -hflip -resize 48
- all DL model classes are under models/
- all custom dataset classes are under datasets/
- data can be put into data/
- some utils used for training are put under utils/
Link to experiments I've done: https://ppnk.notion.site/CS269-Final-Project-Experiments-1e0e15bde4134825b58f0ec8257bd1bd
- Find out a suitbale/best performance network.
- Investigate more on STN part in deep emotion.
- Combine Deformable Model (contours/landmark) to boost DL model performance.
- Data Augmentation part of parser are a little redundant, especially
-rcropand-rcrop_size, only need one.