Closed Fansiee closed 7 years ago
I think I know how to change the labels:
In the line 163 of train.py
, I add the code:
line 161 gt = tf.cast(tf.gather(raw_gt, indices), tf.int32)
line 162 prediction = tf.gather(raw_prediction, indices)
line 163 gt = tf.cast(tf.not_equal(gt, 0), tf.int32) #### added line
Does it right?
Hi I don't have access to the code at the moment, so can only give you some tips: 1) check the summary output and make sure that your images are being read correctly: i.e., there are 2 colours - black (background) + something else (foreground); 2) try to reduce the learning rate by some factor (e.g. 0.1) until the training stops diverging.
And I think you don't need to change the line 163 if you are using the most recent code. On 25 Feb 2017 9:30 pm, "Fansiee" notifications@github.com wrote:
I think I know how to change the labels: In the line 163 of train.py, I add the code:
line 161 gt = tf.cast(tf.gather(raw_gt, indices), tf.int32) line 162 prediction = tf.gather(raw_prediction, indices) line 163 gt = tf.cast(tf.not_equal(gt, 0), tf.int32) #### added line
Does it right?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DrSleep/tensorflow-deeplab-resnet/issues/40#issuecomment-282481040, or mute the thread https://github.com/notifications/unsubscribe-auth/AHemmPYdEnIDPDG27lbBwVWSeofgLGqOks5rgB7egaJpZM4ML7fQ .
I want to change the VOC2012 semantic segmentation task(
21-class, include background
) to a frontground/background task(2-class, all the class is assigned to frontground
). I don't want to change the png image. I want to change the code to achieve the effect.I changed the code as the following:
In
deeplab_resnet/image_reader.py
, I add the code in the line 122:ps: I want to change all the non-background label to 1, and all the background label is 0.
In
train.py
: n_classes = 2In
deeplab_resnet/model.py
: I replace 21 with 2 in the calls to atrous convolution.(as you said in #12)In
train.py
:optim = optimiser.minimize(reduced_loss, var_list=not_restore_var)
saver = tf.train.Saver(var_list=restore_var, max_to_keep=40) if args.restore_from is not None: load(saver, sess, args.restore_from)