Fixed ngraph sample logical errors (#2600)
authorMikhail Ryzhov <mikhail.ryzhov@intel.com>
Mon, 26 Oct 2020 12:36:49 +0000 (15:36 +0300)
committerGitHub <noreply@github.com>
Mon, 26 Oct 2020 12:36:49 +0000 (15:36 +0300)
* Fixed ngrapth sample logical errors

- added batch size, because sample accepts several images
- set label file as optional

inference-engine/samples/ngraph_function_creation_sample/main.cpp

index b360c08..10757bb 100644 (file)
@@ -272,7 +272,8 @@ int main(int argc, char* argv[]) {
         }
 
         /** Setting batch size using image count **/
-        size_t batchSize = 1;
+        network.setBatchSize(imagesData.size());
+        size_t batchSize = network.getBatchSize();
         slog::info << "Batch size is " << std::to_string(batchSize) << slog::endl;
 
         // --------------------------- Prepare output blobs -----------------------------------------------------
@@ -383,8 +384,6 @@ int main(int argc, char* argv[]) {
                 labels.push_back(strLine);
             }
             inputFile.close();
-        } else {
-            throw std::logic_error("Cannot read label file");
         }
 
         ClassificationResult classificationResult(outputBlob, images, batchSize, FLAGS_nt, labels);