Best method to change ground-truth labels (IndexError: Target {} is out of bounds)
Hi. I’m new to HF Transformers, so please excuse this simple question.I’m working through the Fine-Tune a Semantic Segmentation Model with a Custom Dataset blog post and continue to receive theIndexError: Target 4 is out of bounds.error that many folks reference here. I understand that i need my labels to be 0-3 rather than 1-4, however i’m not sure how best to do this with my custom HF dataset that i created using Segments.aiI’ve attempted to update the groundtruth labels using.map()andnp.where(), as well as updating the label ids on Segments.aiI’ve reconfigured theid2label.jsonto reflect 0-3 rather than 1-4. what am i missing here?
2023-10-02T14:46:39Z
Solved!As a follow up to this post I want to share how I solved, as I assume beginners like myself will have a similar issue. When labelling your images using Segments.ai do not create a “background” label. Any object that doesn’t have a specific label leave blank. Once you push to HF, create a json file calledlabel2id.jsonformatted with “no label” in the 0 index like this:{“0”:“no-label”, “1”:“object1”, “2”:“object2”, “3”:“object3”}