0
$\begingroup$

What does the mask look like when doing semantic segmentation. I have 3 classes (background, liver, tumour).

Currently the input to my segmentation model looks like this

(32, 128, 128, 3) where 32 = batch_size, 128 = image width/height, 3 number of color channels -> RGB.

For labeling the masks i do the following.

  1. Iterate through all the pixels of the image
  2. Assign each pixel a class:
    • If the pixel belongs to the background, I set the RGB value at this position to [0,0,1]
    • If the pixel belongs to the liver, I set the RGB value at at this position to [0,1,0]
    • If the pixel belongs to the tumour, I set the RGB value at this position to [1,0,0]

which results in an image where every pixel is either (0,0,1), (0,1,0) or (1,0,0).

Is that the correct way to do it or am I completely wrong?

$\endgroup$
0
$\begingroup$

Seems ok to me, the output of the network will have 3 channels, each with the probability of one of the class. (The interpretation would not be RGB anymore, just the probabilities. If you would have e.g. 5 classes, the output would have 5 channels.)

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you for your answer! $\endgroup$ – Daniel Nov 4 '19 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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