forked from platonic-realm/gbm-seg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgbm.py
executable file
·72 lines (61 loc) · 2.26 KB
/
gbm.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
# Python Imprts
import os
# Library Imports
from pudb import set_trace
# Local Imports
from src.utils.misc import configure_logger, basic_logger
from src.utils import args
from src.utils import exper
if __name__ == '__main__':
args, configs = args.parse_exper()
if args.debug:
set_trace()
if args.action == 'create':
basic_logger()
name = args.name
exper.create_new_experiment(
_name=name,
_root_path=configs['experiments']['root'],
_source_path=os.getcwd(),
_dataset_path=configs['experiments']['default_data_path'],
_batch_size=int(args.batch_size))
if args.action == 'list':
root = args.root
if not root:
root = configs['experiments']['root']
if args.snapshots is None:
exper.list_experiments(root)
else:
exper.list_snapshots(_name=args.snapshots,
_root_path=root)
if args.action == 'train':
configure_logger(configs, _log_to_file=True)
root = configs['experiments']['root']
name = args.name
exper.train_experiment(_name=name,
_root_path=root)
if args.action == 'delete':
basic_logger()
root = configs['experiments']['root']
name = args.name
exper.delete_experiment(_name=name,
_root_path=root)
if args.action == 'infer':
configure_logger(configs, _log_to_file=False)
name = args.name
root = configs['experiments']['root']
snapshot = args.snapshot
batch_size = args.batch_size
sample_dimension = [item.strip() for
item in args.sample_dimension.split(",")]
stride = [item.strip() for
item in args.stride.split(",")]
scale = args.scale_factor
exper.infer_experiment(_name=name,
_root_path=root,
_snapshot=snapshot,
_batch_size=batch_size,
_sample_dimension=sample_dimension,
_stride=stride,
_scale=scale)