forked from Kid-Liet/Reg-GAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
49 lines (38 loc) · 1.23 KB
/
test
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
42
43
44
45
46
47
48
49
#!/usr/bin/python3
import argparse
import itertools
import os
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
from torch.autograd import Variable
from PIL import Image
import torch
import torch.nn.functional as F
import numpy as np
from trainer import Cyc_Trainer,P2p_Trainer,Nice_Trainer
import yaml
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
def get_config(config):
with open(config, 'r') as stream:
return yaml.load(stream)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--config', type=str, default='Yaml/P2p.yaml', help='Path to the config file.')
opts = parser.parse_args()
config = get_config(opts.config)
if config['name'] == 'CycleGan':
trainer = Cyc_Trainer(config)
elif config['name'] == 'Munit':
trainer = Munit_Trainer(config)
elif config['name'] == 'Unit':
trainer = Unit_Trainer(config)
elif config['name'] == 'Nice':
trainer = Nice_Trainer(config)
elif config['name'] == 'U-gat':
trainer = Ugat_Trainer(config)
elif config['name'] == 'P2p':
trainer = P2p_Trainer(config)
trainer.test()
###################################
if __name__ == '__main__':
main()