Home

Awesome

Meta-Module-Network

Code for WACV 2021 Paper "Meta Module Network for Compositional Visual Reasoning"

<p> <img src="figures/architecture.png" width="800"> </p>

Data Downloading

Download all the question files and scene graph files and bottom-up features from the web server, it can take up to 300G disk space.

  bash get_data.sh

This script will download questions/ folder, and the "trainval_all_programs.json" is used for bootstrapping and "trainval_unbiased_programs.json" is used for finetunning in the paper. The "trainval_unbiased_programs.json" and "testdev_pred_programs.json" are both generated by the program generator model.

Meta Module Network Implementation

To understand more detailed implementation of MMN, please refer to README.

Description of different files

Data Preprocessing [Optional]:

If you want to know how the programs and training data are generated, please follow the following steps:

Preprocessing Question-Program Pairs:

Download the questions from the original GQA website and then put it in the parent folder '../gqa-questions/', the following steps are aimed to convert "questions" into program format as follows:

  1. preprocess the trainval_all_question into trainval_all_programs.json
  python preprocess.py trainval_all
  1. preprocess the "balanced" programs into different forms:
  python preprocess.py create_balanced_programs
  1. create the programs into the "input" forms for trainval_all_programs.json:
  python preprocess.py create_all_inputs
  1. create the programs into the "input" forms for *balanced.json:
  python preprocess.py create_inputs

Using NL2Program Model to Predict Test-Dev Programs from input questions:

  1. Train the sequence-2-sequence model:
  python generate_program.py --do_preprocess
  1. Evaluate the NL2Program
  python generate_program.py --do_testdev
  1. Prepare the generated programs for the modular transformer
  python generate_program.py --do_trainval_unbiased

Meta Module Network Training and Evaluation

Citation

If you find this paper useful, please add the following reference to your paper.

  @article{chen2019meta,
  title={Meta module network for compositional visual reasoning},
  author={Chen, Wenhu and Gan, Zhe and Li, Linjie and Cheng, Yu and Wang, William and Liu, Jingjing},
  journal={Proceedings of WACV},
  year={2021}
}