Пример #1
0
from deepbelief.layers import gplvm
from deepbelief.plotting import LatentPointPlotter
from deepbelief.plotting import LatentSamplePlotter
from deepbelief.util import init_logging

# Import local flags.py module without specifying absolute path
import importlib.util
module_spec = importlib.util.spec_from_file_location('flags', 'flags.py')
module = importlib.util.module_from_spec(module_spec)
module_spec.loader.exec_module(module)
flags = module.flags

# Note, this script will train the model and create an output folder containing
# checkpoint files and a summary for TensorBoard.

init_logging(flags['training_log_file'])

lp_plotter = LatentPointPlotter(xlim=flags['xlim'],
                                ylim=flags['ylim'],
                                delta=flags['delta_lp'],
                                output_dir=flags['latent_points_dir'],
                                fig_ext=flags['lp_plotter_fig_ext'])

ls_plotter = LatentSamplePlotter(
    image_shape=flags['img_shape'],
    xlim=flags['xlim'],
    ylim=flags['ylim'],
    delta=flags['delta_ls'],
    num_samples_to_average=flags['num_samples_to_average'],
    output_dir=flags['latent_samples_dir'])
Пример #2
0
# Import local flags.py module without specifying absolute path
import importlib.util

module_spec = importlib.util.spec_from_file_location('flags', 'flags.py')
module = importlib.util.module_from_spec(module_spec)
module_spec.loader.exec_module(module)
flags = module.flags

# Note, this script should be run after the model is trained (run train.py first).
# Basically, the generalisation experiment consist in trying to "reconstruct" the
# test data as closely as possible. The output of this script will be two Numpy arrays,
# one simply containing the test data and the other one the corresponding data generated
# by the model.

init_logging(flags['test_log_file'])

test_data = Data(flags['test_data'],
                 shuffle_first=False,
                 batch_size=flags['test_generalisation_batch_size'],
                 log_epochs=flags['data_log_epochs'],
                 name='TestData')

test_data_batch = test_data.next_batch()

config = tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True))
session = tf.Session(config=config)

layer1 = SBM_Lower(session=session,
                   side=flags['img_shape'][0],
                   side_overlap=flags['layer_1_side_overlap'],