-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·35 lines (26 loc) · 791 Bytes
/
Copy pathmain.py
File metadata and controls
executable file
·35 lines (26 loc) · 791 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
31
32
33
34
35
import lib.algorithm as algorithm
from lib.config import get_cfg
from lib.engine import default_argument_parser, default_setup
def setup(args):
"""
Create configs and perform basic setups.
"""
cfg = get_cfg()
cfg.merge_from_file(args.config_file)
cfg.merge_from_list(args.opts)
cfg = default_setup(cfg, args)
return cfg
def main(args):
cfg = setup(args)
cfg.freeze()
# SSL algorithm
trainer = algorithm.__dict__[cfg.ALGORITHM.NAME](cfg)
if cfg.RESUME:
trainer.load_checkpoint(cfg.RESUME)
if args.eval_only:
val_top1, test_top1 = trainer.evaluate()
return
trainer.train()
if __name__ == "__main__":
args = default_argument_parser().parse_args()
main(args)