0

Trying to train LeNet on my own dataset. I generated HDF5 file from my long 1D vectordata set and created HDF5 data layer as follows: I named the top blobs same as I did when I generate my HDF5.

name: "Test_net"
layer {
  name: "data"
  type: "HDF5Data"
  top: "Inputdata"
  top: "label"
  hdf5_data_param {
    source:"~/*_hdf5_train.txt"
    batch_size: 32
  }
  include{phase: TRAIN}
}
layer {
  name: "data2"
  type: "HDF5Data"
  top: "Inputdata"
  top: "label"
  hdf5_data_param {
    source:"~/*_hdf5_test.txt"
    batch_size: 32
  }
  include{phase: TEST}
}
layer {
  name: "conv1"
  type: "convolution"
  bottom: "data"
  top: "conv1"
  param {lr_mult:1}
  param {lr_mult:2}
  convolution_param{
    num_output: 20
    kernel_h: 1
    kernel_w: 5
    stride_h: 1
    stride_w: 1
    weight_filler {
      type: "xavier"     
    }
    bias_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "pool1"
  type: "pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param{
    pool: MAX
    kernel_h: 1
    kernel_w: 2
    stride_h: 1
    stride_w: 2
  }
}
# more layers here...
layer{
  name: "loss"
  type: "SigmoidCrossEntropyLoss"
  bottom: "ip2"
  bottom: "label"
  top: "loss"
}

But then when I tried to train I am having the following error from insert_split.cpp.

insert_splits.cpp:29] Unknown bottom blob 'data' (layer 'conv1',   bottom     index 0)
  *** Check failure stack trace: ***
  @     0x7f19d7e735cd  google::LogMessage::Fail()
  @     0x7f19d7e75433  google::LogMessage::SendToLog()
  @     0x7f19d7e7315b  google::LogMessage::Flush()
  @     0x7f19d7e75e1e  google::LogMessageFatal::~LogMessageFatal()
  @     0x7f19d82684dc  caffe::InsertSplits()
  @     0x7f19d8230d5e  caffe::Net<>::Init()
  @     0x7f19d8233f21  caffe::Net<>::Net()
  @     0x7f19d829c68a  caffe::Solver<>::InitTrainNet()
  @     0x7f19d829d9f7  caffe::Solver<>::Init()
  @     0x7f19d829dd9a  caffe::Solver<>::Solver()
  @     0x7f19d8211683  caffe::Creator_SGDSolver<>()
  @           0x40a6c9  train()
  @           0x4071c0  main
  @     0x7f19d6dc8830  __libc_start_main
  @           0x4079e9  _start
  @              (nil)  (unknown)
 Aborted (core dumped)

What did I do wrong?

Cheers,

user2413711
  • 85
  • 2
  • 12
  • Possible duplicate of [Caffe Unknown bottom blob](http://stackoverflow.com/questions/38730972/caffe-unknown-bottom-blob) – Shai Oct 06 '16 at 05:25

1 Answers1

1

Your data layer outputs two "blobs": "label" and "Inputdata". Your "conv1" layer expects as input a "blob" named "data". Caffe does not know that you meant "Inputdata" and "data" to be the same blob...
Now, since you already saved the hdf5 files with "Inputdata" name, you cannot change this name in the "HDF5Data" layer, what you can do is change "data" to "Inputdata" in the "bottom" of "conv1" layer.


PS,
Your loss layer requires two "bottom"s: ip2 and label you forgot to feed.

Shai
  • 111,146
  • 38
  • 238
  • 371
  • Appreciate your help, Shai. I actually was trying to do training without testing, just to see if my network starts training. For that I had #test_iter and #test_interval commented. Now I tried both training with and without testing(copy of training set as testing set, it shouldn't matter I guess) and I am having the same issue. I also added label to my loss layer, please see the edited prototxt. – user2413711 Oct 06 '16 at 08:18
  • That worked thanks. Now I am having ....hdf5_data_layer.cpp:88] Failed to open source file: ~/*_hdf5_train.txt error. – user2413711 Oct 06 '16 at 08:53
  • 1
    @user2413711 you cannot have wildcard (`"*"`) in the `path` of the hdf5 list file. you should have a **single** text file that lists all the paths to the binary hdf5 files you are using as train/test. – Shai Oct 06 '16 at 08:55
  • Yeah, that is just not to post my actual path here, I have an absolute path like source: "/A/B/C/D/test_hdf5_train.txt" – user2413711 Oct 06 '16 at 09:00
  • @user2413711 make sure your path is correct. the error message is quite clear: caffe cannot open "/A/B/C/D/test_hdf5_train.txt". make sure the file is indeed there and that you grant read permission to the file. – Shai Oct 06 '16 at 09:02
  • I am having this error now....layer_factory.hpp:77] Creating layer conv1 F1006 04:26:07.040401 11022 layer_factory.hpp:81] Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer type: convolution (known types: AbsVal, Accuracy, ArgMax, BNLL, BatchNorm, BatchReindex, Bias, Concat, ContrastiveLoss, Convolution, Crop, Data, Deconvolution, Dropout, DummyData, ELU, Eltwise, Embed, EuclideanLoss, Exp, Filter, Flatten, HDF5Data, HDF5Output, HingeLoss, Im2col, ImageData, InfogainLoss, InnerProduct, Input, LRN, LSTM, LSTMUnit, Log, MVN, MemoryData, MultinomialLogisticLoss, PReLU... – user2413711 Oct 06 '16 at 09:27
  • 1
    @user2413711 it's `"Convolution"` with capital "C" – Shai Oct 06 '16 at 09:30
  • This one followed up: Check failed: num_spatial_axes_ == 2 (0 vs. 2) kernel_h & kernel_w can only be used for 2D convolution. – user2413711 Oct 06 '16 at 09:36
  • @user2413711 what is the shape of `Inputdata`? – Shai Oct 06 '16 at 09:41
  • 100x3000 and label 1x100, this is just for a test. My actual data will be very large Nx3000 – user2413711 Oct 06 '16 at 09:46
  • @user2413711 please ask a new question. it's too broad for a comment – Shai Oct 06 '16 at 09:55