Exemple #1
0
    from keras.models import model_from_yaml
    import numpy as np

    import argparse

    parser = argparse.ArgumentParser()
    parser.add_argument("--which_epoch", default=200, type=int)
    parser.add_argument("--what_encoder", default=0, type=int)

    args = parser.parse_args()

    #load data
    dataset_obj = Emilya_Dataset(window_width=200,
                                 shift_step=20,
                                 sampling_interval=None,
                                 with_velocity=False,
                                 number=None,
                                 nb_valid=None,
                                 nb_test=None)

    test_X = dataset_obj.test_X[:, :, 1:]
    test_Y2 = dataset_obj.test_Y2[:]
    test_Y2 = convert_indices_2_onehot(test_Y2, nb_labels=8)
    del dataset_obj
    ##load encoder
    which_epoch = args.which_epoch
    encoder_name = '../encoder' + str(which_epoch) + '.yaml'
    with open(encoder_name, mode='r') as fl:
        encoder = model_from_yaml(fl)
    encoder.load_weights(encoder_name[:-4] + 'h5')
    if args.what_encoder == 0:
Exemple #2
0
import sys
import os
root_path = os.getenv('Seq_AAE_V1')
sys.path.append(root_path)
from Seq_AAE_V1.datasets.dataset import Emilya_Dataset
from Seq_AAE_V1.models.Seq_AAE.seq_aae_new_loss import Sequence_Adversrial_Autoencoder_with_New_Loss

dataset_obj = Emilya_Dataset(window_width=200,
                             shift_step=20,
                             sampling_interval=None,
                             with_velocity=False)

model = Sequence_Adversrial_Autoencoder_with_New_Loss(
    latent_dim=50,
    latent_activation='tanh',
    latent_BN=False,
    hidden_dim_enc_list=[100, 100],
    activation_enc_list=['tanh', 'tanh'],
    hidden_dim_dec_list=None,
    activation_dec_list=None,
    hidden_dim_dis_list=[100, 40],
    activation_dis_list=['relu', 'relu'],
    dropout_dis_list=[0.0, 0.0],
    batch_size=200,
    max_epoch=401,
    optimiser_autoencoder='rmsprop',
    optimiser_dis='Adam',
    lr_autoencoder=0.001,
    lr_dis=0.001,
    decay_autoencoder=0.0,
    decay_dis=0.0,