Any way to compress/decompress multiple images at once? #128
-
To compress/decompress on multiple images, I have made some change to load the model once then run the sender/receiver many times. Is there a way to pass a whole batch into the sender/receiver function? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @saltwick, yes, you can pass a batch of images into pre-trained models. A batch dimension is added here: If you pass a batch of images to the models in that dimension, they should return batched compressed strings. Note we haven't tested this approach, and this would naturally only work if the images are all the same size, which is one reason why we didn't implement this. Also, when using the If you can't make it work this way, please let me know. |
Beta Was this translation helpful? Give feedback.
Hi @saltwick,
yes, you can pass a batch of images into pre-trained models. A batch dimension is added here:
https://github.com/tensorflow/compression/blob/master/models/tfci.py#L45
and removed again here:
https://github.com/tensorflow/compression/blob/master/models/tfci.py#L50
If you pass a batch of images to the models in that dimension, they should return batched compressed strings. Note we haven't tested this approach, and this would naturally only work if the images are all the same size, which is one reason why we didn't implement this. Also, when using the
--target_bpp
parameter, you'd need to iterate separately over each image, as the R/D tradeoff will be different for each one.If…