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, sr = librosa.load(filename, sr=None, mono=True) | |
mel = librosa.feature.melspectrogram(y=x, sr=sr, hop_length=hop_length) | |
log_mel = librosa.logamplitude(mel) |
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 diegowizeline (https://keybase.io/diegowizeline) on keybase. | |
* I have a public key ASDAVCHAChnnVO8A6PfThSrPQ1D8VZ7hCJaW42e6OxsIpgo | |
To claim this, I am signing this object: |
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: |
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
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
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
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
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
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
y_pred = Dense(num_classes, activation='softmax', | |
kernel_initializer='he_normal',name='output')(lstm_2) |
OlderNewer