Understanding ignore_index and reduce_labels

Hi there, I am using Mask2Former for a simple segmentation tasks and am struggling to understand if I should use ignore_index and reduce_labels. My dataset is pretty simple each image contains shapes that are either. Circles, triangles or rectangles. Here is an example input image:

And the corresponding masks represent circles with 1, triangles with 2 and rectangles with 3. Every other pixel is 0 in the masks.

So should I used ignore_index and reduce_labels and if so what should the values be?

Ignore_index is the index that is ignored for loss calculations etc. set to 255 - as that’s used in standard loss functions I believe. Some models default to 255 and others don’t set it - not sure exactly why. This will take your background pixels and also unlabelled pixels and set them to the ignore_index value

Reduce_labels - set to True. reindexes the label values so that they start from 0 after the background is set to 255

So in my example case I should use ignore_index=0 and reduce_labels=True ?

Set ignore_index to 255 and reduce_labels to true

Here is an example, see the note in

If the background class index is 0, can we just set the ignore_index to 0 and keep the reduce_labels to False?