本文介绍了数据类型类:H5T_FLOAT F0413 08:54:40.661201 17769 hdf5_data_layer.cpp:53]检查失败:hdf_blobs_ [i]-& gt; shape(0)== num(1与1024)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据集是一个HDF5文件,由形状为[129028,1,12,1024]data和形状为[129028,1,1,1]label组成.但是,当我运行Solver.prototxt时,出现错误消息:

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: ***

推荐答案

似乎您是从matlab中保存了hdf5的,而不是从python保存的(由您的).
从Matlab保存数据时,必须记住Matlab以colums-first的方式(fortran风格)将多维数组存储在内存中,而python,caffe和许多其他应用程序期望以row-first的方式(C风格)存储多维数组. .
因此,您需要先在matlab中permute将该数据保存到caffe的hdf5中.有关更多详细信息,请参见此答案.

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.

我怀疑如果在存储的hdf5文件的shell中运行h5ls,您会注意到存储的数组的形状实际上是

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]

这篇关于数据类型类:H5T_FLOAT F0413 08:54:40.661201 17769 hdf5_data_layer.cpp:53]检查失败:hdf_blobs_ [i]-& gt; shape(0)== num(1与1024)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 02:02