rasmushaugaard / surfemb

SurfEmb (CVPR 2022)
https://surfemb.github.io/
MIT License
77 stars 17 forks source link

question about pose score. #24

Closed LeroyChou closed 2 years ago

LeroyChou commented 2 years ago

Hi, thank you again.

I'm comparing the pose score you proposed in paper and implemented in codes such that I encounter some questions.

  1. In this line you calculate neg_mask_log_prob by inversing mask_lgts before feeding it into the logsigmoid. why do you inverse mask_lgts? Does it actually mean anything?
  2. Can I think of the pose score as confidence as long as I map its value to [0, 1] via a kind of mono-increasing function?
rasmushaugaard commented 2 years ago

Hi

  1. log(P(not mask)) is needed for the mask score, but log(1 - sigmoid(mask_lgts)) is numerically unstable, which is why it's computed as log(sigmoid(-mask_lgts)) instead.
  2. Yes, you could use e^score for the mapping.
LeroyChou commented 2 years ago

Auh, I get it. But why the former is numerically unstable? could you please give me more details?

rasmushaugaard commented 2 years ago

It's because of the relative precision of floating point numbers. Smaller numbers have higher absolute precision. E.g. with float32, machine epsilon is around 1e-7, and (1 - 1e-8) is rounded off to 1, but there's no problem representing 1e-8. When sigmoid(lgt) is close to 1, it is likely to round off to 1, and then log(1-1) = -inf, which we can't use for the score.

LeroyChou commented 2 years ago

I see. And the example you gave is great, it opened my eyes to it. Thank you.