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
================================================================= | |
Total params: 78,519 | |
Trainable params: 78,069 | |
Non-trainable params: 450 |
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
seq_length = 9 | |
random_chars = np.random.randint(0, len(x_train)-1, seq_length) | |
image_seq = [] | |
for j in random_chars: | |
if np.random.random(1) >= 0.5: | |
image_seq.append(cv2.medianBlur(x_train[j], 5)) | |
else: | |
image_seq.append(x_train[j]) | |
image_seq = np.concatenate(image_seq, axis=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
y_pred = Dense(num_classes, activation='softmax', | |
kernel_initializer='he_normal',name='output')(lstm_2) |
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
lstm_1 = LSTM(32, return_sequences=True, kernel_initializer='he_normal', name='lstm1')(reshape) | |
lstm_2 = LSTM(32, return_sequences=True, kernel_initializer='he_normal', name='lstm2')(lstm_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
conv1 = Conv2D(seq_lenght, (3, 3), padding='same', name='conv1', kernel_initializer='he_normal')(inputs) | |
… | |
dims = conv1.get_shape() | |
reshape = Reshape(target_shape=(seq_lenght, int(dims[1]*dims[2])), name='reshape')(conv1) |
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
def build_Model(num_classes, seq_lenght, input_shape=(28, 252, 1)): | |
inputs = Input(name='x', shape=input_shape, dtype='float32') | |
conv1 = Conv2D(seq_lenght, (3, 3), padding='same', name='conv1', kernel_initializer='he_normal')(inputs) | |
conv1 = Activation('relu')(conv1) | |
conv1 = MaxPooling2D(pool_size=(2, 2), name='max1')(conv1) | |
dims = conv1.get_shape() | |
reshape = Reshape(target_shape=(seq_lenght, int(dims[1]*dims[2])), name='reshape')(conv1) |
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
plt.imshow(image_seq) |
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
seq_length = 9 | |
random_chars = np.random.randint(0, len(x_train)-1, seq_length) | |
image_seq = np.concatenate([x_train[j] for j in random_chars], axis=1) | |
seq_label = np.array([y_train[j] for j in random_chars]) |
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
from keras.datasets import mnist | |
(x_train, y_train), (x_test, y_test) = mnist.load_data() |
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
### Keybase proof | |
I hereby claim: | |
* I am diegoagher on github. | |
* I am agher (https://keybase.io/agher) on keybase. | |
* I have a public key ASBfCDf3tTF7YMTy4Ut1T13OfCHuZLcE-Mz0MTKzrZs7Rwo | |
To claim this, I am signing this object: |
NewerOlder