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:011512×512 28.3 KBAnd 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?
2023-12-05T02:57:55Z
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 valueReduce_labels - set to True. reindexes the label values so that they start from 0 after the background is set to 255
2023-12-05T06:42:18Z
So in my example case I should use ignore_index=0 and reduce_labels=True ?
2023-12-05T15:43:44Z
Set ignore_index to 255 and reduce_labels to trueHere is an example, see the note inPyImageSearch – 13 Mar 23Train a MaskFormer Segmentation Model with Hugging Face Transformers -...Train a MaskFormer segmentation model with Hugging Face Transformers.Est. reading time: 24 minutes
2024-08-01T23:04:57Z
If the background class index is 0, can we just set the ignore_index to 0 and keep the reduce_labels to False?