Fix benchmark_app to update app_inputs_info correctly (#4994)

* Fix benchmark_app to set app_inputs_info

* Keep U8 precision only for images by default

* Review fixes

* Fix a typo
This commit is contained in:
Artemy Skrebkov 2021-04-01 19:20:33 +03:00 committed by GitHub
parent 27268f008e
commit dca99aed64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -378,18 +378,21 @@ int main(int argc, char *argv[]) {
topology_name = cnnNetwork.getName();
slog::info << (FLAGS_b != 0 ? "Network batch size was changed to: " : "Network batch size: ") << batchSize << slog::endl;
// ----------------- 6. Configuring input ----------------------------------------------------------------------
// ----------------- 6. Configuring inputs and outputs ----------------------------------------------------------------------
next_step();
for (auto& item : inputInfo) {
if (app_inputs_info.at(item.first).isImage()) {
/** Set the precision of input data provided by the user, should be called before load of the network to the device **/
processPrecision(cnnNetwork, FLAGS_ip, FLAGS_op, FLAGS_iop);
for (auto& item : cnnNetwork.getInputsInfo()) {
// if precision for input set by user, then set it to app_inputs
// if it an image, set U8
if (!FLAGS_ip.empty() || FLAGS_iop.find(item.first) != std::string::npos) {
app_inputs_info.at(item.first).precision = item.second->getPrecision();
} else if (app_inputs_info.at(item.first).isImage()) {
app_inputs_info.at(item.first).precision = Precision::U8;
item.second->setPrecision(app_inputs_info.at(item.first).precision);
}
}
processPrecision(cnnNetwork, FLAGS_ip, FLAGS_op, FLAGS_iop);
printInputAndOutputsInfo(cnnNetwork);
// ----------------- 7. Loading the model to the device --------------------------------------------------------

View File

@ -57,9 +57,8 @@ def _configure_network_inputs(ie_network: IENetwork, app_inputs_info, input_prec
input_info = ie_network.input_info
for key in input_info.keys():
if app_inputs_info[key].is_image:
app_inputs_info[key].precision = input_precision
input_info[key].precision = input_precision
app_inputs_info[key].precision = input_precision
input_info[key].precision = input_precision
def _configure_network_outputs(ie_network: IENetwork, output_precision: str):
output_info = ie_network.outputs