huggingface / huggingface/datasets

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

Open
#6,285 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
22k
Forks
3.4k
Avg merge
5d 7h
Merged PRs (30d)
17

Description

### 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)
[](https://localhost:8080/#) in ()
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.