Extend timetest_infer pipeline with infer track and blob's support (#2298)

This commit is contained in:
Vitaliy Urusovskij 2020-09-21 02:09:41 +03:00 committed by GitHub
parent 3bd46c0b21
commit babff1fd15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 7 deletions

View File

@ -0,0 +1,20 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <string>
namespace TimeTest {
/**
* @brief Get extension from filename
* @param filename - name of the file which extension should be extracted
* @return string with extracted file extension
*/
std::string fileExt(const std::string& filename) {
auto pos = filename.rfind('.');
if (pos == std::string::npos) return "";
return filename.substr(pos + 1);
}
}

View File

@ -6,6 +6,7 @@
#include <iostream>
#include "timetests_helper/timer.h"
#include "timetests_helper/utils.h"
using namespace InferenceEngine;
/**
@ -15,20 +16,41 @@ using namespace InferenceEngine;
*/
int runPipeline(const std::string &model, const std::string &device) {
auto pipeline = [](const std::string &model, const std::string &device) {
SCOPED_TIMER(first_time_to_inference);
Core ie;
CNNNetwork cnnNetwork;
ExecutableNetwork exeNetwork;
InferRequest inferRequest;
{
SCOPED_TIMER(read_network);
cnnNetwork = ie.ReadNetwork(model);
SCOPED_TIMER(first_inference_latency);
{
SCOPED_TIMER(load_plugin);
ie.GetVersions(device);
}
{
SCOPED_TIMER(create_exenetwork);
if (TimeTest::fileExt(model) == "blob") {
SCOPED_TIMER(import_network);
exeNetwork = ie.ImportNetwork(model, device);
}
else {
CNNNetwork cnnNetwork;
{
SCOPED_TIMER(read_network);
cnnNetwork = ie.ReadNetwork(model);
}
{
SCOPED_TIMER(load_network);
exeNetwork = ie.LoadNetwork(cnnNetwork, device);
}
}
}
}
{
SCOPED_TIMER(load_network);
ExecutableNetwork exeNetwork = ie.LoadNetwork(cnnNetwork, device);
SCOPED_TIMER(first_inference);
inferRequest = exeNetwork.CreateInferRequest();
inferRequest.Infer();
}
};