-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathparams.cpp
309 lines (281 loc) · 8.82 KB
/
params.cpp
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
/*
* params.cpp
*
* Created on: Feb 8, 2014
* Author: baj
*/
#include <params.h>
#include "logger.h"
#include "common.h"
using namespace std;
using namespace boost::program_options;
Params::Params()
{
text_margin = -7.5;
false_rate = 2.0;
missing_rate = 2.0;
false_density = 0.5;
false_missing_pruning = 0.001;
assignments_pruning = 0.1;
option_pruning = 0.001;
observation_proposal_prob = 1.0;
observation_error = 0.25;
death_rate = 0.02;
refinement_rate = 0.0;
human_area_min = 0.5;
human_area_max = 2.5;
max_speed = 2.0;
sigma_power = 2.0;
view_length = 12.0;
view_width = 57.0;
sleep_duration = 0.2;
trajectory_size = 500;
max_humans = 5;
max_terms = 1000;
seed = 0;
num_particles = 128;
position_kernel_size = 256;
change_intention_rate = 0.5;
max_em_steps = 1;
approaching_samples = 10;
gaussian_approximate = false;
velocity_augment = false;
detection_confidence = false;
detection_orientation = false;
hierarchical_filters = false;
mixed_filters = false;
assignment_sampling = false;
intention_mode = 0;
threads = 2;
debug_level = 1;
frame_rate = 5.0;
task_name = "OpenAreaTask";
simulation_test = false;
save_input = false;
log_date = false;
runto_step = -1;
simulator_expected_humans = 3;
CLEAR_distance_threshold = -1.0;
cropped = true;
approximation_test = false;
interface = false;
side_view = false;
report_threshold = 0.0;
}
Params::~Params()
{
}
Params &Params::ins()
{
static Params params;
return params;
}
bool Params::Parse(int argc, char** argv, bool verbose)
{
options_description desc("Allowed options");
desc.add_options()
("help", "Produce help message")
("debug", value<int>(&debug_level), "Debug level")
("framerate", value<double>(&frame_rate),
"Rate to process depth frames")
("test", value<bool>(&simulation_test)->implicit_value(true),
"Test by simulation")
("task", value<string>(&task_name), "Task name")
("bag", value<vector<string> >(&bag_names)->multitoken(),
"Bag files to read from")
("runto", value<int>(&runto_step), "Run to step")
("save_input", value<bool>(&save_input)->implicit_value(true),
"Save all inputs (including time)")
("load_input",
value<string>(&load_input)->implicit_value(
string(DEFAULT_LOG_NAME) + ".input"),
"Load all inputs (including time)")
("log_date",
value<bool>(&log_date)->implicit_value(true),
"Use date as log name")
("simulator_expected_humans", value<double>(&simulator_expected_humans),
"Simulator expected number of humans")
("simulator_distance_threshold",
value<double>(&CLEAR_distance_threshold)->implicit_value(1.0),
"Simulator statistic distance threshold")
("camera_calibration",
value<string>(&camera_calibration)->implicit_value("MOT-benchmarks/camera.xml"),
"Camera calibration file (for benchmark testing)")
("benchmark_data", value<vector<string> >(&benchmark_data)->multitoken(),
"Load benchmark detection and ground truth data")
("cropped",
value<bool>(&cropped)->implicit_value(true),
"Use cropped data")
("approximation_test",
value<bool>(&approximation_test)->implicit_value(true),
"Approximation error test")
("interface",
value<bool>(&interface)->implicit_value(true),
"Show benchmark interface")
("side_view",
value<bool>(&side_view)->implicit_value(true),
"Show side-by-side view")
("report_threshold",
value<double>(&report_threshold),
"Report confidence threshold")
("seed", value<uint>(&seed),
"Random seed number")
("num_particles",
value<uint>(&num_particles),
"Number of particles")
("position_kernel_size",
value<uint>(&position_kernel_size),
"Position kernel size")
("max_em_steps",
value<uint>(&max_em_steps),
"Max EM steps")
("approaching_samples",
value<uint>(&approaching_samples),
"Human approaching identification samples")
("false_rate",
value<double>(&false_rate),
"False detection rate")
("missing_rate",
value<double>(&missing_rate),
"Missing detection rate")
("false_density",
value<double>(&false_density),
"False detection density")
("false_missing_pruning",
value<double>(&false_missing_pruning),
"False-missing pruning threshold")
("assignments_pruning",
value<double>(&assignments_pruning),
"Murty pruning ratio threshold")
("option_pruning",
value<double>(&option_pruning),
"Option pruning ratio threshold")
("observation_proposal_prob",
value<double>(&observation_proposal_prob),
"Observation proposal prob")
("death_rate",
value<double>(&death_rate),
"Death rate")
("refinement_rate",
value<double>(&refinement_rate),
"Refinement rate")
("human_area_min",
value<double>(&human_area_min),
"Min human area")
("human_area_max",
value<double>(&human_area_max),
"Max human area")
("intention_mode",
value<int>(&intention_mode),
"Intention initialize mode")
("hierarchical_filters",
value<bool>(&hierarchical_filters)->implicit_value(true),
"Hierarchical particle filters")
("mixed_filters",
value<bool>(&mixed_filters)->implicit_value(true),
"Mixed particle filters")
("gaussian_approximate",
value<bool>(&gaussian_approximate)->implicit_value(true),
"Use Gaussian approximate")
("assignment_sampling",
value<bool>(&assignment_sampling)->implicit_value(true),
"Use assignment sampling")
("velocity_augment",
value<bool>(&velocity_augment)->implicit_value(true),
"Use velocity augment")
("detection_confidence",
value<bool>(&detection_confidence)->implicit_value(true),
"Use detection confidence")
("detection_orientation",
value<bool>(&detection_orientation)->implicit_value(true),
"Use detection orientation")
("observation_error",
value<double>(&observation_error),
"Observation error")
("threads",
value<uint>(&threads),
"Number of threads");
try {
variables_map vm;
store(parse_command_line(argc, argv, desc), vm);
if ( vm.count("help") ) {
TerminalLogger::log() << desc << endl;
return 0;
}
notify(vm);
}
catch(error& e) {
cerr << "ERROR: " << e.what() << endl << endl;
cerr << desc << endl;
return false;
}
const double sleep_buffer = 0.03;
sleep_duration = 1.0 / frame_rate - sleep_buffer;
if (simulation_test || !benchmark_data.empty()) {
sleep_duration += sleep_buffer;
}
else if (sleep_duration < 0.01) {
sleep_duration = 0.01;
}
if (verbose) {
Dump();
}
return true;
}
void Params::Dump()
{
if (debug_level > 0) {
PRINT_VALUE("Options");
PRINT_VALUE(debug_level);
PRINT_VALUE(frame_rate);
PRINT_VALUE(task_name);
PRINT_VALUE(simulation_test);
PRINT_VALUE(save_input);
PRINT_VALUE(load_input);
PRINT_VALUE(log_date);
PRINT_VALUE(runto_step);
PRINT_VALUE(simulator_expected_humans);
PRINT_VALUE(CLEAR_distance_threshold);
PRINT_VALUE(cropped);
PRINT_VALUE(approximation_test);
PRINT_VALUE(interface);
PRINT_VALUE(side_view);
PRINT_VALUE(report_threshold);
PRINT_VALUE(false_rate);
PRINT_VALUE(missing_rate);
PRINT_VALUE(false_density);
PRINT_VALUE(false_missing_pruning);
PRINT_VALUE(assignments_pruning);
PRINT_VALUE(option_pruning);
PRINT_VALUE(observation_proposal_prob);
PRINT_VALUE(death_rate);
PRINT_VALUE(refinement_rate);
PRINT_VALUE(human_area_min);
PRINT_VALUE(human_area_max);
PRINT_VALUE(observation_error);
PRINT_VALUE(max_speed);
PRINT_VALUE(sigma_power);
PRINT_VALUE(view_length);
PRINT_VALUE(view_width);
PRINT_VALUE(sleep_duration);
PRINT_VALUE(trajectory_size);
PRINT_VALUE(max_humans);
PRINT_VALUE(max_terms);
PRINT_VALUE(seed);
PRINT_VALUE(num_particles);
PRINT_VALUE(position_kernel_size);
PRINT_VALUE(change_intention_rate);
PRINT_VALUE(max_em_steps);
PRINT_VALUE(approaching_samples);
PRINT_VALUE(threads);
PRINT_VALUE(gaussian_approximate);
PRINT_VALUE(velocity_augment);
PRINT_VALUE(detection_confidence);
PRINT_VALUE(detection_orientation);
PRINT_VALUE(hierarchical_filters);
PRINT_VALUE(mixed_filters);
PRINT_VALUE(intention_mode);
PRINT_VALUE(assignment_sampling);
PRINT_VALUE("\n");
}
}