-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
482 lines (381 loc) · 24.3 KB
/
settings.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# Settings for Deep Visualization Toolbox
#
# Note: Probably don't change anything in this file. To override
# settings, define them in your network specific settings file or settings_user.py rather than changing them here.
# Import network settings. Turn off creation of X.pyc to avoid stale settings if X.py is removed.
import os
import sys
sys.dont_write_bytecode = True
try:
from settings_model_selector import *
except ImportError:
if not os.path.exists('settings_model_selector.py'):
raise Exception('Could not import settings_model_selector.py')
else:
raise
# Resume usual pyc creation
sys.dont_write_bytecode = False
####################################
#
# General settings
#
####################################
# base folder for paths defined in the settings
base_folder = locals().get('base_folder', '')
# Which device to use for webcam input. On Mac the default device, 0,
# works for builtin camera or external USB webcam, if plugged in. If
# you have multiple cameras, you might need to update this value. To
# disable webcam input, set to None.
input_updater_capture_device = locals().get('input_updater_capture_device', 0)
# How long to sleep in the input reading thread after reading a frame from the camera
input_updater_sleep_after_read_frame = locals().get('input_updater_sleep_after_read_frame', 1.0/20)
# Input updater thread die after this many seconds without a heartbeat. Useful during debugging to avoid other threads running after main thread has crashed.
input_updater_heartbeat_required = locals().get('input_updater_heartbeat_required', 150.0 if __debug__ else 15.0)
# How long to sleep while waiting for key presses and redraws. Recommendation: 1 (min: 1)
main_loop_sleep_ms = locals().get('main_loop_sleep_ms', 1)
# Whether or not to print a "." every second time through the main loop to visualize the loop rate
print_dots = locals().get('print_dots', False)
####################################
#
# Window pane layout and colors/fonts
#
####################################
# Show border for each panel and annotate each with its name. Useful
# for debugging window_panes arrangement.
debug_window_panes = locals().get('debug_window_panes', False)
# The window panes available and their layout is determined by the
# "window_panes" variable. By default all panes are enabled with a
# standard size. This setting will often be overridden on a per-model
# basis, e.g. if the model does not have pre-computed jpgvis
# information, the caffevis_jpgvis pane can be omitted. For
# convenience, if the only variable that needs to be overridden is the
# height of the control panel (to accomodate varying length of layer
# names), one can simply define control_pane_height. If more
if 'default_window_panes' in locals():
raise Exception('Override window panes in settings_MODEL.py by defining window_panes, not default_window_panes')
# set the following member to make control pane height constant, instead of automatic
# control_pane_height = locals().get('control_pane_height', 3*20)
default_window_panes = (
# (i, j, i_size, j_size)
('input', ( 0, 0, 300, 300)), # This pane is required to show the input picture
('caffevis_aux', ( 300, 0, 300, 300)),
('caffevis_back', ( 600, 0, 300, 300)),
('caffevis_status', ( 900, 0, 2*20 + 10, 1500)),
('caffevis_control', ( 0, 300, 3*20, 900)),
('caffevis_layers', (3*20, 300, 900-3*20, 900)),
('caffevis_jpgvis', ( 0, 1200, 900, 300)),
('caffevis_buttons', ( 0, 1500, 900, 300)),
)
window_panes = locals().get('window_panes', default_window_panes)
# Define global_scale as a float to rescale window and all
# panes. Handy for quickly changing resolution for a different screen.
global_scale = locals().get('global_scale', 1.0)
# Define global_font_size to scale all font sizes by this amount.
global_font_size = locals().get('global_font_size', 1.0)
if global_scale != 1.0:
scaled_window_panes = []
for wp in window_panes:
scaled_window_panes.append([wp[0], [int(val*global_scale) for val in wp[1]]])
window_panes = scaled_window_panes
# All window configuation information is now contained in the
# window_panes variable. Print if desired:
if debug_window_panes:
print 'Final window panes and locations/sizes (i, j, i_size, j_size):'
for pane in window_panes:
print ' Pane: %s' % repr(pane)
help_pane_loc = locals().get('help_pane_loc', (.07, .07, .86, .86)) # as a fraction of main window
window_background = locals().get('window_background', (.2, .2, .2))
stale_background = locals().get('stale_background', (.3, .3, .2))
static_files_dir = locals().get('static_files_dir', 'input_images')
static_files_regexp = locals().get('static_files_regexp', '.*\.(jpg|jpeg|png)$')
static_files_ignore_case = locals().get('static_files_ignore_case', True)
# True to stretch to square, False to crop to square. (Can change at
# runtime via 'stretch_mode' key.)
static_file_stretch_mode = locals().get('static_file_stretch_mode', True)
# is the network loaded a siamese network
is_siamese = locals().get('is_siamese', False)
# siamese input mode, can be either 'concat_channelwise' or 'concat_along_width'
siamese_input_mode = locals().get('siamese_input_mode', 'concat_channelwise')
# contains the input mode for reading static images, can be: 'directory', 'image_list'
static_files_input_mode = locals().get('static_files_input_mode', 'directory')
# contains the file name to read, relevant only when static_files_input_mode is 'image_list'
static_files_input_file = locals().get('static_files_input_file', 'images_file_list.txt')
# set to True if the model expects grayscale inputs, False otherwise.
# If value is None we set this parameter according to the network structure
is_gray_model = locals().get('is_gray_model', None)
# int, 0+. How many times to go through the main loop after a keypress
# before resuming handling frames (0 to handle every frame as it
# arrives). Setting this to a value > 0 can enable more responsive
# keyboard input even when other settings are tuned to maximize the
# framerate. Default: 2
keypress_pause_handle_iterations = locals().get('keypress_pause_handle_iterations', 2)
# int, 0+. How many times to go through the main loop after a keypress
# before resuming redraws (0 to redraw every time it is
# needed). Setting this to a value > 0 can enable more responsive
# keyboard input even when other settings are tuned to maximize the
# framerate. Default: 1
keypress_pause_redraw_iterations = locals().get('keypress_pause_redraw_iterations', 1)
# int, 1+. Force a redraw even when keys are pressed if there have
# been this many passes through the main loop without a redraw due to
# the keypress_pause_redraw_iterations setting combined with many key
# presses. Default: 3.
redraw_at_least_every = locals().get('redraw_at_least_every', 3)
# Tuple of tuples describing the file to import and class from it to
# instantiate for each app to be run. Apps are run and given keys to
# handle in the order specified.
default_installed_apps = (
('caffevis.app', 'CaffeVisApp'),
)
installed_apps = locals().get('installed_apps', default_installed_apps)
# Font settings for the help pane. Text is rendered using OpenCV; see
# http://docs.opencv.org/2.4/modules/core/doc/drawing_functions.html#puttext
# for information on parameters.
help_face = locals().get('help_face', 'FONT_HERSHEY_COMPLEX_SMALL')
help_loc = locals().get('help_loc', (20,10)) # r,c order
help_line_spacing = locals().get('help_line_spacing', 10) # extra pixel spacing between lines
help_clr = locals().get('help_clr', (1,1,1))
help_fsize = locals().get('help_fsize', 1.0 * global_font_size)
help_thick = locals().get('help_thick', 1)
####################################
#
# Caffevis settings
#
####################################
# Whether to use GPU mode (if True) or CPU mode (if False)
caffevis_mode_gpu = locals().get('caffevis_mode_gpu', False)
# ID of GPU to use, default is 0
caffevis_gpu_id = locals().get('caffevis_gpu_id', 0)
# Data mean, if any, to be subtracted from input image file / webcam
# image. Specify as string path to file or tuple of one value per
# channel or None.
caffevis_data_mean = locals().get('caffevis_data_mean', None)
# should we generate the channelwise average of the input mean file
generate_channelwise_mean = locals().get('generate_channelwise_mean', False)
# Path to file listing labels in order, one per line, used for the
# below two features. None to disable.
caffevis_labels = locals().get('caffevis_labels', None)
# Which layers have channels/neurons corresponding to the order given
# in the caffevis_labels file? Annotate these units with label text
# (when those neurons are selected). None to disable.
caffevis_label_layers = locals().get('caffevis_label_layers', [])
# Which layer to use for displaying class output numbers in left pane
# (when no neurons are selected). None to disable.
caffevis_prob_layer = locals().get('caffevis_prob_layer', None)
# what is the folder format for loading precomputed visualizations,
# options are:
# "original_combined_single_image" - every unit has a single layer
# "max_tracker_output" - every unit has a list of images to be loaded
caffevis_outputs_dir_folder_format = locals().get('caffevis_outputs_dir_folder_format', 'max_tracker_output')
# List. For which layers should jpgs be loaded for
# visualization? If a layer name (full name, not prettified) is given
# here, we will try to load jpgs to visualize each unit. This is used
# for pattern mode ('s' key by default) and for the right
# caffevis_jpgvis pane ('9' key by default). None disables filtering (thus taking all), empty list to tries nothing
caffevis_jpgvis_layers = locals().get('caffevis_jpgvis_layers', None)
# Dict specifying string:string mapping. Steal pattern mode and right
# jpgvis pane visualizations for certain layers (e.g. pool1) from
# other layers (e.g. conv1). We can do this because
# optimization/max-act/deconv-of-max results are identical.
caffevis_jpgvis_remap = locals().get('caffevis_jpgvis_remap', {})
# Function mapping old name -> new name to modify/prettify/shorten
# layer names.
caffevis_layer_pretty_name_fn = locals().get('caffevis_layer_pretty_name_fn', lambda name: name)
# The CaffeVisApp computes a layout of neurons for the caffevis_layers
# pane given the aspect ratio in caffevis_layers_aspect_ratio (< 1 for
# portrait, 1 for square, > 1 for landscape). Default: 1 (square).
caffevis_layers_aspect_ratio = locals().get('caffevis_layers_aspect_ratio', 1.0)
# Replace magic '%DVT_ROOT%' string with the root DeepVis Toolbox
# directory (the location of this settings file)
dvt_root = os.path.dirname(os.path.abspath(__file__))
if 'caffevis_deploy_prototxt' in locals():
caffevis_deploy_prototxt = caffevis_deploy_prototxt.replace('%DVT_ROOT%', dvt_root)
if 'caffevis_network_weights' in locals():
caffevis_network_weights = caffevis_network_weights.replace('%DVT_ROOT%', dvt_root)
if isinstance(caffevis_data_mean, basestring):
caffevis_data_mean = caffevis_data_mean.replace('%DVT_ROOT%', dvt_root)
if isinstance(caffevis_labels, basestring):
caffevis_labels = caffevis_labels.replace('%DVT_ROOT%', dvt_root)
if isinstance(caffevis_outputs_dir, basestring):
caffevis_outputs_dir = caffevis_outputs_dir.replace('%DVT_ROOT%', dvt_root)
if isinstance(static_files_input_file, basestring):
static_files_input_file = static_files_input_file.replace('%DVT_ROOT%', dvt_root)
if isinstance(static_files_dir, basestring):
static_files_dir = static_files_dir.replace('%DVT_ROOT%', dvt_root)
# Pause Caffe forward/backward computation for this many seconds after a keypress. This is to keep the processor free for a brief period after a keypress, which allow the interface to feel much more responsive. After this period has passed, Caffe resumes computation, in CPU mode often occupying all cores. Default: .1
caffevis_pause_after_keys = locals().get('caffevis_pause_after_keys', .10)
caffevis_frame_wait_sleep = locals().get('caffevis_frame_wait_sleep', .01)
caffevis_jpg_load_sleep = locals().get('caffevis_jpg_load_sleep', .01)
# CaffeProc thread dies after this many seconds without a
# heartbeat. Useful during debugging to avoid other threads running
# after main thread has crashed.
caffevis_heartbeat_required = locals().get('caffevis_heartbeat_required', 150.0 if __debug__ else 30.0)
# How far to move when using fast left/right/up/down keys
caffevis_fast_move_dist = locals().get('caffevis_fast_move_dist', 3)
# Size of jpg reading cache in bytes (default: 2GB)
# Note: largest fc6/fc7 images are ~600MB. Cache smaller than this will be painfully slow when using patterns_mode for fc6 and fc7.
# Cache use when all layers have been loaded is ~1.6GB
caffevis_jpg_cache_size = locals().get('caffevis_jpg_cache_size', 4000*1024**2)
caffevis_grad_norm_blur_radius = locals().get('caffevis_grad_norm_blur_radius', 4.0)
# Boost display of individual channels. For channel activations in the
# range [0,1], boost_indiv rescales the activations of that channel
# such that the new_max = old_max ** -boost_indiv. Thus no-op value =
# 0.0, and a value of 1.0 means each channel is scaled to use the
# entire [0,1] range.
caffevis_boost_indiv_choices = locals().get('caffevis_boost_indiv_choices', (0, .3, .5, .8, 1))
# Default boost indiv given as index into caffevis_boost_indiv_choices
caffevis_boost_indiv_default_idx = locals().get('caffevis_boost_indiv_default_idx', 0)
# Boost display of entire layer activation by the given gamma value
# (for values in [0,1], display_val = old_val ** gamma. No-op value:
# 1.0)
caffevis_boost_gamma_choices = locals().get('caffevis_boost_gamma_choices', (1, .7, .5, .3))
# Default boost gamma given as index into caffevis_boost_gamma_choices
caffevis_boost_gamma_default_idx = locals().get('caffevis_boost_gamma_default_idx', 0)
# Initially show label predictions or not (toggle with default key '8')
caffevis_init_show_label_predictions = locals().get('caffevis_init_show_label_predictions', True)
# Initially show jpg vis or not (toggle with default key '9')
caffevis_init_show_unit_jpgs = locals().get('caffevis_init_show_unit_jpgs', True)
caffevis_keep_aspect_ratio = locals().get('caffevis_keep_aspect_ratio', False)
# extra pixel spacing between lines. Default: 4 = not much space / tight layout
caffevis_control_line_spacing = locals().get('caffevis_control_line_spacing', 4)
# Font settings for control pane (list of layers)
caffevis_control_face = locals().get('caffevis_control_face', 'FONT_HERSHEY_COMPLEX_SMALL')
caffevis_control_loc = locals().get('caffevis_control_loc', (15,5)) # r,c order
caffevis_control_clr = locals().get('caffevis_control_clr', (.8,.8,.8))
caffevis_control_clr_selected = locals().get('caffevis_control_clr_selected', (1, 1, 1))
caffevis_control_clr_cursor = locals().get('caffevis_control_clr_cursor', (.5,1,.5))
caffevis_control_clr_bp = locals().get('caffevis_control_clr_bp', (.8, .8, 1))
caffevis_control_fsize = locals().get('caffevis_control_fsize', 1.0 * global_font_size)
caffevis_control_thick = locals().get('caffevis_control_thick', 1)
caffevis_control_thick_selected = locals().get('caffevis_control_thick_selected', 2)
caffevis_control_thick_cursor = locals().get('caffevis_control_thick_cursor', 2)
caffevis_control_thick_bp = locals().get('caffevis_control_thick_bp', 2)
# Color settings for layer activation pane
caffevis_layer_clr_cursor = locals().get('caffevis_layer_clr_cursor', (.5,1,.5))
caffevis_layer_clr_back_background = locals().get('caffevis_layer_clr_back_background', (.2,.2,.5))
caffevis_layer_clr_back_sel = locals().get('caffevis_layer_clr_back_sel', (.2,.2,1))
# Font settings for status pane (bottom line)
caffevis_status_face = locals().get('caffevis_status_face', 'FONT_HERSHEY_COMPLEX_SMALL')
caffevis_status_loc = locals().get('caffevis_status_loc', (15,10)) # r,c order
caffevis_status_line_spacing = locals().get('caffevis_status_line_spacing', 5) # extra pixel spacing between lines
caffevis_status_clr = locals().get('caffevis_status_clr', (.8,.8,.8))
caffevis_status_fsize = locals().get('caffevis_status_fsize', 1.0 * global_font_size)
caffevis_status_thick = locals().get('caffevis_status_thick', 1)
caffevis_jpgvis_stack_vert = locals().get('caffevis_jpgvis_stack_vert', True)
# Font settings for buttons pane (left most pane)
caffevis_buttons_header_face = locals().get('caffevis_buttons_header_face', 'FONT_HERSHEY_COMPLEX_SMALL')
caffevis_buttons_header_fsize = locals().get('caffevis_buttons_header_fsize', 1.0 * global_font_size)
caffevis_buttons_header_clr = locals().get('caffevis_buttons_header_clr', (.8,.8,.8))
caffevis_buttons_header_thick = locals().get('caffevis_buttons_header_thick', 2)
caffevis_buttons_normal_face = locals().get('caffevis_buttons_normal_face', 'FONT_HERSHEY_COMPLEX_SMALL')
caffevis_buttons_normal_fsize = locals().get('caffevis_buttons_normal_fsize', 1.0 * global_font_size)
caffevis_buttons_normal_clr = locals().get('caffevis_buttons_normal_clr', (.8,.8,.8))
caffevis_buttons_normal_thick = locals().get('caffevis_buttons_normal_thick', 1)
caffevis_buttons_selected_face = locals().get('caffevis_buttons_selected_face', 'FONT_HERSHEY_COMPLEX_SMALL')
caffevis_buttons_selected_fsize = locals().get('caffevis_buttons_selected_fsize', 1.0 * global_font_size)
caffevis_buttons_selected_clr = locals().get('caffevis_buttons_selected_clr', (.5,1,.5))
caffevis_buttons_selected_thick = locals().get('caffevis_buttons_selected_thick', 1)
caffevis_buttons_loc = locals().get('caffevis_buttons_loc', (15,10)) # r,c order
caffevis_buttons_line_spacing = locals().get('caffevis_buttons_line_spacing', 10) # extra pixel spacing between lines
# Font settings for class prob output (top 5 classes listed on left)
caffevis_class_face = locals().get('caffevis_class_face', 'FONT_HERSHEY_COMPLEX_SMALL')
caffevis_class_loc = locals().get('caffevis_class_loc', (20,10)) # r,c order
caffevis_class_line_spacing = locals().get('caffevis_class_line_spacing', 10) # extra pixel spacing between lines
caffevis_class_clr_0 = locals().get('caffevis_class_clr_0', (.5,.5,.5))
caffevis_class_clr_1 = locals().get('caffevis_class_clr_1', (.5,1,.5))
caffevis_class_fsize = locals().get('caffevis_class_fsize', 1.0 * global_font_size)
caffevis_class_thick = locals().get('caffevis_class_thick', 1)
# Font settings for label overlay text (shown on layer pane only for caffevis_label_layers layers)
caffevis_label_face = locals().get('caffevis_label_face', 'FONT_HERSHEY_COMPLEX_SMALL')
caffevis_label_loc = locals().get('caffevis_label_loc', (30,20)) # r,c order
caffevis_label_clr = locals().get('caffevis_label_clr', (.8,.8,.8))
caffevis_label_fsize = locals().get('caffevis_label_fsize', 1.0 * global_font_size)
caffevis_label_thick = locals().get('caffevis_label_thick', 1)
# Font settings for score overlay text (shown on maximal images on rightmost pane)
caffevis_score_face = locals().get('caffevis_score_face', 5) # this is a hacky way to use FONT_HERSHEY_COMPLEX_SMALL
caffevis_score_loc = locals().get('caffevis_score_loc', (20,10)) # r,c order
caffevis_score_clr = locals().get('caffevis_score_clr', (.5,1,.5))
caffevis_score_fsize = locals().get('caffevis_score_fsize', 1.0 * global_font_size)
caffevis_score_thick = locals().get('caffevis_score_thick', 1)
# how should histograms be loaded: 'calculate_in_realtime' or 'load_from_file'
caffevis_histograms_format = locals().get('caffevis_histograms_format','load_from_file')
# should we black maximal input images with zero or negative activation score
caffevis_clear_negative_activations = locals().get('caffevis_clear_negative_activations', False)
# folder for generating and reading deep vis outputs
caffevis_outputs_dir = locals().get('caffevis_outputs_dir', '.')
# caffe net parameter - channel swap, default is None which will make automatic decision according to other settings
# the automatic setting is either (2,1,0) or (2,1,0,5,4,3) according to is_siamese value and siamese_input_mode
caffe_net_channel_swap = locals().get('caffe_net_channel_swap', None)
# caffe net parameter - transpose, used to convert HxWxK to KxHxW, when None uses caffe default which is (2,0,1)
# this parameter should rarely change
caffe_net_transpose = locals().get('caffe_net_transpose', None)
# caffe net parameter - raw scale, multiplies input BEFORE mean subtraction
caffe_net_raw_scale = locals().get('caffe_net_raw_scale', 255.0)
# caffe net parameter - input scale, multiplies input AFTER mean subtraction
caffe_net_input_scale = locals().get('caffe_net_input_scale', None)
# caffe net parameter - image dims
caffe_net_image_dims = locals().get('caffe_net_image_dims', None)
# default value for do_maxes parameter in max_tracker
max_tracker_do_maxes = locals().get('max_tracker_do_maxes', True)
# default value for do_deconv parameter in max tracker
max_tracker_do_deconv = locals().get('max_tracker_do_deconv', True)
# default value for do_deconv_norm parameter in max tracker
max_tracker_do_deconv_norm = locals().get('max_tracker_do_deconv_norm', False)
# default value for do_backprop parameter in max tracker
max_tracker_do_backprop = locals().get('max_tracker_do_backprop', False)
# default value for do_backprop_norm parameter in max tracker
max_tracker_do_backprop_norm = locals().get('max_tracker_do_backprop_norm', False)
# default value for do_info parameter in max tracker
max_tracker_do_info = locals().get('max_tracker_do_info', True)
# default value for do_histograms parameter in max tracker
max_tracker_do_histograms = locals().get('max_tracker_do_histograms', True)
# default value for do_correlation parameter in max tracker
max_tracker_do_correlation = locals().get('max_tracker_do_correlation', True)
# default batch size used in max_tracker
max_tracker_batch_size = locals().get('max_tracker_batch_size', 1)
# list of layers to output when using offlien scripts
layers_to_output_in_offline_scripts = locals().get('layers_to_output_in_offline_scripts', [])
# list of siamese layers/blobs to show
# note: if an item in the list is a pair of layers, then it is a siamese layer
layers_list = locals().get('layers_list', [])
# rand-seed parameter for optimize_image.py
optimize_image_rand_seed = locals().get('optimize_image_rand_seed', 0)
# decay parameter for optimize_image.py
optimize_image_decay = locals().get('optimize_image_decay', 0.0001)
# blur-radius parameter for optimize_image.py
optimize_image_blur_radius = locals().get('optimize_image_blur_radius', 1.0)
# blur-every parameter for optimize_image.py
optimize_image_blue_every = locals().get('optimize_image_blue_every', 4)
# lr-policy parameter for optimize_image.py
optimize_image_lr_policy = locals().get('optimize_image_lr_policy', 'constant')
# lr-params parameter for optimize_image.py
optimize_image_lr_params = locals().get('optimize_image_lr_params', '{"lr": 100.0}')
# max-iter parameter for optimize_image.py
optimize_image_max_iters = locals().get('optimize_image_max_iters', [1000])
# output-prefix parameter for optimize_image.py
optimize_image_output_prefix = locals().get('optimize_image_output_prefix', '%(p.push_layer)s/unit_%(p.push_channel)04d/opt_%(r.batch_index)03d_seed%(p.rand_seed)d')
# parameter which marks whether we should generate also the plus mean image of the optmized image
optimize_image_generate_plus_mean = locals().get('optimize_image_generate_plus_mean', False)
# batch size used in optimize_image.py
optimize_image_batch_size = locals().get('optimize_image_batch_size', 1)
# channels to generate in optimize_image.py, if list is empty we generate all the channels in the layer
optimize_image_channels = locals().get('optimize_image_channels', [])
####################################
#
# A few final sanity checks
#
####################################
# Check that required setting have been defined
bound_locals = locals()
def assert_in_settings(setting_name):
if not setting_name in bound_locals:
raise Exception('The "%s" setting is required; be sure to define it in settings_MODEL.py' % setting_name)
# Set this to point to your compiled checkout of caffe
assert_in_settings('caffevis_caffe_root')
# Path to caffe deploy prototxt file. Minibatch size should be 1.
assert_in_settings('caffevis_deploy_prototxt')
# Path to network weights to load.
assert_in_settings('caffevis_network_weights')
assert_in_settings('caffevis_data_mean')
# Check that caffe directory actually exists
if not os.path.exists(caffevis_caffe_root):
raise Exception('The Caffe directory specified in settings_model_selector.py, %s, does not exist. Set the caffevis_caffe_root variable in your settings_model_selector.py to the path of your compiled Caffe checkout.' % caffevis_caffe_root)