How to use HDF5 data type

3,243 views
Skip to first unread message

Catherine

unread,
Jan 20, 2015, 5:19:37 AM1/20/15
to caffe...@googlegroups.com

Hi Guys, 

I want to use caffe to  extract convolutional feature on multispectral images, but I don`t know how to transfer them into hdf5 format that is supported by Caffe. Specifically, my images are 500*800 (height*width), and each image has 6 channels. The dataset has 9000 images for training, and 1000 images for test. They are belong to 7 classes.

I have two questions:
1. Should I package all 9000 images into one .h5 file?
2. In the 'train.h5' file, the dimention size of 'label' dataset is [7 x 1], and the 'data' dataset is [9000 x 6 x 800 x 500] , is that right ?

Thank you very much !

Evan Shelhamer

unread,
Jan 20, 2015, 12:56:40 PM1/20/15
to Catherine, caffe...@googlegroups.com
Hi,

For multispectral images of this resolution, I suggest preparing your data in LMDB instead of HDF5 for faster IO. Here is an example of how to make a custom LMDB by Python: https://github.com/BVLC/caffe/issues/1698#issuecomment-70211045. The channel dimension of the input can be anything, so your hyperspectral images will be fine.

For HDF5, there is a MATLAB example that was recently submitted: https://github.com/BVLC/caffe/pull/1746. The data dimensions in the h5 will be 9000 x 6 x 500 x 800 because height comes before width. The label dimension will actually be 9000 x 1 x 1 x 1 where the value is the label in {0, ..., 6}.

Happy brewing,

Evan Shelhamer

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/e66fd214-556a-4ee6-8600-d892ef4b4361%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fahimeh

unread,
Jul 2, 2015, 12:22:27 AM7/2/15
to caffe...@googlegroups.com
Hi Catherine,

Could you explain me how you import your data in 6 channels to Caffe? using which format?
How did you generate your own lmdb from 6-channel data?

Thank you so much
Reply all
Reply to author
Forward
0 new messages