royorel / StyleSDF

Other
533 stars 50 forks source link

A small problem with a dataset #8

Closed Ruinmou closed 2 years ago

Ruinmou commented 2 years ago

When I use the ffhq dataset, how many data do I need? I only downloaded images1024x1024there is a problem with training.

Traceback (most recent call last):
  File "/home/haimou/anaconda3/envs/StyleSDF2/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/home/haimou/anaconda3/envs/StyleSDF2/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/home/haimou/anaconda3/envs/StyleSDF2/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/haimou/anaconda3/envs/StyleSDF2/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/haimou/Desktop/PyAll/StyleSDF/dataset.py", line 42, in __getitem__
    img = Image.open(buffer)
  File "/home/haimou/anaconda3/envs/StyleSDF2/lib/python3.8/site-packages/PIL/Image.py", line 3008, in open
    raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f3ac305f310>
richardburleigh commented 2 years ago

You may need to try the steps in 'Preparing your Dataset' again

royorel commented 2 years ago

@hai8023,

As @richardburleigh said, please follow the steps in "Preparing your Dataset" section. It saves the dataset in lmdb format instead of loading each image separately.

In your case that would be: python prepare_data.py --out_path ./datasets/FFHQ --n_worker N_WORKERS --size 1024 PATH_TO_YOUR_ORIGINAL_FFHQ_DATASET

Ruinmou commented 2 years ago

I succeeded after getting the latest code,thanks for your help