Create dataset for image segmentation

1,365 views
Skip to first unread message

a.m.l...@gmail.com

unread,
Jan 6, 2017, 5:46:49 AM1/6/17
to Caffe Users
Hi!

I'm trying to create my first dataset to train a network (i think FCN-Alexnet by the moment) to perform a image segmentation. My problem is in the moment of create the "labels". I use the quotes because i see (in PscalVOC) this labels are .png files with only one channel (indexed). I'm search in google some program to make this .png's and find some like: labelme or imageJ, but nothing of these convinced me (because the png generates by those programs didnt works in the training). I try with Gimp too but i dont know how i can create the png exactly like PascalVOC. I attached one example of jpg and png from PascalVOC to see what i want. Somebody have a good method to create this labels??

Thanks in advance guys!!
2007_000033.jpg
2007_000033.png

Przemek D

unread,
Jan 9, 2017, 5:05:25 AM1/9/17
to Caffe Users
Use Nvidia DIGITS if you're new and don't want to get stuck on that for a long time.

Other than that, the labels are just like any other images - just grayscale and only taking very specific values (for PASCAL VOC these are 0-20 and 255), so I think you could use default tools to convert them to a lmdb like any other (just with --gray switch, but don't take my word for that one).

a.m.l...@gmail.com

unread,
Jan 16, 2017, 9:38:05 AM1/16/17
to Caffe Users
Thanks! I used Digits in the past and achieve a good results with FCN-Alexnet, but my question is not about how create the Imdb, is about how I can create the Ground Truth Image, I mean: I take the original image (.jog) and I dont know how create the .png file. I've read the .png is a pallete image where each pixel is associated to an indice (integer) and this indice represents one color in the pallette, but I dont know how create this images.. 

Przemek D

unread,
Jan 17, 2017, 2:57:07 AM1/17/17
to Caffe Users
I simply painted mine with GIMP, only making sure I was using solid colors all the time (ie. no shades or gradients). DIGITS handled them well for me, but I think it silently converted it somehow. I suspect if you're using only caffe, you'll have to paint your labels in gray mode, using different shades for different labels (that is, pixel values of 0, 1, 2...).

a.m.l...@gmail.com

unread,
Jan 19, 2017, 6:16:02 PM1/19/17
to Caffe Users
Thanks!!! This works! Really thanks, I'm gonna to write a detalied guide to perform the labeling because I see that find good information about this is complicated...Thanks again!

Alper ALT

unread,
Feb 17, 2017, 11:10:30 AM2/17/17
to Caffe Users
Hello, ImageJ is a very capable piece of software and whats you describing not seem very difficult in it. Although I am not interested in (yet) with image segmentation (I need number of individual objects detected, guess not possible with segmentation), basically, you select the outline of object in image, then fill the selection (or delete) with a specific color, and get this color as a mask then save it in an image format? (I am seeing an outer white line in segmented images, bu do not know if its a necessity). Is this the basic segmentation work or anything missed here?


20 Ocak 2017 Cuma 02:16:02 UTC+3 tarihinde a.m.l...@gmail.com yazdı:

Isaac Kargar

unread,
Jan 27, 2018, 3:47:06 AM1/27/18
to Caffe Users
Hi, Would you please explain about the procedure of creating labels? what is the shape of output? is it a rgb image (h,w,c) with different colors for every class? or is it a 2D matrix with the shape of (h*w, num_classes) ?

Thanks

Przemek D

unread,
Jan 29, 2018, 4:35:40 AM1/29/18
to Caffe Users
It's a grayscale image, CHW with C=1, where each pixel value is an integer indicating label for the corresponding pixel.

Alex Ter-Sarkisov

unread,
Feb 5, 2018, 3:59:22 AM2/5/18
to Caffe Users
This is probably gross self-advertising, but I published a paper last year on this and can send you a script if you want

Reply all
Reply to author
Forward
0 new messages