Closed andrewssobral closed 7 years ago
Thank you @bodokaiser !
Hi @bodokaiser again, Just a small question, why the number of class is defined as 22 if PascalVoc has 20 classes?
I think VOC before 2012 had less classes, however according to segmentation examples
pixel indices correspond to classes in alphabetical order (1=aeroplane, 2=bicycle, 3=bird, 4=boat, 5=bottle, 6=bus, 7=car , 8=cat, 9=chair, 10=cow, 11=diningtable, 12=dog, 13=horse, 14=motorbike, 15=person, 16=potted plant, 17=sheep, 18=sofa, 19=train, 20=tv/monitor) For both types of segmentation image, index 0 corresponds to background and index 255 corresponds to 'void' or unlabelled.
Thank you @bodokaiser ! So, if I have only 2 classes on my dataset (0 = background, 255 = foreground), I need to set NUM_CLASSES = 2 ?
NUM_CLASSES = 2
basically just says how much output channels to use in the last layer(s) of the chosen network architecture.
There is also another VOC specific transform which convert the color codes of the VOC images to class labels numbered from 1 to 22 so you might want to change this according to your dataset.
Solved!
I am trying to solve a binary mask segmentation as well for my dataset in this VOC format.. however getting a NaN value for segmentation loss.. could you please help me here?? Thanks!
Hello @numancelik34 , I am sorry for the late reply, and thank you for the contact! Yes, my solution for this issue can be found here: https://github.com/andrewssobral/deep-learning-pytorch/tree/master/segmentation I created a git repository with some codes showing how to do binary segmentation with pytorch. Please, let me know if it helps you, and feel free to contact me if you have any questions. Best regards, Andrews
Hi @bodokaiser Do you know how to adapt this code for binary masks? (background = black, foreground = white) I changed the number of classes to 2:
NUM_CLASSES = 22
NUM_CLASSES = 2 But some erros still occurs: