Giter Site home page Giter Site logo

trellixvulnteam / hatememedetection_cz97 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aggarwalpiush/hatememedetection

0.0 0.0 0.0 20.79 MB

Create to detect the hate meme against the protected group

License: MIT License

Shell 2.42% Python 95.77% Jupyter Notebook 1.58% Dockerfile 0.24%

hatememedetection_cz97's Introduction

HateMemeDetection

This is the code for our submission for Task A to the Shared Task on Hateful Memes Detection at WOAH 2021. It is built on top of the winning system of a previous hateful memes binary classification shared task.

Dataset Download

The original memes dataset could be downloaded from Facebook.

The augmented images could be downloaded here.

After both folders are downloaded, merge them together in a folder called data/hateful_memes/img.

Training

Use the following command to train:

bash VL-BERT/run_train.sh

CSV and JSON inference results will be located at checkpoints/vl-bert/{MODEL_NAME}/{CONFIG_NAME}.

Pre-trained VL-BERT Model

Download the pre-trained VL-BERT model here.

After downloading, place the models in the folder pretrain_model.

Training Configurations

Path to the training config file: VL-BERT/cfgs/cls.

Path to the dataset config file: VL-BERT/cls/data/datasets.

VL-BERT Large Training config file Dataset config file Box annotations Train/Val set
+W large_4x14G_fp32_k8s_v4.yaml cls_v2.py box_annos.json train.entity.jsonl
+W,RG large_4x14G_fp32_k8s_v5_race.yaml cls_v3.py box_annos.race.json train.entity.jsonl
+W,E large_4x14G_fp32_k8s_v5_emotion.yaml cls_v5.py box_annos.emotion.json train.entity.jsonl
+W,RG,E large_4x14G_fp32_k8s_v5_race_emotion.yaml cls_v4.py box_annos.race_emotion.json train.entity.jsonl
U|+W large_4x14G_fp32_k8s_v4.yaml cls_v2.py box_annos.json train_undersampled.entity.jsonl
U|+W,RG large_4x14G_fp32_k8s_v5_race.yaml cls_v3.py box_annos.race.json train_undersampled.entity.jsonl
I|+W large_4x14G_fp32_k8s_v4.yaml cls_v2.py box_annos_imgaug.json train_imgaug.entity.jsonl
I|+W,RG large_4x14G_fp32_k8s_v5_race.yaml cls_v3.py box_annos_imgaug.race.json train_imgaug.entity.jsonl
T|+W large_4x14G_fp32_k8s_v4.yaml cls_v2.py box_annos.json train_textaug.entity.jsonl
I|+W,RG large_4x14G_fp32_k8s_v5_race.yaml cls_v3.py box_annos.race.json train_textaug.entity.jsonl
IT|+W large_4x14G_fp32_k8s_v4.yaml cls_v2.py box_annos_imgaug.json train_imgtextaug.entity.jsonl
I|+W,RG large_4x14G_fp32_k8s_v5_race.yaml cls_v3.py box_annos_imgaug.race.json train_imgtextaug.entity.jsonl

Note: W = Web Entities, RG = Race and Gender, E = Emotion, U = Undersampling, I = Image Augmentation, IT = Image and Text Augmentation

Results in the paper are tested on dev_all.entity.jsonl.

For training, the original train set is split into two sets โ€” train1 as the training set and train2 as the validation set. If you want to replicate the results in the paper, use train1(_<aug>).entity.jsonl as the training set and train2(_<aug>).entity.jsonl as the validation set. For example: For text augmentation, training set: train1_textaug.entity.jsonl and validation set: train2_textaug.entity.jsonl.

The used box annotations and train/val sets must be specified inside the Python dataset config file cls_v<version>.py.

You can specify which split should be used as train, val, and test sets in the training config file. For example, "train1" corresponds to any train1(_<aug>).entity.jsonl, "val_all" corresponds dev_all.entity.jsonl.

hatememedetection_cz97's People

Contributors

aggarwalpiush avatar trellixvulnteam 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.