Code Monkey home page Code Monkey logo

avce_fer's Introduction

AVCE_FER

Emotion-aware Multi-view Contrastive Learning for Facial Emotion Recognition (ECCV 2022)

Ubuntu PyThon PyTorch

Daeha Kim, Byung Cheol Song

CVIP Lab, Inha University

Real-time demo with pre-trained weights

Requirements

  • Python (>=3.7)
  • PyTorch (>=1.7.1)
  • pretrainedmodels (>=0.7.4)
  • cvxpy (>=1.1.15)
  • Wandb
  • Fabulous (terminal color toolkit)

To install all dependencies, do this.

pip install -r requirements.txt

News

[22.07.10]: Add source code and demo.

[22.07.07]: OPEN official pytorch version of AVCE_FER.

Datasets

  1. Download three public benchmarks for training and evaluation (I cannot upload datasets due to the copyright issue).

(For more details visit website)

  1. Follow preprocessing rules for each dataset by referring pytorch official custom dataset tutorial.

Pretrained weights

  • Check pretrained_weights folder.

    • Weights are trained on AFEW-VA dataset.

    • Weights for demo are trained on multiple VA database (please refer here)

Run

  1. Go to /src.

  2. Train AVCE.

  3. (Or) Execute run.sh

CUDA_VISIBLE_DEVICES=0 python main.py --freq 250 --model alexnet --online_tracker 1 --data_path <data_path> --save_path <save_path>
Arguments Description
freq Parameter saving frequency.
model CNN model for backbone. Choose from 'alexnet', and 'resnet18'.
online_tracker Wandb on/off.
data_path Path to load facial dataset.
save_path Path to save weights.

Real-time demo

  1. Go to /AVCE_demo.

  2. Run main.py.

  • Facial detection and AV FER functionalities are equipped.
  • Before that, you have to train and save Encoder.t7 and FC_layer.t7.

Citation

@inproceedings{kim2022emotion,
	title={Emotion-aware Multi-view Contrastive Learning for Facial Emotion Recognition},
	author={Kim, Daeha and Song, Byung Cheol},
	booktitle={European Conference on Computer Vision},
	pages={178--195},
	year={2022},
	organization={Springer}

}

Contact

If you have any questions, feel free to contact me at [email protected].

avce_fer's People

Contributors

kdhht2334 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tps-f

avce_fer's Issues

missing keys when loading regressor

Hi,
First of all, Thank you so much for your work and sharing your code and pretrained weights!
I would appreciate if you could help me with a peroblem regarding loading the network

so i'm looking at the code an experimenting with it (more specifically the demo code)
there I see that the network is loaded in lines (320-322 demo-> run.py)

        encoder, regressor = nn_output()
        encoder.load_state_dict(torch.load('/home/daehakim/Desktop/FER_int_system/AVCE_demo/weights/Sparse_cont_enc.t7'), strict=False)
        regressor.load_state_dict(torch.load('/home/daehakim/Desktop/FER_int_system/AVCE_demo/weights/Sparse_cont_reg.t7'), strict=False)

but when loading the weights i get missing keys warning in the reggressor line

_IncompatibleKeys(missing_keys=['lin2.weight', 'lin2.bias', 'pw_conv.weight', 'pw_conv.bias'], unexpected_keys=[])

could it be that the weights file Sparse_cont_reg.t7 is corrupted / not up to date? could you please update it?

Thanks

Error : y.register_hook in cvx_utils.py file

Original line was : y.register_hook(lambda grad,b=batch : torch.solve(grad[:,None], J[b].transpose(0,1))[0][:,0])

I changed to torch.linalg.solve, but still got error as
RuntimeError: linalg.solve: A must be batches of square matrices, but they are 65 by 1 matrices

I changed the code to the
y.register_hook(lambda grad,b=batch : torch.linalg.solve(J[b].transpose(0,1),grad[:,None])[:,0])
By this change, code works but I am not sure if operations are right ?

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.