-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save jpeg in fuel/h5py #360
Comments
I'd recommend looking at the implementation of the ilsvrc2010 converter, Also, I've found the throughput when working with JPEG-in-HDF5 to be... On Thu, Aug 4, 2016 at 12:11 PM, markusnagel [email protected]
|
Thanks for the hint David, should have thought of it myself to look there ;)
|
Hello,
I currently deal with image datasets of about 1 million images. When saving them as bumpy array (with dtype uint8) this would result in a dataset file of over 1TB which is very suboptimal.
My solution to this is to save the images as jpeg (that is there original format) which should reduce the dataset size to less than 100GB. I was very enthusiastic when I saw that there is a Transformer called
ImageFromBytes
, this does exactly what I want, load the image with PIL from binary and then transform it to numpy.So my only problem is now how to get the jpeg images into a fuel compatible h5py. Reading the binary is easy:
But I can not manage the save it in h5py. If I do:
I get the following error
If I change line 3 to
dt = h5py.special_dtype(vlen=bytes)
then I getValueError: VLEN strings do not support embedded NULLs
like in http://docs.h5py.org/en/latest/strings.html#variable-length-ascii. But avoiding nulls is not possible in a binary string from jpeg images.Also changing the last line to
dset[0] = np.void(binary_data)
seems not to help (was suggested here: http://docs.h5py.org/en/latest/strings.html#how-to-store-raw-binary-data).I in general I tried lots/all different things and combinations from this 3 tutorials:
http://docs.h5py.org/en/latest/special.html
http://docs.h5py.org/en/latest/strings.html
http://fuel.readthedocs.io/en/latest/h5py_dataset.html#variable-length-data
It would be great if anyone could hint me to the correct solution.
Thanks a lot,
Markus
The text was updated successfully, but these errors were encountered: