KranthiGV / Pretrained-Show-and-Tell-model

This repository contains pretrained Show and Tell: A Neural Image Caption Generator implemented in Tensorflow.
MIT License
198 stars 45 forks source link

unable to run #8

Open ankush-06 opened 7 years ago

ankush-06 commented 7 years ago

I'm getting following error

ankush@Lenovo:/media/Study/Projects/showandtell/models/im2txt$ bazel-bin/im2txt/run_inference --checkpoint_path=${CHECKPOINT_PATH} --vocab_file=${VOCAB_FILE} --input_files=${IMAGE_FILE} INFO:tensorflow:Building model. INFO:tensorflow:Initializing vocabulary from file: Traceback (most recent call last): File "/media/ankush/Study/Projects/showandtell/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 85, in tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/media/ankush/Study/Projects/showandtell/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 55, in main vocab = vocabulary.Vocabulary(FLAGS.vocab_file) File "/media/ankush/Study/Projects/showandtell/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/inference_utils/vocabulary.py", line 50, in init assert start_word in reverse_vocab AssertionError

KranthiGV commented 7 years ago

@ankush-06 Where did you place the checkpoint files? Can you run ls -l --block-size=K in your Pretrained-Show-and-Tell-model folder? Also, please share the full error log. It seems to have been truncated here.

ankush-06 commented 7 years ago

Thanks for replying so soon. This is the result i got. Here are some screenshots. https://image.ibb.co/mfGza5/1.png https://image.ibb.co/da0E8Q/2.png

ankush@Lenovo:/media/ankush/Study/Projects/showandtell/models/im2txt/Pretrained-Show-and-Tell-model$ ls -l --block-size=K total 297528K drwxrwxrwx 1 ankush ankush 0K Jun 20 05:56 extras -rwxrwxrwx 1 ankush ankush 6334K Oct 1 2016 image.jpg -rwxrwxrwx 1 ankush ankush 2K Jun 20 05:56 LICENSE -rwxrwxrwx 1 ankush ankush 145511K Jun 20 10:24 model.ckpt-1000000.data-00000-of-00001 -rwxrwxrwx 1 ankush ankush 17K Jun 20 05:56 model.ckpt-1000000.index -rwxrwxrwx 1 ankush ankush 145511K Jun 20 05:55 model.ckpt-2000000.data-00000-of-00001 -rwxrwxrwx 1 ankush ankush 17K Jun 20 05:56 model.ckpt-2000000.index -rwxrwxrwx 1 ankush ankush 4K Jun 20 05:56 README.md -rwxrwxrwx 1 ankush ankush 120K Jun 20 10:48 word_counts.txt

KranthiGV commented 7 years ago

This seems to be okay. Can you share your full error log (the previous one was truncated)? Which tensorflow version are you using?

ankush-06 commented 7 years ago

I'm using ubuntu 16.04, python 2, tensorflow 1.2.0 Here is a screenshot of the error

https://image.ibb.co/dvSY2k/3.png

KranthiGV commented 7 years ago

Seems like there's an issue with the word vocabulary. Are you using the word_counts.txt file given here? Run cat word_counts.txt | head.

ankush-06 commented 7 years ago

https://image.ibb.co/hc6Ahk/4.png ashish@Ashish-Lenovo:/media/ashish/Study/Academics/BTP/Projects/showandtell/models/im2txt/Pretrained-Show-and-Tell-model$ cat word_counts.txt | head a 969108 586368 586368 . 440479 on 213612 of 202290 the 196219 in 182598 with 152984 and 139109

I think i'm not able to load "word_counts.txt" file properly because when i tried to print reverse_vocab it gave me an empty list.

ankush-06 commented 7 years ago

i solved the problem, but results are not accurate. Any suggestions to improve performance ?

KranthiGV commented 7 years ago

Can you try the 1M like mentioned here? Keep us updated on that thread. :smile: Closing this issue because it's solved.

Update: @ankush-06 Can you let us know how you solved it? Would love to document it. (Reopened until then)

ankush-06 commented 7 years ago

To be really honest, i could'n really solved that issue :) but i somewhat overcame that. The problem was that the program was not able to locate the "word_counts.txt" file. I tried everything. I was getting frustated. So, i ran the commands in a separate python file("xxx.py"):

_with tf.gfile.GFile("word_counts.txt") as f: word_map = list(f.readlines()) word_map = [line.split()[0] for line in wordmap]

then i imported this word_map list in the vocabulary.py file. _from xxx import word_map reverse_vocab = wordmap

Also i had to install tensorflow==1.0 version. In versions > 1.0, i was having problems.

chih-hong commented 5 years ago

@ankush-06 how to solve it. I also encountered the same problem. Can teach me how to solve it?

chih-hong commented 5 years ago

1547198048621

I also encountered the same problem.