# Pushing new dataset for images semantic segmentation

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpushing-new-dataset-for-images-semantic-segmentation%2F28552%3E%5C
**Category:** 🤗Datasets\
**Created:** [December 28, 2022, 10:57am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpushing-new-dataset-for-images-semantic-segmentation%2F28552 "2022-12-28T10:57:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alanoix](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alanoix/32/13170_2.png) [@alanoix](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Falanoix)%5C
**Post date:** [December 28, 2022, 10:57am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpushing-new-dataset-for-images-semantic-segmentation%2F28552%2F1 "2022-12-28T10:57:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Yehor](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/yehor/32/5079_2.png) [@Yehor](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FYehor)%5C
**Post date:** [December 28, 2022, 11:31am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpushing-new-dataset-for-images-semantic-segmentation%2F28552%2F2 "2022-12-28T11:31:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alanoix](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alanoix/32/13170_2.png) [@alanoix](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Falanoix)%5C
**Post date:** [December 28, 2022, 12:36pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpushing-new-dataset-for-images-semantic-segmentation%2F28552%2F3 "2022-12-28T12:36:04Z")

</div>

Thanks for your no help

---

<div class="post-metadata">

**Author:** ![lhoestq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/32/64813_2.png) [@lhoestq](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flhoestq)%5C
**Post date:** [January 3, 2023, 11:03am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpushing-new-dataset-for-images-semantic-segmentation%2F28552%2F4 "2023-01-03T11:03:24Z")

</div>

Hi ! You can check our documentation on [How to load image data](https://huggingface.co/docs/datasets/v2.8.0/en/image_load)

You can for example use something like

```python
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())
```

---

<div class="post-metadata">

**Author:** ![Yehor](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/yehor/32/5079_2.png) [@Yehor](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FYehor)%5C
**Post date:** [March 8, 2023, 2:14pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpushing-new-dataset-for-images-semantic-segmentation%2F28552%2F5 "2023-03-08T14:14:05Z")

</div>

you’re no welcome
