CSAILVision / semantic-segmentation-pytorch

Pytorch implementation for Semantic Segmentation/Scene Parsing on MIT ADE20K dataset
http://sceneparsing.csail.mit.edu/
BSD 3-Clause "New" or "Revised" License
4.96k stars 1.1k forks source link

Class number and name association #199

Open bluesky314 opened 5 years ago

bluesky314 commented 5 years ago

Hey I am unable to understand how to class values in mask correspond to class names. I want to only use a subset of classes and for that need to know which classes to set as background and which to keep.

I used the encoding function to convert the 3 dimensional mask and got:

Screen Shot 2019-10-07 at 11 57 42 AM

As you can see in image, after using encoding function provided I am getting two different class numbers for the class of person while it should be only one. It is not corresponding to colours and numbers given in https://docs.google.com/spreadsheets/d/1se8YEtb2detS7OuPE86fXGyD269pMycAWe2mtKUj2W8/edit?usp=sharing. Person has idx of 14 here.

(I got the encoding function https://github.com/meetshah1995/pytorch-semseg/blob/master/ptsemseg/loader/ade20k_loader.py as encode_segmap)

If I see the masks individually I see

Screen Shot 2019-10-07 at 12 07 20 PM

which shows in the first channel humans are not coded the same, in the second and third they share colour code with some background class.

Can anyone please help me figure out how do I figure this out? I want the correct way to get association of class value with class name.

mcdy143 commented 5 years ago

On a follow-up to this question: if I wanted to train on all of the ADE20K classes, should I only need to modify the config file parameter "DATASET: num_class: "? How should I generate a corresponding class value-to-names dictionary and a color encoding?