0

I am quite new in caffe and in deep learning. I want to train my model using the dataset that downloaded from here.

My train data has hdf5 format. It also has following parameters.

{
    "debug": false, 
    "git_revision": "60c477dae59f3d1378568e2ebea054a135683e2f", 
    "height": 128, 
    "no_train_mirrors": false, 
    "output_dir": "/tmp/parse27k_crops_64x128", 
    "output_mode": "hdf5", 
    "padding": 32, 
    "padding_mode": "edge", 
    "parse_path": "/fast_work/sudowe/parse27k", 
    "single_threaded": false, 
    "verbose": false, 
    "width": 64
}

I have following data layer in my train model.

layer {
  name: "data"
  type: "HDF5Data"
  top: "data"
  top: "label"
  hdf5_data_param {
    source: "path_to_caffe/caffe/examples/hdf5_classification/data/train.txt"
    batch_size: 10
  }
   include {
    phase: TRAIN
  }
}

I am getting following error message when i am trying to train my train.hdf5 data which is mentioned in train.txt file.

I1031 11:52:10.185920  8670 layer_factory.hpp:77] Creating layer data
I1031 11:52:10.185933  8670 net.cpp:100] Creating Layer data
I1031 11:52:10.185940  8670 net.cpp:408] data -> data
I1031 11:52:10.185957  8670 net.cpp:408] data -> label
I1031 11:52:10.185971  8670 hdf5_data_layer.cpp:79] Loading list of HDF5 filenames from: path_to_caffe/caffe/examples/hdf5_classification/data/train.txt
I1031 11:52:10.186003  8670 hdf5_data_layer.cpp:93] Number of HDF5 files: 2
F1031 11:52:10.186825  8670 hdf5.cpp:14] Check failed: H5LTfind_dataset(file_id, dataset_name_) Failed to find HDF5 dataset data
*** Check failure stack trace: ***
    @     0x7f231a6a1daa  (unknown)
    @     0x7f231a6a1ce4  (unknown)
    @     0x7f231a6a16e6  (unknown)
    @     0x7f231a6a4687  (unknown)
    @     0x7f231acca607  caffe::hdf5_load_nd_dataset_helper<>()
    @     0x7f231acc93d5  caffe::hdf5_load_nd_dataset<>()
    @     0x7f231ad5172e  caffe::HDF5DataLayer<>::LoadHDF5FileData()
    @     0x7f231ad50548  caffe::HDF5DataLayer<>::LayerSetUp()
    @     0x7f231acaf3ac  caffe::Net<>::Init()
    @     0x7f231acb0235  caffe::Net<>::Net()
    @     0x7f231ae0332a  caffe::Solver<>::InitTrainNet()
    @     0x7f231ae0442c  caffe::Solver<>::Init()
    @     0x7f231ae0475a  caffe::Solver<>::Solver()
    @     0x7f231adf8453  caffe::Creator_SGDSolver<>()
    @           0x40f0fe  caffe::SolverRegistry<>::CreateSolver()
    @           0x408134  train()
    @           0x405b3c  main
    @     0x7f23196adf45  (unknown)
    @           0x4063ab  (unknown)
    @              (nil)  (unknown)

Any kind of help or suggestion will be really appreciated.

MIRMIX
  • 1,052
  • 2
  • 14
  • 40
  • 1
    what "datasets" do you have in `'train.hdf5'` file? you can see this by typing (in bash shell): `h5ls train.hdf5` – Shai Oct 31 '16 at 09:26
  • crops Dataset {27482, 3, 128, 192} labels Dataset {27482, 12} mean Dataset {3, 128, 192} pids Dataset {27482} – MIRMIX Oct 31 '16 at 09:49
  • 1
    Then you cannot have "top" `data`, the only options you have are `"crops"`, `"labels"`, `"mean"` or `"pids"`. See [this answer](http://stackoverflow.com/a/34261942/1714410) for more information. – Shai Oct 31 '16 at 09:50
  • You mean that i should have these lines top: "crops" top: "mean" top: "labels" top: "pids" ? – MIRMIX Oct 31 '16 at 09:53
  • 1
    you don't have to have all these "tops", but you cannot have others. When reading data from HDF5 using "HDF5Data" layer caffe uses the HDF5 dataset name to associate the relevant dataset with the corresponding "top". – Shai Oct 31 '16 at 09:55
  • 1
    Thanks dude, that was really helpful. I appreciate – MIRMIX Oct 31 '16 at 10:41

1 Answers1

4

In caffe input data layer output blob can be only named after the names of datasets inside of the .hdf5 file. My dataset has following structure

crops       Dataset {27482, 3, 128, 192}
labels      Dataset {27482, 12}
mean        Dataset {3, 128, 192}
pids        Dataset {27482}

By the help of @Shai I solve it like this :

layer {
  name: "data"
  type: "HDF5Data"
  top: "crops"
  top: "labels"
  include {
    phase: TRAIN
  }
  hdf5_data_param {
    source: "path_to_caffe/examples/hdf5_classification/data/train.txt"
    batch_size: 64
  }
}
Michał Perłakowski
  • 88,409
  • 26
  • 156
  • 177
MIRMIX
  • 1,052
  • 2
  • 14
  • 40
  • 4
    Please do not vandalize your posts. Once you've posted an answer, you have licensed the content to the Stack Overflow community at large (under the CC-by-SA license). If you would like to disassociate this post from your account, see [What is the proper route for a disassociation request](http://meta.stackoverflow.com/questions/323395/what-is-the-proper-route-for-a-dissociation-request)? – CalvT Jun 08 '17 at 12:41