How to double compression


My CNN-based model is trained on jpg images. I want to test my model on double compression test images to compare how accuracy changes.
How do I do this?
I resized test images to 320*320, is it a double compression?

JPEG compression is an algorithm that makes use of a discrete cosine transform and removing a set cutoff of frequencies, depending on the quality of compression chosen.

Here is one way you could make use of PIL and StringIO libraries to compress an image using the JPEG algorithm:

1 Like

Dear @J_Johnson
Thanks a lot.

Although I got a lot of errors because of the difference between Python 2 and 3, it was the right way.

1 Like