Files
openvino/samples/cpp/benchmark_app/inputs_filling.cpp

973 lines
48 KiB
C++
Raw Normal View History

// Copyright (C) 2018-2023 Intel Corporation
2019-08-09 19:02:42 +03:00
// SPDX-License-Identifier: Apache-2.0
//
#include "inputs_filling.hpp"
#include <algorithm>
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
#include <fstream>
#include <iomanip>
#include <memory>
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
#include <random>
#include <string>
#include <utility>
#include <vector>
2019-08-09 19:02:42 +03:00
#include "format_reader_ptr.h"
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
#include "samples/slog.hpp"
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
#include "utils.hpp"
2019-08-09 19:02:42 +03:00
template <typename T>
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
using uniformDistribution = typename std::conditional<
std::is_floating_point<T>::value,
std::uniform_real_distribution<T>,
typename std::conditional<std::is_integral<T>::value, std::uniform_int_distribution<T>, void>::type>::type;
template <typename T>
ov::Tensor create_tensor_from_image(const std::vector<std::string>& files,
size_t inputId,
size_t batchSize,
const benchmark_app::InputInfo& inputInfo,
const std::string& inputName,
std::string* filenames_used = nullptr) {
auto tensor = ov::Tensor(inputInfo.type, inputInfo.dataShape);
auto data = tensor.data<T>();
2019-08-09 19:02:42 +03:00
/** Collect images data ptrs **/
std::vector<std::shared_ptr<uint8_t>> vreader;
vreader.reserve(batchSize);
size_t imgBatchSize = 1;
if (!inputInfo.layout.empty() && ov::layout::has_batch(inputInfo.layout)) {
imgBatchSize = batchSize;
} else {
slog::warn << inputName << ": layout does not contain batch dimension. Assuming batch 1 for this input"
<< slog::endl;
}
for (size_t b = 0; b < imgBatchSize; ++b) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
auto inputIndex = (inputId + b) % files.size();
if (filenames_used) {
*filenames_used += (filenames_used->empty() ? "" : ", ") + files[inputIndex];
}
FormatReader::ReaderPtr reader(files[inputIndex].c_str());
2019-08-09 19:02:42 +03:00
if (reader.get() == nullptr) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
slog::warn << "Image " << files[inputIndex] << " cannot be read!" << slog::endl << slog::endl;
2019-08-09 19:02:42 +03:00
continue;
}
/** Getting image data **/
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
std::shared_ptr<uint8_t> imageData(reader->getData(inputInfo.width(), inputInfo.height()));
2019-08-09 19:02:42 +03:00
if (imageData) {
vreader.push_back(imageData);
}
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
/** Fill input tensor with image. First b channel, then g and r channels **/
const size_t numChannels = inputInfo.channels();
const size_t width = inputInfo.width();
const size_t height = inputInfo.height();
2019-08-09 19:02:42 +03:00
/** Iterate over all input images **/
for (size_t b = 0; b < imgBatchSize; ++b) {
/** Iterate over all width **/
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
for (size_t w = 0; w < width; ++w) {
/** Iterate over all height **/
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
for (size_t h = 0; h < height; ++h) {
/** Iterate over all channels **/
for (size_t ch = 0; ch < numChannels; ++ch) {
/** [images stride + channels stride + pixel id ] all in
* bytes **/
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
size_t offset = b * numChannels * width * height +
(((inputInfo.layout == "NCHW") || (inputInfo.layout == "CHW"))
? (ch * width * height + h * width + w)
: (h * width * numChannels + w * numChannels + ch));
data[offset] = static_cast<T>(vreader.at(b).get()[h * width * numChannels + w * numChannels + ch]);
}
2019-08-09 19:02:42 +03:00
}
}
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
return tensor;
2019-08-09 19:02:42 +03:00
}
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
template <typename T>
ov::Tensor create_tensor_from_numpy(const std::vector<std::string>& files,
size_t inputId,
size_t batchSize,
const benchmark_app::InputInfo& inputInfo,
const std::string& inputName,
std::string* filenames_used = nullptr) {
size_t tensor_size =
std::accumulate(inputInfo.dataShape.begin(), inputInfo.dataShape.end(), 1, std::multiplies<size_t>());
auto tensor = ov::Tensor(inputInfo.type, inputInfo.dataShape);
auto data = tensor.data<T>();
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
std::vector<std::shared_ptr<unsigned char>> numpy_array_pointers;
numpy_array_pointers.reserve(batchSize);
size_t numpy_batch_size = 1;
if (!inputInfo.layout.empty() && ov::layout::has_batch(inputInfo.layout)) {
numpy_batch_size = batchSize;
} else {
slog::warn << inputName
<< ": layout is not set or does not contain batch dimension. Assuming that numpy array "
"contains data for all batches."
<< slog::endl;
}
for (size_t b = 0; b < numpy_batch_size; ++b) {
auto inputIndex = (inputId + b) % files.size();
if (filenames_used) {
*filenames_used += (filenames_used->empty() ? "" : ", ") + files[inputIndex];
}
FormatReader::ReaderPtr numpy_array_reader(files[inputIndex].c_str());
if (numpy_array_reader.get() == nullptr) {
slog::warn << "Numpy array " << files[inputIndex] << " cannot be read!" << slog::endl << slog::endl;
continue;
}
std::shared_ptr<unsigned char> numpy_array_data_pointer(numpy_array_reader->getData());
if (numpy_array_data_pointer) {
numpy_array_pointers.push_back(numpy_array_data_pointer);
}
}
size_t type_bytes_size = sizeof(T);
std::unique_ptr<unsigned char[]> bytes_buffer(new unsigned char[type_bytes_size]);
for (size_t batch_nr = 0; batch_nr < numpy_batch_size; ++batch_nr) {
for (size_t input_tensor_nr = 0; input_tensor_nr < tensor_size; ++input_tensor_nr) {
size_t offset = batch_nr * tensor_size + input_tensor_nr;
for (size_t byte_nr = 0; byte_nr < type_bytes_size; ++byte_nr) {
bytes_buffer.get()[byte_nr] =
numpy_array_pointers.at(batch_nr).get()[offset * type_bytes_size + byte_nr];
}
data[offset] = *((T*)(bytes_buffer.get()));
}
}
return tensor;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
}
template <typename T>
ov::Tensor create_tensor_im_info(const std::pair<size_t, size_t>& image_size,
size_t batchSize,
const benchmark_app::InputInfo& inputInfo,
const std::string& inputName) {
size_t tensor_size =
std::accumulate(inputInfo.dataShape.begin(), inputInfo.dataShape.end(), 1, std::multiplies<size_t>());
auto tensor = ov::Tensor(inputInfo.type, inputInfo.dataShape);
char* data = static_cast<char*>(tensor.data());
size_t infoBatchSize = 1;
if (!inputInfo.layout.empty() && ov::layout::has_batch(inputInfo.layout)) {
infoBatchSize = batchSize;
} else {
slog::warn << inputName << ": layout is not set or does not contain batch dimension. Assuming batch 1. "
<< slog::endl;
}
for (size_t b = 0; b < infoBatchSize; b++) {
size_t iminfoSize = tensor_size / infoBatchSize;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
for (size_t i = 0; i < iminfoSize; i++) {
size_t index = b * iminfoSize + i;
if (0 == i)
data[index] = static_cast<char>(image_size.first);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
else if (1 == i)
data[index] = static_cast<char>(image_size.second);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
else
data[index] = static_cast<char>(1);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
2020-02-11 22:48:49 +03:00
}
return tensor;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
2019-08-09 19:02:42 +03:00
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
template <typename T>
ov::Tensor create_tensor_from_binary(const std::vector<std::string>& files,
size_t inputId,
size_t batchSize,
const benchmark_app::InputInfo& inputInfo,
const std::string& inputName,
std::string* filenames_used = nullptr) {
size_t tensor_size =
std::accumulate(inputInfo.dataShape.begin(), inputInfo.dataShape.end(), 1, std::multiplies<size_t>());
auto tensor = ov::Tensor(inputInfo.type, inputInfo.dataShape);
char* data = static_cast<char*>(tensor.data());
size_t binaryBatchSize = 1;
if (!inputInfo.layout.empty() && ov::layout::has_batch(inputInfo.layout)) {
binaryBatchSize = batchSize;
} else {
slog::warn << inputName
<< ": layout is not set or does not contain batch dimension. Assuming that binary "
"data read from file contains data for all batches."
<< slog::endl;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
for (size_t b = 0; b < binaryBatchSize; ++b) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
size_t inputIndex = (inputId + b) % files.size();
std::ifstream binaryFile(files[inputIndex], std::ios_base::binary | std::ios_base::ate);
OPENVINO_ASSERT(binaryFile, "Cannot open ", files[inputIndex]);
2019-08-09 19:02:42 +03:00
auto inputSize = tensor_size * sizeof(T) / binaryBatchSize;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
std::string extension = get_extension(files[inputIndex]);
if (extension == "bin") {
auto fileSize = static_cast<std::size_t>(binaryFile.tellg());
binaryFile.seekg(0, std::ios_base::beg);
OPENVINO_ASSERT(binaryFile.good(), "Can not read ", files[inputIndex]);
OPENVINO_ASSERT(fileSize == inputSize,
"File ",
files[inputIndex],
" contains ",
fileSize,
" bytes, but the model expects ",
inputSize);
} else {
OPENVINO_THROW("Unsupported binary file type: " + extension);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
if (inputInfo.layout != "CN") {
binaryFile.read(&data[b * inputSize], inputSize);
} else {
for (size_t i = 0; i < inputInfo.channels(); i++) {
binaryFile.read(&data[(i * binaryBatchSize + b) * sizeof(T)], sizeof(T));
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
}
if (filenames_used) {
*filenames_used += (filenames_used->empty() ? "" : ", ") + files[inputIndex];
}
2019-08-09 19:02:42 +03:00
}
return tensor;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
template <typename T, typename T2>
ov::Tensor create_tensor_random(const benchmark_app::InputInfo& inputInfo,
T rand_min = std::numeric_limits<uint8_t>::min(),
T rand_max = std::numeric_limits<uint8_t>::max()) {
size_t tensor_size =
std::accumulate(inputInfo.dataShape.begin(), inputInfo.dataShape.end(), 1, std::multiplies<size_t>());
auto tensor = ov::Tensor(inputInfo.type, inputInfo.dataShape);
auto data = tensor.data<T>();
2020-02-11 22:48:49 +03:00
std::mt19937 gen(0);
uniformDistribution<T2> distribution(rand_min, rand_max);
for (size_t i = 0; i < tensor_size; i++) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
data[i] = static_cast<T>(distribution(gen));
2019-08-09 19:02:42 +03:00
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
return tensor;
2019-08-09 19:02:42 +03:00
}
ov::Tensor get_image_tensor(const std::vector<std::string>& files,
size_t inputId,
size_t batchSize,
const std::pair<std::string, benchmark_app::InputInfo>& inputInfo,
std::string* filenames_used = nullptr) {
auto type = inputInfo.second.type;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
if (type == ov::element::f16) {
return create_tensor_from_image<ov::float16>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if (type == ov::element::f32) {
return create_tensor_from_image<float>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::f64) {
return create_tensor_from_image<double>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if (type == ov::element::i8) {
return create_tensor_from_image<int8_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i16) {
return create_tensor_from_image<int16_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i32) {
return create_tensor_from_image<int32_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i64) {
return create_tensor_from_image<int64_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if ((type == ov::element::u8) || (type == ov::element::boolean)) {
return create_tensor_from_image<uint8_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if (type == ov::element::u16) {
return create_tensor_from_image<uint16_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::u32) {
return create_tensor_from_image<uint32_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::u64) {
return create_tensor_from_image<uint64_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
} else {
OPENVINO_THROW("Input type is not supported for " + inputInfo.first);
2020-02-11 22:48:49 +03:00
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
2020-02-11 22:48:49 +03:00
ov::Tensor get_im_info_tensor(const std::pair<size_t, size_t>& image_size,
size_t batchSize,
const std::pair<std::string, benchmark_app::InputInfo>& inputInfo) {
auto type = inputInfo.second.type;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
if (type == ov::element::f16) {
return create_tensor_im_info<ov::float16>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else if (type == ov::element::f32) {
return create_tensor_im_info<float>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else if (type == ov::element::f64) {
return create_tensor_im_info<double>(image_size, batchSize, inputInfo.second, inputInfo.first);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if (type == ov::element::i8) {
return create_tensor_im_info<int8_t>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else if (type == ov::element::i16) {
return create_tensor_im_info<int16_t>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else if (type == ov::element::i32) {
return create_tensor_im_info<int32_t>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else if (type == ov::element::i64) {
return create_tensor_im_info<int64_t>(image_size, batchSize, inputInfo.second, inputInfo.first);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if ((type == ov::element::u8) || (type == ov::element::boolean)) {
return create_tensor_im_info<uint8_t>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else if (type == ov::element::u16) {
return create_tensor_im_info<uint16_t>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else if (type == ov::element::u32) {
return create_tensor_im_info<uint32_t>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else if (type == ov::element::u64) {
return create_tensor_im_info<uint64_t>(image_size, batchSize, inputInfo.second, inputInfo.first);
} else {
OPENVINO_THROW("Input type is not supported for " + inputInfo.first);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
}
}
ov::Tensor get_numpy_tensor(const std::vector<std::string>& files,
size_t inputId,
size_t batchSize,
const std::pair<std::string, benchmark_app::InputInfo>& inputInfo,
std::string* filenames_used = nullptr) {
auto type = inputInfo.second.type;
if (type == ov::element::f16) {
return create_tensor_from_numpy<ov::float16>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::f32) {
return create_tensor_from_numpy<float>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::f64) {
return create_tensor_from_numpy<double>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i8) {
return create_tensor_from_numpy<int8_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i16) {
return create_tensor_from_numpy<int16_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i32) {
return create_tensor_from_numpy<int32_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i64) {
return create_tensor_from_numpy<int64_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if ((type == ov::element::u8) || (type == ov::element::boolean)) {
return create_tensor_from_numpy<uint8_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::u16) {
return create_tensor_from_numpy<uint16_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::u32) {
return create_tensor_from_numpy<uint32_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::u64) {
return create_tensor_from_numpy<uint64_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
} else {
OPENVINO_THROW("Input type is not supported for " + inputInfo.first);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
}
ov::Tensor get_binary_tensor(const std::vector<std::string>& files,
size_t inputId,
size_t batchSize,
const std::pair<std::string, benchmark_app::InputInfo>& inputInfo,
std::string* filenames_used = nullptr) {
const auto& type = inputInfo.second.type;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
if (type == ov::element::f16) {
return create_tensor_from_binary<ov::float16>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::f32) {
return create_tensor_from_binary<float>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::f64) {
return create_tensor_from_binary<double>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if (type == ov::element::i8) {
return create_tensor_from_binary<int8_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i16) {
return create_tensor_from_binary<int16_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i32) {
return create_tensor_from_binary<int32_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::i64) {
return create_tensor_from_binary<int64_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if ((type == ov::element::u8) || (type == ov::element::boolean)) {
return create_tensor_from_binary<uint8_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if (type == ov::element::u16) {
return create_tensor_from_binary<uint16_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::u32) {
return create_tensor_from_binary<uint32_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
} else if (type == ov::element::u64) {
return create_tensor_from_binary<uint64_t>(files,
inputId,
batchSize,
inputInfo.second,
inputInfo.first,
filenames_used);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
} else {
OPENVINO_THROW("Input type is not supported for " + inputInfo.first);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
}
ov::Tensor get_random_tensor(const std::pair<std::string, benchmark_app::InputInfo>& inputInfo) {
auto type = inputInfo.second.type;
if (type == ov::element::f32) {
return create_tensor_random<float, float>(inputInfo.second);
} else if (type == ov::element::f64) {
return create_tensor_random<double, double>(inputInfo.second);
} else if (type == ov::element::f16) {
return create_tensor_random<ov::float16, float>(inputInfo.second);
} else if (type == ov::element::i32) {
return create_tensor_random<int32_t, int32_t>(inputInfo.second);
} else if (type == ov::element::i64) {
return create_tensor_random<int64_t, int64_t>(inputInfo.second);
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if ((type == ov::element::u8) || (type == ov::element::boolean)) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
// uniform_int_distribution<uint8_t> is not allowed in the C++17
// standard and vs2017/19
return create_tensor_random<uint8_t, uint32_t>(inputInfo.second);
} else if (type == ov::element::i8) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
// uniform_int_distribution<int8_t> is not allowed in the C++17 standard
// and vs2017/19
return create_tensor_random<int8_t, int32_t>(inputInfo.second,
std::numeric_limits<int8_t>::min(),
std::numeric_limits<int8_t>::max());
} else if (type == ov::element::u16) {
return create_tensor_random<uint16_t, uint16_t>(inputInfo.second);
} else if (type == ov::element::i16) {
return create_tensor_random<int16_t, int16_t>(inputInfo.second);
} else if (type == ov::element::boolean) {
return create_tensor_random<uint8_t, uint32_t>(inputInfo.second, 0, 1);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
} else {
OPENVINO_THROW("Input type is not supported for " + inputInfo.first);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
}
std::string get_test_info_stream_header(benchmark_app::InputInfo& inputInfo) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
std::stringstream strOut;
strOut << "(" << inputInfo.layout.to_string() << ", " << inputInfo.type.get_type_name() << ", "
<< inputInfo.dataShape << ", ";
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
if (inputInfo.partialShape.is_dynamic()) {
strOut << std::string("dyn:") << inputInfo.partialShape << "):\t";
} else {
strOut << "static):\t";
}
return strOut.str();
}
std::map<std::string, ov::TensorVector> get_tensors(std::map<std::string, std::vector<std::string>> inputFiles,
std::vector<benchmark_app::InputsInfo>& app_inputs_info) {
std::ios::fmtflags fmt(std::cout.flags());
std::map<std::string, ov::TensorVector> tensors;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
if (app_inputs_info.empty()) {
[BENCHMARK_APP/PYTHON/CPP] Align benchmark_app output across languages (#12814) * [PYTHON] Pipeline transfer * [PYTHON] Align python benchmark * [PYTHON] Align last step * [PYTHON] Fix innacuracies of the last step - median * [PYTHON/CPP] Add Core::get_version method to python API, refactor Ben benchmark to print version with this func * [PYTHON] Remove get_version_string from API * [PYTHON/CPP] Align output for model input/output info * [PYTHON/CPP] Step 4,6 alignment of outputs, step 8 dumps all info stored in config parameters * [CPP] Fix a bug causing nstreams parameter to never be set to AUTO in CPP benchmark_app * [CPP] Fix clang format errors * [CPP] Modify print order and data output for 8th step * [PYTHON] Add verification checks from C++, modify set_thoughtput_streams to match documentation * [CPP] Revert changes to C++ benchmark_app * [CPP] Remove additional spacebar * Update submodules versions on remote * Update module from master branch * Redownload submodules from master and override changes from commit * [PYTHON] Remove unneccesary parse_status from validation function * [PYTHON] Check for HINT in map, fix circular import * [PYTHON] Remove artifacts from commit, fix args.perf_hint set to '' instead to 'none' * [PYTHON] Reverse changes to perf hint, add key in map check, fix validation function throwing error on set hint * [PYTHON] Fix linter * [PYTHON] Remove linter spacebar * [CPP] Fix wait_all exception throw * [CPP/PYTHON] Clean artifacts and unwanted changes from work process * [PYTHON] Fix artifacts from merge, clean submodule update * [C++ CPU] Fix device name string by removing padding NULL characters from the back * [CPP] Fix ba infer_request_wrap in other throw-catch clauses * [PYTHON/CPP] Fix missing latencies in final step for shape group, fix minor misaligned messages, add missing report parameter create infer requests time * [CPP] Clang fix formatting * [CPP] Reverse clang fix format on plugin.cpp * [PYTHON/CPP] Fix C++ progressbar printing endl when disabled, fix rounding in python creating infer request message * [CPP] Fix foramtiing error * [PYTHON/C++] Refactor network to model based on naming conventions, provide fresh README output example * [PYTHON/C++] Add example output to C++ README, remove unnecessary device loop * [BENCHMARK_APP/C++] Fix artifact from refactoring, remove try-catch clause * Update samples/cpp/benchmark_app/benchmark_app.hpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * [CPP] Fix clang errors * [CPP/PLUGIN Reverse modification to extract to separate task * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update tools/benchmark_tool/openvino/tools/benchmark/parameters.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update tools/benchmark_tool/openvino/tools/benchmark/utils/utils.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON/C++/BENCHMARK_APP] Fix language inconsistencies, remove unnecessary checks * Update pyopenvino.cpp * [CPP/BENCHMARK_APP] Remove unnecessary try-catch, fix linter errors * [PYTHON/CPP/BENCHMARK_APP] Revert changes to Core, align version prints usin only provided methods * [DOCS/BENCHMARK_APP] Update README with proper model examples * Update README.md Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> Co-authored-by: Michal Lukaszewski <michal.lukaszewski@intel.com> Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2022-11-14 14:10:36 +01:00
throw std::logic_error("Inputs Info for model is empty!");
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
if (!inputFiles.empty() && inputFiles.size() != app_inputs_info[0].size()) {
[BENCHMARK_APP/PYTHON/CPP] Align benchmark_app output across languages (#12814) * [PYTHON] Pipeline transfer * [PYTHON] Align python benchmark * [PYTHON] Align last step * [PYTHON] Fix innacuracies of the last step - median * [PYTHON/CPP] Add Core::get_version method to python API, refactor Ben benchmark to print version with this func * [PYTHON] Remove get_version_string from API * [PYTHON/CPP] Align output for model input/output info * [PYTHON/CPP] Step 4,6 alignment of outputs, step 8 dumps all info stored in config parameters * [CPP] Fix a bug causing nstreams parameter to never be set to AUTO in CPP benchmark_app * [CPP] Fix clang format errors * [CPP] Modify print order and data output for 8th step * [PYTHON] Add verification checks from C++, modify set_thoughtput_streams to match documentation * [CPP] Revert changes to C++ benchmark_app * [CPP] Remove additional spacebar * Update submodules versions on remote * Update module from master branch * Redownload submodules from master and override changes from commit * [PYTHON] Remove unneccesary parse_status from validation function * [PYTHON] Check for HINT in map, fix circular import * [PYTHON] Remove artifacts from commit, fix args.perf_hint set to '' instead to 'none' * [PYTHON] Reverse changes to perf hint, add key in map check, fix validation function throwing error on set hint * [PYTHON] Fix linter * [PYTHON] Remove linter spacebar * [CPP] Fix wait_all exception throw * [CPP/PYTHON] Clean artifacts and unwanted changes from work process * [PYTHON] Fix artifacts from merge, clean submodule update * [C++ CPU] Fix device name string by removing padding NULL characters from the back * [CPP] Fix ba infer_request_wrap in other throw-catch clauses * [PYTHON/CPP] Fix missing latencies in final step for shape group, fix minor misaligned messages, add missing report parameter create infer requests time * [CPP] Clang fix formatting * [CPP] Reverse clang fix format on plugin.cpp * [PYTHON/CPP] Fix C++ progressbar printing endl when disabled, fix rounding in python creating infer request message * [CPP] Fix foramtiing error * [PYTHON/C++] Refactor network to model based on naming conventions, provide fresh README output example * [PYTHON/C++] Add example output to C++ README, remove unnecessary device loop * [BENCHMARK_APP/C++] Fix artifact from refactoring, remove try-catch clause * Update samples/cpp/benchmark_app/benchmark_app.hpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * [CPP] Fix clang errors * [CPP/PLUGIN Reverse modification to extract to separate task * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update tools/benchmark_tool/openvino/tools/benchmark/parameters.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update tools/benchmark_tool/openvino/tools/benchmark/utils/utils.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON/C++/BENCHMARK_APP] Fix language inconsistencies, remove unnecessary checks * Update pyopenvino.cpp * [CPP/BENCHMARK_APP] Remove unnecessary try-catch, fix linter errors * [PYTHON/CPP/BENCHMARK_APP] Revert changes to Core, align version prints usin only provided methods * [DOCS/BENCHMARK_APP] Update README with proper model examples * Update README.md Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> Co-authored-by: Michal Lukaszewski <michal.lukaszewski@intel.com> Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2022-11-14 14:10:36 +01:00
throw std::logic_error("Number of inputs specified in -i must be equal to number of model inputs!");
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
// count image type inputs of network
std::vector<std::pair<size_t, size_t>> net_input_im_sizes;
for (auto& inputs_info : app_inputs_info) {
for (auto& input : inputs_info) {
if (input.second.is_image()) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
net_input_im_sizes.push_back(std::make_pair(input.second.width(), input.second.height()));
}
2019-08-09 19:02:42 +03:00
}
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
for (auto& files : inputFiles) {
if (!files.first.empty() && app_inputs_info[0].find(files.first) == app_inputs_info[0].end()) {
throw std::logic_error("Input name \"" + files.first +
[BENCHMARK_APP/PYTHON/CPP] Align benchmark_app output across languages (#12814) * [PYTHON] Pipeline transfer * [PYTHON] Align python benchmark * [PYTHON] Align last step * [PYTHON] Fix innacuracies of the last step - median * [PYTHON/CPP] Add Core::get_version method to python API, refactor Ben benchmark to print version with this func * [PYTHON] Remove get_version_string from API * [PYTHON/CPP] Align output for model input/output info * [PYTHON/CPP] Step 4,6 alignment of outputs, step 8 dumps all info stored in config parameters * [CPP] Fix a bug causing nstreams parameter to never be set to AUTO in CPP benchmark_app * [CPP] Fix clang format errors * [CPP] Modify print order and data output for 8th step * [PYTHON] Add verification checks from C++, modify set_thoughtput_streams to match documentation * [CPP] Revert changes to C++ benchmark_app * [CPP] Remove additional spacebar * Update submodules versions on remote * Update module from master branch * Redownload submodules from master and override changes from commit * [PYTHON] Remove unneccesary parse_status from validation function * [PYTHON] Check for HINT in map, fix circular import * [PYTHON] Remove artifacts from commit, fix args.perf_hint set to '' instead to 'none' * [PYTHON] Reverse changes to perf hint, add key in map check, fix validation function throwing error on set hint * [PYTHON] Fix linter * [PYTHON] Remove linter spacebar * [CPP] Fix wait_all exception throw * [CPP/PYTHON] Clean artifacts and unwanted changes from work process * [PYTHON] Fix artifacts from merge, clean submodule update * [C++ CPU] Fix device name string by removing padding NULL characters from the back * [CPP] Fix ba infer_request_wrap in other throw-catch clauses * [PYTHON/CPP] Fix missing latencies in final step for shape group, fix minor misaligned messages, add missing report parameter create infer requests time * [CPP] Clang fix formatting * [CPP] Reverse clang fix format on plugin.cpp * [PYTHON/CPP] Fix C++ progressbar printing endl when disabled, fix rounding in python creating infer request message * [CPP] Fix foramtiing error * [PYTHON/C++] Refactor network to model based on naming conventions, provide fresh README output example * [PYTHON/C++] Add example output to C++ README, remove unnecessary device loop * [BENCHMARK_APP/C++] Fix artifact from refactoring, remove try-catch clause * Update samples/cpp/benchmark_app/benchmark_app.hpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * [CPP] Fix clang errors * [CPP/PLUGIN Reverse modification to extract to separate task * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> * Update tools/benchmark_tool/openvino/tools/benchmark/parameters.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update tools/benchmark_tool/openvino/tools/benchmark/utils/utils.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update tools/benchmark_tool/openvino/tools/benchmark/main.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON/C++/BENCHMARK_APP] Fix language inconsistencies, remove unnecessary checks * Update pyopenvino.cpp * [CPP/BENCHMARK_APP] Remove unnecessary try-catch, fix linter errors * [PYTHON/CPP/BENCHMARK_APP] Revert changes to Core, align version prints usin only provided methods * [DOCS/BENCHMARK_APP] Update README with proper model examples * Update README.md Co-authored-by: Nadezhda Ageeva <nkogteva@gmail.com> Co-authored-by: Michal Lukaszewski <michal.lukaszewski@intel.com> Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2022-11-14 14:10:36 +01:00
"\" used in -i parameter doesn't match any model's input");
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
std::string input_name = files.first.empty() ? app_inputs_info[0].begin()->first : files.first;
auto input = app_inputs_info[0].at(input_name);
if (!files.second.empty() && files.second[0] != "random" && files.second[0] != "image_info") {
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
auto filtered_numpy_files = filter_files_by_extensions(files.second, supported_numpy_extensions);
auto filtered_image_files = filter_files_by_extensions(files.second, supported_image_extensions);
if (!filtered_numpy_files.empty()) {
files.second = filtered_numpy_files;
} else if (!filtered_image_files.empty() && input.is_image()) {
files.second = filtered_image_files;
} else if (input.is_image_info() && net_input_im_sizes.size() == app_inputs_info.size()) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
slog::info << "Input '" << input_name
<< "' probably is image info. All files for this input will"
" be ignored."
<< slog::endl;
files.second = {"image_info"};
continue;
} else {
files.second = filter_files_by_extensions(files.second, supported_binary_extensions);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
}
if (files.second.empty()) {
slog::warn << "No suitable files for input were found! Random data will be used for input " << input_name
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
<< slog::endl;
files.second = {"random"};
}
size_t filesToBeUsed = 0;
size_t shapesToBeUsed = 0;
if (files.second.size() > app_inputs_info.size()) {
shapesToBeUsed = app_inputs_info.size();
filesToBeUsed = files.second.size() - files.second.size() % app_inputs_info.size();
if (filesToBeUsed != files.second.size()) {
slog::warn << "Number of files must be a multiple of the number of shapes for certain input. Only " +
std::to_string(filesToBeUsed) + " files will be added."
<< slog::endl;
}
while (files.second.size() != filesToBeUsed) {
files.second.pop_back();
}
} else {
shapesToBeUsed = app_inputs_info.size() - app_inputs_info.size() % files.second.size();
filesToBeUsed = files.second.size();
if (shapesToBeUsed != app_inputs_info.size()) {
slog::warn << "Number of data shapes must be a multiple of the number of files. For input "
<< files.first << " only " + std::to_string(shapesToBeUsed) + " files will be added."
<< slog::endl;
}
while (app_inputs_info.size() != shapesToBeUsed) {
app_inputs_info.pop_back();
net_input_im_sizes.pop_back();
}
}
}
std::vector<std::map<std::string, std::string>> logOutput;
// All inputs should process equal number of files, so for the case of N, 1, N number of files,
// second input also should have N blobs cloned from 1 file
size_t filesNum = 0;
if (!inputFiles.empty()) {
filesNum = std::max_element(inputFiles.begin(),
inputFiles.end(),
[](const std::pair<std::string, std::vector<std::string>>& a,
const std::pair<std::string, std::vector<std::string>>& b) {
return a.second.size() < b.second.size();
})
->second.size();
} else {
std::vector<std::pair<size_t, size_t>> net_input_im_sizes;
for (auto& input_info : app_inputs_info[0]) {
inputFiles[input_info.first] = {"random"};
}
}
std::vector<size_t> batchSizes;
for (const auto& info : app_inputs_info) {
batchSizes.push_back(get_batch_size(info));
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
for (const auto& files : inputFiles) {
std::string input_name = files.first.empty() ? app_inputs_info[0].begin()->first : files.first;
size_t n_shape = 0, m_file = 0;
while (n_shape < app_inputs_info.size() || m_file < filesNum) {
size_t batchSize = batchSizes[n_shape % app_inputs_info.size()];
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
size_t inputId = m_file % files.second.size();
auto input_info = app_inputs_info[n_shape % app_inputs_info.size()].at(input_name);
std::string tensor_src_info;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
if (files.second[0] == "random") {
// Fill random
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
tensor_src_info = "random (" +
std::string((input_info.is_image() ? "image/numpy array" : "binary data")) +
" is expected)";
tensors[input_name].push_back(get_random_tensor({input_name, input_info}));
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
} else if (files.second[0] == "image_info") {
// Most likely it is image info: fill with image information
auto image_size = net_input_im_sizes.at(n_shape % app_inputs_info.size());
tensor_src_info =
"Image size tensor " + std::to_string(image_size.first) + " x " + std::to_string(image_size.second);
tensors[input_name].push_back(get_im_info_tensor(image_size, batchSize, {input_name, input_info}));
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if (supported_numpy_extensions.count(get_extension(files.second[0]))) {
// Fill with Numpy arrrays
tensors[input_name].push_back(
get_numpy_tensor(files.second, inputId, batchSize, {input_name, input_info}, &tensor_src_info));
} else if (input_info.is_image()) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
// Fill with Images
tensors[input_name].push_back(
get_image_tensor(files.second, inputId, batchSize, {input_name, input_info}, &tensor_src_info));
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
} else {
// Fill with binary files
tensors[input_name].push_back(
get_binary_tensor(files.second, inputId, batchSize, {input_name, input_info}, &tensor_src_info));
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
// Preparing info
std::string strOut = get_test_info_stream_header(input_info) + tensor_src_info;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
if (n_shape >= logOutput.size()) {
logOutput.resize(n_shape + 1);
}
logOutput[n_shape][input_name] += strOut;
++n_shape;
m_file += batchSize;
}
}
for (size_t i = 0; i < logOutput.size(); i++) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
slog::info << "Test Config " << i << slog::endl;
auto maxNameWidth = std::max_element(logOutput[i].begin(),
logOutput[i].end(),
[](const std::pair<std::string, std::string>& a,
const std::pair<std::string, std::string>& b) {
return a.first.size() < b.first.size();
})
->first.size();
for (const std::pair<const std::string, std::string>& inputLog : logOutput[i]) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
slog::info << std::left << std::setw(maxNameWidth + 2) << inputLog.first << inputLog.second << slog::endl;
}
}
std::cout.flags(fmt);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
return tensors;
2019-08-09 19:02:42 +03:00
}
std::map<std::string, ov::TensorVector> get_tensors_static_case(const std::vector<std::string>& inputFiles,
const size_t& batchSize,
benchmark_app::InputsInfo& app_inputs_info,
size_t requestsNum) {
std::ios::fmtflags fmt(std::cout.flags());
std::map<std::string, ov::TensorVector> blobs;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
std::vector<std::pair<size_t, size_t>> net_input_im_sizes;
for (auto& item : app_inputs_info) {
if (item.second.partialShape.is_static() && item.second.is_image()) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
net_input_im_sizes.push_back(std::make_pair(item.second.width(), item.second.height()));
2019-08-09 19:02:42 +03:00
}
}
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
std::vector<std::string> binaryFiles = filter_files_by_extensions(inputFiles, supported_binary_extensions);
std::vector<std::string> numpyFiles = filter_files_by_extensions(inputFiles, supported_numpy_extensions);
std::vector<std::string> imageFiles = filter_files_by_extensions(inputFiles, supported_image_extensions);
2019-08-09 19:02:42 +03:00
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
size_t imageInputsNum = imageFiles.size();
size_t numpyInputsNum = numpyFiles.size();
size_t binaryInputsNum = binaryFiles.size();
size_t totalInputsNum = imageInputsNum + numpyInputsNum + binaryInputsNum;
2019-08-09 19:02:42 +03:00
if (inputFiles.empty()) {
slog::warn << "No input files were given: all inputs will be filled with "
"random values!"
<< slog::endl;
2019-08-09 19:02:42 +03:00
} else {
std::sort(std::begin(binaryFiles), std::end(binaryFiles));
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
std::sort(std::begin(numpyFiles), std::end(numpyFiles));
std::sort(std::begin(imageFiles), std::end(imageFiles));
2019-08-09 19:02:42 +03:00
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
auto filesToBeUsed = totalInputsNum * batchSize * requestsNum;
if (filesToBeUsed == 0 && !inputFiles.empty()) {
2019-08-09 19:02:42 +03:00
std::stringstream ss;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
for (auto& ext : supported_image_extensions) {
if (!ss.str().empty()) {
ss << ", ";
}
ss << ext;
2019-08-09 19:02:42 +03:00
}
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
for (auto& ext : supported_numpy_extensions) {
if (!ss.str().empty()) {
ss << ", ";
}
ss << ext;
}
for (auto& ext : supported_binary_extensions) {
if (!ss.str().empty()) {
ss << ", ";
}
ss << ext;
2019-08-09 19:02:42 +03:00
}
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
slog::warn << "Inputs of unsupported type found! Please check your file "
"extensions: "
<< ss.str() << slog::endl;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
} else if (app_inputs_info.size() > totalInputsNum) {
slog::warn << "Some input files will be duplicated: " << filesToBeUsed << " files are required but only "
<< totalInputsNum << " are provided" << slog::endl;
} else if (filesToBeUsed < app_inputs_info.size()) {
slog::warn << "Some input files will be ignored: only " << filesToBeUsed << " are required from "
<< totalInputsNum << slog::endl;
2019-08-09 19:02:42 +03:00
}
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
std::map<std::string, std::vector<std::string>> mappedFiles;
size_t imageInputsCount = 0;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
size_t numpyInputsCount = 0;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
size_t binaryInputsCount = 0;
for (auto& input : app_inputs_info) {
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
if (numpyInputsNum) {
mappedFiles[input.first] = {};
for (size_t i = 0; i < numpyFiles.size(); i += numpyInputsNum) {
mappedFiles[input.first].push_back(
numpyFiles[(numpyInputsCount + i) * numpyInputsNum % numpyFiles.size()]);
}
++numpyInputsCount;
} else if (input.second.is_image()) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
mappedFiles[input.first] = {};
for (size_t i = 0; i < imageFiles.size(); i += imageInputsNum) {
mappedFiles[input.first].push_back(
imageFiles[(imageInputsCount + i) * imageInputsNum % imageFiles.size()]);
}
++imageInputsCount;
} else {
mappedFiles[input.first] = {};
if (!binaryFiles.empty()) {
for (size_t i = 0; i < binaryFiles.size(); i += binaryInputsNum) {
mappedFiles[input.first].push_back(binaryFiles[(binaryInputsCount + i) % binaryFiles.size()]);
}
}
++binaryInputsCount;
}
}
2019-08-09 19:02:42 +03:00
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
size_t filesNum = 0;
if (!inputFiles.empty()) {
filesNum = std::max_element(mappedFiles.begin(),
mappedFiles.end(),
[](const std::pair<std::string, std::vector<std::string>>& a,
const std::pair<std::string, std::vector<std::string>>& b) {
return a.second.size() < b.second.size();
})
->second.size();
}
size_t test_configs_num = filesNum / batchSize == 0 ? 1 : filesNum / batchSize;
std::vector<std::map<std::string, std::string>> logOutput(test_configs_num);
for (const auto& files : mappedFiles) {
2019-08-09 19:02:42 +03:00
size_t imageInputId = 0;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
size_t numpyInputId = 0;
2019-08-09 19:02:42 +03:00
size_t binaryInputId = 0;
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
auto input_name = files.first;
auto input_info = app_inputs_info.at(files.first);
for (size_t i = 0; i < test_configs_num; ++i) {
std::string blob_src_info;
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
if (files.second.size() && supported_numpy_extensions.count(get_extension(files.second[0]))) {
if (!numpyFiles.empty()) {
// Fill with Numpy arryys
blobs[input_name].push_back(get_numpy_tensor(files.second,
imageInputId,
batchSize,
{input_name, input_info},
&blob_src_info));
numpyInputId = (numpyInputId + batchSize) % files.second.size();
logOutput[i][input_name] += get_test_info_stream_header(input_info) + blob_src_info;
continue;
}
} else if (input_info.is_image()) {
2019-08-09 19:02:42 +03:00
if (!imageFiles.empty()) {
// Fill with Images
blobs[input_name].push_back(get_image_tensor(files.second,
imageInputId,
batchSize,
{input_name, input_info},
&blob_src_info));
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
imageInputId = (imageInputId + batchSize) % files.second.size();
logOutput[i][input_name] += get_test_info_stream_header(input_info) + blob_src_info;
2019-08-09 19:02:42 +03:00
continue;
}
} else {
if (!binaryFiles.empty()) {
// Fill with binary files
blobs[input_name].push_back(get_binary_tensor(files.second,
binaryInputId,
batchSize,
{input_name, input_info},
&blob_src_info));
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
binaryInputId = (binaryInputId + batchSize) % files.second.size();
logOutput[i][input_name] += get_test_info_stream_header(input_info) + blob_src_info;
2019-08-09 19:02:42 +03:00
continue;
}
if (input_info.is_image_info() && (net_input_im_sizes.size() == 1)) {
2019-08-09 19:02:42 +03:00
// Most likely it is image info: fill with image information
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
auto image_size = net_input_im_sizes.at(0);
blob_src_info = "Image size blob " + std::to_string(image_size.first) + " x " +
std::to_string(image_size.second);
blobs[input_name].push_back(get_im_info_tensor(image_size, batchSize, {input_name, input_info}));
logOutput[i][input_name] += get_test_info_stream_header(input_info) + blob_src_info;
2019-08-09 19:02:42 +03:00
continue;
}
}
// Fill random
[BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app/Fix a bug that would cause Python Numpy array loading to fail (#14021) * [C++/BENCHMARK_APP] Introduce Numpy array loading for C++ benchmark app * [DOCS/BENCHMARK_APP] Update docs to reflect changes, update list of available extensions from OpenCV, align help messages * Update inputs_filling.cpp * Update tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++/Python] Implement quality-of-life improvements from PR comments * [C++] Fix compilation errors, fix linter output * [C++/PYTHON] Apply requested changes * Update samples/cpp/benchmark_app/main.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * Update samples/cpp/benchmark_app/utils.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [PYTHON] Separate loading of numpy arrays similar to images * [PYTHON] Remove unnecessary 'Prepare xxx file' print * Update README again because IF OPENCV.. dissapeared for some reason * Update second README with missing IF OPENCV.. * [C++] Remove unnecessary vector print function * [C++ Add Numpy processing function - TODO link it to the tensor filling * Reverse OneDnn plugin modification * [C++] Numpy array loading for C++ * [C++] Add (almost) all missing types of data * Reverse submodule modifications * [C++/PYTHON] Fix compilation errors, clean code * [C++] Modify supported extensions, add numpy checking to utils, add numpy to get_image_info method * Update samples/cpp/benchmark_app/inputs_filling.cpp Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> * [C++] Fix utils header file to reflect unordered set change * [PYTHON/C++] Fix compilation errors in C++ code, fix Python dynamic shapes numpy loading * [C++] Fix explicit instantiation of NumpyArray reader * [C++] Clang format, minor syntax fixes * [PYTHON/C++] Remove unnecessary data types, introduce a new approach to cast data of different types from format_rt_reader, remove uppercase types from Python precision parameters * [PYTHON] Update README to reflect new precision settings * [PYTHON] Fix README, fix clang format * [C++] Clean headers * [C++] Fix uninitialized variable error * [C++/PYTHON] Fixed choices in Python benchmark, fixed types in C++ benchmark * [C++] Fixed ov::float16conversion, fixed Python types map - removed redundancies * [C++] Add back boolean support * [C++] Fix compilation errors --------- Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
2023-02-13 09:04:23 +01:00
blob_src_info = "random (" + std::string((input_info.is_image() ? "image" : "binary data")) +
"/numpy array is expected)";
blobs[input_name].push_back(get_random_tensor({input_name, input_info}));
logOutput[i][input_name] += get_test_info_stream_header(input_info) + blob_src_info;
2019-08-09 19:02:42 +03:00
}
}
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
for (size_t i = 0; i < logOutput.size(); i++) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
slog::info << "Test Config " << i << slog::endl;
auto maxNameWidth = std::max_element(logOutput[i].begin(),
logOutput[i].end(),
[](const std::pair<std::string, std::string>& a,
const std::pair<std::string, std::string>& b) {
return a.first.size() < b.first.size();
})
->first.size();
for (auto inputLog : logOutput[i]) {
slog::info << std::left << std::setw(maxNameWidth + 2) << inputLog.first << inputLog.second << slog::endl;
}
}
std::cout.flags(fmt);
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
return blobs;
}
void copy_tensor_data(ov::Tensor& dst, const ov::Tensor& src) {
if (src.get_shape() != dst.get_shape() || src.get_byte_size() != dst.get_byte_size()) {
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
throw std::runtime_error(
"Source and destination tensors shapes and byte sizes are expected to be equal for data copying.");
Dynamic reshapes (#7788) * Merged and compiling * Fix for dynamic shape type * review fixes * renamed blob shape to tensor shape, small improvements * fix code style * added parsing of multiple shapes * store latency per group, add isIdleRequestAvailable() to Infer Queue * added cached random inputs * redesign pipeline, added new metrics(avg, max, min), added metrics per groups * fixed code style * small improvements * modified tensor parameters parsing * modified -i parameter parsing: added possibility to specify input names * implemented image cashing * added cashed blobs creating * added -pcseq flag, modified batch filling, changes fps formula * improvements * code formatting * code formatting2 * apply suggestions from review * replaced Buffer class with InferenceEngine Blobs * use batch size in blobs filling * added shared blob allocator to handle blob's data * fixed warnings & code style * allocate blobs * fix for networks with image info input * added comments & fixed codestyle * clear data in free() in SharedBlobAllocator * remove unnecessary check * Delimeter is changed to :: * stylefix * added layout from string function, small improvements * modified parsing to enable : in input parameters * small fixes * small fixes * added missed blob allocation, fixes * [TEST]added support for remote blobs * fix remote blobs * new inputs/files output format * removed vectors resize which caused bugs * made cl::Buffer type under ifdef, fix inputs filling * changed batch() function to not throwing exceptions * removed unused var * fix code style * replace empty name in input files with name from net input * restored old behaviour for static models * fix code style * fix warning - made const iterator * fix warning - remove reference in loop variable * added random and image_info input types to -i, fix problem with layout * replaced batch() with getBatchSize() in main * fix layout, shape, tensor shape parameters parsing * upd help messages for input, tensor shape and pcseq command * added buffer for cl output blobs, small fixes Signed-off-by: ivikhrev <ivan.vikhrev@intel.com> * added legacy mode * restore setBlob * code style formatting * move collecting latency for groups under flag * removed not applicable layouts * added hint to error message when wrong input name in -tensor_shape was specified * added new metrics to statistics report * Apply suggestions from code review * fix binary blobs filling when layout is CN * apply suggestions * moved file in the right place after rebase * improved -pcseq output * updated args and readme * removed TEMPLATE plugin registration * fix -shape arg decsription * enable providing several -i args as input * renamed legacy_mode to inference_only and made it default for static models, renamed tensor_shape to data_shape * upd readme * use getBlob() in inference only mode * fix old input type for static case * fix typo * upd readme * move log about benchmark mode to the measuring perfomance step * added class for latency metrics * upd readme, fix typos, renamed funcs * fix warning and upd parsing to avoid error with : in file paths * fix error on centos : error: use of deleted function ‘std::basic_stringstream<char>::basic_stringstream(const std::basic_stringstream<char>&) * added check for key in inputs * renamed input to inputs * adjust batch size for binary blobs * replaced warning with exception in bench mode defining * align measurement cycle with master Co-authored-by: ivikhrev <ivan.vikhrev@intel.com>
2021-12-17 12:20:43 +03:00
}
memcpy(dst.data(), src.data(), src.get_byte_size());
2019-08-09 19:02:42 +03:00
}