hq-jiang / instance-segmentation-with-discriminative-loss-tensorflow

Tensorflow implementation of "Semantic Instance Segmentation with a Discriminative Loss Function"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clustering in discriminative loss

mikeedi opened this issue · comments

In the original paper https://arxiv.org/pdf/1708.02551.pdf they are used only pixels of concrete class (without background) and then do instance segmentation.
But in discriminative_loss.py you calculate loss for full embedding tensor including background:
unique_labels, unique_id, counts = tf.unique_with_counts(correct_label) counts = tf.cast(counts, tf.float32) num_instances = tf.size(unique_labels)
Here num_instances here = num of lines + 1 (background class)
Am I right?

Yes, you are correct.

Is this advisable? Why not mask the output tensor so that only the foreground pixels are used in the computation of the loss?