Пример #1
0
    return return_img


if not os.path.exists(FLAGS.saved_prediction):
    os.mkdir(FLAGS.saved_prediction)

val_data = input_data.read_val_data(rgb_mean=FLAGS.rgb_mean,
                                    crop_height=FLAGS.crop_height,
                                    crop_width=FLAGS.crop_width,
                                    classes=FLAGS.classes,
                                    ignore_label=FLAGS.ignore_label,
                                    scales=FLAGS.scales)
test_data = input_data.read_test_data(rgb_mean=FLAGS.rgb_mean,
                                      crop_height=FLAGS.crop_height,
                                      crop_width=FLAGS.crop_width,
                                      classes=FLAGS.classes,
                                      ignore_label=FLAGS.ignore_label,
                                      scales=FLAGS.scales)

with tf.name_scope("input"):

    x = tf.placeholder(tf.float32,
                       [FLAGS.batch_size, FLAGS.height, FLAGS.width, 3],
                       name='x_input')
    y = tf.placeholder(tf.int32, [FLAGS.batch_size, FLAGS.height, FLAGS.width],
                       name='ground_truth')

_, logits = PSPNet.PSPNet(x,
                          is_training=False,
                          output_stride=FLAGS.output_stride,
                          pre_trained_model=FLAGS.pretrained_model_path,
saved_prediction_val_gray = './pred/val_gray'

saved_prediction_test_color = './pred/test_color'
saved_prediction_test_gray = './pred/test_gray'

VAL_LIST = input_data.VAL_LIST
ANNOTATION_PATH = input_data.ANNOTATION_PATH

val_num = 1449
test_num = 1456

if not os.path.exists('./pred'):
    os.mkdir('./pred')

val_data = input_data.read_val_data()
test_data = input_data.read_test_data()

with tf.name_scope("input"):

    x = tf.placeholder(tf.float32, [BATCH_SIZE, None, None, 3], name='x_input')
    y = tf.placeholder(tf.int32, [BATCH_SIZE, None, None], name='ground_truth')

logits = deeplab_model.deeplab_v3_plus(x,
                                       is_training=False,
                                       output_stride=8,
                                       pre_trained_model=PRETRAINED_MODEL_PATH)

with tf.name_scope('prediction_and_miou'):

    prediction = tf.argmax(logits, axis=-1, name='predictions')