# Loading Script for Vision Dataset

**URL:** <https://discuss.huggingface.co/t/loading-script-for-vision-dataset/55347>\
**Category:** 🤗Datasets\
**Created:** [September 17, 2023, 5:07pm UTC](https://discuss.huggingface.co/t/loading-script-for-vision-dataset/55347 "2023-09-17T17:07:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoushathS](https://avatars.discourse-cdn.com/v4/letter/n/b2d939/32.png) [@NoushathS](https://discuss.huggingface.co/u/NoushathS)\
**Post date:** [September 17, 2023, 5:07pm UTC](https://discuss.huggingface.co/t/loading-script-for-vision-dataset/55347/1 "2023-09-17T17:07:48Z")

</div>

Hello HF community,

Could someone please share a sample script/documentation (other than food101 dataset provided by HF) that creates custom vision dataset for image classification. The dataset is available in image format in my local drive with following structure:  
train/class\_1/img1  
train/class\_1/img2  
train/class\_1/img3  
…  
…  
train/class\_2/img1  
train/class\_2/img2  
train/class\_2/img3  
…  
…

Looking forward to the support by 🤗 community

---

<div class="post-metadata">

**Author:** ![mariosasko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mariosasko/32/31548_2.png) [@mariosasko](https://discuss.huggingface.co/u/mariosasko)\
**Post date:** [September 20, 2023, 12:51pm UTC](https://discuss.huggingface.co/t/loading-script-for-vision-dataset/55347/2 "2023-09-20T12:51:30Z")

</div>

You can use the `imagefolder` loader to load such a dataset:

```python
from datasets import load_dataset
ds = load_dataset("imagefolder", data_files="path/to/train_dir/**", split="train")

```
