Datasets:

Modalities:
Image
Text
Size:
< 1K
Libraries:
Datasets

Dataset Viewer issue

#1
by thinh-huynh-re - opened
RGB-D Salient Object Detection org

The dataset viewer is not working.

Error details:

Error code:   StreamingRowsError
Exception:    FileNotFoundError
Message:      [Errno 2] No such file or directory: 'zip://RGB/COME_Train_5.jpg::https://huggingface.co/datasets/RGBD-SOD/test/resolve/main/data/v1/train.zip'
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/first_rows.py", line 565, in compute_first_rows_response
                  rows = get_rows(
                File "/src/services/worker/src/worker/job_runners/first_rows.py", line 156, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/job_runners/first_rows.py", line 212, in get_rows
                  rows_plus_one = list(itertools.islice(ds, rows_max_number + 1))
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 937, in __iter__
                  for key, example in ex_iterable:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 113, in __iter__
                  yield from self.generate_examples_fn(**self.kwargs)
                File "/tmp/modules-cache/datasets_modules/datasets/RGBD-SOD--test/a0c926353f8f8a902803eab2a64e2d38957375e54def2ae79dcd965cbc5ce643/test.py", line 177, in _generate_examples
                  "rgb": Image.open(os.path.join(dir_path, row["rgb"])).convert("RGB"),
                File "/src/services/worker/.venv/lib/python3.9/site-packages/PIL/Image.py", line 3227, in open
                  fp = builtins.open(filename, "rb")
              FileNotFoundError: [Errno 2] No such file or directory: 'zip://RGB/COME_Train_5.jpg::https://huggingface.co/datasets/RGBD-SOD/test/resolve/main/data/v1/train.zip'

cc @albertvillanova @lhoestq @severo .

Hi @thinh-huynh-re ,

To implement a loading script for an image dataset, you can have look at the guide we provide in our docs: https://huggingface.co/docs/datasets/image_dataset#loading-script

Also note that currently the viewer uses the streaming mode, which passes URLs instead of local paths. However when passed a string, Image.open only accepts local paths.

To circumvent this limitation you could pass a file-like object instead, by replacing:

Image.open(os.path.join(dir_path, row["rgb"])).convert("RGB")

with

Image.open(open(os.path.join(dir_path, row["rgb"]), "rb")).convert("RGB")

for all the images.

Sign up or log in to comment