Pushing new dataset for images semantic segmentation

Hello,

I’m trying to create a new dataset for semantic segmentation. I have a folder containing my images and another folder containing my labels (same file name for the correspondence images - labels) However I cannot create my dataset. Could someone put me on the way? thank you

You can look on existing datasets and their structure. Look and repeat.

Thanks for your no help

Hi ! You can check our documentation on How to load image data

You can for example use something like

ds = Dataset.from_dict({
    "image": list(glob.glob("images/*"))
})

def add_labels(example):
    label_file = example["image"].replace("images/", "labels/")
    return {"label": open(label_file).read()}

ds = ds.map(add_labels)
ds = ds.cast_column("image", Image())
1 Like