captain-pool / GSOC

Repository for Google Summer of Code 2019 https://summerofcode.withgoogle.com/projects/#4662790671826944
MIT License
68 stars 22 forks source link

Fail to load dataset for `train.bat` script. #70

Open cloudy-sfu opened 7 months ago

cloudy-sfu commented 7 months ago

When run bash train.sh, the following error occurs. How to solve it?

  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/load.py", line 643, in load
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/logging/__init__.py", line 168, in __call__
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/load.py", line 643, in load
    dbuilder = _fetch_builder(
               ^^^^^^^^^^^^^^^
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/load.py", line 498, in _fetch_builder
    return builder(name, data_dir=data_dir, try_gcs=try_gcs, **builder_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/logging/__init__.py", line 168, in __call__
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/load.py", line 225, in builder
    raise not_found_error
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/load.py", line 202, in builder
    cls = builder_cls(str(name))
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/load.py", line 124, in builder_cls
    cls = registered.imported_builder_cls(str(ds_name))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cld/.conda/envs/ml-tf/lib/python3.11/site-packages/tensorflow_datasets/core/registered.py", line 296, in imported_builder_cls
    raise DatasetNotFoundError(f'Dataset {name} not found.')
tensorflow_datasets.core.registered.DatasetNotFoundError: Dataset image_label_folder not found.
captain-pool commented 7 months ago

Hi @cloudy-sfu , this apparently is because of a breaking change in TensorFlow 2 API. Please try replacing the image_label_folder loader in the train.sh file with: https://www.tensorflow.org/datasets/api_docs/python/tfds/folder_dataset/ImageFolder

cloudy-sfu commented 7 months ago

Thanks, now the scrip can run, I replace the variable CODE with

CODE="import os;
  import tensorflow_datasets as tfds;
  dl_config = tfds.download.DownloadConfig(manual_dir=os.path.expanduser('$DATADIR'));
  ds = tfds.load(name='image_label_folder',
    data_dir=os.path.expanduser('$DATADIR'),
    split='train',
    as_supervised=True,
    download_and_prepare_kwargs={'download_config': dl_config});"

But, the folder datadir/coco2014/train/none is still empty. Taking coco2014 which is used in train.sh as an example, which value should I change image_label_folder to?