forked from clovaai/cutblur
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (25 loc) · 653 Bytes
/
main.py
File metadata and controls
30 lines (25 loc) · 653 Bytes
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
"""
CutBlur
Copyright 2020-present NAVER corp.
MIT license
"""
import json
import importlib
import torch
from option import get_option
from solver import Solver
def main():
opt = get_option()
torch.manual_seed(opt.seed)
module = importlib.import_module("model.{}".format(opt.model.lower()))
if not opt.test_only:
print(json.dumps(vars(opt), indent=4))
solver = Solver(module, opt)
if opt.test_only:
print("Evaluate {} (loaded from {})".format(opt.model, opt.pretrain))
psnr = solver.evaluate()
print("{:.2f}".format(psnr))
else:
solver.fit()
if __name__ == "__main__":
main()