Image segmentation of a kaggle dataset

Hello,
in your tutorial for image segmentation: Fine-Tune a Semantic Segmentation Model with a Custom Dataset you create a dataset or choose from the hub to use with the segformer model. But if I wanted to use a kaggle dataset how should I proceed? For example how can I use this drone dataset: Aerial Semantic Segmentation Drone Dataset | Kaggle?

Hi! You can load download and extract the data archive locally and then load it as follows:

import datasets
import glob

IMAGES = glob.glob("path/to/archive/dataset/semantic_drone_dataset/original_images/*.jpg")
SEG_MAPS = glob.glob("path/to/archive/dataset/semantic_drone_dataset/label_images_semantic/*.png") 
dataset = datasets.Dataset.from_dict({"image": IMAGES, "label": SEG_MAPS}, features=datasets.Features({"image": datasets.Image(), "label": datasets.Image()}))
2 Likes