a-PyTorch-Tutorial-to-Image-Captioning icon indicating copy to clipboard operation
a-PyTorch-Tutorial-to-Image-Captioning copied to clipboard

BLEU-4 score @ beam size of 5 is 0.0606. result on author's model.

Open ada-dl opened this issue 5 years ago • 8 comments

Hi

I have used the authors' WORDMAP and checkpoint files but after running the eval.py on these files with correct filepaths, I received a BLEU-4 score @ beam size of 5 is 0.0606. Do you think I am doing something wrong? I would really appreciate your input on this. Thank you.

ada-dl avatar Feb 03 '20 18:02 ada-dl

Hi, Came across the same problem when trying to evaluate the model. Hope someone can offer a solution...

teddybearxzh avatar Feb 12 '20 21:02 teddybearxzh

Hello, I just ran eval.py with my checkpoint and wordmap but received a score of 0.3028 (i.e. 30.28) with a beam size of 1 as I had reported earlier in issue #35. (The score of 29.98 on the Readme is actually on the validation set as discussed in that issue, which I hadn't updated.)

Perhaps there's a mistake somewhere?

Note: I didn't need to downgrade PyTorch to version 0.4 (the version the checkpoints were initially trained on).

sgrvinod avatar Feb 13 '20 04:02 sgrvinod

I just noticed you mentioned that it happened at a beam size of 5. At this beam size, I get a score of 0.3329 (i.e. 33.29).

sgrvinod avatar Feb 13 '20 05:02 sgrvinod

@ada-dl Got the same number 0.0606. The reason is that, I used from skimage.transform import resize as imresize and img = imresize(img, (256, 256). The default behavior of resize is to convert original range 0-255 to 0-1, so you should use img = imresize(img, (256, 256),preserve_range=True) instead. Everything was normal after the change

sddduuu avatar Dec 03 '20 01:12 sddduuu

@sddduuu Hello, I want to know if the line img = imresize(img, (256, 256) in utils.py needs to be modified, which is a preprocessing step for the dataset?

Kevinskt avatar Mar 31 '24 16:03 Kevinskt

@sddduuu Hello, I want to know if the line img = imresize(img, (256, 256) in utils.py needs to be modified, which is a preprocessing step for the dataset?

Hello, I also occurred the BLEU-4 pretty low issue (around 0.14) and read this post, change to add preserve_range=True as below in utils.py and caption.py, then the BLEU-4 get to over 20 and caption.py make sense.

from skimage.transform import resize  
img = resize(img, (256, 256), anti_aliasing=True, preserve_range=True, mode='constant')

Nanochuan avatar Apr 01 '24 01:04 Nanochuan

@Nanochuan Hello, Can you completely reproduce the author's scores? The imresize function has been deprecated since scipy 1.3.0, but I noticed some issues when directly using the resize function. What I want to know now is: is your approach feasible?

Kevinskt avatar Apr 01 '24 04:04 Kevinskt

@Nanochuan Hello, Can you completely reproduce the author's scores? The imresize function has been deprecated since scipy 1.3.0, but I noticed some issues when directly using the resize function. What I want to know now is: is your approach feasible?

Hi! Yes, with the change I mentioned above, I am able to get similar result like author. So far I run with ResNet-101 as encoder and run 4 Epoch, the BLEU-4 score is 22.33. And comments generated from picture by caption.py is quite reasonable.

Nanochuan avatar Apr 03 '24 14:04 Nanochuan