Image Captioning in Keras
This example trains an image and a partial caption to predict the next word in the caption. 

Input: [, "&lt;BEGIN&gt; The cat sat on the"]
Output: "mat"


Notice the model doesn't predict the entire output of the caption only the next word. To construct a new caption, you would have to predict multiple times for each word.

Input: [, "&lt;BEGIN&gt;"] # predict "The"
Input: [, "&lt;BEGIN&gt; The"] # predict "cat"
Input: [, "&lt;BEGIN&gt; The cat"] # predict "sat"
...


To predict the entire sequence, I believe you need to use TimeDistributedDense for the output layer.

Input: [, "&lt;BEGIN&gt; The cat sat on the mat"]
Output: "The cat sat on the mat &lt;END&gt;"


See this issue: https://github.com/fchollet/keras/issues/1029