Giter Site home page Giter Site logo

xiaohoua / apvit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youqingxiaozhua/apvit

0.0 0.0 0.0 739 KB

PaddlePaddle and PyTorch implementation of APViT and TransFER

License: Apache License 2.0

Shell 0.13% Python 96.56% Jupyter Notebook 3.31%

apvit's Introduction

APViT: Vision Transformer With Attentive Pooling for Robust Facial Expression Recognition

APViT is a simple and efficient Transformer-based method for facial expression recognition (FER). It builds on the TransFER, but introduces two attentive pooling (AP) modules that do not require any learnable parameters. These modules help the model focus on the most expressive features and ignore the less relevant ones. You can read more about our method in our paper.

Update

Installation

This project is based on MMClassification and PaddleClas, please refer to their repos for installation and dataset preparation.

Notable, our method does not rely on custome cuda operations in mmcv-full.

The pre-trained weight of IR-50 weight was downloaded from face.evoLVe, and ViT-Small was downloaded from pytorch-image-models.

PaddlePaddle Version

The PaddlePaddle version of TransFER is included in the Paddle folder.

Training

To train an APViT model with two GPUs, use:

python -m torch.distributed.launch --nproc_per_node=2 \
    train.py configs/apvit/RAF.py \
    --launcher pytorch

Evaluation

To evaluate the model with a given checkpoint, use:

PYTHONPATH=$(pwd):$PYTHONPATH \
python -m torch.distributed.launch --nproc_per_node=2 \
    tools/test.py configs/apvit/RAF.py \
    weights/APViT_RAF-3eeecf7d.pth \   # your checkpoint
    --launcher pytorch

Pretrained checkpoints

Model RAF-DB Config Download
APViT 91.98% config model

License

This project is released under the Apache 2.0 license.

Reference

If you use APViT or TransFER, please cite the paper:

@article{xue2022vision,
  title={Vision Transformer with Attentive Pooling for Robust Facial Expression Recognition},
  author={Xue, Fanglei and Wang, Qiangchang and Tan, Zichang and Ma, Zhongsong and Guo, Guodong},
  journal={IEEE Transactions on Affective Computing},
  year={2022},
  publisher={IEEE}
}

@inproceedings{xue2021transfer,
  title={Transfer: Learning Relation-aware Facial Expression Representations with Transformers},
  author={Xue, Fanglei and Wang, Qiangchang and Guo, Guodong},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={3601--3610},
  year={2021}
}

apvit's People

Contributors

youqingxiaozhua 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.