Out of bounds Error in label conversion , two labels getting converted to 0 and 247

I’m facing a challenge while performing data augmentation with SegformerImageProcessor from the Transformers library. My dataset uses labels where 0 represents the background and 1 represents an object. However, after augmentation, the label values are unexpectedly converted to 255 and 247. This is causing an error because 247 is outside the valid range of labels.

Here’s my understanding:

The reduce_labels parameter in SegformerImageProcessor is likely set to True, which automatically converts the background label (originally 0) to 255 during augmentation.
In a separate scenario using segments.ai, the labels were correctly preserved as 0 and 1 after augmentation.

My question is

Can I manually adjust the labels after augmentation? Specifically, can I convert 255 back to 0 and 247 to 1? Would this allow training to proceed without errors?

  • Is there a more appropriate approach to address this issue?
  • Should I modify my label dataset beforehand to avoid this conversion during augmentation?