About coding with CABAC in compression_Hyperprior

323 views
Skip to first unread message

zhang lu

unread,
Jun 15, 2021, 4:08:28 AM6/15/21
to tensorflow-compression
Hi  Johannes,

I recently read your ICLR18 paper "VARIATIONAL IMAGE COMPRESSION WITH A SCALE HYPERPRIOR" again, and I have a question about how to encode a symbol with CABAC and entropy model.

I could not find where we use the arithmetic coding and decoding in tensorflow_compression code. Someone tell me you used C languages to .so file and used it,but I did not find .so files.I want to know which are the AD's input and AE's output.

Very Very looking forward your reply!Thanks for your time.

Best,
zhanglu

Johannes Ballé

unread,
Jun 15, 2021, 5:00:19 PM6/15/21
to tensorflow-compression
Hi Zhang Lu,

the arithmetic coder we are using is not based on CABAC. It's a standard multi-symbol range coder, and it has an overflow functionality for out-of-range values. Values outside of the range where we have probabilities, are encoded using a code similar to an exponential Golomb code.

The code is here:

The documentation for the corresponding TensorFlow op is here:

The .so files are not on Github. They show up in the binaries we provide on pypi (https://pypi.org/project/tensorflow-compression/2.2/#files) or if you compile the library yourself.

Hope this helps,
Johannes.

--
You received this message because you are subscribed to the Google Groups "tensorflow-compression" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tensorflow-compre...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tensorflow-compression/34adc07d-4b56-4d81-800b-996f6da66f23n%40googlegroups.com.

zhang lu

unread,
Jun 18, 2021, 4:52:16 AM6/18/21
to tensorflow-compression
Hi  Johannes,

I recently read your ICLR18 paper "VARIATIONAL IMAGE COMPRESSION WITH A SCALE HYPERPRIOR" again, and I have a question about how to draw the bpp-PSNR curve and bpp--MS-SSIM.

How can I  change the value of bpp to get the value of PSNR or MS-SSIM of same picture? I would like to know how to get the line chart,the figure 5: Rate–distortion curves aggregated over the Kodak dataset.

Very looking forward your reply!Thanks for your time.

Best wishes,
zhanglu

Johannes Ballé

unread,
Jun 18, 2021, 11:48:30 AM6/18/21
to tensorflow-compression
Hi,

the plots were generated by sweeping over the lambda parameter, training one model for each lambda. Then the bpp and the MS-SSIM were averaged over all images encoded with that lambda.

Hope this helps!
Johannes


zhang lu

unread,
Jun 18, 2021, 10:42:33 PM6/18/21
to tensorflow-compression
Hi,

Thanks for your reply.And how can I chose the lambda parameter to get all value of bpp from 0 to 2.0? and how many points I will plot?  

Best wishes,
ZhangLu

Johannes Ballé

unread,
Jun 20, 2021, 3:07:36 PM6/20/21
to tensorflow-...@googlegroups.com
Hi Zhang Lu,

the lambda values you need you need to determine experimentally. It is hard to know what rate vs. distortion a model will have ahead of time.

Best,
Johannes

zhang lu

unread,
Jul 23, 2021, 2:44:07 AM7/23/21
to tensorflow-compression
Hi Johannes,
Thank you very much for your reply!

And I have another problem about the articalVARIATIONAL IMAGE COMPRESSION WITH A SCALE HYPERPRIOR. If I will optimized for MS-SSIM,what the loss function I will use? I know the loss=λ*(1-D)+R,but how could I get the 'D'?
When I used the train_msssim=tf.squeeze(tf.image.ssim_multiscale(x_tilde,x,255)),the program reported an error.
How do i find this parameter?
Looking forward to your reply!

Best wishes,
ZhangLu

zhang lu

unread,
Jul 28, 2021, 4:01:28 AM7/28/21
to tensorflow-compression
Hi Johannes,

And I have another problem about the artical VARIATIONAL IMAGE COMPRESSION WITH A SCALE HYPERPRIOR. If I will optimized for MS-SSIM,what the loss function I will use? I know the loss=λ*(1-D)+R,but how could I get the 'D'?
When I used the train_msssim=tf.reduce_mean(tf.image.ssim_multiscale(x_tilde,x,255)) to get the average,the result is not well. Is the loss function wrong or the value of λ is wrong?   Are the values of λ to optimized for MS-SSIM same as optimized for MSE?
Very Very looking forward your reply!Thanks for your time.

Best wishes,
ZhangLu

Johannes Ballé

unread,
Aug 23, 2021, 10:59:30 PM8/23/21
to tensorflow-...@googlegroups.com
Hi Zhang,

most likely you need to change the value of lambda, since it will be different from the MSE based model.

Johannes

Reply all
Reply to author
Forward
0 new messages