Giter VIP home page Giter VIP logo

show-attend-and-tell's Introduction

Show, Attend and Tell: Neural Image Caption Generation with Visual Attention

A PyTorch implementation

For a trained model to load into the decoder, use

Some training statistics

BLEU scores for VGG19 (Orange) and ResNet152 (Red) Trained With Teacher Forcing.

BLEU Score Graph Top-K Accuracy Graph
BLEU-1 BLEU-1 Training Top-1 Train TOP-1
BLEU-2 BLEU-2 Training Top-5 Train TOP-5
BLEU-3 BLEU-3 Validation Top-1 Val TOP-1
BLEU-4 BLEU-4 Validation Top-5 Val TOP-5

To Train

This was written in python3 so may not work for python2. Download the COCO dataset training and validation images. Put them in data/coco/imgs/train2014 and data/coco/imgs/val2014 respectively. Put the COCO dataset split JSON file from Deep Visual-Semantic Alignments in data/coco/. It should be named dataset.json.

Run the preprocessing to create the needed JSON files:

python generate_json_data.py

Start the training by running:

python train.py

The models will be saved in model/ and the training statistics will be saved in runs/. To see the training statistics, use:

tensorboard --logdir runs

To Generate Captions

python generate_caption.py --img-path <PATH_TO_IMG> --model <PATH_TO_MODEL_PARAMETERS>

Todo

  • Create image encoder class
  • Create decoder class
  • Create dataset loader
  • Write main function for training and validation
  • Implement attention model
  • Implement decoder feed forward function
  • Write training function
  • Write validation function
  • Add BLEU evaluation
  • Update code to use GPU only when available, otherwise use CPU
  • Add performance statistics
  • Allow encoder to use resnet-152 and densenet-161

Captioned Examples

Correctly Captioned Images

Correctly Captioned Image 1

Correctly Captioned Image 2

Incorrectly Captioned Images

Incorrectly Captioned Image 1

Incorrectly Captioned Image 2

References

Show, Attend and Tell

Original Theano Implementation

Neural Machine Translation By Jointly Learning to Align And Translate

Karpathy's Data splits

show-attend-and-tell's People

Contributors

aaronccwong avatar

Watchers

James Cloos avatar paper2code - bot 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.