Git Product home page Git Product logo

dacl's Introduction

DACL: Facial Expression Recognition in the Wild via Deep Attentive Center Loss

PyTorch training code and pretrained models for DACL (Deep Attentive Center Loss). We propose an attention network to adaptively select a subset of significant feature elements for enhanced facial expression discrimination. The attention network estimates attention weights across all feature dimensions to accommodate the sparse formulation of center loss to selectively achieve intra-class compactness and inter-class separation for the relevant information in the embedding space.

PWC

DACL DACL is highly customizable and can be adapted to other problems in computer vision. For more details see Facial Expression Recognition in the Wild via Deep Attentive Center Loss by Amir Hossein Farzaneh and Xiaojun Qi (WACV2021).

Model Zoo

We provide the trained DACL model and other baseline models with softmax loss and center loss in the future.

method backbone affectnet acc. rafdb acc. url | logs size
0 DACL resnet18 65.20 % 87.78 % soon NA
1 center loss resnet18 64.09 % 87.06 % soon NA
2 softmax loss resnet18 63.86 % 86.54 % soon NA

Usage

  1. Install the required dependencies:
- torch == 1.5+
- torchvision == 0.6+
- scikit-learn
- tqdm
  1. Download ms-celeb pretrained model for weight initialization: Google Drive
  2. clone this repository:
git clone https://github.com/amirhfarzaneh/dacl

Data preparation

  1. Download either affectnet or rafdb dataset and prepare the dataset folder structure as follows:
path/to/fer/dataset/
  train/  # directory containing training images
        00/ # subdirectory containing images from class 0 (neutral)
        01/ # subdirectory containing images from class 1 (happy)
        02/ # subdirectory containing images from class 2 (sad)
        ...
        06/ # subdirectory containing images from class 6 (disgust)
  valid/  # directory containing validation images
        00/ # subdirectory containing images from class 0 (neutral)
        01/ # subdirectory containing images from class 1 (happy)
        02/ # subdirectory containing images from class 2 (sad)
        ...
        06/ # subdirectory containing images from class 6 (disgust)
  1. modify the dataset root_dir in workspace.py at line 14

Training

To train DACL initialized with msceleb weights on a single GPU for 10 epochs run:

python main.py --arch=resnet18 --lr=[LR] --wd=[WD] --bs=[BATCH-SIZE] --epochs=10 --alpha=[ALPHA] --lamb=[LAMBDA]

Citation

If you use this code in your project or research, please cite using the following bibtex:

@InProceedings{Farzaneh_2021_WACV,
    author    = {Farzaneh, Amir Hossein and Qi, Xiaojun},
    title     = {Facial Expression Recognition in the Wild via Deep Attentive Center Loss},
    booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
    month     = {January},
    year      = {2021},
    pages     = {2402-2411}
}

dacl's People

Contributors

amirhfarzaneh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.