Unknown bottom blob 'data' (layer 'conv1', bottom index 0)

1,090 views
Skip to first unread message

Sharp Weapon

unread,
Oct 6, 2016, 1:04:51 AM10/6/16
to Caffe Users
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.txt"
    batch_size: 32
    }
    include{phase: TRAIN}
}
  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
    }
  }
  layer {
    name: "conv2"
    type: "convolution"
    bottom: "pool1"
    top: "conv2"
    param {lr_mult:1}
    param {lr_mult:2}
   
    convolution_param{
    num_output: 50
    kernel_h: 1
    kernel_w: 5
    stride_h: 1
    stride_w: 1
    weight_filler {
      type: "xavier"
     
    }
    bias_filler {
      type: "xavier"
     
    }
    }
  }

  layer {
    name: "pool2"
    type: "pool"
    bottom: "conv2"
    pooling_param{
       pool: MAX
       kernel_h: 1
       kernel_w: 2
       stride_h: 1
       stride_w: 2
    }
  }

  layer {
    name: "ip1"
    type: "innerproduct"
    bottom: "pool2"
    top: "ip1"
    param {lr_mult:1}
    param {lr_mult:2}
   
    inner_product_param{
        num_output: 4000
        weight_filler {
          type: "xavier"
        }
        bias_filler {
          type: "xavier"
         
        }
  }
 }

  layer {
    name: "relu"
    type: "ReLU"
    bottom: "ip1"
    top: "ip1"
  }
  layer {
    name: "ip2"
    type: "innerproduct"
    bottom: "ip1"
    top: "ip2"
    param {lr_mult:1}
    param {lr_mult:2}
   
    inner_product_param{
        num_output: 1000
        weight_filler {
          type: "xavier"
        }
        bias_filler {
          type: "xavier"
         
        }
  }

   layer{
    name: "loss"
    type: "SigmoidCrossEntropyLoss"
    bottom: "ip2"
    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,

Przemek D

unread,
Oct 6, 2016, 4:41:26 AM10/6/16
to Caffe Users
Your conv1 layer tries to load data from a blob named data, but your data layer outputs only blobs named Inputdata and label. Layer names are just for you, caffe doesn't - as far as I know - use them. Blob names, however, matter, because you refer to blobs not layers when passing bottom and top parameters. So the first error in your network is attempting to access blob named data instead of what you called Inputdata.

Another error (although caffe hasn't told you yet) is in the pool2 layer definition - you forgot to create a top blob for ip1 to receive as its bottom.

Last but not least, your loss layer should receive two bottom blobs - after all, you compute loss in relation to some known data, most likely label.

Sharp Weapon

unread,
Oct 6, 2016, 12:29:03 PM10/6/16
to Caffe Users
Thanks for your answer. I fixed all of them and and now I am having "...Check failed: num_spatial_axes_ == 2 (0 vs. 2) kernel_h & kernel_w can only be used for 2D convolution" error. A single InputData is 1x3000 and I have 100 of those for now. Each single InputData entry has one label so my label shape is 1x100. 

Przemek D

unread,
Oct 7, 2016, 4:40:00 AM10/7/16
to Caffe Users
I suppose your data is of the wrong shape. Caffe expects a 4D blob at the input, made of (batch_size) of 3D blobs. I'm not sure about HDF5 labels though, I suppose they can be anything up to that size, but also follow that scheme: 1-, 2-, or 3D data piece, batched along another dimension. That error seems to suggest that your input has too few dimensions and caffe doesn't know how to convolve with it... as if you had a 2D blob instead of 4D, hence a 1D "image" to work with. Are you sure your data is 3D, in this case 1x1x3000, instead of 1D (just 3000)? I think it should be.
Reply all
Reply to author
Forward
0 new messages