TypeError: expected str, bytes or os.PathLike object, not dict
COLLABORATOR
You should be able to load the images by modifying the `load_dataset` call like this:
```python
dataset = load_dataset("imagefolder", data_dir="/content/datasets/PotholeDetectionYOLOv8-1")
```

The `imagefolder` builder expects the image files to be in `path/label/image_file` (e.g. .`.../train/dog/image_1.jpg`), so the solution for the labels in your case is to create metadata files (one for each split; as explained [here](https://huggingface.co/docs/datasets/image_dataset#imagefolder)) that map the images to their labels.
2023-10-09T21:47:30Z
https://github.com/huggingface/datasets/issues/6285#issuecomment-1753928232
https://api.github.com/repos/huggingface/datasets/issues/6285
IC_kwDODunzps5oitIo
https://api.github.com/repos/huggingface/datasets/issues/comments/1753928232/reactions
2023-10-09T21:47:50Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1753928232
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
> You should be able to load the images by modifying the `load_dataset` call like this:
> 
> ```python
> dataset = load_dataset("imagefolder", data_dir="/content/datasets/PotholeDetectionYOLOv8-1")
> ```
> 
> The `imagefolder` builder expects the image files to be in `path/label/image_file` (e.g. .`.../train/dog/image_1.jpg`), so the solution for the labels in your case is to create metadata files (one for each split; as explained [here](https://huggingface.co/docs/datasets/image_dataset#imagefolder)) that map the images to their labels.

I tried like this but only uploads images and not labels, Andyrasika/potholes-dataset
2023-10-10T01:50:17Z
https://github.com/huggingface/datasets/issues/6285#issuecomment-1754191810
https://api.github.com/repos/huggingface/datasets/issues/6285
IC_kwDODunzps5ojtfC
https://api.github.com/repos/huggingface/datasets/issues/comments/1754191810/reactions
2023-10-10T01:50:17Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1754191810
https://avatars.githubusercontent.com/u/20493493?v=4
https://api.github.com/users/andysingal/events{/privacy}
https://api.github.com/users/andysingal/followers
https://api.github.com/users/andysingal/following{/other_user}
https://api.github.com/users/andysingal/gists{/gist_id}
https://github.com/andysingal
andysingal
MDQ6VXNlcjIwNDkzNDkz
https://api.github.com/users/andysingal/orgs
https://api.github.com/users/andysingal/received_events
https://api.github.com/users/andysingal/repos
https://api.github.com/users/andysingal/starred{/owner}{/repo}
https://api.github.com/users/andysingal/subscriptions
User
https://api.github.com/users/andysingal
public
COLLABORATOR
As explained in my previous comment, you need to define metadata files to load the labels or update the paths to be in the format `train/label/image` (`train- image /n -labels` is not supported by the loader).
2023-10-10T12:42:08Z
https://github.com/huggingface/datasets/issues/6285#issuecomment-1755335215
https://api.github.com/repos/huggingface/datasets/issues/6285
IC_kwDODunzps5ooEov
https://api.github.com/repos/huggingface/datasets/issues/comments/1755335215/reactions
2023-10-10T12:42:08Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1755335215
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
I downloaded my file after annotating using roboflow . It gives train-
images, labels ,  test- images, labels , valid- images, labels . I hope it
gives you an idea of the dataset . Please advise on this dataset

On Tue, Oct 10, 2023 at 18:12 Mario Šaško ***@***.***> wrote:

> As explained in my previous comment, you need to define metadata files to
> load the labels or update the paths to be in the format train/label/image
> (train- image /n -labels is not supported by the loader).
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/huggingface/datasets/issues/6285#issuecomment-1755335215>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AE4LJNN56FWWTSBYTSTUWHLX6U7CVAVCNFSM6AAAAAA5YHCSTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJVGMZTKMRRGU>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>

2023-10-10T13:17:33Z
https://github.com/huggingface/datasets/issues/6285#issuecomment-1755412129
https://api.github.com/repos/huggingface/datasets/issues/6285
IC_kwDODunzps5ooXah
https://api.github.com/repos/huggingface/datasets/issues/comments/1755412129/reactions
2023-10-10T13:17:33Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1755412129
https://avatars.githubusercontent.com/u/20493493?v=4
https://api.github.com/users/andysingal/events{/privacy}
https://api.github.com/users/andysingal/followers
https://api.github.com/users/andysingal/following{/other_user}
https://api.github.com/users/andysingal/gists{/gist_id}
https://github.com/andysingal
andysingal
MDQ6VXNlcjIwNDkzNDkz
https://api.github.com/users/andysingal/orgs
https://api.github.com/users/andysingal/received_events
https://api.github.com/users/andysingal/repos
https://api.github.com/users/andysingal/starred{/owner}{/repo}
https://api.github.com/users/andysingal/subscriptions
User
https://api.github.com/users/andysingal
public
### Describe the bug

my dataset is in form : train- image /n -labels

and tried the code:
```
from datasets import load_dataset

data_files = {
    "train": "/content/datasets/PotholeDetectionYOLOv8-1/train/",
      "validation": "/content/datasets/PotholeDetectionYOLOv8-1/valid/",
      "test": "/content/datasets/PotholeDetectionYOLOv8-1/test/"
}
dataset = load_dataset("imagefolder", data_dir=data_files)
dataset
```
got error:
```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-29-2ef1926f73d9>](https://localhost:8080/#) in <cell line: 8>()
      6       "test": "/content/datasets/PotholeDetectionYOLOv8-1/test/"
      7 }
----> 8 dataset = load_dataset("imagefolder", data_dir=data_files)
      9 dataset

6 frames
[/usr/lib/python3.10/pathlib.py](https://localhost:8080/#) in _parse_args(cls, args)
    576                 parts += a._parts
    577             else:
--> 578                 a = os.fspath(a)
    579                 if isinstance(a, str):
    580                     # Force-cast str subclasses to str (issue #21127)

TypeError: expected str, bytes or os.PathLike object, not dict
```

### Steps to reproduce the bug

as share above 

### Expected behavior

load images and labels , but my dataset only uploads images 
- https://huggingface.co/datasets/Andyrasika/potholes-dataset

### Environment info

colab pro 