Created
March 14, 2018 09:01
-
-
Save chrisdinant/20f48750026fa88a90475ed8a3001850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
y_pred = TimeDistributed(Dense(output_dim, activation = 'softmax'))(X) | |
# ctc | |
y_true = Input(name='the_labels', shape=[None,], dtype='int32') | |
input_length = Input(name='input_length', shape=[1], dtype='int32') | |
label_length = Input(name='label_length', shape=[1], dtype='int32') | |
# Keras doesn't currently support loss funcs with extra parameters | |
# so CTC loss is implemented in a lambda layer | |
loss_out = Lambda(ctc_lambda_func, output_shape=(1,), | |
name='ctc')([y_pred, | |
y_true, | |
input_length, | |
label_length]) | |
test_model = Model(inputs = X_input, outputs = y_pred) | |
model = Model(inputs = [X_input, | |
y_true, | |
input_length, | |
label_length], | |
outputs = loss_out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment