How to save list of numpy.arrays of different shape with h5py?

拥有回忆 提交于 2019-12-12 12:44:49

问题


I'm saving a large dataset of images (flickr25k dataset) into hdf5 using h5py. However image are different in size, thus I can't create a dataset with shape (nb_images, height, width).

Now I'm using multiple datasets to handle this problem. Thus create_dataset('image1', shape=shape1) , create_dataset('image2', shape=shape2) , etc.

In python we can use a list to save multiple numpy.array with different size easily. I'm wondering if we can do the same thing with h5py, and fetch data with syntax like:

images = h5file.get('images')
images[id_img][:,:]

来源:https://stackoverflow.com/questions/42406376/how-to-save-list-of-numpy-arrays-of-different-shape-with-h5py

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!