问题描述
我想使用HDF5文件在CNN中输入数据和标签.我用matlab创建了hdf5文件.
I want to use HDF5 file to input my data and labels in my CNN.I created the hdf5 file with matlab.
这是我的代码:
h5create(['uNetDataSet.h5'],'/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/train/image',[522 775 3 numFrames]);
h5create(['uNetDataSet.h5'],'/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/train/anno',[522 775 3 numFrames]);
h5create(['uNetDataSet.h5'],'/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/label',[1 numFrames]);`
h5write(['uNetDataSet.h5'],'/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/train/image',images);
h5write(['uNetDataSet.h5'],'/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/train/anno',anno);
h5write(['uNetDataSet.h5'],'/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/label',label);`
其中image
,anno
是4D unit8
并且label
是1x85 unit16
向量.
Where image
, anno
are 4D unit8
and label
is a 1x85 unit16
vector.
当我显示.h5文件时,我得到了:
When I display my .h5 file I got this:
HDF5 uNetDataSet.h5
Group '/'
Group '/home'
Group '/home/alexandra'
Group '/home/alexandra/Documents'
Group '/home/alexandra/Documents/my-u-net'
Group '/home/alexandra/Documents/my-u-net/warwick_dataset'
Group '/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset'
Dataset 'label'
Size: 1x85
MaxSize: 1x85
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Group '/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/train'
Dataset 'anno'
Size: 522x775x3x85
MaxSize: 522x775x3x85
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'image'
Size: 522x775x3x85
MaxSize: 522x775x3x85
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000`
当我使用h5read
读取标签数据集时,它会起作用.
When I read the label dataset with h5read
it works.
但是当我尝试训练我的网络时,出现此错误:
But when I try to train my network I got this error:
I0713 09:47:18.620510 4278 layer_factory.hpp:77] Creating layer loadMydata
I0713 09:47:18.620535 4278 net.cpp:91] Creating Layer loadMydata
I0713 09:47:18.620550 4278 net.cpp:399] loadMydata -> label
I0713 09:47:18.620580 4278 net.cpp:399] loadMydata -> anno
I0713 09:47:18.620600 4278 net.cpp:399] loadMydata -> image
I0713 09:47:18.620622 4278 hdf5_data_layer.cpp:79] Loading list of HDF5 filenames from: /home/alexandra/Documents/my-u-net/my_data.txt
I0713 09:47:18.620656 4278 hdf5_data_layer.cpp:93] Number of HDF5 files: 1
F0713 09:47:18.621317 4278 hdf5.cpp:14] Check failed: H5LTfind_dataset(file_id, dataset_name_) Failed to find HDF5 dataset label
*** Check failure stack trace: ***
@ 0x7f2edf557daa (unknown)
@ 0x7f2edf557ce4 (unknown)
@ 0x7f2edf5576e6 (unknown)
@ 0x7f2edf55a687 (unknown)
@ 0x7f2edf908597 caffe::hdf5_load_nd_dataset_helper<>()
@ 0x7f2edf907365 caffe::hdf5_load_nd_dataset<>()
@ 0x7f2edf9579fe caffe::HDF5DataLayer<>::LoadHDF5FileData()
@ 0x7f2edf956818 caffe::HDF5DataLayer<>::LayerSetUp()
@ 0x7f2edf94fcbc caffe::Net<>::Init()
@ 0x7f2edf950b45 caffe::Net<>::Net()
@ 0x7f2edf91d08a caffe::Solver<>::InitTrainNet()
@ 0x7f2edf91e18c caffe::Solver<>::Init()
@ 0x7f2edf91e4ba caffe::Solver<>::Solver()
@ 0x7f2edf930ed3 caffe::Creator_SGDSolver<>()
@ 0x40e67e caffe::SolverRegistry<>::CreateSolver()
@ 0x40794b train()
@ 0x40590c main
@ 0x7f2ede865f45 (unknown)
@ 0x406041 (unknown)
@ (nil) (unknown)
Aborted (core dumped)
在我的.prototxt文件中:
In my .prototxt file :
layer {
top: 'label'
top:'anno'
top: 'image'
name: 'loadMydata'
type: "HDF5Data"
hdf5_data_param { source: '/home/alexandra/Documents/my-u-net/my_data.txt' batch_size: 1 }
include: { phase: TRAIN }
}
我不知道我在哪里做错了什么,如果有人可以帮助我,那就太好了!
I don't know where I did something wrong, if anyone could help me it would be great !
推荐答案
您的hdf5文件'uNetDataSet.h5'
中没有label
.
相反,您拥有的是'/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/label'
-我希望您能发现差异.
your hdf5 file 'uNetDataSet.h5'
does not have label
in it.
What you have instead is '/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/label'
- I hope you can spot the difference.
尝试使用创建数据集
h5create(['uNetDataSet.h5'],'/image',[522 775 3 numFrames]);
h5create(['uNetDataSet.h5'],'/anno',[522 775 3 numFrames]);
h5create(['uNetDataSet.h5'],'/label',[1 numFrames]);
有关更多详细信息,请参见此答案.另外请注意,在使用matlab将输入数据保存到hdf5之前,可能需要先permute
输入数据.
Please see this answer for more details. Also note that you might need to permute
the input data before saving it to hdf5 using matlab.
这篇关于错误:H5LTfind_dataset(file_id,dataset_name_)未能找到HDF5数据集标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!