Code Monkey home page Code Monkey logo

skeafn's Introduction

SKEAFN

1. Introduction

The source code for the paper titled "Sentiment Knowledge Enhanced Attention Fusion Network (SKEAFN)".

1.1 Datasets

Dataset Train Valid Test Total Modality Type Sentiment
CMU-MOSI 1284 229 686 2199 Text, Acoustic, Visual Regression HN, NG, WN, NU, WP, PS, HP
CMU-MOSEI 16326 1871 4659 22856 Text, Acoustic, Visual Regression HN, NG, WN, NU, WP, PS, HP
Twitter2019 19816 2410 2409 24635 Text, Visual Classification A, no SA

1.2 Models

Models Metrics
SKEAFN accuracy

2. Code Structure

├── checkpoints                     # dir for saving best model and tensorboard logs.
├── logs                            # dir for recording outputs of the training process.
├── pretrained_models               # dir for saving pretrained models from HuggingFace.
├── results                         # dir for recording performance of the SKEAFN model.
├── ca.py                           # implement for text-guided interaction.
├── classifier.py                   # implement for classifier.
├── dataloader.py                   # implement for constructing PyTorch dataloader.
├── fafw.py                         # implement for feature-wised attention fusion.
├── get_data.py                     # implement for getting train/valid/test dataloader.
├── logger.py                       # implement for obtaining tensorboard log.
├── loss.py                         # implement for ASLSingleLabel loss.
├── main.py                         # implement for main.
├── metrics.py                      # implement for evaluation metrics.
├── model.py                        # implement for our SKEAFN model.
├── tools.py                        # implement for train tools.
├── train.py                        # implement for the train process.
├── trick.py                        # implement for tricks in training process.
├── LICENSE                     
└── README.md

3. Run

3.1 Environment

pip install -r requirements.txt

3.2 Args

  • seed: random seed, default is 1.
  • dataset_name: dataset name, support twitter mosi mosei, default is mosi.
  • net_type: model name, default is SKEAFN.
  • category_number: dim of the model outputs, default is 2.
  • num_workers: num workers of loading data, default is 2.
  • checkpoint_log_path: path to save model and tensorboard log, default is checkpoints.
  • res_save_path: path to save results, default is results.
  • work_dir: path of working directory, default is ..
  • dataset_prefix: path to dataset prefix, default is dataset.
  • pretrained_path: path to save pretrained models, default is pretrained_models.
  • test_pretrained_path: path of the best model and determine the mode (train, test), default is None.

3.3 Training

nohup python main.py --dataset_name=twitter --category_number=2 --pretrained_arch=roberta --num_workers=2 > logs/twitter_roberta_train.log 2>&1 &

3.4 Testing

nohup python main.py --dataset_name=twitter --test_pretrained_path=best_model.pth > logs/twitter_roberta_test.log 2>&1 &

5 Cite

@article{ZHU2023101958,
  title = {SKEAFN: Sentiment Knowledge Enhanced Attention Fusion Network for multimodal sentiment analysis},
  journal = {Information Fusion},
  volume = {100},
  pages = {101958},
  year = {2023},
  issn = {1566-2535},
  doi = {https://doi.org/10.1016/j.inffus.2023.101958},
  url = {https://www.sciencedirect.com/science/article/pii/S1566253523002749},
  author = {Chuanbo Zhu and Min Chen and Sheng Zhang and Chao Sun and Han Liang and Yifan Liu and Jincai Chen},
  keywords = {Multi-view learning, Multiple feature fusion, Multimodal sentiment analysis, External knowledge, Multi-head attention},
}

skeafn's People

Contributors

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