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

Tensorflow implementation of "Semantic Instance Segmentation with a Discriminative Loss Function"
MIT License
170 stars 47 forks source link

Clustering in discriminative loss #13

Open mikeedi opened 5 years ago

mikeedi commented 5 years ago

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?

hq-jiang commented 5 years ago

Yes, you are correct.

JadTawil-theonly commented 4 years ago

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