错误:H5LTfind_dataset(file_id,dataset_name_)无法找到HDF5数据集标签

时间:2016-07-13 09:52:03

标签: matlab deep-learning hdf5 caffe conv-neural-network

我想使用HDF5文件在我的CNN中输入我的数据和标签。 我用matlab创建了hdf5文件。

这是我的代码:

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);`

imageanno为4D unit8label为1x85 unit16向量。

当我显示我的.h5文件时,我得到了这个:

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读取标签数据集时,它可以正常工作。

但是当我尝试训练我的网络时,我收到了这个错误:

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文件中:

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 }
}

我不知道我做错了什么,如果有人能帮我,那就太好了!

1 个答案:

答案 0 :(得分:1)

您的hdf5文件'uNetDataSet.h5'中没有label 你所拥有的是'/home/alexandra/Documents/my-u-net/warwick_dataset/Warwick_Dataset/label' - 我希望你能发现差异。

尝试使用

创建数据集
h5create(['uNetDataSet.h5'],'/image',[522 775 3 numFrames]);
h5create(['uNetDataSet.h5'],'/anno',[522 775 3 numFrames]);
h5create(['uNetDataSet.h5'],'/label',[1 numFrames]);

有关详细信息,请参阅this answer。另请注意,在使用matlab将输出数据保存到hdf5之前,您可能需要permute输入数据。