Giter VIP home page Giter VIP logo

meme-multimodal's Introduction

Multi-category meme model

Dataset Preparation:

  1. Reddit Dataset from this repository Put splitted data under data/reddit directory
  2. Memotion Dataset from kaggle Put splitted data under data/memotion directory
  3. Eimages from MET-Meme: A Multi-modal Meme Dataset Rich in Metaphors Meme class: happiness(1);love(2);anger(3);sorrow(4);fear(5);hate(6);surprise(7). Put images under data/Multi_category_Meme/images/ and csv files directly under data/Multi_category_Meme

Models Pretraining

  1. Pretrain ALBERT and Multi-Modal models by following instructions in Memotion Multi-Modal Model section.
  2. Preprocess Eimages data:
    python utils/multi_category_meme_data_to_pkl.py
    
  3. Train model for multi category meme sentiment analysis
    bash utils/run_model_w_multi_category_meme.sh
    

Pretrained models and results will be stored in the pretrained_models directory.

Usage

  1. Create a directory and store your meme images under the data directory.
  2. Go to utils/meme_prediction.sh and change YOUR_IMAGE_DIRECTORY_NAME to the name of the directory you just created
  3. Run the following script to first preprocess your meme images
    bash utils.meme_prediction.sh
    
    Probability distribution of each meme image over 7 sentiment classes will be stored in meme_filename_to_prob_dist.json file




Memotion Multi-Modal Model (M4 Model)

The growing ubiquity of Internet memes on social media platforms, such as Facebook, Twitter, Instagram and Reddit have become a unstoppable trend. Comprising of visual and textual information, memes typically convey various emotion (e.g. humor, sarcasm, offensive, motivational, and sentiment). Nevertheless, there is not much research attention toward meme emotion analysis. The main objective of this project is to bring the attention of the research community toward meme studying. In this project, we propose the Memotion Multimodal Model (M4 Model) newtork for humor detection on memotion dataset. Inspired by ConcatBERT model, we propose our model while the core "Gated Multimodal Layer" (GML) are borrowed by this arXiv paper

Dataset Preparation

In this project, memotion Dataset are mainly used while we apply transfer learning using Reddit Dataset.

  1. Download offical Memotion Dataset from kaggle
  2. Download and prepare sampled Reddit Dataset from this repository
  3. Put your Reddit and Memotion Dataset to ./data/reddit and ./data/memotion accordingly.

Procedures

  1. Training the ALBERT model using Reddit Dataset.
  • go to utils/util_args/
  • set "train_reddit" to 1
  • set "dataset" to "reddit"
  • set "model" to "RedditAlbert"
  • set "bert_model" to "albert-base-v2"
  • run "python main.py"
  1. After training, the trained model and corresponding log file should be stored under ./pretrained_models/.
  2. Training the MultiModal model using Memotion Dataset.
  • go to utils/util_args/
  • set "train_reddit" to 0
  • set "dataset" to "memotion"
  • set "model" to "GatedAverageBERT"
  • load the pretrained bert model by modify the model name in initiate() function of main.py.
  • run "python main.py"

Pretrained Model

Resulted log files can be found under pretrained_models/.

Variant Model Task Test Acc % Macro-F1 % Benchmark % Download Link
A2 ALBERT+FC Reddit 60.79 55.96 72.40 (Acc) โœ…
A2 (GML) ALBERT+FC+VGG16 Memotion 68.32 54.57 52.99 (F1) โœ…

Acknowledgment

This code is partial borrowed from:

meme-multimodal's People

Contributors

lorenayannnnn avatar terenceylchow124 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.