-// Copyright (C) 2018 Intel Corporation
+// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <inference_engine.hpp>
#include <samples/ocv_common.hpp>
+#include <samples/classification_results.h>
using namespace InferenceEngine;
// -----------------------------------------------------------------------------------------------------
// --------------------------- 1. Load Plugin for inference engine -------------------------------------
- InferencePlugin plugin = PluginDispatcher({"../../../lib/intel64", ""}).getPluginByDevice(device_name);
+ InferencePlugin plugin = PluginDispatcher().getPluginByDevice(device_name);
// -----------------------------------------------------------------------------------------------------
// --------------------------- 2. Read IR Generated by ModelOptimizer (.xml and .bin files) ------------
- int batchSize = 1;
+ size_t batchSize = 1;
CNNNetReader network_reader;
network_reader.ReadNetwork(input_model);
network_reader.ReadWeights(input_model.substr(0, input_model.size() - 4) + ".bin");
// --------------------------- 8. Process output ------------------------------------------------------
Blob::Ptr output = infer_request.GetBlob(output_name);
- auto output_data = output->buffer().as<PrecisionTrait<Precision::FP32>::value_type*>();
-
- std::vector<unsigned> results;
- /* This is to sort output probabilities and put it to results vector */
- TopResults(10, *output, results);
-
- std::cout << std::endl << "Top 10 results:" << std::endl << std::endl;
- for (size_t id = 0; id < 10; ++id) {
- std::cout.precision(7);
- auto result = output_data[results[id]];
- std::cout << std::left << std::fixed << result << " label #" << results[id] << std::endl;
- }
+ // Print classification results
+ ClassificationResult classificationResult(output, {input_image_path});
+ classificationResult.print();
// -----------------------------------------------------------------------------------------------------
std::cout << std::endl << "total inference time: " << total << std::endl;