Beispiel #1
0
from theano import tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from scipy.io import wavfile
import os
import sys
from kdllib import load_checkpoint, dense_to_one_hot, plot_lines_iamondb_example
from kdllib import fetch_fruitspeech, list_iterator, np_zeros, GRU, GRUFork
from kdllib import make_weights, as_shared, adam, gradient_clipping
from kdllib import get_values_from_function, set_shared_variables_in_function
from kdllib import save_checkpoint, save_weights, sample_single_dimensional_gmms
from kdllib import single_dimensional_gmms, single_dimensional_phase_gmms, soundsc

if __name__ == "__main__":
    import argparse

    speech = fetch_fruitspeech()
    X = speech["data"]
    y = speech["target"]
    vocabulary = speech["vocabulary"]
    vocabulary_size = speech["vocabulary_size"]
    reconstruct = speech["reconstruct"]
    fs = speech["sample_rate"]
    X = np.array([x.astype(theano.config.floatX) for x in X])
    y = np.array([yy.astype(theano.config.floatX) for yy in y])

    minibatch_size = 20
    n_epochs = 20000  # Used way at the bottom in the training loop!
    checkpoint_every_n = 500
    # Was 300
    cut_len = 41  # Used way at the bottom in the training loop!
    random_state = np.random.RandomState(1999)
Beispiel #2
0
from kdllib import overlap
from kdllib import load_checkpoint, theano_one_hot, concatenate
from kdllib import fetch_fruitspeech, list_iterator
from kdllib import np_zeros, GRU, GRUFork, dense_to_one_hot
from kdllib import make_weights, make_biases, relu, run_loop
from kdllib import as_shared, adam, gradient_clipping
from kdllib import get_values_from_function, set_shared_variables_in_function
from kdllib import soundsc, categorical_crossentropy
from kdllib import relu, softmax, sample_softmax



if __name__ == "__main__":
    import argparse

    speech = fetch_fruitspeech()
    X = speech["data"]
    fs = speech["sample_rate"]
    reconstruct = speech["reconstruct"]
    X = np.array([x.astype(theano.config.floatX) for x in X])
    # reslice to 2D in sets of 128, 4
    def _s(x):
        xi = x[:len(x) - len(x) % 4]
        # chunk it
        xi = xi.reshape((-1, 4))
        #xi = overlap(xi, 4, 1)
        return xi

    X_windows = []
    for x in X:
        xw = _s(x)