-
Notifications
You must be signed in to change notification settings - Fork 0
/
postprocess.py
68 lines (57 loc) · 2.38 KB
/
postprocess.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
import os
import sys
from optparse import OptionParser
from tensorboardX import SummaryWriter
import config
import project.HisCancer_project.HisCancer_postprocess
from gpu import gpu_profile
from reproduceability import reproduceability
from utils.memory import memory_thread
# def get_args():
# parser = OptionParser()
# parser.add_option('--loaddir', dest='loaddir', default=False, help='tag you want to load')
# parser.add_option('--versiontag', dest='versiontag', default="predict", help='tag for tensorboard-log and prediction')
# parser.add_option('--loadfile', dest='loadfile', default=False, help='file you want to load')
#
# (options, args) = parser.parse_args()
# return options
# def load_args():
# args = get_args()
# if args.versiontag: config.PREDICTION_TAG = args.versiontag
# if args.loadfile:
# config.DIRECTORY_LOAD = config.DIRECTORY_PREFIX + "model/" + args.loaddir + "/" + args.loadfile
# config.DIRECTORY_CHECKPOINT = config.DIRECTORY_PREFIX + "model/" + args.loaddir + "/predict/"
# else: raise ValueError("You must set --loadfile directory in prediction mode")
if __name__ == '__main__':
"""
PLAYGROUND
"""
os.system("sudo shutdown -c")
config.DEBUG_TEST_CODE = False
config.DEBUG_LAPTOP = False
if not config.DEBUG_TEST_CODE:
if config.DEBUG_TRAISE_GPU: sys.settrace(gpu_profile)
# load_args()
if config.PREDICTION_WRITER:
writer = SummaryWriter(config.DIRECTORY_CHECKPOINT)
print("=> Tensorboard: " + "tensorboard --logdir=" + config.DIRECTORY_CHECKPOINT + " --port=6006")
memory = memory_thread(1, writer)
memory.setDaemon(True)
memory.start()
else: writer = None
reproduceability()
try:
postprocess = project.HisCancer_project.HisCancer_postprocess.HisCancerPostprocess(writer)
except Exception as e:
if not isinstance(e, KeyboardInterrupt):
os.system("sudo shutdown -P +20")
print("""
WARNING: THE SYSTEM WILL SHUTDOWN
Use command: sudo shutdown -c
""")
raise
os.system("sudo shutdown -P +20")
print("""
WARNING: THE SYSTEM WILL SHUTDOWN
Use command: sudo shutdown -c
""")