Giter VIP home page Giter VIP logo

pytorch-dssn-mer's Introduction

README

Introduction

This is the Pytorch Version for the reimplementation of Dual-stream Shallow Networks for Facial Micro-Expression Recognition. [Head to official code]

Files

  • dataloader: Function for building custom dataset
  • network: Network design
  • preprocess: Function for processing the original dataset
  • save_preprocess_weight: Save the preprocessed image into npz for repeating usage
  • train: Train the model
  • utils: Rename the fileanem in SAMM dataset

Package requirements

Install the required packages in this project by:

$ pip install -r requirements.txt

Usage

Note that for SAMM dataset, you should rename the data to fulfill the format in the code. To rename the dataset, see utils.py.

Preprocessing

The preprocessed images can be reused to cut down the training time. The usage is shown below:

usage: save_process_image.py [-h] --csv_path CSV_PATH --root ROOT --save_path
                             SAVE_PATH --catego CATEGO

optional arguments:
  -h, --help            show this help message and exit
  --csv_path CSV_PATH
  --root ROOT
  --catego CATEGO

For example:

$ python save_process_weight \
    --csv_path <path_to_csv_file> \
    --root <Path to images> \
    --catego <category>

Training

usage: train.py [-h] --path PATH --catego CATEGO --img_root IMG_ROOT [--num_classes NUM_CLASSES]
                [--combination_mode COMBINATION_MODE] [--image_mode IMAGE_MODE [IMAGE_MODE ...]]
                [--batch_size BATCH_SIZE] [--weight_save_path WEIGHT_SAVE_PATH] [--model MODEL]
                [--epochs EPOCHS] [--learning_rate LEARNING_RATE]

optional arguments:
  -h, --help            show this help message and exit
  --path PATH           Path for the csv file for training data
  --catego CATEGO       SAMM or CASME dataset
  --img_root IMG_ROOT   Root for the training image
  --num_classes NUM_CLASSES
                        Classes to be trained
  --combination_mode COMBINATION_MODE
                        Mode to be used in combination
  --image_mode IMAGE_MODE [IMAGE_MODE ...]
                        Image type to be used in training
  --batch_size BATCH_SIZE
                        Training batch size
  --weight_save_path WEIGHT_SAVE_PATH
                        Path for the saving weight
  --model MODEL         Model to used for training
  --epochs EPOCHS       Epochs for training the model
  --learning_rate LEARNING_RATE
                        Learning rate for training the model

For example:

$ python train.py \
    --path <path to csv file> \
    --img_root <place for your dataset> \
    --catego CASME \
    --image_mode F G \
    --weight_save_path CASME_DSSN_weight \
    --model DSSN

Especially, user can decide what mode to be used in training. DSSN needs two modes for training. On the other hand, SSSN only needs to choose one mode.

# For DSSN
... \
--image_mode F G \
...

# For SSSN
... \
--image_mode G

Pretrained AlexNet

The weight was obtained from YOUSIKI's GitHub repo.

Metrics

Model weights

Model Paramters
SSSN 0.63M
DSSN 0.972M

Citation

@inproceedings{khor2019dual,
    title={Dual-stream Shallow Networks for Facial Micro-expression Recognition},
    author={Khor, Huai-Qian and See, John and Liong, Sze-Teng and Phan, Raphael CW and Lin, Weiyao},
    booktitle={2019 IEEE International Conference on Image Processing (ICIP)},
    pages={36--40},
    year={2019},
    organization={IEEE}
}

pytorch-dssn-mer's People

Contributors

justin900429 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  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

Forkers

siventeen kavicii

pytorch-dssn-mer's Issues

AlexNet pretrained

Hi author, Where can I find the correct file alex_pretrained/partial.pt? Or could you provide it to me? Thank you.

about csv_path and root path

I have some problems in data processing. Can you tell me the specific structure of the csv_path and root path?Thank you very much!

trained model

Can you provide a trained model? Thank you very much!!

Nan

image

Hello, I encountered the problem in the figure when running your reproduction code. I don't know how to solve it. In addition, num_ Class = 5 reports an error. Have you modified the casme dataset table?

Model

Dear author, due to the lack of data set, can I apply for a pre-trained model?

save-process-image.py

Hello, there is no csv file in the SAMM dataset I downloaded, how do I need to get it, I can't run save-process-image.py, I hope to get your reply!

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.