示例#1
0
        shutil.copyfile('./' + filename,
                        FLAGS.summary_dir + filename.replace("/", "_"))

    for key, value_obj in tf.flags.FLAGS.__flags.items():
        print(key, ': ', value_obj.value)

    print(FLAGS.input_video_dir)

    useValidat = tf.placeholder_with_default(tf.constant(False, dtype=tf.bool),
                                             shape=())
    rdata = frvsr_gpu_data_loader(FLAGS, useValidat)
    # Data = collections.namedtuple('Data', 'paths_HR, s_inputs, s_targets, image_count, steps_per_epoch')
    print('tData count = %d, steps per epoch %d' %
          (rdata.image_count, rdata.steps_per_epoch))
    if (FLAGS.ratio > 0):
        Net = TecoGAN(rdata.s_inputs, rdata.s_targets, FLAGS)
    else:
        Net = FRVSR(rdata.s_inputs, rdata.s_targets, FLAGS)
    # Network = collections.namedtuple('Network', 'gen_output, train, learning_rate, update_list, '
    #                                     'update_list_name, update_list_avg, image_summary')

    # Add scalar summary
    tf.summary.scalar('learning_rate', Net.learning_rate)
    train_summary = []
    for key, value in zip(Net.update_list_name, Net.update_list_avg):
        # 'map_loss, scale_loss, FrameA_loss, FrameA_loss,...'
        train_summary += [tf.summary.scalar(key, value)]
    train_summary += Net.image_summary
    merged = tf.summary.merge(train_summary)

    validat_summary = []  # val data statistics is not added to average
示例#2
0
    with tf.Session() as sess:
        sess.run(iterator.initializer)
        s_inputs_data, s_targets_data = sess.run([s_inputs, s_targets])

    # hard coded save
    filelist = [
        'main.py', 'lib/Teco.py', 'lib/frvsr.py', 'lib/dataloader.py',
        'lib/ops.py'
    ]
    for filename in filelist:
        shutil.copyfile('./' + filename,
                        FLAGS.summary_dir + filename.replace("/", "_"))

    if (FLAGS.ratio > 0):
        Net = TecoGAN(s_inputs_data, s_targets_data, FLAGS)
    else:
        Net = FRVSR(s_inputs_data, s_targets_data, FLAGS)

    # Add scalar summary
    tf.summary.scalar('learning_rate', Net.learning_rate)
    train_summary = []
    for key, value in zip(Net.update_list_name, Net.update_list_avg):
        # 'map_loss, scale_loss, FrameA_loss, FrameA_loss,...'
        train_summary += [tf.summary.scalar(key, value)]
    train_summary += Net.image_summary
    merged = tf.summary.merge(train_summary)

    validat_summary = []  # val data statistics is not added to average
    uplen = len(Net.update_list)
    for key, value in zip(Net.update_list_name[:uplen], Net.update_list):