-
Notifications
You must be signed in to change notification settings - Fork 4
/
datasets.py
27 lines (21 loc) · 860 Bytes
/
datasets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from torch.utils.data import Dataset
import torchvision
class MNIST(torchvision.datasets.MNIST):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __getitem__(self, index):
return super().__getitem__(index)[0]
class CIFAR10(torchvision.datasets.CIFAR10):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __getitem__(self, index):
return super().__getitem__(index)[0]
class CELEBA(torchvision.datasets.ImageFolder):
def __init__(self, root='./data/celeba/', train=True, transform=None):
if train:
root = root + 'train'
else:
root = root + 'test'
super().__init__(root=root, transform=transform)
def __getitem__(self, index):
return super().__getitem__(index)[0]