问题
My data set is a HDF5 file consists of data
with shape [129028,1,12,1024]
and label
of shape [129028,1,1,1]
.
But when I run solver.prototxt, I get the error message:
I0413 08:54:34.689985 17769 hdf5.cpp:32] Datatype class: H5T_FLOAT F0413 08:54:40.661201 17769 hdf5_data_layer.cpp:53] Check failed: hdf_blobs_[i] ->shape(0) == num (1 vs. 1024) *** Check failure stack trace: ***
回答1:
It looks like you saved your hdf5 from matlab, rather than python (judging by your previous question).
When saving data from Matlab one has to remember that Matlab stores multi-dimensions arrays in memory in colums-first fashion (fortran style), while python, caffe and many other applications expects multi-dimension arrays in row-first fashion (C style).
Thus, you need to permute
the data in matlab before saving it to hdf5 for caffe. See this answer for more details.
I suspect that if you run h5ls
in shell on the hdf5 file you stored you'll notice that the shape of the stored arrays are actually
data [1024, 12, 1, 129028]
label [1, 1, 1, 129028]
来源:https://stackoverflow.com/questions/36601019/datatype-class-h5t-float-f0413-085440-661201-17769-hdf5-data-layer-cpp53-ch