My question may sound easy, however, I have difficulty in creating an Hdf5 dataset from my 3d medical images that have been saved in nii format for both images and manual segmentation (label files). My questions are:
- The blob shape in
pycaffeisN*C*W*H, is it different order in matcaffe? for example in pycaffe the data blob shape will be1*1*60*320*320for a grayscale volume with width and height 320-by-320 and 60 slices. I tried to use aMatlabcode to create HDF5 dataset for the 3D data, and the order of blob inhdf5infofile is320*320*60*1*1for bothdataandlabel. How should I change the orders in the Matlab code to be readable in Pycaffe? - Is there any python code for creating the hdf5 database for 3D data?
- if I create the hdf5 data in Matlab and use the list the pycaffe, will it raise issue?
Thanks
Matlab arranges elements in ND arrays from the first dimension to the last (like fortran), while caffe and hdf5 stores the arrays from last dimension to first ("col-major").
This answer explains how to simply modify Matlab's code to write "col-major" arrays to HDF5 files.
You might also find this answer useful for your problem.