コード例 #1
0
# START
print_term('Starting session...', run_id)
sess = tf.Session()
K.set_session(sess)
print_term('Started session...', run_id)

# Build the network and the various operations
print_term('Building network...', run_id)
col = Colorization(256)
fwd_col = Feedforward_Colorization(256)
ref = Refinement()

opt_operations = training_pipeline(col, fwd_col, ref, learning_rate,
                                   batch_size)
evaluations_ops = evaluation_pipeline(col, fwd_col, ref, val_number_of_images)
train_col_writer, train_fwd_writer, train_ref_writer, val_col_writer, val_fwd_writer, val_ref_writer = metrics_system(
    run_id, sess)
saver, checkpoint_paths, latest_checkpoint = checkpointing_system(run_id)
print_term('Built network', run_id)

with sess.as_default():
    # tf.summary.merge_all()
    # writer = tf.summary.FileWriter('./graphs', sess.graph)

    # Initialize
    print_term('Initializing variables...', run_id)
    sess.run(tf.local_variables_initializer())
    sess.run(tf.global_variables_initializer())
    print_term('Initialized variables', run_id)

    # Coordinate the loading of image files.
    print_term('Coordinating loaded image files...', run_id)
コード例 #2
0
from colorization import Colorization
from colorization.training_utils import evaluation_pipeline, \
    checkpointing_system, plot_evaluation, metrics_system

# PARAMETERS
run_id = 'run{}'.format(1)
number_of_images = 200

# START
sess = tf.Session()
K.set_session(sess)

# Build the network and the various operations
col = Colorization(256)
evaluations_ops = evaluation_pipeline(col, number_of_images)
summary_writer = metrics_system(run_id, sess)
saver, checkpoint_paths, latest_checkpoint = checkpointing_system(run_id)

with sess.as_default():
    # Initialize
    sess.run(tf.global_variables_initializer())
    sess.run(tf.local_variables_initializer())

    coord = tf.train.Coordinator()
    threads = tf.train.start_queue_runners(coord=coord)

    # Restore
    if latest_checkpoint is not None:
        print('Restoring from: {}'.format(latest_checkpoint))
        saver.restore(sess, latest_checkpoint)
        print(' done!')