Using vectors as labels for images?

413 views
Skip to first unread message

Bo Moon

unread,
Mar 2, 2016, 6:52:52 AM3/2/16
to Caffe Users
I'm trying to predict vector labels for my images, but I'm not sure how to do this in Caffe. For instance, each of my images is associated with a vector of 5 values, in contrast to the examples on the Caffe page, where each image has only 1 value describing the class. Ideally, I would like to create an ImageData layer with input text file:

/path/img1.png 24 1 2.4 45 32

 
However, the layer documentation doesn't specify if this format is allowed, although I know it can be used for only 1 label. None of the examples on the main site involve vector-valued labels either.

How can I prepare the data or write a prototext definition for the input layer to handle vector labels?



Xi Yin

unread,
Mar 2, 2016, 10:48:16 AM3/2/16
to Caffe Users

You can use hdf5 data which support multiple labels. 
I am using the MATLAB functions provided by caffe to write my hdf5 files. 


在 2016年3月2日星期三 UTC-5上午6:52:52,Bo Moon写道:

Jan C Peters

unread,
Mar 2, 2016, 11:19:22 AM3/2/16
to Caffe Users
It is not possible with the existing layers, but it should be very easy to create a copy of the ImageData layer (both in the source code and the caffe proto) and adjust it to support more than one label. Look at this recent question about almost the same thing: https://groups.google.com/d/topic/caffe-users/mPDvq_9kY9A/discussion

Jan

Bo Moon

unread,
Mar 3, 2016, 8:53:51 AM3/3/16
to Caffe Users
That was really helpful, thanks so much! :)
Reply all
Reply to author
Forward
0 new messages