Feeding long 1D vector data, 1D vector label to Caffe

221 views
Skip to first unread message

Sharp Weapon

unread,
Oct 4, 2016, 9:53:10 PM10/4/16
to Caffe Users
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.


New Caffe User

unread,
Oct 5, 2016, 7:27:17 PM10/5/16
to Caffe Users
Hi,

Is the input an image? LeNet is convolution neural network. I dont think it can perform for a data set which is not an image (2d data). What is the structure of your 1D input?

Thanks

Przemek D

unread,
Oct 6, 2016, 4:22:42 AM10/6/16
to Caffe Users
Cutting and stacking your data isn't the right way to approach this, most likely. Remember, convolutions find spatial features in data - for images, two neighboring pixels (no matter if one's left/right of the other or above/below it) are related, so a 2D convolution makes sense. If you stacked your data the way you suggested, pixels in the same rows would still be related (as they are now - assuming your data is some kind of signal, for example in time domain), but within columns they wouldn't; so a 2D convolution wouldn't make much sense column-wise.

Fortunately, convolution over 1D data is perfectly legal. There should also be no technical problem with training a CNN on 1x3000 data. It can still be considered a 2D mxn image, but a very thin one - with m=1 and n=3000, so you can create a dataset as you normally would. You cannot, however, use the standard LeNet setup on this kind of data, because it is designed to deal with 28x28 inputs. You'd have to write your own network architecture with 1D (specifically: 1xK) kernels.
Reply all
Reply to author
Forward
0 new messages