forked from adipandas/multi-object-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilechooser_utils.py
More file actions
91 lines (67 loc) · 3.53 KB
/
filechooser_utils.py
File metadata and controls
91 lines (67 loc) · 3.53 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
from ipyfilechooser import FileChooser
def create_filechooser(default_path="~/", html_title="Select File", use_dir_icons=True):
fc = FileChooser(default_path)
fc.title = html_title
fc.use_dir_icons = use_dir_icons
return fc
def select_caffemodel_prototxt(default_path="~/", use_dir_icons=True):
html_title = '<b>Select <code>.prototxt</code> file for the caffemodel:</b>'
fc = create_filechooser(default_path=default_path,
html_title=html_title,
use_dir_icons=use_dir_icons)
return fc
def select_caffemodel_weights(default_path="~/", use_dir_icons=True):
html_title = '<b>Select caffemodel weights (file with extention <code>.caffemodel</code>):</b>'
fc = create_filechooser(default_path=default_path,
html_title=html_title,
use_dir_icons=use_dir_icons)
return fc
def select_caffemodel(default_path="~/", use_dir_icons=True):
prototxt = select_caffemodel_prototxt(default_path=default_path, use_dir_icons=use_dir_icons)
weights = select_caffemodel_weights(default_path=default_path, use_dir_icons=use_dir_icons)
return prototxt, weights
def select_videofile(default_path="~/", use_dir_icons=True):
html_title = '<b>Select video file:</b>'
fc = create_filechooser(default_path=default_path,
html_title=html_title,
use_dir_icons=use_dir_icons)
return fc
def select_yolo_weights(default_path="~/", use_dir_icons=True):
html_title = '<b>Select YOLO weights (<code>.weights</code> file):</b>'
fc = create_filechooser(default_path=default_path,
html_title=html_title,
use_dir_icons=use_dir_icons)
return fc
def select_coco_labels(default_path="~/", use_dir_icons=True):
html_title = '<b>Select coco labels file (<code>.name</code> file):</b>'
fc = create_filechooser(default_path=default_path,
html_title=html_title,
use_dir_icons=use_dir_icons)
return fc
def select_yolo_config(default_path="~/", use_dir_icons=True):
html_title = '<b>Choose YOLO config file (<code>.cfg</code> file):</b>'
fc = create_filechooser(default_path=default_path,
html_title=html_title,
use_dir_icons=use_dir_icons)
return fc
def select_yolo_model(default_path="~/", use_dir_icons=True):
yolo_weights = select_yolo_weights(default_path, use_dir_icons)
yolo_config = select_yolo_config(default_path, use_dir_icons)
coco_names = select_coco_labels(default_path, use_dir_icons)
return yolo_weights, yolo_config, coco_names
def select_pbtxt(default_path="~/", use_dir_icons=True):
html_title = '<b>Select <code>.pbtxt</code> file:</b>'
fc = create_filechooser(default_path=default_path,
html_title=html_title,
use_dir_icons=use_dir_icons)
return fc
def select_tfmobilenet_weights(default_path="~/", use_dir_icons=True):
html_title = '<b>Select tf-frozen graph of mobilenet (<code>.pb</code> file):</b>'
fc = create_filechooser(default_path=default_path,
html_title=html_title,
use_dir_icons=use_dir_icons)
return fc
def select_tfmobilenet(default_path="~/", use_dir_icons=True):
prototxt = select_pbtxt(default_path, use_dir_icons)
tfweights = select_tfmobilenet_weights(default_path, use_dir_icons)
return prototxt, tfweights