Error in PyTorch DataLoder
i got this error when i train a model (srgan)
KeyError: Caught KeyError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/drive/My Drive/PyTorch--master/datasets.py", line 67, in getitem img = Image.open(self.images[i], mode='r') KeyError: 0 how how many epoch i should do to make a good model? i'm training the model in google colab thanks
for d in train_folders:
for i in os.listdir(d):
img_path = os.path.join(d, i)
img = Image.open(img_path, mode='r')
if img.width >= min_size and img.height >= min_size:
train_images.append(img_path)
there is something wrong. For the first line, train folders is a string and so for d in train_folders doesn't work.
for d in train_folders: for i in os.listdir(d): img_path = os.path.join(d, i) img = Image.open(img_path, mode='r') if img.width >= min_size and img.height >= min_size: train_images.append(img_path)there is something wrong. For the first line, train folders is a string and so for d in train_folders doesn't works.
Sorry, now i know that d is a list. hahaha
How can I download the training datasets? thanks
@JIAZhenZ when you search (CTRLF) in the readme for "download", you will find:
Model checkpoints are available here.
While the authors of the paper trained their models on a 350k-image subset of the ImageNet data, I simply used about 120k COCO images (train2014 and val2014 folders). They're a lot easier to obtain. If you wish to do the same, you can download them from the links listed in my other tutorial.
So: [ training direct link ], [validation direct link]