-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.hpp
executable file
·167 lines (124 loc) · 7.38 KB
/
main.hpp
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
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <string>
#include <vector>
#include <gflags/gflags.h>
#include <iostream>
/// @brief Message for help argument
static const char help_message[] = "Print a usage message.";
/// @brief Message for images argument
static const char video_message[] = "Required. Path to a video file (specify \"cam\" to work with camera).";
/// @brief Message for model argument
static const char model_message[] = "Required. Path to an .xml file with a trained model.";
/// @brief Message for assigning cnn calculation to device
static const char target_device_message[] = "Optional. Specify a target device to infer on (the list of available devices is shown below). " \
"Default value is CPU. The demo will look for a suitable plugin for the specified device";
/// @brief Message for performance counters
static const char performance_counter_message[] = "Optional. Enable per-layer performance report.";
/// @brief Message for clDNN custom kernels desc
static const char custom_cldnn_message[] = "Optional. Required for GPU custom kernels. "\
"Absolute path to the .xml file with the kernels description.";
/// @brief Message for user library argument
static const char custom_cpu_library_message[] = "Optional. Required for CPU custom layers. " \
"Absolute path to a shared library with the layers implementation.";
/// @brief Message for probability threshold argument
static const char thresh_output_message[] = "Optional. Probability threshold for detections.";
/// @brief Message for probability threshold argument
static const char iou_thresh_output_message[] = "Optional. Filtering intersection over union threshold for overlapping boxes.";
/// @brief Message raw output flag
static const char raw_output_message[] = "Optional. Output inference results raw values showing.";
/// @brief Message resizable input flag
static const char input_resizable_message[] = "Optional. Enable resizable input with support of ROI crop and auto resize.";
/// @brief Message do not show processed video
static const char no_show_processed_video[] = "Optional. Do not show processed video.";
/// \brief Defines flag for showing help message <br>
DEFINE_bool(h, false, help_message);
/// \brief Define parameter for set video file of reading from camera <br>
/// It is a required parameter
DEFINE_string(i, "", video_message);
/// \brief Defines parameter for setting path to a model file <br>
/// It is a required parameter
DEFINE_string(m, "", model_message);
/// \brief Defines the target device to infer on <br>
DEFINE_string(d, "CPU", target_device_message);
/// \brief Enables per-layer performance report
DEFINE_bool(pc, false, performance_counter_message);
/// @brief Defines GPU custom kernels path <br>
/// Default is ./lib
DEFINE_string(c, "", custom_cldnn_message);
/// @brief Defines absolute path to CPU library with user layers <br>
/// It is a optional parameter
DEFINE_string(l, "", custom_cpu_library_message);
/// \brief Defines flag to output raw scoring results<br>
/// It is an optional parameter
DEFINE_bool(r, false, raw_output_message);
/// \brief Defines value of confidence threshold <br>
/// It is an optional parameter
DEFINE_double(t, 0.5, thresh_output_message);
/// \brief Defines value of intersection over union threshold<br>
/// It is an optional parameter
DEFINE_double(iou_t, 0.4, iou_thresh_output_message);
/// \brief Enables resizable input<br>
/// It is an optional parameter
DEFINE_bool(auto_resize, false, input_resizable_message);
/// \brief Define a flag to disable showing processed video<br>
/// It is an optional parameter
DEFINE_bool(no_show, false, no_show_processed_video);
static const char mqtt_host_message[] = "Required. Specify an MQTT host url.";
DEFINE_string(mh, "", mqtt_host_message);
static const char mqtt_username[] = "Required. Specify an MQTT host username.";
DEFINE_string(u, "", mqtt_username);
static const char mqtt_password[] = "Required. Specify an MQTT host password.";
DEFINE_string(p, "", mqtt_password);
static const char mqtt_topic[] = "Required. Specify an MQTT topic.";
DEFINE_string(tp, "", mqtt_topic);
static const char mqtt_timeout_message[] = "Optional. Seconds between no people detected and MQTT publish. Default is 5.";
DEFINE_double(to, 5, mqtt_timeout_message);
static const char crop_right_message[] = "Optional. Number of pixels to crop from the right.";
static const char crop_bottom_message[] = "Optional. Number of pixels to crop from the bottom.";
static const char crop_left_message[] = "Optional. Number of pixels to crop from the left.";
static const char crop_top_message[] = "Optional. Number of pixels to crop from the top.";
DEFINE_double(cr, 0, crop_right_message);
DEFINE_double(cb, 0, crop_bottom_message);
DEFINE_double(cl, 0, crop_left_message);
DEFINE_double(ct, 0, crop_top_message);
static const char async_message[] = "Optional. Start program in async mode.";
DEFINE_bool(async, false, async_message);
static const char cameras_message[] = "Optional. Specify path to camera YAML config.";
DEFINE_string(cameras, "", cameras_message);
/**
* \brief This function shows a help message
*/
static void showUsage() {
std::cout << std::endl;
std::cout << "object_detection_demo_yolov3_async [OPTION]" << std::endl;
std::cout << "Options:" << std::endl;
std::cout << std::endl;
std::cout << " -h " << help_message << std::endl;
std::cout << " -cameras \"<path>\" " << cameras_message << std::endl;
std::cout << " -i \"<path>\" " << video_message << std::endl;
std::cout << " -m \"<path>\" " << model_message << std::endl;
std::cout << " -l \"<absolute_path>\" " << custom_cpu_library_message << std::endl;
std::cout << " Or" << std::endl;
std::cout << " -c \"<absolute_path>\" " << custom_cldnn_message << std::endl;
std::cout << " -d \"<device>\" " << target_device_message << std::endl;
std::cout << " -pc " << performance_counter_message << std::endl;
std::cout << " -r " << raw_output_message << std::endl;
std::cout << " -t " << thresh_output_message << std::endl;
std::cout << " -iou_t " << iou_thresh_output_message << std::endl;
std::cout << " -auto_resize " << input_resizable_message << std::endl;
std::cout << " -no_show " << no_show_processed_video << std::endl;
std::cout << " -mh " << mqtt_host_message << std::endl;
std::cout << " -u " << mqtt_username << std::endl;
std::cout << " -p " << mqtt_password << std::endl;
std::cout << " -tp " << mqtt_topic << std::endl;
std::cout << " -to \"<human_timeout>\" " << mqtt_timeout_message << std::endl;
std::cout << " -cr \"<pixels>\" " << crop_right_message << std::endl;
std::cout << " -cb \"<pixels>\" " << crop_bottom_message << std::endl;
std::cout << " -cl \"<pixels>\" " << crop_left_message << std::endl;
std::cout << " -ct \"<pixels>\" " << crop_top_message << std::endl;
std::cout << " -async " << async_message << std::endl;
}