forked from snuhcclab/detect_hccmvi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
53 lines (46 loc) · 1.3 KB
/
run.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
# SNU HCC LAB Junseo Kang
# Run Experiment script; Build Model, Fit Model, Plot&Estimate Model
# python run.py raw_dir result_dir
import os.path
import shutil
import sys
from train.trainers import trainer, plotter
from train import experiments
import pdb
def main(raw_dir, result_dir):
#
# Build Models
#
experiment_list = [
experiments.Res3DMMPAD_WJL
]
#
# Prepare Directory
#
if os.path.exists(result_dir):
shutil.rmtree(result_dir)
os.mkdir(result_dir)
#
# For Each Model
#
for experiment in experiment_list:
os.mkdir(os.path.join(result_dir, experiment.name))
os.mkdir(os.path.join(result_dir, experiment.name, 'logs'))
os.mkdir(os.path.join(result_dir, experiment.name, 'plot'))
os.mkdir(os.path.join(result_dir, experiment.name, 'model'))
#
# Fit Model
#
experiment.model, history = trainer(
experiment=experiment,
result_dir=os.path.join(result_dir, experiment.name)
)
#
# Plot Model
#
plotter(experiment=experiment,
result_dir=os.path.join(result_dir, experiment.name),
hist=history)
if __name__ == '__main__':
main(raw_dir=sys.argv[1],
result_dir=sys.argv[2])