How to do Instance segmentation with overlapping labels?

I’m working on a project to segment rooftop objects, I have a labeled dataset for YOLOv8 from roboflow.
I’m creating a custom model using PyTorch, but I’m stuck as to how PyTorch gets the labels for instance segmentation.
Because it’s about objects on a roof, the labels I have are overlapping, here is an example:
"0 0.8151095629770003 0 0.7230230457121672 0.06468577367652012 0.629497676615071 0.1376042821845973 0.9193334366944352 0.4491040183592357 1 0.3833300151572437 1 0.16354047283849452 0.8438865996222608 0

0 0.5468747017258877 0.04966784730650573 0.41719574128953224 0.12416961826626435 0.35124472712475713 0.17141464375294052 0.7402872243045079 0.5745475758597562 0.8066917261524205 0.5246918030069853 0.9188415514955619 0.44950608104353224

0 0.2841732368719464 0.208170580740801 0.16228395620321057 0.29134432383450326 0.23119906089224523 0.2986127892939919 0.571328448551029 0.6468934258944896 0.5431665666792898 0.6944899882906383 0.5597133627503145 0.706839090537974 0.6625912687571204 0.6121626399750674 0.7316561567057452 0.5674706508894717 0.3505037044936923 0.17323176011781283"
the format is in class, x y coordinates, what is the format PyTorch need to do instance segmentation on this?
Online I found that it’s usually transformed into a mask with 0 as background, class 1 as 1, class 2 as 2, etc. how does that work when an overlapping class has a large overlap with a different class?
lAUzHNe
In this case, the orange class overlaps for the most part with the pink class (the orange class is on top of the pink class)

may be dataset issue,at the time of createing bounding boxes issue occured,you can resolve this issue by createing dataset again

i don’t really have an issue with the dataset, it’s more the representation of the labels that i don’t really understand, specifically when labels overlap.