Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
215 views
in Technique[技术] by (71.8m points)

python - Create last output as current input LSTM model using keras

I am working on the image captioning problem and I want to build the model that is trained using many to many LSTM architecture by feeding the captions of the image but at the prediction time, I want the same model to behave like a one to many model that takes start word as a 1st input and automatically generate other words by using previous output word as input.

just like this

linked one to many lstm

is it possible to create a model like this?

I am new to deep learning so it may be possible that what I am describing above is one to many or many to many model.

question from:https://stackoverflow.com/questions/65844224/create-last-output-as-current-input-lstm-model-using-keras

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If I understood your question correctly,

You want to give an input a word (token) and the model to give you multiple sequential words based on the previous output ?

If that is the case, would a model that takes a word and predicts a word work well for you ? Then you can feedback the current output as input and repeat.

The issue there is that a model like that would be learning the statistical distribution of the training data. i.e. it means that if you give the model a word, it would output the word that is statistically repeating after.

Either way, you can use RNN layers (GRU, LSTM) to build such model.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...