我在hdf5中存储浮点值,但caffe说数据类型类:H5T\u INTEGER

2024-03-28 09:33:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在将文件写入hdf5.0文件,如下所示:

image = np.zeros( (split, 1, IMAGE_SIZE, IMAGE_SIZE), dtype=np.float )

img = img.astype(np.float)
image[counter] = img[np.newaxis, :, :]
....
H.create_dataset( 'data', data=image)

我在caffe里收到输出:

I0828 09:25:57.495980 21298 hdf5_data_layer.cpp:79] Loading list of HDF5 filenames from: train_h5_list.txt
I0828 09:25:57.509590 21298 hdf5_data_layer.cpp:93] Number of HDF5 files: 8259
I0828 09:25:57.566036 21296 hdf5_data_layer.cpp:79] Loading list of HDF5 filenames from: train_h5_list.txt
I0828 09:25:57.879372 21296 hdf5_data_layer.cpp:93] Number of HDF5 files: 8259
I0828 09:25:58.406316 21297 hdf5_data_layer.cpp:79] Loading list of HDF5 filenames from: train_h5_list.txt
I0828 09:25:58.418432 21297 hdf5_data_layer.cpp:93] Number of HDF5 files: 8259
I0828 09:26:02.211232 21262 solver.cpp:273] Solving train
I0828 09:26:02.211280 21262 solver.cpp:274] Learning Rate Policy: fixed
I0828 09:26:02.214079 21262 solver.cpp:331] Iteration 0, Testing net (#0)
I0828 09:26:18.361723 21262 hdf5.cpp:35] Datatype class: H5T_INTEGER

编辑

当使用as.type('f4')时,它看起来是这样的:

h5ls train2102.h5

data                     Dataset {100, 1, 256, 256}
volume                   Dataset {100, 128, 128, 128}

有了-v,它看起来是这样的:

data                     Dataset {100/100, 1/1, 256/256, 256/256}
Location:  1:800
Links:     1
Storage:   26214400 logical bytes, 26214400 allocated bytes, 100.00% utilization
Type:      native float
volume                   Dataset {100/100, 128/128, 128/128, 128/128}
Location:  1:1400
Links:     1
Storage:   838860800 logical bytes, 838860800 allocated bytes, 100.00% utilization
Type:      native float

现在看起来好多了!你知道吗


Tags: ofimagelayerdatabytesnptrainfloat