create hfd5 with float numbers for caffe

2019-07-31 16:54发布

问题:

I want to feed caffe vectors of labels (multi label regression problem), so I have used the following link for creating hdf5 files.
Using this code, I created an image_list.txt which contains path of files and float labels in each line, e.g.

/home/deep/00000.bmp  0.9997 0.0236 -0.0082 -0.0231 0.9980 0.0588 0.0096 -0.0586 0.9982 -0.0046 0.1084 0.3938

but it seems that it only works for integer label.
when I run demo.m the following error comes:

Error using dataread
Trouble reading integer from file (row 1, field 3) ==> .9997 0.0236 -0.0082 -0.0231 0.9980 0.0588 0.

回答1:

If you also use caffe's C++ interface, I would like to share you with this Multitask DataLayer and it supports float typed label vector for regression tasks. Here provides a simple example for learning facial expressions' label distribution which is a vector size of 8.