return tf.reduce_mean(loss) if FLAGS.dataset == 'train': print('training on train set') MAX_STEPS = FLAGS.max_epoches * FLAGS.train_samples // FLAGS.batch_size train_data = input_data.read_train_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) 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) elif FLAGS.dataset == 'trainval': print('training on trainval set') MAX_STEPS = FLAGS.max_epoches * FLAGS.trainval_samples // FLAGS.batch_size trainval_data = input_data.read_trainval_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) else: raise Exception('train or trainval is needed')
initial_lr_slow = 1e-5 end_lr_slow = 1e-6 decay_steps_slow = 30000 flags.DEFINE_integer('output_stride', 16, 'output stride used in the resnet model') if FLAGS.output_stride == 16: MAX_STEPS = MAX_STEPS_FAST initial_lr = initial_lr_fast end_lr = end_lr_fast decay_steps = decay_steps_fast BATCH_SIZE = BATCH_SIZE_OS_16 train_data = input_data.read_train_data() val_data = input_data.read_val_data() elif FLAGS.output_stride == 8: MAX_STEPS = MAX_STEPS_SLOW initial_lr = initial_lr_slow end_lr = end_lr_slow decay_steps = decay_steps_slow BATCH_SIZE = BATCH_SIZE_OS_8 train_data = input_data.read_train_raw_data() val_data = input_data.read_val_data() # for saved path saved_ckpt_path = './checkpoint/' saved_summary_train_path = './summary/train/' saved_summary_test_path = './summary/test/'