Multi-label classification with LMDB

1,377 views
Skip to first unread message

Dieterich Lawson

unread,
Aug 17, 2015, 9:02:16 PM8/17/15
to Caffe Users
I'd like to do multi-label classification using an LMDB. Are there any examples of this beyond this link on github?

https://github.com/BVLC/caffe/issues/1698#issuecomment-70211045

If I understand correctly, what Evan is suggesting is to make 2 LMDBs -- one with the images and one with the ground truth, ensuring that the ground truth and images have the same ID in the database. So, assuming I used Evan's python and correctly created the LMDBs then would the prototxt look something like this?

layer {
  name: "data"
  type: "Data"
  top: "data"
  include: {
    phase: TRAIN
  }
  data_param {
    source: "../../data/train"
    batch_size: 50
    backend: LMDB
  }
... 
}

layer {
  name: "label"
  type: "Data"
  top: "label"
  include: {
    phase: TRAIN
  }
  data_param {
    source: "../../data/train"
    batch_size: 50
    backend: LMDB
  }
... 
}

... middle layers through fc8 ...
 
layer {
  name: "loss"
  type: "SigmoidCrossEntropyLoss"
  bottom: "fc8"
  bottom: "label"
  top: "loss"
 
With 2 more similar input LMDBs for the test set, for a grand total of 4 LMDBs?


 
 

Jia Li

unread,
Aug 18, 2015, 8:48:23 AM8/18/15
to Caffe Users
This is exactly what you need to do... however, you need to implement your own accuracy layer or get it from a PR

Coen Stevens

unread,
Sep 8, 2015, 11:04:33 AM9/8/15
to Caffe Users
Has anyone tried this out and has an example he or she could share, including the accuracy layer?

There is a long list of pull requests (see below) around multi-label classification that eventually ends up in https://github.com/BVLC/caffe/issues/1698 saying it is only a documentation / example issue.
Is this truly the case and is there an accuracy layer available in master for multi-label classification (in combination with LMDB input data)? 

Hopefully someone could add an example to master, because I would love to be able to do multi-label (1000+ labels) classification with LMDB (avoiding HDFS).

Thank you in advance.


https://github.com/BVLC/caffe/issues/144 => Multi label data layer
=> https://github.com/BVLC/caffe/issues/149 Implement MultiLabel losses and data input
=> https://github.com/BVLC/caffe/pull/523 => Multi label Data and MultiLabel Accuracy
Closing this PR since it is against the defunct dev branch and we concluded that losses and layers are capable of handling multilabel problems so this is a documentation / example issue and not a technical problem that needs further layers.
=> https://github.com/BVLC/caffe/issues/1698 Make a matrix output and ground truth example (segmentation, sliding window detection, etc.)

Gavin Hackeling

unread,
Sep 13, 2015, 4:34:47 PM9/13/15
to Caffe Users
An example network definition for a multi-label classifier would be great. I'd be happy to contribute a more detailed walkthrough for multi-label classification with LMDBs once I have an experiment running; I'm blocked now on the net definition.

Echo

unread,
Oct 17, 2015, 6:35:10 PM10/17/15
to Caffe Users
Hi Jia,

Do you know how to implement accuracy layer for multi-label classification? Right now, I use slice layer to slice fc8, for example, alex net, and feed each output node into an accuracy layer, is it right?
Thanks!

在 2015年8月18日星期二 UTC-4上午8:48:23,Jia Li写道:
Reply all
Reply to author
Forward
0 new messages