mahaichuan / Versatile-Image-Compression

Lossy compression; Variable rate compresson; Lossless compression;
56 stars 6 forks source link

ce_loss calculate code #5

Open JintaoLee-Roger opened 2 years ago

JintaoLee-Roger commented 2 years ago

Hi, it's a nice work! Your code is easy to understand, however, I still have some questions.

  1. In entropy_codec.py file. What is the function of variable c? Why multiply each ce_loss loss by c? c = tf.pow(tf.pow(2, (4-4-i)), 2)

  2. Why divide the total ce_loss by 256? return ce_loss / 256

  3. In pixelcnn_2D.py and pixelcnn_2D_context.py files, the cross_entropy is calculate with cross_entropy = -tf.reduce_mean(tf.log(prob)). There seems to be something wrong, becuase tf.log(x) means ln(x), not log_2(x).

  4. Can you share your compress and decompress code?

Look forward to your reply, and I would appreciate it very much.