ismlkrkmz / automatic-image-captioning

Automatic Image Captioning (LSTM, PyTorch, Torchvision)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CVND---Image-Captioning-Project

Instructions

  1. Clone this repo: https://github.com/cocodataset/cocoapi
git clone https://github.com/cocodataset/cocoapi.git  
  1. Setup the coco API (also described in the readme here)
cd cocoapi/PythonAPI  
make  
cd ..
  1. Download some specific data from here: http://cocodataset.org/#download (described below)
  • Under Annotations, download:

    • 2014 Train/Val annotations [241MB] (extract captions_train2014.json and captions_val2014.json, and place at locations cocoapi/annotations/captions_train2014.json and cocoapi/annotations/captions_val2014.json, respectively)
    • 2014 Testing Image info [1MB] (extract image_info_test2014.json and place at location cocoapi/annotations/image_info_test2014.json)
  • Under Images, download:

    • 2014 Train images [83K/13GB] (extract the train2014 folder and place at location cocoapi/images/train2014/)
    • 2014 Val images [41K/6GB] (extract the val2014 folder and place at location cocoapi/images/val2014/)
    • 2014 Test images [41K/6GB] (extract the test2014 folder and place at location cocoapi/images/test2014/)
  1. The project is structured as a series of Jupyter notebooks that are designed to be completed in sequential order (0_Dataset.ipynb, 1_Preliminaries.ipynb, 2_Training.ipynb, 3_Inference.ipynb).

Image Captioning Project

In this project, I design and train a CNN-RNN (Convolutional Neural Network - Recurrent Neural Network) model for automatically generating image captions. The network is trained on the Microsoft Common Objects in COntext (MS COCO) dataset. The image captioning model is displayed below.

Image Captioning Model Image source

Generating Image Captions

Here are some predictions from my model.

Good results

sample_171
sample_440
sample_457
sample_002
sample_029
sample_107
sample_202

Not so good results

sample_296
sample_008
sample_193
sample_034
sample_326
sample_366
sample_498

More samples

There are 500 predictions in the samples folder.


To setup your environment for Computer Vision Exercises and Projects, please see: CVND-Exercises-Solved

About

Automatic Image Captioning (LSTM, PyTorch, Torchvision)


Languages

Language:Jupyter Notebook 98.9%Language:Python 1.1%