Alignment model and input (#3115)
authorAnton Romanov <anton.romanov@intel.com>
Mon, 16 Nov 2020 09:26:04 +0000 (01:26 -0800)
committerGitHub <noreply@github.com>
Mon, 16 Nov 2020 09:26:04 +0000 (12:26 +0300)
18 files changed:
inference-engine/ie_bridges/c/samples/object_detection_sample_ssd/main.c
inference-engine/ie_bridges/c/samples/object_detection_sample_ssd/object_detection_sample_ssd.h
inference-engine/samples/benchmark_app/README.md
inference-engine/samples/benchmark_app/benchmark_app.hpp
inference-engine/samples/classification_sample_async/README.md
inference-engine/samples/classification_sample_async/classification_sample_async.h
inference-engine/samples/classification_sample_async/main.cpp
inference-engine/samples/common/samples/common.hpp
inference-engine/samples/hello_classification/main.cpp
inference-engine/samples/hello_query_device/main.cpp
inference-engine/samples/hello_reshape_ssd/main.cpp
inference-engine/samples/ngraph_function_creation_sample/README.md
inference-engine/samples/ngraph_function_creation_sample/main.cpp
inference-engine/samples/ngraph_function_creation_sample/ngraph_function_creation_sample.hpp
inference-engine/samples/object_detection_sample_ssd/README.md
inference-engine/samples/object_detection_sample_ssd/main.cpp
inference-engine/samples/object_detection_sample_ssd/object_detection_sample_ssd.h
inference-engine/samples/style_transfer_sample/main.cpp

index a98c3f6..6916e93 100644 (file)
@@ -68,12 +68,12 @@ int ParseAndCheckCommandLine(int argc, char *argv[]) {
 
     if (help)
         return -1;
-    if (img_msg == NULL) {
-        printf("Parameter -i is not set\n");
+    if (input_model == NULL) {
+        printf("Model is required but not set. Please set -m option. \n");
         return -1;
     }
-    if (input_model == NULL) {
-        printf("Parameter -m is not set \n");
+    if (img_msg == NULL) {
+        printf("Input is required but not set.Please set - i option.\n");
         return -1;
     }
 
index d2d1204..a3c0e40 100644 (file)
@@ -9,12 +9,12 @@
 /// @brief message for help argument
 static const char *help_message = "Print a usage message.";
 
+/// @brief message for model argument
+static const char* model_message = "Required. Path to an .xml file with a trained model.";
+
 /// @brief message for images argument
 static const char *image_message = "Required. Path to an .bmp image.";
 
-/// @brief message for model argument
-static const char *model_message = "Required. Path to an .xml file with a trained model.";
-
 /// @brief message for plugin argument
 static const char *plugin_message = "Plugin name. For example MKLDNNPlugin. If this parameter is pointed, " \
 "the sample will look for this plugin only";
@@ -41,8 +41,8 @@ static void showUsage() {
     printf("\nobject_detection_sample_ssd [OPTION]\n");
     printf("Options:\n\n");
     printf("    -h                      %s\n", help_message);
-    printf("    -i \"<path>\"             %s\n", image_message);
     printf("    -m \"<path>\"             %s\n", model_message);
+    printf("    -i \"<path>\"             %s\n", image_message);
     printf("      -l \"<absolute_path>\"  %s\n", custom_cpu_library_message);
     printf("          Or\n");
     printf("      -c \"<absolute_path>\"  %s\n", custom_cldnn_message);
@@ -77,6 +77,7 @@ static int getopt(int argc, char **argv, char *opts) {
         optopt = c = argv[optind][sp];
         if(c == ':' || (cp = strchr(opts, c)) == 0) {
             ERR(": unrecognized option -- ", c);
+            showUsage();
             if(argv[optind][++sp] == '\0') {
                 optind++;
                 sp = 1;
@@ -102,4 +103,4 @@ static int getopt(int argc, char **argv, char *opts) {
         }
     }
     return(c);
-}
\ No newline at end of file
+}
index 6709c67..d6aa954 100644 (file)
@@ -68,8 +68,8 @@ benchmark_app [OPTION]
 Options:
 
     -h, --help                Print a usage message
+    -m "<path>"               Required. Path to an .xml/.onnx/.prototxt file with a trained model or to a .blob files with a trained compiled model.   
     -i "<path>"               Optional. Path to a folder with images and/or binaries or to specific image or binary file.
-    -m "<path>"               Required. Path to an .xml/.onnx/.prototxt file with a trained model or to a .blob files with a trained compiled model.
     -d "<device>"             Optional. Specify a target device to infer on (the list of available devices is shown below). Default value is CPU.
                               Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin.
                               Use "-d MULTI:<comma-separated_devices_list>" format to specify MULTI plugin. 
@@ -143,11 +143,11 @@ This section provides step-by-step instructions on how to run the Benchmark Tool
    
    * On CPU:
    ```sh
-   ./benchmark_app -m <ir_dir>/googlenet-v1.xml -d CPU -api async -i <INSTALL_DIR>/deployment_tools/demo/car.png --progress true
+   ./benchmark_app -m <ir_dir>/googlenet-v1.xml -i <INSTALL_DIR>/deployment_tools/demo/car.png  -d CPU -api async --progress true
    ```
    * On FPGA:
    ```sh
-   ./benchmark_app -m <ir_dir>/googlenet-v1.xml -d HETERO:FPGA,CPU -api async -i <INSTALL_DIR>/deployment_tools/demo/car.png --progress true
+   ./benchmark_app -m <ir_dir>/googlenet-v1.xml -i <INSTALL_DIR>/deployment_tools/demo/car.png -d HETERO:FPGA,CPU -api async --progress true
    ```
 
 The application outputs the number of executed iterations, total duration of execution, latency, and throughput.
index 6f223f0..1a5a529 100644 (file)
@@ -199,8 +199,8 @@ static void showUsage() {
     std::cout << "Options:" << std::endl;
     std::cout << std::endl;
     std::cout << "    -h, --help                " << help_message << std::endl;
-    std::cout << "    -i \"<path>\"               " << input_message << std::endl;
     std::cout << "    -m \"<path>\"               " << model_message << std::endl;
+    std::cout << "    -i \"<path>\"               " << input_message << std::endl;
     std::cout << "    -d \"<device>\"             " << target_device_message << std::endl;
     std::cout << "    -l \"<absolute_path>\"      " << custom_cpu_library_message << std::endl;
     std::cout << "          Or" << std::endl;
index 4d87920..5d9abb0 100644 (file)
@@ -38,8 +38,8 @@ classification_sample_async [OPTION]
 Options:
 
     -h                      Print a usage message.
-    -i "<path>"             Required. Path to a folder with images or path to an image files: a .ubyte file for LeNetand a .bmp file for the other networks.
     -m "<path>"             Required. Path to an .xml file with a trained model.
+    -i "<path>"             Required. Path to a folder with images or path to an image files: a .ubyte file for LeNetand a .bmp file for the other networks.
       -l "<absolute_path>"  Required for CPU custom layers.Absolute path to a shared library with the kernels implementation
           Or
       -c "<absolute_path>"  Required for GPU custom kernels.Absolute path to the .xml file with kernels description
@@ -57,7 +57,7 @@ To run the sample, use AlexNet and GoogLeNet or other public or pre-trained imag
 
 You can do inference of an image using a trained AlexNet network on FPGA with fallback to CPU using the following command:
 ```sh
-./classification_sample_async -i <path_to_image>/cat.bmp -m <path_to_model>/alexnet_fp32.xml -nt 5 -d HETERO:FPGA,CPU
+./classification_sample_async -m <path_to_model>/alexnet_fp32.xml -i <path_to_image>/cat.bmp -d HETERO:FPGA,CPU -nt 5 
 ```
 
 ## Sample Output
index f01ee28..09d2ebb 100644 (file)
 /// @brief message for help argument
 static const char help_message[] = "Print a usage message.";
 
+/// @brief message for model argument
+static const char model_message[] = "Required. Path to an .xml file with a trained model.";
+
 /// @brief message for images argument
 static const char image_message[] = "Required. Path to a folder with images or path to an image files: a .ubyte file for LeNet"\
                                     "and a .bmp file for the other networks.";
 
-/// @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 the target device to infer on (the list of available devices is shown below). " \
                                             "Default value is CPU. Sample will look for a suitable plugin for device specified.";
@@ -72,8 +72,8 @@ static void showUsage() {
     std::cout << "Options:" << std::endl;
     std::cout << std::endl;
     std::cout << "    -h                      " << help_message << std::endl;
-    std::cout << "    -i \"<path>\"             " << image_message << std::endl;
     std::cout << "    -m \"<path>\"             " << model_message << std::endl;
+    std::cout << "    -i \"<path>\"             " << image_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;
index 2a20eb5..a4afc80 100644 (file)
@@ -43,12 +43,12 @@ bool ParseAndCheckCommandLine(int argc, char *argv[]) {
     }
     slog::info << "Parsing input parameters" << slog::endl;
 
-    if (FLAGS_i.empty()) {
-        throw std::logic_error("Parameter -i is not set");
+    if (FLAGS_m.empty()) {
+        throw std::logic_error("Model is required but not set. Please set -m option.");
     }
 
-    if (FLAGS_m.empty()) {
-        throw std::logic_error("Parameter -m is not set");
+    if (FLAGS_i.empty()) {
+        throw std::logic_error("Input is required but not set. Please set -i option.");
     }
 
     return true;
index f7867f8..cd6948e 100644 (file)
@@ -1127,4 +1127,5 @@ inline void showAvailableDevices() {
     for (const auto& device : devices) {
         std::cout << "  " << device;
     }
+    std::cout << std::endl;
 }
index 048f3b0..3539940 100644 (file)
@@ -67,7 +67,7 @@ int main(int argc, char *argv[]) {
     try {
         // ------------------------------ Parsing and validation of input args ---------------------------------
         if (argc != 4) {
-            tcout << "Usage : ./hello_classification <path_to_model> <path_to_image> <device_name>" << std::endl;
+            tcout << "Usage : " << argv[0] << " <path_to_model> <path_to_image> <device_name>" << std::endl;
             return EXIT_FAILURE;
         }
 
index e656dcc..ab8c8b5 100644 (file)
@@ -72,7 +72,7 @@ int main(int argc, char *argv[]) {
     try {
         // ------------------------------ Parsing and validation of input args ---------------------------------
         if (argc != 1) {
-            std::cout << "Usage : ./hello_query_device" << std::endl;
+            std::cout << "Usage : "<< argv[0] << std::endl;
             return EXIT_FAILURE;
         }
 
index ef28ece..63a7cc8 100644 (file)
@@ -19,7 +19,7 @@ int main(int argc, char* argv[]) {
     try {
         // ------------------------------ Parsing and validation of input args ---------------------------------
         if (argc != 5) {
-            std::cout << "Usage : ./hello_reshape_ssd <path_to_model> <path_to_image> <device> <batch>"
+            std::cout << "Usage : "<< argv[0] <<" <path_to_model> <path_to_image> <device> <batch>"
                       << std::endl;
             return EXIT_FAILURE;
         }
index 6833441..2eb0353 100644 (file)
@@ -35,7 +35,7 @@ ngraph_function_creation_sample [OPTION]
 Options:
 
     -h                      Print a usage message.
-    -m "<path>"             Path to a .bin file with weights for the trained model
+    -m "<path>"             Required. Path to a .bin file with weights for the trained model
     -i "<path>"             Required. Path to an image or folder with images
     -d "<device>"           Specify the target device to infer on it. See the list of available devices below. The sample looks for a suitable plugin for the specified device. The default value is CPU.
     -nt "<integer>"         Number of top results. The default value is 10.
@@ -46,7 +46,7 @@ Available target devices: <devices>
 
 For example, to do inference of an UByte image on a GPU run the following command:
 ```sh
-./ngraph_function_creation_sample -i <path_to_image> -m <path_to_weights_file> -d GPU
+./ngraph_function_creation_sample -m <path_to_weights_file> -i <path_to_image> -d GPU
 ```
 
 ## Sample Output
index 10757bb..057737a 100644 (file)
@@ -35,6 +35,14 @@ bool ParseAndCheckCommandLine(int argc, char* argv[]) {
         throw std::logic_error("Incorrect value for nt argument. It should be greater than 0 and less than 10.");
     }
 
+    if (FLAGS_m.empty()) {
+        throw std::logic_error("Path to a .bin file with weights for the trained model is required but not set. Please set -m option.");
+    }
+
+    if (FLAGS_i.empty()) {
+        throw std::logic_error("Path to an image is required but not set. Please set -i option.");
+    }
+
     return true;
 }
 
index e6e9d84..da20c59 100644 (file)
@@ -16,7 +16,7 @@ static const char help_message[] = "Print a usage message.";
 static const char input_message[] = "Required. Path to image or folder with images";
 
 /// @brief message for model argument
-static const char model_message[] = "Path to a .bin file with weights for the trained model.";
+static const char model_message[] = "Required. Path to a .bin file with weights for the trained model.";
 
 /// @brief message for assigning cnn calculation to device
 static const char target_device_message[] = "Specify the target device to infer on it . See the list of available devices below. " \
index 9ce4460..b0a4f4e 100644 (file)
@@ -26,8 +26,8 @@ object_detection_sample_ssd [OPTION]
 Options:
 
     -h                      Print a usage message.
-    -i "<path>"             Required. Path to an .bmp image.
     -m "<path>"             Required. Path to an .xml file with a trained model.
+    -i "<path>"             Required. Path to an .bmp image.
       -l "<absolute_path>"  Required for CPU custom layers. Absolute path to a shared library with the kernels implementations.
           Or
       -c "<absolute_path>"  Required for GPU custom kernels. Absolute path to the .xml file with the kernels descriptions.
@@ -45,11 +45,11 @@ To run the sample, you can use public or pre-trained models. To download the pre
 For example, to do inference on a CPU with the OpenVINO&trade; toolkit person detection SSD models, run one of the following commands:
 
 ```sh
-./object_detection_sample_ssd -i <path_to_image>/inputImage.bmp -m <path_to_model>person-detection-retail-0013.xml -d CPU
+./object_detection_sample_ssd -m <path_to_model>person-detection-retail-0013.xml -i <path_to_image>/inputImage.bmp -d CPU
 ```
 or
 ```sh
-./object_detection_sample_ssd -i <path_to_image>/inputImage.jpg -m <path_to_model>person-detection-retail-0002.xml -d CPU
+./object_detection_sample_ssd -m <path_to_model>person-detection-retail-0002.xml -i <path_to_image>/inputImage.jpg -d CPU
 ```
 
 ## Sample Output
index 382e007..fbb2316 100644 (file)
@@ -36,12 +36,12 @@ bool ParseAndCheckCommandLine(int argc, char *argv[]) {
 
     slog::info << "Parsing input parameters" << slog::endl;
 
-    if (FLAGS_i.empty()) {
-        throw std::logic_error("Parameter -i is not set");
+    if (FLAGS_m.empty()) {
+        throw std::logic_error("Model is required but not set. Please set -m option.");
     }
 
-    if (FLAGS_m.empty()) {
-        throw std::logic_error("Parameter -m is not set");
+    if (FLAGS_i.empty()) {
+        throw std::logic_error("Input is required but not set. Please set -i option.");
     }
 
     return true;
index d62d0cf..e0f0200 100644 (file)
 /// @brief message for help argument
 static const char help_message[] = "Print a usage message.";
 
-/// @brief message for images argument
-static const char image_message[] = "Required. Path to an .bmp image.";
-
 /// @brief message for model argument
 static const char model_message[] = "Required. Path to an .xml file with a trained model.";
 
+/// @brief message for images argument
+static const char image_message[] = "Required. Path to an .bmp image.";
+
 /// @brief message for plugin argument
 static const char plugin_message[] = "Plugin name. For example MKLDNNPlugin. If this parameter is pointed, " \
 "the sample will look for this plugin only";
@@ -78,8 +78,8 @@ static void showUsage() {
     std::cout << "Options:" << std::endl;
     std::cout << std::endl;
     std::cout << "    -h                      " << help_message << std::endl;
-    std::cout << "    -i \"<path>\"             " << image_message << std::endl;
     std::cout << "    -m \"<path>\"             " << model_message << std::endl;
+    std::cout << "    -i \"<path>\"             " << image_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;
index cc37023..b85ab42 100644 (file)
@@ -33,12 +33,12 @@ bool ParseAndCheckCommandLine(int argc, char *argv[]) {
         return false;
     }
 
-    if (FLAGS_i.empty()) {
-        throw std::logic_error("Parameter -i is not set");
+    if (FLAGS_m.empty()) {
+        throw std::logic_error("Model is required but not set. Please set -m option.");
     }
 
-    if (FLAGS_m.empty()) {
-        throw std::logic_error("Parameter -m is not set");
+    if (FLAGS_i.empty()) {
+        throw std::logic_error("Input is required but not set. Please set -i option.");
     }
 
     return true;