63a18b2fe0594a772521c9f0c7caf6f9367b45fa
[platform/upstream/dldt.git] / inference-engine / samples / speech_sample / speech_sample.hpp
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 /// @brief message for help argument
13 static const char help_message[] = "Print a usage message.";
14
15 /// @brief message for images argument
16 static const char input_message[] = "Required. Paths to an .ark files. Example of usage: <file1.ark,file2.ark> or <file.ark>.";
17
18 /// @brief message for model argument
19 static const char model_message[] = "Required. Path to an .xml file with a trained model (required if -rg is missing).";
20
21 /// @brief message for plugin argument
22 static const char plugin_message[] = "Plugin name. For example MKLDNNPlugin. If this parameter is pointed, " \
23                                      "the sample will look for this plugin only";
24
25 /// @brief message for assigning cnn calculation to device
26 static const char target_device_message[] = "Specify a target device to infer on. CPU, GPU, GNA_AUTO, GNA_HW, GNA_SW, GNA_SW_FP32 "
27                                             "GNA_SW_EXACT and HETERO with combination of GNA as the primary device and CPU"
28                                             " as a secondary (e.g. HETERO:GNA,CPU) are supported. The list of available devices is shown below. "
29                                             "The sample will look for a suitable plugin for device specified.";
30
31 /// @brief message for performance counters
32 static const char performance_counter_message[] = "Enables per-layer performance report";
33
34 /// @brief message for user library argument
35 static const char custom_cpu_library_message[] = "Required for MKLDNN (CPU)-targeted custom layers." \
36 "Absolute path to a shared library with the kernels impl.";
37
38 /// @brief message for score output argument
39 static const char output_message[] = "Output file name (default name is scores.ark).";
40
41 /// @brief message for reference score file argument
42 static const char reference_score_message[] = "Read reference score .ark file and compare scores.";
43
44 /// @brief message for read GNA model argument
45 static const char read_gna_model_message[] = "Read GNA model from file using path/filename provided (required if -m is missing).";
46
47 /// @brief message for write GNA model argument
48 static const char write_gna_model_message[] = "Write GNA model to file using path/filename provided.";
49
50 /// @brief message for write GNA embedded model argument
51 static const char write_embedded_model_message[] = "Write GNA embedded model to file using path/filename provided.";
52
53 /// @brief message for quantization argument
54 static const char quantization_message[] = "Input quantization mode:  static (default), dynamic, or user (use with -sf).";
55
56 /// @brief message for quantization bits argument
57 static const char quantization_bits_message[] = "Weight bits for quantization:  8 or 16 (default)";
58
59 /// @brief message for scale factor argument
60 static const char scale_factor_message[] = "Optional user-specified input scale factor for quantization (use with -q user).";
61
62 /// @brief message for batch size argument
63 static const char batch_size_message[] = "Batch size 1-8 (default 1)";
64
65 /// @brief message for #threads for CPU inference
66 static const char infer_num_threads_message[] = "Optional. Number of threads to use for concurrent async" \
67 " inference requests on the GNA.";
68
69 /// @brief message for left context window argument
70 static const char context_window_message_l[] = "Optional. Number of frames for left context windows (default is 0). " \
71                                                "Works only with context window networks."
72                                                " If you use the cw_l or cw_r flag, then batch size and nthreads arguments are ignored.";
73
74 /// @brief message for right context window argument
75 static const char context_window_message_r[] = "Optional. Number of frames for right context windows (default is 0). " \
76                                                "Works only with context window networks."
77                                                " If you use the cw_r or cw_l flag, then batch size and nthreads arguments are ignored.";
78
79 /// \brief Define flag for showing help message <br>
80 DEFINE_bool(h, false, help_message);
81
82 /// \brief Define parameter for set image file <br>
83 /// It is a required parameter
84 DEFINE_string(i, "", input_message);
85
86 /// \brief Define parameter for set model file <br>
87 /// It is a required parameter
88 DEFINE_string(m, "", model_message);
89
90 /// \brief Define parameter for set plugin name <br>
91 /// It is a required parameter
92 DEFINE_string(p, "", plugin_message);
93
94 /// \brief device the target device to infer on <br>
95 DEFINE_string(d, "GNA_AUTO", target_device_message);
96
97 /// \brief Enable per-layer performance report
98 DEFINE_bool(pc, false, performance_counter_message);
99
100 /// @brief Absolute path to CPU library with user layers <br>
101 /// It is a optional parameter
102 DEFINE_string(l, "", custom_cpu_library_message);
103
104 /// @brief Write model to file (model.bin)
105 DEFINE_string(o, "", output_message);
106
107 /// @brief Read reference score file
108 DEFINE_string(r, "", reference_score_message);
109
110 /// @brief Read GNA model from file (model.bin)
111 DEFINE_string(rg, "", read_gna_model_message);
112
113 /// @brief Write GNA model to file (model.bin)
114 DEFINE_string(wg, "", write_gna_model_message);
115
116 /// @brief Write GNA embedded model to file (model.bin)
117 DEFINE_string(we, "", write_embedded_model_message);
118
119 /// @brief Input quantization mode (default static)
120 DEFINE_string(q, "static", quantization_message);
121
122 /// @brief Input quantization bits (default 16)
123 DEFINE_int32(qb, 16, quantization_bits_message);
124
125 /// @brief Scale factor for quantization (default 1.0)
126 DEFINE_double(sf, 1.0, scale_factor_message);
127
128 /// @brief Batch size (default 1)
129 DEFINE_int32(bs, 1, batch_size_message);
130
131 /// @brief Number of threads to use for inference on the CPU (also affects Hetero cases)
132 DEFINE_int32(nthreads, 1, infer_num_threads_message);
133
134 /// @brief Right context window size (default 0)
135 DEFINE_int32(cw_r, 0, context_window_message_r);
136
137 /// @brief Left context window size (default 0)
138 DEFINE_int32(cw_l, 0, context_window_message_l);
139
140 /**
141  * \brief This function show a help message
142  */
143 static void showUsage() {
144     std::cout << std::endl;
145     std::cout << "speech_sample [OPTION]" << std::endl;
146     std::cout << "Options:" << std::endl;
147     std::cout << std::endl;
148     std::cout << "    -h                      " << help_message << std::endl;
149     std::cout << "    -i \"<path>\"             " << input_message << std::endl;
150     std::cout << "    -m \"<path>\"             " << model_message << std::endl;
151     std::cout << "    -o \"<path>\"             " << output_message << std::endl;
152     std::cout << "    -l \"<absolute_path>\"    " << custom_cpu_library_message << std::endl;
153     std::cout << "    -d \"<device>\"           " << target_device_message << std::endl;
154     std::cout << "    -p                      " << plugin_message << std::endl;
155     std::cout << "    -pc                     " << performance_counter_message << std::endl;
156     std::cout << "    -q \"<mode>\"             " << quantization_message << std::endl;
157     std::cout << "    -qb \"<integer>\"         " << quantization_bits_message << std::endl;
158     std::cout << "    -sf \"<double>\"          " << scale_factor_message << std::endl;
159     std::cout << "    -bs \"<integer>\"         " << batch_size_message << std::endl;
160     std::cout << "    -r \"<path>\"             " << reference_score_message << std::endl;
161     std::cout << "    -rg \"<path>\"            " << read_gna_model_message << std::endl;
162     std::cout << "    -wg \"<path>\"            " << write_gna_model_message << std::endl;
163     std::cout << "    -we \"<path>\"            " << write_embedded_model_message << std::endl;
164     std::cout << "    -nthreads \"<integer>\"   " << infer_num_threads_message << std::endl;
165     std::cout << "    -cw_l \"<integer>\"       " << context_window_message_l << std::endl;
166     std::cout << "    -cw_r \"<integer>\"       " << context_window_message_r << std::endl;
167 }
168