score_sde_pytorch icon indicating copy to clipboard operation
score_sde_pytorch copied to clipboard

Question about reporting likelihoods in bits per dim

Open Mattias421 opened this issue 1 year ago • 4 comments

Hi all,

Thank you for providing this code, it's very educational :)

I am interested in reporting likelihoods but I don't fully understand how bits per dim are calculated. In the code this is

bpd = -(prior_logp + delta_logp) / np.log(2)
N = np.prod(shape[1:])
bpd = bpd / N
# A hack to convert log-likelihoods to bits/dim
offset = 7. - inverse_scaler(-1.)
bpd = bpd + offset

Would you be able to elaborate on how this hack works and if it applies to other image dimensions?

Best, Matt

Mattias421 avatar Dec 19 '23 11:12 Mattias421

same question here.

toyot-li avatar Jan 12 '24 01:01 toyot-li

same question here as well Edit: I think this hack applies to images which originally have discrete pixel intensities from 0 to 255. See, e.g., equations 3 to 5 in Danihelka et al. (https://arxiv.org/pdf/1705.05263.pdf).

mareikethies avatar Feb 05 '24 16:02 mareikethies

@mareikethies Thanks a lot! I got it.

toyot-li avatar Mar 17 '24 12:03 toyot-li

@mareikethies Thank you, it looks like this offset doesn't apply to other data types :0

Mattias421 avatar Mar 17 '24 20:03 Mattias421