1

Newbie to caffe here.
I am trying to replicate LeNet on my own dataset. My training data is a 1D data which can be represented as 1x3000 vector. For each 1x3000 vector I have a label which is another 1D vector of 1x64 dimension binary vector. I have 100 thousands of such (data, label) data. I am confused how I can feed this to Caffe. All the examples out there are for images of dimension NxN.

Any idea how this data can be per-processed to be fed to Caffe?

I was thinking of zero-padding the vector and make it n(zero-padding)xN, but it doesn't seem the right way. Also could slicing the 1x3000 vector into 1xn and stacking them up to form an mxn matrix be a solution? Has anyone done this before?

Any suggestion is appreciated.

Shai
  • 111,146
  • 38
  • 238
  • 371
user2413711
  • 85
  • 2
  • 12

1 Answers1

0

Caffe can easily deal with 1D data, both for "data" and "label".
I suppose the most straight forward way to feed the data to caffe is using hdf5 format files. You can have the data in binary hdf5 data files with 'data' and 'label' datasets. Then you can feed the data to caffe using "HDF5Data" layer.

Graham
  • 7,431
  • 18
  • 59
  • 84
Shai
  • 111,146
  • 38
  • 238
  • 371
  • Thanks Shai for your suggestion. I have a few follow up questions. 1. So, in that case all my kernels for both convolutional and pooling layers will also be 1xN dimensions right? Is that also supported by caffe? 2. My 'labels' are really long so I am kinda worried if that will cause a bad result later. For one 1x3000 data I have 64(may increase to 128) binary vector label. This is not like the data belongs to 64 different classes(as I have seen some suggested solutions for multilabels). One label can be anything in the 2^64 space and it is specific to one 1x3000 data. Any suggestion here? – user2413711 Oct 05 '16 at 15:01
  • @user2413711 (1) Yes, you should use `kernel_w` and `kernel_h` to specify non rectangle kernel (see [`caffe.proto`](https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto#L556) for details). (2) You need to use the appropriate loss layer. For binary labels I suppose you can check [`"SigmoidCrossEntropyLoss"`](http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1SigmoidCrossEntropyLossLayer.html) layer. – Shai Oct 05 '16 at 15:09