I'm training Deeplab v3 by making custom data set in three class, including background
Then, My class is background, panda, bottle and there are 1949 pictures.
and I'm using a moblienetv2 model
and segmentation_dataset.py has been modified as follow.
_MYDATA_INFORMATION = DatasetDescriptor(
splits_to_sizes={
'train': 975, # num of samples in images/training
'trainval': 1949,
'val': 974, # num of samples in images/validation
},
num_classes=3,
ignore_label=0,
)
train.py has been modified as follow.
flags.DEFINE_boolean('initialize_last_layer', False,
'Initialize the last layer.')
flags.DEFINE_boolean('last_layers_contain_logits_only', True,
'Only consider logits as last layers or not.')
train_utils.py has not been modified.
not_ignore_mask = tf.to_float(tf.not_equal(scaled_labels, ignore_label)) * loss_weight
I get some results, but not the perfect ones.
For example, the mask colors of panda and bottles are same or not distinct
The result that I want is panda of red and bottle of green
So, I judged that there was a problem with the weight.
Based on the other people's questions, train_utils.py was configured as follows
irgore_weight = 0
label0_weight =1
label1_weight = 10
label2_weight = 15
not_ignore_mask =
tf.to_float(tf.equal(scaled_labels, 0)) * label0_weight +
tf.to_float(tf.equal(scaled_labels, 1)) * label1_weight +
tf.to_float(tf.equal(scaled_labels, 2)) * label2_weight +
tf.to_float(tf.equal(scaled_labels, ignore_label)) * irgore_weight
tf.losses.softmax_cross_entropy(
one_hot_labels,
tf.reshape(logits, shape=[-1, num_classes]),
weights=not_ignore_mask,
scope=loss_scope)
I have a question here.
What are the criteria for the weight?
My data set consists of the following.
It's automatically generating, so I don't know exactly which one is more, but it's a similar amount.
And another thing, I'm using Pascal's color map type.
This is the first black background and the second red third green.
I want to designate pandas as red and bottles as green exactly. What should I do?