Git Product home page Git Product logo

cdnet's Introduction

Learn-to-Decompose: Cascaded Decomposition Network for Cross-Domian Few-Shot Facial Expression Recignition

[Paper] [Code]

This is an official implementation of the following paper:

Learn-to-Decompose: Cascaded Decomposition Network for Cross-Domian Few-Shot Facial Expression Recignition

Xinyi Zou, Yan Yan*, Jing-Hao Xue, Si Chen, and Hanzi Wang

European Conference on Computer Vision (ECCV), 2022

In breif, we have the following contributions:

  1. propose CDNet which cascades several shared learn-to-decompose (LD) module via a sequential decomposition mechanism to obtain the general expression prototypes and their corresponing weights.
  2. develop a partial regularization strategy to combine the benefits of both episodic training and batch training
  3. achieve stat-of-the-art performance on various compound FER datasets under CD-FSL setting.

Please cite our paper if you find the code useful for your research.

@article{zou2022learn,
  title={Learn-to-Decompose: Cascaded Decomposition Network for Cross-Domain Few-Shot Facial Expression Recognition},
  author={Zou, Xinyi and Yan, Yan and Xue, Jing-Hao and Chen, Si and Wang, Hanzi},
  journal={arXiv preprint arXiv:2207.07973},
  year={2022}
}

Usage

Prerequisites

  • Python >= 3.7
  • Pytorch >= 1.7 and torchvision (https://pytorch.org/)
  • You can use the requirements.txt file we provide to setup the environment via Anaconda.
conda create --name py37 python=3.7
conda install pytorch torchvision -c pytorch
pip3 install -r requirements.txt

Install

Clone this repository:

git clone https://github.com/zouxinyi0625/CDNet.git
cd CDNet

Datasets

Training & Testing

We adopt the pretrained ResNet18 from here.

  • Pretrain (Batch Training)
cd batch
python pretrain_e.py --dataset multi --name cascade_e --testset CFEE --split val --color 3 --w_domain 1.0
  • Finetune (Episodic Training)
cd episodic
python train_l2d_pre.py --dataset multi --testset CFEE --split val --train_aug --weight net --name cascade_pre --w_d 1.0 --w_t 1.0 --pretrain

Note

cdnet's People

Contributors

zouxinyi0625 avatar

Stargazers

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

Watchers

 avatar  avatar

cdnet's Issues

best_model.tar doesn't exist which is required when i am running the project 1st time

(py37) satya@revanth-vigil:~/CDNet/batch$ python pretrain_e.py --dataset multi --name cascade_e --testset CFEE --split val --color 3 --w_domain 1.0

Namespace(backbone='ResNet18', batch_size=64, benchmarks_dir='root to the data path/', checkpoint_dir='root to save the model', color=3, data_aug=False, dataset='multi', ft_n_epoch=50, group=7, img_size=224, k=256, log_dir='root to save the result5way_5shot_multi_CFEE_val_cascade_e_3_1.0_1.0_softMax_ResNet18', lr=0.001, method='softMax', mode='train', n_base_class=8, n_batches=100, n_domains=5, n_episodes=600, n_epoch=100, n_iters=10000, n_query=16, n_shot=5, n_way=5, name='cascade_e', num_workers=12, out_dim=512, over_fineTune=False, pretrain=False, projection_dim=128, results_dir='root to save the result', seed=10, split='val', teacher_name='root to pretrained encoder', temp=1, test_epoch=-1, test_n_way=5, testing_epochs=5, testset='CFEE', w_SIMCLR=1.0, w_base=1.0, w_c=0.0001, w_ce=1.0, w_de=1.0, w_domain=1.0, w_mi=1.0, w_pd=1.0, w_re=1.0, w_t=1.0)
Traceback (most recent call last):
File "pretrain_e.py", line 150, in
checkpoint = torch.load(os.path.join(args.checkpoint_dir, "base", teacher_name, "best_model.tar"))
File "/home/cho/anaconda3/envs/satyaPy373/lib/python3.8/site-packages/torch/serialization.py", line 699, in load
with _open_file_like(f, 'rb') as opened_file:
File "/home/cho/anaconda3/envs/satyaPy373/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/home/cho/anaconda3/envs/satyaPy373/lib/python3.8/site-packages/torch/serialization.py", line 211, in init
super(_open_file, self).init(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'root to save the model/base/root to pretrained encoder/best_model.tar'

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.