tensorflow / compression

Data compression in TensorFlow
Apache License 2.0
860 stars 251 forks source link

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

Closed watertianyi closed 1 year ago

watertianyi commented 2 years ago

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

jonarchist commented 2 years 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.

watertianyi commented 2 years 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

jonarchist commented 2 years 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 2 years 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.