-
Notifications
You must be signed in to change notification settings - Fork 0
/
modules_svhn.py
41 lines (28 loc) · 876 Bytes
/
modules_svhn.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import torchvision
import modules_general
class SVHNDataModule(modules_general.IALDataModule):
def __init__(self, **kwargs):
super().__init__()
def prepare_data(self):
torchvision.datasets.SVHN(self.hparams.data_dir, split='train', download=True)
torchvision.datasets.SVHN(self.hparams.data_dir, split='test', download=True)
def get_data_train(self):
data = torchvision.datasets.SVHN(
self.hparams.data_dir,
split='train',
transform=self.transform
)
# Needed for intra-dataset consistency
data.classes = list(map(str, range(10)))
data.targets = data.labels
return data
def get_data_test(self):
data = torchvision.datasets.SVHN(
self.hparams.data_dir,
split='test',
transform=self.transform
)
# Needed for intra-dataset consistency
data.classes = list(map(str, range(10)))
data.targets = data.labels
return data