tensorflow / compression

Data compression in TensorFlow
Apache License 2.0
850 stars 248 forks source link

The memory size of the compressed and decompressed image has become larger? #161

Closed goldwater668 closed 1 year ago

goldwater668 commented 1 year ago

The original image is only 200kb, and it becomes 500kb after compression and decompression

jonycgn commented 1 year ago

Memory size of an image should be constant, since it is typically stored as an array of pixel values in memory. We need more details on what you are doing.

goldwater668 commented 1 year ago

@jonycgn

I want to resize the image from 1024X1024 to 256X256, and the file size should be reduced while ensuring high fidelity of the image quality. The format of the image file supports common image formats such as jpg

jonycgn commented 1 year ago

Hi, I don't see what this has to do with TensorFlow Compression. Please be more specific about what specific steps you took, what the outcome was, and how it differed from what you expected.

MahmoudAshraf97 commented 1 year ago

When comparing the original image size and the reconstructed image size, you are actually comparing the original encoding with tensorflow encoding and both have nothing to do with your model, to measure your model compression you need to assume that the image is stored in HWC bytes and divide that by the length of compressed string you get from tfc.PackedTensors().string, this yealds the compression ratio.