GithubHelp home page GithubHelp logo

shagunsodhani / image-caption-generator Goto Github PK

View Code? Open in Web Editor NEW
27.0 4.0 18.0 1.08 MB

A simple implementation of neural image caption generator

License: MIT License

Python 96.82% Shell 3.18%
machine-learning artificial-intelligence neural-networks computer-vision natural-language-processing image-processing captioning-images tensorflow keras keras-tensorflow

image-caption-generator's Introduction

Image-Caption-Generator

A simple implementation of neural image caption generator

Please note that the code in this repo is for use in talks/workshops. There is a lot of room for improvement (in terms of both accuracy and efficiency) so that these aspects can be discussed during the sessions.

You may refer to Tensorflow's im2text Model for a stable and accurate implementation.

Setup

Create Directories

  • Run ./scripts/mkdir.sh

Downloading Datasets

  • Run ./scripts/download_images.sh
  • This downloads Flick8K dataset

Downloading Models

  • The VGG16 model would be downloaded automatically when the model is trained for the first time and would be cached on the disk.
  • Alternatively, run python3 vgg16.py. It would download the VGG16 model, produce the embeddings for a test image and compare with a pre-computed embedding.

Processing Images

  • Update data_dir in code/preprocess.py and set mode_list=["train", "test", "debug"]
  • Run python3 preprocess.py

Train

  • Run python3 train.py

image-caption-generator's People

Contributors

shagunsodhani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

image-caption-generator's Issues

Gives me same reply for any picture i give it

I've trained the model. And when i run test.py it gives me same output for any different picture no matter what. Please help

Generated caption is: start man on skis looking at artwork for sale displaying paintings in the snow end end skier skier in a blue hat end end end end end end end end end end end end end end end end end end
Score is: 36.81266660988331

Generated caption is: start a man in a hat is displaying pictures next to a skier in a blue hat end end end end end end end end end end end end end end end end end end end end end end end
Score is: 37.113694965839386

Happens for all inputs

When i run test.py i get this error what should i do??? thanks in advance

Traceback (most recent call last):
File "test.py", line 108, in
mode="debug")
File "test.py", line 84, in predict
model.load_weights(data_dir + "model/" + weights_path)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2613, in load_weights
f = h5py.File(filepath, mode='r')
File "/home/ajith/.local/lib/python2.7/site-packages/h5py/_hl/files.py", line 271, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/home/ajith/.local/lib/python2.7/site-packages/h5py/_hl/files.py", line 101, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-nCYoKW-build/h5py/_objects.c:2840)
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-nCYoKW-build/h5py/_objects.c:2798)
File "h5py/h5f.pyx", line 78, in h5py.h5f.open (/tmp/pip-nCYoKW-build/h5py/h5f.c:2117)
IOError: Unable to open file (Unable to open file: name = '/home/ajith/image-caption-generator/data/model/weights-00.hdf5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)

can not .pkl file

Hey shagun i am getting two errors. please help me.
i run python3 preprocess.py
error: os error cant find image file
when i run python3 train.py
error:file not found error, debug_image_encoding.pkl

please contact on [email protected] sir.
please help.
Thanks in advance.
Naveen vadavalasa

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.