Professional Documents
Culture Documents
Applications
Imran Siddiqi
Bahria University, Islamabad
imran.siddiqi@bahria.edu.pk
Many-to-one mapping
• Create Model
Many-to-many mapping
• Encoder Network:
• RNN/LSTM
• Feed one word at a time
• RNN outputs a vector that
represents the sentence
Drop the softmax layer and feed the encoding to an RNN which predicts caption – one word at a time
DSC 704 Deep Learning Bahria University, Spring 2019 25
Machine Translation
• There can be many possible
translations
• How to pick?
• Greedy Search:
• Generate 1 word at a time ,
generating the first most likely
word , then generating the
next most likely word and so
on…..
Step 1:
Define Beam Width (e.g. B=3) and instead of one
most probably output pick three most probably
outputs for the first word
,
)=
) .
, "")
,
)=
) .
, "")
,
)=
) .
, "")
, " ")
, " ")
Time-Steps
The cat is red ….
T=0 0.4 0.0 0.3 0.0 ….
Example Credit: Text Generation With LSTM Recurrent Neural Networks in Python with Keras, by Jason Brownlee
• Split the book text up into subsequences with a fixed length of 100 characters, an arbitrary
length.
• Each training pattern of the network is comprised of 100 time steps of one character (X)
followed by one character output (y).
• When creating these sequences, we slide this window along the whole book one character
at a time, allowing each character a chance to be learned from the 100 characters that
preceded it (except the first 100 characters)
• For example, if the sequence length is 5 (for simplicity) then the first two training patterns
would be:
• There is no test dataset. We are modeling the entire training dataset to learn the probability of each
character in a sequence.
Seed Text
Generated Text
CTC
CTC Decoding
ap-pl-ee
Remove repeated symbols
ap-pl-e
Remove blanks
apple
CTC Loss