コード例 #1
0
ファイル: train.py プロジェクト: tobytoy/MotionGAN
flags.DEFINE_string("save_path", None, "Model output directory")
flags.DEFINE_string("config_file", None, "Model config file")
FLAGS = flags.FLAGS

if __name__ == "__main__":
    _reset_rand_seed()
    if not tf.gfile.Exists('./save'):
        tf.gfile.MkDir('./save')

    # Config stuff
    config = get_config(FLAGS)

    data_input = DataInput(config)
    _reset_rand_seed()
    train_batches = data_input.train_epoch_size
    train_generator = data_input.batch_generator(True)
    val_batches = data_input.val_epoch_size
    val_generator = data_input.batch_generator(False)

    # Model building
    if config.model_type == 'motiongan':
        model_wrap = get_model(config)

    if FLAGS.verbose:
        print('Discriminator model:')
        print(model_wrap.disc_model.summary())
        print('Generator model:')
        print(model_wrap.gen_model.summary())
        print('GAN model:')
        print(model_wrap.gan_model.summary())
コード例 #2
0
ファイル: visualize.py プロジェクト: tobytoy/MotionGAN
def _reset_rand_seed():
    seed = 42
    np.random.seed(seed)


if __name__ == "__main__":
    # Config stuff
    config = get_config(FLAGS)
    # config.only_val = True
    config.normalize_data = False
    # config.pick_num = 0
    data_input = DataInput(config)
    _reset_rand_seed()

    n_batches = 4
    n_splits = 32
    print('Plotting %d batches in %d splits for the %s dataset' %
          (n_batches, n_splits, config.data_set))
    for b in range(n_batches):

        labs_batch, poses_batch = data_input.batch_generator(False).next()

        n_seqs = (config.batch_size // n_splits)
        for i in trange(n_splits):
            plot_seq_gif(
                poses_batch[i * n_seqs:(i + 1) * n_seqs, :, :, :3],
                labs_batch[i * n_seqs:(i + 1) * n_seqs, ...],
                config.data_set,
                # save_path='save/vis_%s_%d_%d.gif' % (config.data_set, b, i),
                figwidth=1920,
                figheight=1080)