Slight modification of the latest caffe (forked in Feb 2017), and extend the ImageData layer to multi-label inputs.
You could specify your network prototxt as:
name: "multi-class-alexnet"
layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mirror: true
crop_size: 227
mean_file: "../../data/ilsvrc12/imagenet_mean.binaryproto"
}
image_data_param {
source: "file-list.txt"
batch_size: 10
new_height: 256
new_width: 256
label_size: 4 # specify the number of labels
}
}
Then, the contend of file-list.txt
are:
imgs1.jpg 1 1 -1 -1
imgs2.jpg 1 1 -1 -1
imgs3.jpg 1 1 -1 -1
imgs4.jpg 1 1 -1 0
imgs5.jpg 1 0 0 -1
You could also find a toy example at /examples/multi-label-train
. Note that you can indicate the label as "don't care" by setting label to 0
.
Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by the Berkeley Vision and Learning Center (BVLC) and community contributors.
Check out the project site for all the details like
- DIY Deep Learning for Vision with Caffe
- Tutorial Documentation
- BVLC reference models and the community model zoo
- Installation instructions
and step-by-step examples.
Please join the caffe-users group or gitter chat to ask questions and talk about methods and models. Framework development discussions and thorough bug reports are collected on Issues.
Happy brewing!
Caffe is released under the BSD 2-Clause license. The BVLC reference models are released for unrestricted use.
Please cite Caffe in your publications if it helps your research:
@article{jia2014caffe,
Author = {Jia, Yangqing and Shelhamer, Evan and Donahue, Jeff and Karayev, Sergey and Long, Jonathan and Girshick, Ross and Guadarrama, Sergio and Darrell, Trevor},
Journal = {arXiv preprint arXiv:1408.5093},
Title = {Caffe: Convolutional Architecture for Fast Feature Embedding},
Year = {2014}
}