How to separate predictions map to create id2label.json

Pipelines are convenient, but they perform complex processing internally, so they are like black boxes.
It might be better to try doing it manually at first. The method on the model explanation page is the most general-purpose method.

Then do I only need the mask for training?

Yes.

semantic segmentation so not only it is segmented but its also labelled as something

If that’s the case, you may need to label the data set…
It’s difficult to create data that doesn’t exist. Only a large AI or a human being could do it.