示例#1
0
文件: main.py 项目: templeblock/das
if __name__ == "__main__":
    H5_dico = read_data_header()

    Males = H5PY_RW()
    Males.open_h5_dataset('test.h5py', subset=males_keys(H5_dico))
    Males.set_chunk(config.chunk_size)
    Males.shuffle()
    print 'Male voices loaded: ', Males.length(), ' items'

    Females = H5PY_RW()
    Females.open_h5_dataset('test.h5py', subset=females_keys(H5_dico))
    Females.set_chunk(config.chunk_size)
    Females.shuffle()
    print 'Female voices loaded: ', Females.length(), ' items'

    Mixer = Mixer([Males, Females])

    das_model = DAS(S=len(Mixer.get_labels()), T=config.chunk_size)

    das_model.init()

    for i in range(100):
        print 'Step #', i
        X, Y, Ind = Mixer.get_batch(64)
        x_mixture = []

        for x in X:
            _, x_recons = istft_(x.T)
            x_mixture.append(x_recons)

        X = X[:, :, :128]
示例#2
0
import numpy as np
import tensorflow as tf
import config
import os

H5_dic = read_metadata()
chunk_size = 512*40

males = H5PY_RW('test_raw.h5py', subset = males_keys(H5_dic))
fem = H5PY_RW('test_raw.h5py', subset = females_keys(H5_dic))

print 'Data with', len(H5_dic), 'male and female speakers'
print males.length(), 'elements'
print fem.length(), 'elements'

mixed_data = Mixer([males, fem], chunk_size= chunk_size, with_mask=False, with_inputs=True)


####
#### PREVIOUS MODEL CONFIG
####

N = 256
max_pool = 256
batch_size = 32
learning_rate = 0.01

config_model = {}
config_model["type"] = "DPCL_train_front"

config_model["batch_size"] = batch_size
示例#3
0
file = 'test_raw_16k.h5py'
H5_dic = read_metadata()
chunk_size = 512 * 10

males = H5PY_RW(file,
                subset=males_keys(H5_dic)).set_chunk(chunk_size).shuffle()
fem = H5PY_RW(file,
              subset=females_keys(H5_dic)).set_chunk(chunk_size).shuffle()
print 'Data with', len(H5_dic), 'male and female speakers'

# Mixing the dataset

from data.dataset import Mixer

mixed_data = Mixer([males, fem], with_mask=False, with_inputs=True)

# Training set selection
mixed_data.select_split(0)

# Model pretrained loading

N = 256
max_pool = 128
batch_size = 8
learning_rate = 0.001

config_model = {}
config_model["type"] = "pretraining"

config_model["batch_size"] = batch_size
示例#4
0
import config
import os

H5_dic = read_metadata()
chunk_size = 512 * 40

males = H5PY_RW('test_raw.h5py', subset=males_keys(H5_dic))
fem = H5PY_RW('test_raw.h5py', subset=females_keys(H5_dic))

print 'Data with', len(H5_dic), 'male and female speakers'
print males.length(), 'elements'
print fem.length(), 'elements'

mixed_data = Mixer([males, fem],
                   chunk_size=chunk_size,
                   with_mask=False,
                   with_inputs=True,
                   shuffling=True)

####
#### PREVIOUS MODEL CONFIG
####

N = 256
max_pool = 256
batch_size = 16
learning_rate = 0.01

config_model = {}
config_model["type"] = "pretraining"
示例#5
0
    H5_dico = read_data_header()

    males = H5PY_RW()
    males.open_h5_dataset('test_raw.h5py', subset=males_keys(H5_dico))
    males.set_chunk(5 * 4 * 512)
    males.shuffle()
    print 'Male voices loaded: ', males.length(), ' items'

    fem = H5PY_RW()
    fem.open_h5_dataset('test_raw.h5py', subset=females_keys(H5_dico))
    fem.set_chunk(5 * 4 * 512)
    fem.shuffle()
    print 'Female voices loaded: ', fem.length(), ' items'

    Mixer = Mixer([males, fem], with_mask=False, with_inputs=True)

    adapt_model = Adapt.load('jolly-firefly-9628',
                             pretraining=False,
                             separator=DPCL)
    # adapt_model.init()
    print 'Model DAS created'

    testVar = raw_input("Model loaded : Press Enter")

    cost_valid_min = 1e10
    Mixer.select_split(0)
    learning_rate = 0.01

    for i in range(config.max_iterations):
        X_in, X_mix, Ind = Mixer.get_batch(1)