Error : H5LTfind_dataset(file_id, dataset_name_) Failed to find HDF5 dataset label

Error : H5LTfind_dataset(file_id, dataset_name_) Failed to find HDF5 dataset label

我想使用 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 unit8 并且 label 是 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 }
}

我不知道我哪里做错了,如果有人能帮助我就太好了!

您的 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]);

请参阅了解更多详情。另请注意,在使用 matlab 将输入数据保存到 hdf5 之前,您可能需要 permute 输入数据。