Beispiel #1
0
layer1 = SBM_Lower(session=session,
                   side=flags['img_shape'][0],
                   side_overlap=flags['layer_1_side_overlap'],
                   num_h=flags['layer_1_num_h'],
                   name=flags['layer_1_name'])

layer1.restore(flags['layer_1_ckpt'])

layer2 = RBM(session=session,
             num_v=flags['layer_1_num_h'],
             num_h=flags['layer_2_num_h'],
             bottom=layer1,
             name=flags['layer_2_name'])

layer2.restore(flags['layer_2_ckpt'])

table_path = os.path.join(flags['test_generalisation_plots_dir'], 'table')

layer2.test_generalisation(
    test_data=test_data_batch,
    output_table_path=table_path,
    num_iterations=flags['test_generalisation_num_iterations'],
    num_runs=flags['test_generalisation_num_runs'],
    num_samples_to_average=flags['test_generalisation_num_samples_to_average'])

with open(table_path, 'rb') as f:
    table = pickle.load(f)

assert len(table) == test_data_batch.shape[0]
min_dists = []
Beispiel #2
0
                 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 = RBM(session=session,
             num_v=flags['img_shape'][0] * flags['img_shape'][1],
             num_h=flags['layer_1_num_h'],
             name=flags['layer_1_name'])

layer1.restore(flags['layer_1_ckpt'])

layer2 = RBM(session=session,
             num_v=flags['layer_1_num_h'],
             num_h=flags['layer_2_num_h'],
             bottom=layer1,
             name=flags['layer_2_name'])

layer2.restore(flags['layer_2_ckpt'])

layer3 = RBM(session=session,
             num_v=flags['layer_2_num_h'],
             num_h=flags['layer_3_num_h'],
             bottom=layer2,
             name=flags['layer_3_name'])