Attention mechanism for image captioning