How to create LMDB files for semantic segmentation?

1,006 views
Skip to first unread message

Sara Caffe

unread,
Dec 22, 2016, 5:17:02 AM12/22/16
to Caffe Users
Hi

I have downloaded PASCAL trainval.tar.gz and 33_context_labels and saved into two folders for running semantic segmentation. The trainval folder includes images with .mat format and ground truth images in 33_context_labels folder are in .png format.

My questions are:
  1.  How can I create LMDB files for this ground truth? Please share the code if there is any.
  2.  How corresponding pixel labels in 33_context_labels folder are assigned to the original images in trainval folder?
What I realized in this group is that most of questions stays without any answer. I will be thankful if someone knows the answer, please let me know.
Your help is appreciated. 


Thanks 

Miquel Martí

unread,
Dec 27, 2016, 11:08:22 PM12/27/16
to Caffe Users
You can start with this script. It assumes you have a list with the correspondance image and labels. Also, you might need to convert the .mat files to .png or .jpg or change the code and directly load the .mat files, which should be doable with numpy.

Miquel
El dijous, 22 desembre de 2016 19:17:02 UTC+9, Sara Caffe va escriure:
create_dataset_lmdb.py

john1...@gmail.com

unread,
Jan 3, 2017, 9:14:07 PM1/3/17
to Caffe Users
Hi Miquel,

Thank you for sharing the scirpt. I have an issue when run it. I used the command

python create_dataset_lmdb.py --W 256 --H 256 --output_path /home/john/VOC2012ext_train_aug_label_lmdb --input_images /media/john/pascal/VOCdevkit/VOC2012_train_val_list/train_label_lmdb.txt --nb_classes 21 --labels

After that, I run the traning process, I got the error
softmax_loss_layer.cpp:42] Check failed: outer_num_ * inner_num_ == bottom[1]->count() (166500 vs. 65536) 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 think the error is happened in converting the lmdb file. For more details, let see my issue at https://groups.google.com/forum/#!topic/caffe-users/QdShjZtzY4Q . Thanks





Vào 13:08:22 UTC+9 Thứ Tư, ngày 28 tháng 12 năm 2016, Miquel Martí đã viết:

Sara Caffe

unread,
Jan 5, 2017, 10:15:26 AM1/5/17
to Caffe Users
Have you set the number of your classes correctly?

john1...@gmail.com

unread,
Jan 6, 2017, 4:34:27 AM1/6/17
to Caffe Users
Yes. I am using Pascal 2012. It has 21 classes includes background. 

Vào 00:15:26 UTC+9 Thứ Sáu, ngày 06 tháng 1 năm 2017, Sara Caffe đã viết:

Yongfei Liu

unread,
Sep 21, 2017, 5:45:06 AM9/21/17
to Caffe Users
Hi, 
recently, I want to use th pascal-33 labels dataset, but i have some trouble in convert the dataset.  Have you converted the dataset?  If you already have that, please send a copy to me, Thanks

在 2016年12月22日星期四 UTC+8下午6:17:02,Shima Caffe写道:
Reply all
Reply to author
Forward
0 new messages