[PYTHON] I took a benchmark of h5py compression

This time, I saved the big image data again in h5 format. In h5py, you can compress variables with gzip by writing as follows.

x = cv2.imread("Big image 1.png ")
y = cv2.imread("Big image 2.png ")
with h5py.File("out.h5", "w") as f:
    f.create_dataset("data1", data=X, compression="gzip", compression_level=4)
    f.create_dataset("data2", data=y, compression="gzip", compression_level=4)

I'm not sure about the time because it's not the average of the results I've done several times.

Compression level Output file size(GB) Output time(sec) Load time(sec)
Uncompressed 6.83 7.7 10.1
1 1.48 81.3 53.7
4(Default) 1.47 107.8 57.2
9 1.46 204.3 56.6

If the data changes, the result may change, but

――There is a big difference in file size between uncompressed and compressed, but the time required for input and output also increases significantly. ――If you increase the compression level, the processing time will be relatively long, but the compression rate will not increase so much. --Reading time does not change much regardless of compression level

I think it's simply the same trend as the gzip benchmark, It seems that there are cases where the difference in input / output time with and without compression is worrisome.

Recommended Posts

I took a benchmark of h5py compression
I tried 3D detection of a car
Flask + PyPy I took a speed benchmark with Blueprint for large-scale Web
I took a look at the contents of sklearn (scikit-learn) (1) ~ What about the implementation of CountVectorizer? ~
A miscellaneous summary of what I researched about Ansible
I made a threshold change box of Pepper's Dialog
I want to install a package of Php Redis
A summary of what I have touched like a blog
I tried using Python (3) instead of a scientific calculator
〇✕ I made a game
I got a sqlite3.OperationalError
Compression / decompression of zipfile
I wrote a demo program for linear transformation of a matrix
I want to start a lot of processes from python
NikuGan ~ I want to see a lot of delicious meat! !!
I made a function to check the model of DCGAN
I tried a little bit of the behavior of the zip function
I made a dot picture of the image of Irasutoya. (part2)
I tried a stochastic simulation of a bingo game with Python