NVIDIA / pix2pixHD

Synthesizing and manipulating 2048x1024 images with conditional GANs
https://tcwang0509.github.io/pix2pixHD/
Other
6.57k stars 1.38k forks source link

IndexError: Caught IndexError in DataLoader worker process 0. #306

Open YaoOOoooolin opened 2 years ago

YaoOOoooolin commented 2 years ago

I want to train my image and download the same data set as train_label and set files train_A,train_B, but this error is reported:

create web directory ./checkpoints/train_A/web... Traceback (most recent call last): File "/content/pix2pixhd/1/2/train.py", line 60, in for i, data in enumerate(dataset, start=epoch_iter): File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 530, in next data = self._next_data() File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1224, in _next_data return self._process_data(data) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1250, in _process_data data.reraise() File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 457, in reraise raise exception IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/pix2pixhd/1/2/data/aligned_dataset.py", line 50, in getitem B_path = self.B_paths[index] IndexError: list index out of range

my run code:

!python /content/pix2pixhd/1/2/train.py --name train_A --label_nc 0 --dataroot /content/pix2pixhd/1/2/datasets/cityscapes/

I run it in the colab

MitoTAIKI commented 1 year ago

Your problem occurs when the number of images differs between in the train_A folder and the train_B folder.