-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (30 loc) · 1.2 KB
/
main.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
from training import Trainer
from data_preprocessing import BirdDataset
import numpy as np
from initValues import config
import torch.utils.data as utils
import torchvision.transforms as transforms
import shutil
#shutil.rmtree("Output")
imgTransform = transforms.Compose([
transforms.RandomResizedCrop(config.IMG_SIZE),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
dataset = BirdDataset(filePath='./birds/train/filenames.pickle',
cidPath='./birds/train/class_info.pickle',
dataDir='./birds/CUB_200_2011/CUB_200_2011/',
embPath='./birds/train/char-CNN-RNN-embeddings.pickle',
imgSize=(64,64),
transform = imgTransform)
dataLoader = utils.DataLoader(
dataset, batch_size=config.TRAIN.BATCH_SIZE, shuffle=False, num_workers=2
)
Gan = Trainer("Output")
#Train on Stage 1
Gan.train(dataLoader, 1)
#Training on Stage 2
# Gan.train(dataLoader, 2)
# Gan.sample("SampleOutput S1", 1)
# Gan.sample("SampleOutput S2", 2)