Skip to content

IndexError with custom dataset #163

Open
@emoebel

Description

@emoebel

Hello, I'm trying to run SPADE with a custom dataset, but when trying to run:

python train.py --name test --dataset_mode custom --label_dir datasets/increased/B/ --image_dir datasets/increased/A/ --label_nc 3

I get the error:

dataset [CustomDataset] of size 357 was created
Network [SPADEGenerator] was created. Total number of parameters: 92.1 million. To see the architecture, do print(network).
Network [MultiscaleDiscriminator] was created. Total number of parameters: 5.5 million. To see the architecture, do print(network).
create web directory ./checkpoints/increased_monoclass/web...
/net/serpico-fs2/emoebel/venv/spade/lib/python3.7/site-packages/torchvision/transforms/transforms.py:288: UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum.
  "Argument interpolation should be of type InterpolationMode instead of int. "
Traceback (most recent call last):
  File "train.py", line 34, in <module>
    for i, data_i in enumerate(dataloader, start=iter_counter.epoch_iter):
  File "/net/serpico-fs2/emoebel/venv/spade/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/net/serpico-fs2/emoebel/venv/spade/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/net/serpico-fs2/emoebel/venv/spade/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/net/serpico-fs2/emoebel/venv/spade/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/net/serpico-fs2/emoebel/increased/semantic_img_synthesis/SPADE/data/pix2pix_dataset.py", line 81, in __getitem__
    instance_path = self.instance_paths[index]
IndexError: list index out of range

My dataset is organised as follows (like for pix2pix from pytorch-CycleGAN-and-pix2pix):

A
|-train
|-val
B
|-train
|-val

any idea why I get an error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions