This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
forked from arikpoz/deep-visualization-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_toolbox.py
executable file
·48 lines (36 loc) · 1.54 KB
/
run_toolbox.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
#! /usr/bin/env python
# this import must comes first to make sure we use the non-display backend
import matplotlib
matplotlib.use('Agg')
import os, argparse
from live_vis import LiveVis
from bindings import bindings
from optimize_image import change_model_to_load, clean_temp_file
def main(model=None):
try:
if model:
change_model_to_load(model)
try:
import settings
except:
print '\nError importing settings.py. Check the error message below for more information.'
print "If you haven't already, you'll want to open the settings_model_selector.py file"
print 'and edit it to point to your caffe checkout.\n'
raise
if not os.path.exists(settings.caffevis_caffe_root):
raise Exception('ERROR: Set caffevis_caffe_root in settings.py first.')
lv = LiveVis(settings)
help_keys, _ = bindings.get_key_help('help_mode')
quit_keys, _ = bindings.get_key_help('quit')
print '\n\nRunning toolbox. Push %s for help or %s to quit.\n\n' % (help_keys[0], quit_keys[0])
lv.run_loop()
except Exception as exep:
print str(exep)
finally:
clean_temp_file()
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Runs the Deep Visualization Toolbox.')
parser.add_argument('--model', type=str, default=None,
help='Name of the model you want to change to. This overwrites the settings made in files.')
args = parser.parse_args()
main(args.model)