Giter Club home page Giter Club logo

chainer-image-caption's Introduction

Image caption generator using Chainer

Requirement

Usage

Download dataset

  1. Download flickr8k.zip, flickr30k.zip, or coco.zip from: http://cs.stanford.edu/people/karpathy/deepimagesent/
  2. Extract downloaded zip file, and you'll get dataset.json and vgg_feats.mat.

Convert dataset

$ python src/convert_dataset.py dataset.json dataset.pkl

Parameters:

  • sentence JSON file of dataset.
  • output pkl file.

Train dataset

$ python src/train.py -g 0 -s dataset.pkl -i vgg_feats.mat -o model/caption_gen

Options:

  • -g, --gpu: (optional) GPU device index (default: -1).
  • -s, --sentence: (required) sentence dataset file path.
  • -i, --image: (required) image feature file path.
  • -m, --model: (optional) input model file path without extension.
  • -o, --output: (required) output model file path without extension.
  • --iter: (optional) the number of iterations (default: 100).

Convert VGG 19-layer caffemodel to pkl file

$ python src/convert_caffemodel_to_pkl.py VGG_ILSVRC_19_layers.caffemodel vgg19.pkl

Parameters:

  • caffe model file path.
  • output pkl file path.

Generate image caption

$ python src/generate_caption.py -s dataset.pkl -i vgg19.pkl -m model/caption_gen_0010.model -l image/list.txt

Options:

  • -s, sentence: (required) sentence dataset file path.
  • -i, --image: (required) image model file path.
  • -m, --model: (required) trained model file path.
  • -l, --list: (required) image path list file.

Image path list file sample

image/asakusa.jpg
image/tree.jpg

License

MIT License

chainer-image-caption's People

Contributors

dsanno 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.