Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in PyTorch DataLoder #1

Open
MostafaMagdSalama opened this issue Feb 21, 2020 · 4 comments
Open

Error in PyTorch DataLoder #1

MostafaMagdSalama opened this issue Feb 21, 2020 · 4 comments

Comments

@MostafaMagdSalama
Copy link

MostafaMagdSalama commented Feb 21, 2020

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

@goudantongxue
Copy link

goudantongxue commented Mar 10, 2020

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.

@goudantongxue
Copy link

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

@JIAZhenZ
Copy link

How can I download the training datasets? thanks

@lucidBrot
Copy link

@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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants