Training for a multi label loss using lmdb

1,179 views
Skip to first unread message

sukrit shankar

unread,
May 4, 2015, 5:04:21 PM5/4/15
to caffe...@googlegroups.com

I wish to train AlexNet with Cross Entropy Loss, for which every input has multiple label probabilities. Till now, I have been doing this using an HDF5 layer. However, one has to do all sorts of manual pre processing and access to this layer is around twice as slow as that to lmdb.

In view of the above, I wish to know how can one train for a multi label loss using an lmdb layer in caffe. More precisely, what should be done in train.txt so that one can specify multiple labels for a given image ?

npit

unread,
May 5, 2015, 4:28:12 AM5/5/15
to caffe...@googlegroups.com
bumping this.

Guillem C

unread,
May 5, 2015, 6:23:00 AM5/5/15
to caffe...@googlegroups.com
As far as I know, which is not much, when a LMDB database is created what Caffe does is to store datums in string format, which means that what we have in the database are a bunch of datums.

Datums, as seen in proto, can only have one label, so a lot of work should be done to make Caffe capable of storing and understanding datums with multiple labels.

Correct me if I'm wrong, but I think that the easiest way is to create one LMDB file to store the images and a HDF5 file to store the labels. Of course the images should be ordered in the same way in both LMDB and HDF5 files. The input data to train the net should be taken from the LMDB file and the labels to compute loss should be the ones stored in the HDF5 file.

Travis

unread,
Jun 19, 2015, 2:51:28 PM6/19/15
to caffe...@googlegroups.com
Hey,

Did you find a solution for multi-label using lmdb?

Axel Angel

unread,
Jun 19, 2015, 5:31:38 PM6/19/15
to caffe...@googlegroups.com
Correct me if I'm wrong, but I think that the easiest way is to create one LMDB file to store the images and a HDF5 file to store the labels. Of course the images should be ordered in the same way in both LMDB and HDF5 files. The input data to train the net should be taken from the LMDB file and the labels to compute loss should be the ones stored in the HDF5 file.

Why not two LMDB files: data + labels (don't use real label field)? Or a single HDF5 file. 

Tiêu Phong Võ Đình

unread,
Jul 7, 2015, 4:11:55 AM7/7/15
to caffe...@googlegroups.com
Hi Axel,

Could you elaborate on your idea? How can caffe read the two lmdb files and combine them ? THanks.

Axel Angel

unread,
Jul 9, 2015, 2:25:36 PM7/9/15
to caffe...@googlegroups.com
If you add two DataLayer they should both provide one input during a forward-pass. Then you can do what you want with the two "input"s. Take a look at the layer catalog of caffe.

Muneeb Shahid

unread,
Dec 27, 2015, 2:57:53 PM12/27/15
to Caffe Users
The issue with this is you cant shuffle the data on the go.
Reply all
Reply to author
Forward
0 new messages