-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
46 lines (38 loc) · 1.03 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
38
39
40
41
42
43
44
45
46
import argparse
from config import get_cfg_defaults
from model import build_model
from data import build_dataset
from engine import train
def main():
parser = argparse.ArgumentParser(description="Deep Neural Networks for 3D Anaglyph Image Generation")
parser.add_argument(
"--config-file",
default="",
metavar="file",
help="path to config file",
type=str,
)
parser.add_argument(
"--mode",
default="test",
metavar="mode",
help="'train' or 'test'",
type=str,
)
parser.add_argument(
"opts",
help="Modify config options using the command-line",
default=None,
nargs=argparse.REMAINDER,
)
args = parser.parse_args()
# build the config
cfg = get_cfg_defaults()
cfg.merge_from_file(args.config_file)
cfg.merge_from_list(args.opts)
cfg.freeze()
dataset = build_dataset(cfg)
model, optimizer = build_model(cfg)
train(cfg, optimizer, dataset)
if __name__ == "__main__":
main()