Giter VIP home page Giter VIP logo

vqa-soft's Introduction

Accompanying code for "A Simple Loss Function for Improving the Convergence and Accuracy of Visual Question Answering Models" CVPR 2017 VQA workshop paper.

The repo contains code for reproducing the paper's experiments and efficient GPU implementation of the proposed loss function for torch, pytorch, and caffe.

Requirements

To run the experiments you would first need to install torch from https://github.com/torch/distro/. We used torch version from commit 5c1d3cfda8101123628a45e70435d545ae1bc771 but later versions probably would work too.

After installing torch you will need to install the following useful lua libraries:

C data structures for torch https://github.com/torch/tds, so we can allocate data in C memory space instead of lua's and thus avoid lua's memory limit and garbage collection.

luarocks install tds

RNN lib for torch https://github.com/Element-Research/rnn for mask zero lookuptable and other useful modules.

luarocks install rnn

threads for lua https://github.com/torch/threads for multi-threaded code.

luarocks install threads

The following libraries are required but you can modify the code and still run the experiments. However we recommend installing them anyway.

fb-debugger a source-level debugger for lua

Follow the install instructions at https://github.com/facebook/fblualib/blob/master/fblualib/debugger/README.md.

OptNet - Reducing memory usage in torch neural nets https://github.com/fmassa/optimize-net.

luarocks install optnet

Visdom for visualization https://github.com/facebookresearch/visdom.

pip install visdom
luarocks install visdom

Installation

We provide GPU implementation of the loss function for torch, pytorch, and caffe. cd to loss_implementations to read further instructions on how to add the loss function to your framework's installation.

Experiments

First, head over the image_preprocess folder and follow the instructions there to extract feature tensors for MS COCO images.

After obtaining image feature tensors, head over experiments/pool or experiments/avg to run the experiments reported in the paper. To run the models with the proposed loss function run:

gpu=0 ./run_soft_cross_entropy.sh

For standard cross entropy run:

gpu=0 ./run_cross_entropy.sh

gpu=0 specifies the ID of the GPU to be used i.e. it's an alias for CUDA_VISIBLE_DEVICES=0.

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.