This file contains hidden or 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 import backend as K | |
from keras.engine.base_layer import Layer, InputSpec | |
from keras import activations | |
from keras.layers.convolutional import _Conv | |
import numpy as np | |
class TDNN(_Conv): | |
# Original TDNN | |
# A. Waibel, T. Hanazawa, G. Hinton, K. Shikano and K. J. Lang, | |
# "Phoneme recognition using time-delay neural networks," |
This file contains hidden or 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
# Launch tensorboard | |
# $ tensorboard --logdir=~/tensorboard.log | |
import tensorflow as tf | |
from keras.layers import Dense, Dropout, Conv3D, MaxPooling3D, GlobalAveragePooling3D | |
from keras.models import Sequential | |
import keras.backend as K | |
model = Sequential() | |
model.add(Conv3D(8, kernel_size=(3, 3, 3), input_shape=(None,None,None,1), padding='same')) |
This file contains hidden or 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 plot(array, width, height): | |
size = len(array) | |
y = [array[int(round(k*size/width)):int(round((k+1)*size/width))] for k in range(width)] | |
y = [np.mean(k) for k in y[5:]] #y[5:] when the firsts values are too big | |
y = height*(y-np.min(y))/(np.max(y)-np.min(y)) | |
res = np.array(list([list('#'*int(round(y[k]))+' '*int(round(height-y[k]))) for k in range(len(y))])) | |
res = np.rot90(res, k=1, axes=(0,1)) | |
for r in res: | |
print(''.join(r)) |
This file contains hidden or 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
#!/usr/bin/python3 | |
import numpy as np | |
import sys | |
import time | |
import math | |
import os | |
def plot(array, width, height): | |
size = len(array) | |
y = [array[int(round(k*size/width)):int(round((k+1)*size/width))] for k in range(width)] |