Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / samples / classification_sample_async / classification_sample_async.h
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include <string>
8 #include <vector>
9 #include <gflags/gflags.h>
10 #include <iostream>
11
12 #ifdef _WIN32
13 #include <os/windows/w_dirent.h>
14 #else
15 #include <dirent.h>
16 #endif
17
18 /// @brief message for help argument
19 static const char help_message[] = "Print a usage message.";
20
21 /// @brief message for images argument
22 static const char image_message[] = "Required. Path to a folder with images or path to an image files: a .ubyte file for LeNet"\
23                                     "and a .bmp file for the other networks.";
24
25 /// @brief message for plugin_path argument
26 static const char plugin_path_message[] = "Optional. Path to a plugin folder.";
27
28 /// @brief message for model argument
29 static const char model_message[] = "Required. Path to an .xml file with a trained model.";
30
31 /// @brief message for assigning cnn calculation to device
32 static const char target_device_message[] = "Optional. Specify the target device to infer on; CPU, GPU, FPGA, HDDL or MYRIAD is acceptable. " \
33                                             "Sample will look for a suitable plugin for device specified. Default value is CPU";
34
35 /// @brief message for performance counters
36 static const char performance_counter_message[] = "Optional. Enables per-layer performance report";
37
38 /// @brief message for top results number
39 static const char ntop_message[] = "Optional. Number of top results. Default value is 10.";
40
41 /// @brief message for iterations count
42 static const char iterations_count_message[] = "Optional. Number of iterations. Default value is 1.";
43
44 /// @brief message for iterations count
45 static const char ninfer_request_message[] = "Optional. Number of infer request for pipelined mode. Default value is 1.";
46
47 /// @brief message for #threads for CPU inference
48 static const char infer_num_threads_message[] = "Optional. Number of threads to use for inference on the CPU "
49                                                 "(including HETERO cases).";
50
51 /// @brief message for clDNN custom kernels desc
52 static const char custom_cldnn_message[] = "Required for GPU custom kernels."\
53                                             "Absolute path to the .xml file with kernels description";
54
55 /// @brief message for user library argument
56 static const char custom_cpu_library_message[] = "Required for CPU custom layers." \
57                                                  "Absolute path to a shared library with the kernels implementation";
58
59 // @brief message for CPU threads pinning option
60 static const char cpu_threads_pinning_message[] = "Optional. Enable (\"YES\", default) or disable (\"NO\")" \
61                                                   "CPU threads pinning for CPU-involved inference.";
62
63 /// @brief message for plugin messages
64 static const char plugin_message[] = "Optional. Enables messages from a plugin";
65
66
67 /// @brief Define flag for showing help message <br>
68 DEFINE_bool(h, false, help_message);
69
70 /// @brief Define parameter for set image file <br>
71 /// It is a required parameter
72 DEFINE_string(i, "", image_message);
73
74 /// @brief Define parameter for set model file <br>
75 /// It is a required parameter
76 DEFINE_string(m, "", model_message);
77
78 /// @brief Define parameter for set path to plugins <br>
79 DEFINE_string(pp, "", plugin_path_message);
80
81 /// @brief device the target device to infer on <br>
82 DEFINE_string(d, "CPU", target_device_message);
83
84 /// @brief Top results number (default 10) <br>
85 DEFINE_uint32(nt, 10, ntop_message);
86
87 /// @brief Enable per-layer performance report
88 DEFINE_bool(pc, false, performance_counter_message);
89
90 /// @brief Define parameter for clDNN custom kernels path <br>
91 /// Default is ./lib
92 DEFINE_string(c, "", custom_cldnn_message);
93
94 /// @brief Absolute path to CPU library with user layers <br>
95 /// It is a optional parameter
96 DEFINE_string(l, "", custom_cpu_library_message);
97
98 /// @brief Iterations count (default 1)
99 DEFINE_uint32(ni, 1, iterations_count_message);
100
101 /// @brief Number of infer requests
102 DEFINE_uint32(nireq, 1, ninfer_request_message);
103
104 /// @brief Enable plugin messages
105 DEFINE_bool(p_msg, false, plugin_message);
106
107 /// @brief Enable plugin messages
108 DEFINE_string(pin, "YES", cpu_threads_pinning_message);
109
110 /// @brief Number of threads to use for inference on the CPU (also affects Hetero cases)
111 DEFINE_int32(nthreads, 0, infer_num_threads_message);
112
113
114 /**
115 * @brief This function show a help message
116 */
117 static void showUsage() {
118     std::cout << std::endl;
119     std::cout << "classification_sample_async [OPTION]" << std::endl;
120     std::cout << "Options:" << std::endl;
121     std::cout << std::endl;
122     std::cout << "    -h                      " << help_message << std::endl;
123     std::cout << "    -i \"<path>\"             " << image_message << std::endl;
124     std::cout << "    -m \"<path>\"             " << model_message << std::endl;
125     std::cout << "      -l \"<absolute_path>\"    " << custom_cpu_library_message << std::endl;
126     std::cout << "          Or" << std::endl;
127     std::cout << "      -c \"<absolute_path>\"    " << custom_cldnn_message << std::endl;
128     std::cout << "    -pp \"<path>\"            " << plugin_path_message << std::endl;
129     std::cout << "    -d \"<device>\"           " << target_device_message << std::endl;
130     std::cout << "    -nt \"<integer>\"         " << ntop_message << std::endl;
131     std::cout << "    -ni \"<integer>\"         " << iterations_count_message << std::endl;
132     std::cout << "    -pc                     " << performance_counter_message << std::endl;
133     std::cout << "    -nireq \"<integer>\"      " << ninfer_request_message << std::endl;
134     std::cout << "    -p_msg                  " << plugin_message << std::endl;
135     std::cout << "    Some CPU-specific performance options" << std::endl;
136     std::cout << "    -nthreads \"<integer>\"   " << infer_num_threads_message << std::endl;
137     std::cout << "    -pin \"YES\"/\"NO\"       " << cpu_threads_pinning_message << std::endl;
138 }