davyneven / SpatialEmbeddings

Instance Segmentation by Jointly Optimizing Spatial Embeddings and Clustering Bandwidth

Home Page:https://arxiv.org/pdf/1906.11109.pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regarding the Lovasz Hinge loss

lmanan opened this issue · comments

Hello,

I have more of a question here rather than an issue. I was curious about this line of code. As I understand, dist is a variable that lies between 0 (pixel embedding is very far from the instance center) and 1 (pixel embedding lies atop the instance center). Also by that logic,

0< dist*2 -1 <1

Could you share any intuition on why this dist*2-1 is preferred instead of just using dist, as the first argument to the lovasz hinge class? Does it have better convergence properties for the loss in your opinion, for example? Thank you!

Hi,

@MLbyML I just wanted to share my thoughts with you since I stumbled about the same problem.

The signature of the loss function is lovasz_hinge(logits, labels, per_image=True, ignore=None) - so it expects logits in the range of [-\infty. +\infty] instead of probabilities [0, 1].

By computing dist*2 -1 the author maps all predicted probabilities from [0,1] to [-1,1] to transform them to valid logits.
So from my point of view this mapping is necessary due to the signature of the loss function.

Indeed, I map the distance/probability to the interval [-1,1], as expected by the lovasz loss.

Thanks for the reply @JaWeyl and @davyneven That was helpful!