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,), |
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
x = Reshape((8,1280))(x) | |
x = TimeDistributed(Dense(512))(x) | |
x_RNN = LSTM(256)(x) |
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
filters = [32,64,128] input_img = Input(shape = (61,75,1)) | |
def block(filters, inp): | |
inp = inp layer_1 = BatchNormalization()(inp) | |
act_1 = Activation('relu')(layer_1) | |
conv_1 = Conv2D(filters, (3,3), padding = 'same')(act_1) | |
layer_2 = BatchNormalization()(conv_1) | |
act_2 = Activation('relu')(layer_2) | |
conv_2 = Conv2D(filters, (3,3), padding = 'same')(act_2) | |
return(conv_2) |