instance-segmentation-with-discriminative-loss-tensorflow icon indicating copy to clipboard operation
instance-segmentation-with-discriminative-loss-tensorflow copied to clipboard

l_dist term when instance_num=1

Open AlbertHuyb opened this issue 5 years ago • 1 comments

I am using you discriminative loss function for another use. And I discovered that if instance_num==1, the l_dist term will become nan because mu_norm=[]. So I suggest to add a sentence like l_dist = tf.cond(num_instances<=1, lambda:tf.zeros(1, dtype=tf.float32), lambda:tf.reduce_mean(mu_norm)) after the calculation of l_dist term.

Do you think it's necessary? If so, may I add a pull request to your repo?

AlbertHuyb avatar Aug 22 '19 15:08 AlbertHuyb

@AlbertHuyb I got a complaint about the tensor's shape using your command when instance_num==1, changing from tf.zeros(1, dtype=tf.float32) to tf.constant(0, dtype=tf.float32) works for me

lhoangan avatar Sep 18 '19 11:09 lhoangan