a-PyTorch-Tutorial-to-Image-Captioning
a-PyTorch-Tutorial-to-Image-Captioning copied to clipboard
Why do you use log_softmax in sampling?
In line 94 in caption.py you use:
scores = F.log_softmax(scores, dim=1)
Could you explain the reason for log_softmax here? You did not use it in forward() method.
More than that, I tried your model on my dataset and got BLEU = 0.16 on test set with that code for captioning. It produced almost similar captions for all images.
But when i removed log_softmax line I got BLEU = 0.60... and I'm a little bit confused with that.
@RodinIvan log_softmax is used to implement beam search. In beam search, you take the log_softmax of the concatenated scores, as opposed to taking the softmax only like after the cross entropy loss. This is how beam search is implemented.