CSAILVision / ADE20K

ADE20K Dataset

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation Mask: RGB to Object Label

gordon-lim opened this issue · comments

Could you please point me to the mapping of RGB values to object labels? Or is there no such mapping in one place. Am I to somehow make use the individual instance masks to get the object labels per pixel?

My apologies, I wasn't looking hard enough. For ease of reference for future visitors, I'll put the relevant code block down below:

with Image.open(fileseg) as io:
  seg = np.array(io);

R = seg[:,:,0];
G = seg[:,:,1];
B = seg[:,:,2];
ObjectClassMasks = (R/10).astype(np.int32)*256+(G.astype(np.int32));

The above is from utils/utils_ade20k.py

ObjectClassMasks is an array of object ids assigned to the respective pixel.