DeepRNN / image_captioning

Tensorflow implementation of "Show, Attend and Tell: Neural Image Caption Generation with Visual Attention"
MIT License
786 stars 354 forks source link

Have a question in main.py #23

Open SoarAnyway opened 6 years ago

SoarAnyway commented 6 years ago

Hello, thank you for your work first. There are some problem when I run main.py, I am confused why there is a Syntax Error in bleu_scorer.py .Error message as follow:

Traceback (most recent call last): File "main.py", line 5, in from model import CaptionGenerator File "D:\AI_Prj\image_captioning-master\model.py", line 4, in from base_model import BaseModel File "D:\AI_Prj\image_captioning-master\base_model.py", line 13, in from utils.coco.pycocoevalcap.eval import COCOEvalCap File "D:\AI_Prj\image_captioning-master\utils\coco\pycocoevalcap\eval.py", line 3, in from utils.coco.pycocoevalcap.bleu.bleu import Bleu File "D:\AI_Prj\image_captioning-master\utils\coco\pycocoevalcap\bleu\bleu.py", line 11, in from utils.coco.pycocoevalcap.bleu.bleu_scorer import BleuScorer File "D:\AI_Prj\image_captioning-master\utils\coco\pycocoevalcap\bleu\bleu_scorer.py", line 60 def cook_test(test, (reflen, refmaxcounts), eff=None, n=4): ^ SyntaxError: invalid syntax

mpowelson commented 6 years ago

Are you perhaps using Python 3? If so, make the change listed below.

https://stackoverflow.com/questions/20035591/python-cant-define-tuples-in-a-function

SoarAnyway commented 6 years ago

Thank you . I try to debug the code using Python 2.7.4. But there is still an error:

Traceback (most recent call last): File "main.py", line 69, in tf.app.run() File "/home/ubuntu/anaconda3/envs/lihong_python/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "main.py", line 50, in main model.train(sess, data) File "/home/share2/lihong/image_captioning-master/base_model.py", line 46, in train images = self.image_loader.load_images(image_files) File "/home/share2/lihong/image_captioning-master/utils/misc.py", line 34, in load_images images.append(self.load_image(image_file)) File "/home/share2/lihong/image_captioning-master/utils/misc.py", line 18, in load_image temp = image.swapaxes(0, 2) AttributeError: 'NoneType' object has no attribute 'swapaxes'

SoarAnyway commented 6 years ago

Sorry, I got a wrong file path. When I change the path it's OK! Thanks for your reply

pranjalnaman commented 6 years ago

@SoarAnyway I'm getting the same error: AttributeError: 'NoneType' object has no attribute 'swapaxes' Can you tell me how you solved this issue?

lfydegithub commented 6 years ago

@SoarAnyway I'm getting the same error: AttributeError: 'NoneType' object has no attribute 'swapaxes' Can you tell me how you solved this issue?

SoarAnyway commented 6 years ago

@lfydegithub @pranjal4697 Sorry, I have compiled successfully but I forgot the debugging process. You can leave your e-mail and I send you the debugged code.

AnwarUllahKhan commented 6 years ago

@SoarAnyway dear send me the debugging code....my email id is anwarullah0343@gmail.com. I am facing the same error how can I solve? thank you very much

AnwarUllahKhan commented 6 years ago

@SoarAnyway dear, you are talking about which path, config.py file path? or any other path can you want to send me the mics.py file as well in my id? thank you very much....

SoarAnyway commented 6 years ago

@AnwarUllahKhan I have send you your email

I found that the author called coco-caption, but COCO-caption only supports python2.7, and someone has rewritten to make COCO-caption support Python 3.x.

https://github.com/mtanti/coco-caption

phyukhaing7 commented 5 years ago

Sorry, I got a wrong file path. When I change the path it's OK! Thanks for your reply

Where you change the path in code? I also face this problem. Let me know.

phyukhaing7 commented 5 years ago

@lfydegithub @pranjal4697 Sorry, I have compiled successfully but I forgot the debugging process. You can leave your e-mail and I send you the debugged code.

Dear, You can send me the debugged code. My email is phyukhaing7@gmail.com.