land-cover
land-cover copied to clipboard
Calculation of variance in the super resolution loss
Hi,
I have a question about variance in sr_loss. Could you please elaborate on why variance is calculated this way?
# Mean var of predicted distribution:
var = K.sum(masked_probs * (1.0 - masked_probs), axis=(1, 2)) / (
c_mask_size * c_mask_size
) # (16x5) / (16,1) --> shape 16x5`
Basically, in the above line, we calculate sigma(x(1-x)) / (n^2)
. However, since we had calculated mean (mu
) in the previous line, we could use mu
in the calculation of variance.
Definition of variance is sigma((x-mu)^2) / n
. So I was thinking something like below:
mean = K.sum(masked_probs, axis=(1, 2)) / c_mask_size # (16x5) / (16,1) --> shape 16x5
var = K.sum((K.pow(masked_probs - mean, 2) * c_mask), axis=(1, 2)) / ( c_mask_size ) # (16x5) / (16,1) --> shape 16x5
In the above line, * c_mask
sets to zero the irrelevant values outside the current class's mask.
So why not stick to the exact variance formula here? Am I missing something?
Thanks,