Пример #1
0
from data.dataset import H5PY_RW, Mixer
from models.das import DAS
from data.data_tools import read_data_header, males_keys, females_keys
from utils.audio import istft_

import config
import numpy as np
import tensorflow as tf

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):
Пример #2
0
import os
import sys
import tensorflow as tf
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# Get your datasets

from data.dataset import H5PY_RW
from data.data_tools import read_metadata, males_keys, females_keys

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
Пример #3
0
from data.dataset import H5PY_RW
from data.data_tools import read_metadata, males_keys, females_keys
from data.dataset import Mixer
from models.adapt import Adapt
from models.dpcl import DPCL
from utils.tools import getETA
import time
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
Пример #4
0
import config
import numpy as np
# import tensorflow as tf
# import soundfile as sf


def normalize(y):
    y = y - np.mean(y)
    return y / np.std(y)


if __name__ == "__main__":

    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,