Skip to content

Measure the size of compressed image #215

Answered by YodaEmbedding
danishnazir asked this question in Q&A
Discussion options

You must be logged in to vote

Two methods, which we use in the given [Code] links:

  • [Code]. During training, we calculate the negative log likelihoods via:

     bpp_loss = sum( -log2(likelihoods) ) / num_pixels
    

    The likelihoods representing $p_{\hat{y}}(\hat{y})$ are determined by feeding a monotonic differentiable function $c : \mathbb{R} \to [0, 1]$ (i.e., the CDF) with a single latent tensor element $\hat{y}_i$. Further details can be found in the Appendix of "Variational image compression with a scale hyperprior".

  • [Code]. During inference, when using a real entropy coder,

    bpp = len(bytestring) * 8 / num_pixels
    

If measured on the exact same $\hat{y}$, the aforementioned bpp_loss and bpp should be very, very close…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@RizerKayseri
Comment options

@YodaEmbedding
Comment options

@RizerKayseri
Comment options

@RizerKayseri
Comment options

Answer selected by danishnazir
Comment options

You must be logged in to vote
1 reply
@YodaEmbedding
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants