HDF5 data and label dimensions for time series prediction

553 views
Skip to first unread message

François Le Lay

unread,
Nov 6, 2014, 2:04:46 PM11/6/14
to caffe...@googlegroups.com
Hi,

I am working on a time series classification topic and need help building my HDF5 input.

for the "data" dataset
One single example of my training set is made of 3 vectors of length 4096, each vector being a normalized time series.
If we transposed this in the image recognition space it would be like training from RGB images of height=1 and width=4096.

What is the shape expected by the HDF5_DATA layer ?
My initial assumption was the expected dimensions are N x K x H x W : N examples of K channels of height H and width W. Is that correct or not ?
So in my case it would be 300,000 x 3 x 1 x 4096

I'm a bit confused because I read elsewhere that N vectors of length 1000 are represented as a N x 1000 x 1 x 1 tensor.
If that is true then the correct dimensions for my input would then be something like 300,000 x 4096 x 3 x 1

Which approach seems correct to you ?

for the "label" dataset
The predicted label can take 500 different values.

Again what are the expected dimensions of my input layer ?
I could go for N x 1 x 1 x 1 and for each example only store the single float value that is my label or,
I could go for N x 500 x 1 x 1 and store a vector of probabilities with the correct label index set to 1 and all other values set to 0.

Thanks for your help,
François



François Le Lay

unread,
Nov 7, 2014, 10:36:48 AM11/7/14
to caffe...@googlegroups.com
I figured this out.

The top shapes I was expecting are properly loaded (batch size = 32, 3 channels, height 1, width 4096):

I1107 09:04:27.160989 2044195600 hdf5_data_layer.cpp:63] Loading list of HDF5 filenames from: ./h5v.txt

I1107 09:04:27.161015 2044195600 hdf5_data_layer.cpp:77] Number of HDF5 files: 1

I1107 09:04:27.240342 2044195600 net.cpp:103] Top shape: 32 3 1 4096 (393216)

I1107 09:04:27.240365 2044195600 net.cpp:103] Top shape: 32 1 1 1 (32)

The trick was to build the HDF5 file with dimensions in reverse order :

R> h5ls('./data/7/micro_t7.h5')
  group  name       otype dclass                dim
0     /  data H5I_DATASET  FLOAT 4096 x 1 x 3 x 256
1     / label H5I_DATASET  FLOAT            1 x 256

Ildoo Kim

unread,
Dec 14, 2014, 5:15:49 AM12/14/14
to caffe...@googlegroups.com
Just from curiosity.

How can you design your layers of model?
Reply all
Reply to author
Forward
0 new messages