karpathy / neuraltalk

NeuralTalk is a Python+numpy project for learning Multimodal Recurrent Neural Networks that describe images with sentences.
5.4k stars 1.32k forks source link

list index out of range error #22

Closed pecorarista closed 9 years ago

pecorarista commented 9 years ago

I created coco_sample directory containing the following files.

I ran the following command.

python predict_on_images.py coco_sample/model_checkpoint_coco_visionlab43.stanford.edu_lstm_11.14.p -r coco_sample

I got an error message as below.

parsed parameters: { "beam_size": 1, "checkpoint_path": "coco_sample/model_checkpoint_coco_visionlab43.stanford.edu_lstm_11.14.p", "root_path": "coco_sample" } loading checkpoint coco_sample/model_checkpoint_coco_visionlab43.stanford.edu_lstm_11.14.p image 0/123287: /home/ec2-user/neuraltalk/imagernn/lstm_generator.py:227: RuntimeWarning: overflow encountered in exp IFOGf[t,:3_d] = 1.0/(1.0+np.exp(-IFOG[t,:3_d])) PRED: (-14.587771) a man and a woman sitting on a bench in the middle of a park image 1/123287: Traceback (most recent call last): File "predict_on_images.py", line 109, in main(params) File "predict_on_images.py", line 66, in main img['local_file_path'] =img_names[n] IndexError: list index out of range

Isn't it possible to run predict_on_images.py on a few images?

liuchang8am commented 9 years ago

Maybe should check "-m" parameter in predict_on_images.py.

pecorarista commented 9 years ago

Thank you @liuchang8am. But I don't understand what you are saying. I don't think predict_on_images.py provides "-m" option.

pecorarista commented 9 years ago

I understand why I got such a strange result. I didn't know how vgg_feats.mat was used and that filenames in tasks.txt should have been aligned according to the order of features in that file.

After I wrote filenames in tasks.txt according to the order of files in dataset.json, which I got from here, neuraltalk generates reasonable sentences for each picture of MS COCO.

Thank you.