vrusso
vrusso

Reputation: 51

Error downloading celebA dataset using torchvision

Using the torchvision module datasets, I can't download the celebA image dataset. I am pretty sure that I am doing everything right.

dataset = datasets.CelebA(
    root='../datasets/celebA/train_images',
    split='train',
    target_type='identity',
    transform=transforms.Compose([transforms.ToTensor()]),
    download=True)

The error:

BadZipFile: File is not a zip file

Upvotes: 5

Views: 4769

Answers (1)

lorsanta
lorsanta

Reputation: 118

It is a known issue that has been already reported in #1920, and it seems it was fixed in #4109 but the commit is not yet included in a stable release.

In the meanwhile you can do the following:

  • Look at the source code of datasets.CelebA, search for file_list and take note of the files in it.
  • Download those files from here, and copy the files in a new directory called celeba
  • Unzip img_align_celeba.zip in the same directory

Finally call datasets.CelebA() with download=False.

Upvotes: 3

Related Questions