1
$\begingroup$

It's very straightforward for binary semantic segmentation: black color (0s) is responsible for background, whereas white color (1s) is responsible for objects of interest.

enter image description here

But what about multiclass semantic segmentation? As far as I understand, these masks must be RGB images since we use more than two colors. Is it correct? Or should I have a separate binary mask for every class?

If I can use RGB images with multiple colors as masks, should I use some specific colors for masking? If not, should I specify colors I chose somewhere in a network as class parameters? Or will any CNN automatically detect any number of different colors in my masks?

These questions may seem naive and primitive, but I was unable to find any clear explanantions of thus aspect of multiclass semantic segmentation.

$\endgroup$

1 Answer 1

1
$\begingroup$

You should create a separate binary mask (1 for the pixlels belonging to that class and 0 for the rest of pixels) for each class. Therefore, your mask array should have a shape of (BATCH_SIZE, WIDTH, HEIGHT, NUM_CHANNELS), where NUM_CHANNELS is the number of class.

$\endgroup$
1
  • $\begingroup$ Can you please explain to me how to plot a mask with shape (img_height, img_width, n_classes), because I have stored my masks in that shape but I couldn't visualize them, and the same thing for my predicted masks by the UNet model, I couldn't visualize them even when I tried the argmax method test_mask_argmax=np.argmax(test_mask, axis=2), So can you please help me $\endgroup$ Commented Feb 9, 2023 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.