How to generate the lmdb from label in VOC for Segmentation task?

589 views
Skip to first unread message

john1...@gmail.com

unread,
Jan 3, 2017, 5:33:25 AM1/3/17
to Caffe Users
Hello all, I am using a network architecture which requires the inputs are lmdb format as follows:

layer {
  name
: "label"
  type
: "Data"
  top
: "label"
  include
{
    phase
: TRAIN
 
}
  data_param
{
    source
: "examples/VOC2012ext/VOC2012ext_train_aug_label_lmdb"
    batch_size
: 1
    backend
: LMDB
 
}
}

As you known, the original VOC2012 contains these folders:

Annotations  JPEGImages  SegmentationClass     SegmentationObject
ImageSets    SegmentationClassAug

And the train.txt file has

/JPEGImages/2007_000032.jpg /SegmentationClassAug/2007_000032.png
/JPEGImages/2007_000033.jpg /SegmentationClassAug/2007_000033.png
...

I followed the example of imagenet to create the VOC2012ext_train_aug_label_lmdb as follows:

EXAMPLE=/home/john/caffe/examples/VOC2012ext
DATA
=/media/john/pascal/VOCdevkit/VOC2012_train_val_list
TOOLS
=../../build/tools
CLASS_DATA_ROOT
=/media/john/pascal/VOCdevkit/VOC2012

echo
"Creating CLASS_DATA_ROOT lmdb..."
GLOG_logtostderr
=1 $TOOLS/convert_imageset \
   
--resize_height=$RESIZE_HEIGHT \
   
--resize_width=$RESIZE_WIDTH \
   
--shuffle \
    $CLASS_DATA_ROOT
\
    $DATA
/train_label.txt \
    $EXAMPLE
/VOC2012ext_train_aug_label_lmdb

where my
train_label.txt is extract from the train.txt with information

/SegmentationClassAug/2007_000032.png
/SegmentationClassAug/2007_000033.png
...

After running the code, I got the lmdb file in the folder VOC2012ext_train_aug_label_lmdb. However, when I run train prototxt, I got the error


softmax_loss_layer
.cpp:42] Check failed: outer_num_ * inner_num_ == bottom[1]->count() (166500 vs. 564000) Number of labels must match number of predictions; e.g., if softmax axis == 1 and prediction shape is (N, C, H, W), label count (number of labels) must be N*H*W, with integer values in {0, 1, ..., C-1}.

I sure that I was wrong in creating the label lmdb file. I am working in segmentation using Parsnet. Can you help me to fix it? Thank all

Francois Badaud

unread,
Oct 25, 2017, 3:16:39 AM10/25/17
to Caffe Users
hello John

I am facing the same problem , have you received any answer or found a solution to this?

 thanks and BR
Francois
Reply all
Reply to author
Forward
0 new messages