-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About the y_bpp and the Gaussian entropy model #326
Comments
Because of the symmetry of the normal distribution, upper - lower
= _standardized_cumulative( z + 0.5) - _standardized_cumulative( z - 0.5)
= _standardized_cumulative(-z + 0.5) - _standardized_cumulative(-z - 0.5)
# Proof left as exercise. The only reason I think the improvement in numerical stability is probably quite minimal for typical cases, so you can probably omit it if it makes it easier. |
Thank you for your response. So the torch.abs does not impose additional constraints to the distribution of y. Additionally, I am curious: if I aim to normalize ( y ) to achieve a standard normal distribution, should I take the lower bound of the scale set into account? |
I'm not sure what you mean about normalizing Note that >>> num_bins = 17
>>> bin_centers = np.arange(num_bins) - num_bins // 2
>>> def H(p): return -(p * np.log2(p)).sum()
>>> H(norm.cdf(bin_centers + 0.5) - norm.cdf(bin_centers - 0.5))
2.1048326541776676 The lossless entropy coder works on quantized values
>>> scale_table = np.logspace(np.log10(0.11), np.log10(64))
>>> scale_table
array([ 0.11 , 0.125, 0.143, 0.162, 0.185, 0.211, 0.24 , 0.273,
0.311, 0.354, 0.403, 0.459, 0.523, 0.596, 0.678, 0.772,
0.879, 1.001, 1.14 , 1.299, 1.479, 1.684, 1.917, 2.183,
2.486, 2.831, 3.224, 3.672, 4.181, 4.761, 5.422, 6.174,
7.03 , 8.006, 9.116, 10.381, 11.821, 13.461, 15.329, 17.456,
19.878, 22.635, 25.776, 29.352, 33.424, 38.061, 43.342, 49.355,
56.203, 64. ])
>>> 1 / scale_table[0]
9.090909090909092 The Interestingly, there's no |
Thank you for your response. In the transformer-based transform coding (ICLR22), it is noted that the effectiveness of the analysis transform ga can then be evaluated by measuring how much correlation there is among different elements in y. Thus the standardized representation of y (i.e., (y - mean) / scale) is utilized to compute the spatial correlation of y across different positions. Theoretically, (y - mean) / scale should follow a normal distribution. However, in practice, constraints are applied during BPP calculation, and optimization tends to align it. From your explanation, it appears that Therefore, the difference between (y-mean)/scale and (y-mean)/lower bound (scale) may be very small? |
Hello, I have a question about y_bpp and normalization.
In the implementation of the Gaussian entropy model in CompressAI, y_bpp is computed by estimating the likelihood after normalizing the input:
Does this mean that during actual training, it is not
(y - means) / scales
but rathertorch.abs(y - means) / self.lower_bound_scale(scales)
that is fitted to the standard normal distribution?I need to normalize the latent variable y to obtain a standard spherical normal vector for calculating the spatial correlation.
The text was updated successfully, but these errors were encountered: