Can't load a dataset from torchvision

Viewed 872

I'm trying to load the LSUN dataset following PyTorch's code. I used their other datasets but this one seems to give me errors.

import torch
import torchvision.transforms as transforms

#convert the data to torch tensors
transform = transforms.Compose([transforms.ToTensor()])

from torchvision.datasets import LSUN
data = LSUN(root = './', transform=transform)

>>>Error: .//bedroom_train_lmdb: No such file or directory

Am I doing something wrong here? The code works just fine with MNIST/CIFAR/etc. (with a slight modification data = MNIST(root = './', train=False, download=True, transform=transform)

Update
Cloned the repo and downloaded the dataset:

!git clone https://github.com/fyu/lsun.git
cd lsun
# Download testing set
!python3 download.py -c test

Tried running the code as before with

data = LSUN(root = '',classes='test_lmdb.zip', transform=transform)

But getting this error now:

ValueError: Unknown value 'test_lmdb.zip' for argument classes. Valid values are {'train', 'val', 'test'}.

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/torchvision/datasets/utils.py in verify_str_arg(value, arg, valid_values, custom_msg)
    348             msg = msg.format(value=value, arg=arg,
    349                              valid_values=iterable_to_str(valid_values))
--> 350         raise ValueError(msg)
    351 
    352     return value

ValueError: Unknown value '' for LSUN class. Valid values are {'bedroom', 'bridge', 'church_outdoor', 'classroom', 'conference_room', 'dining_room', 'kitchen', 'living_room', 'restaurant', 'tower'}.

When I change it to

data = LSUN(root = '',classes='test', transform=transform)

I get this error:

Error: /test_lmdb: No such file or directory
1 Answers
Related