Dataset not found or corrupted. You can use download=True to download it

Question:

Recently I downloaded CelebA dataset from this page. I want to apply some transformations to this data set:

To do it firstly let’s define transformations:

from torchvision import transforms
from torchvision.datasets CelebA
celeba_transforms = transforms.Compose([
    transforms.CenterCrop(130),
    transforms.Resize([64, 64]),
    transforms.ToTensor()
    ])

And now execute it:

CelebA(root='img_align_celeba',
       split='train',
       download=False,
       transform=celeba_transforms)

However result of this code is an error:

Dataset not found or corrupted. You can use download=True to download it

Setting download=True is also not working. Could you please help me with applying those transformations to this data set?

Asked By: John

||

Answers:

It seems like for some copyright/privacy/legal consideration CelebA dataset is slowly going "off-grid".
If you really have to use it, try downloading it from the baidu drive.

Other users report that there might be download quota issues, and retrying might resolve the issue.

What exactly is the error you get when you try download=True?

Answered By: Shai

Finally I resolved the issue. I’m posting my solution:

Problem number one

There is a problem with downloading zip file img_align_celeba.zip due to reaching daily quota. Solution to this problem is simply downloading this file from internet e.g. Kaggle.

Problem number two

When using function CelebA function with download=True program will think for a while and then return error mentioned in a question title. Cause of the problem are broken .txt files which I listed below (those files are also downloaded via CelebA function):

enter image description here

For correct working of this function you have to download those .txt files directly from internet. I found them here. When you download all of those and replace old ones function CelebA should work without any problems.

Answered By: John

Unfortunately, i cant comment Johns answer, due to lack of reputation. I just wanted to add, that you also need to unzip the image folder and the image-containing folder should be: data/celeba/img_align_celeba/000001.jpg
and so on (data is a free to choose folder-name and the parameter you pass to root = "./data" in torchs dataset function). In my case, all images had to be moved up one directory.

Answered By: Robin Müller
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.