0

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: ***
Shai
  • 111,146
  • 38
  • 238
  • 371
Zhao Wulanaren
  • 161
  • 1
  • 2
  • 9
  • please run in shell `h5ls` to see the actual shape of your stored arrays – Shai Apr 13 '16 at 15:31
  • Possible duplicate of [\[caffe\]: check fails: Check failed: hdf\_blobs\_\[i\]->shape(0) == num (200 vs. 6000)](http://stackoverflow.com/questions/34418027/caffe-check-fails-check-failed-hdf-blobs-i-shape0-num-200-vs-6000) – Shai Apr 13 '16 at 15:39

1 Answers1

2

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]
Community
  • 1
  • 1
Shai
  • 111,146
  • 38
  • 238
  • 371