# Can't use ImageFolder

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-imagefolder%2F19485%3E%5C
**Category:** 🤗Datasets\
**Created:** [June 23, 2022, 4:46am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-imagefolder%2F19485 "2022-06-23T04:46:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peymansoft](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@Peymansoft](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FPeymansoft)%5C
**Post date:** [June 23, 2022, 4:46am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-imagefolder%2F19485%2F1 "2022-06-23T04:46:19Z")

</div>

## Can’t use ImageFolder.

Hi! I want to load my image dataset, and I want to use ImageFolder to do that. this is my code:

**from datasets import load\_dataset**

**dataset = load\_dataset(“imagefolder”, data\_dir= “./folder”)**

and this is the error:

**ValueError : At least one data file must be specified, but got data\_files=None**

and this is my folder structure:  
**folder/train/label\_0/x1.png**  
**folder/train/label\_0/xn.png**  
**folder/train/label\_1/x1.png**  
**folder/train/label\_1/xn.png**  
**.**  
**.**  
**.**  
**folder/train/label\_9/x1.png**  
**folder/train/label\_9/xn.png**  
I would appreciate it if anyone could help me with that and give me some tips to use ImageFolder in a proper manner.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [June 23, 2022, 8:35am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-imagefolder%2F19485%2F2 "2022-06-23T08:35:55Z")

</div>

cc @mariosasko

---

<div class="post-metadata">

**Author:** ![mariosasko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mariosasko/32/31548_2.png) [@mariosasko](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmariosasko)%5C
**Post date:** [June 24, 2022, 1:00pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-imagefolder%2F19485%2F3 "2022-06-24T13:00:11Z")

</div>

Hi! Sadly I can’t reproduce the error locally. Can you please update the `datasets` installation to the newest version with `pip install -U datasets` and try again?

Also, what the following code outputs in your env when you run it?

```python
import os
from fsspec.implementations.local import LocalFileSystem
print(LocalFileSystem().glob(os.path.join("./folder", "**train*")))

```

---

<div class="post-metadata">

**Author:** ![Peymansoft](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@Peymansoft](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FPeymansoft)%5C
**Post date:** [June 25, 2022, 10:38am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-use-imagefolder%2F19485%2F4 "2022-06-25T10:38:21Z")

</div>

Hi @mariosasko!  
updating `datasets` to its newest version solved my problem!  
Thank you so much 🤩 😍 🙏
