From fa41a799b5f27fd6329b78db2d203344995ca1b4 Mon Sep 17 00:00:00 2001 From: Sergey Lyubimtsev Date: Thu, 14 Jan 2021 17:22:41 +0300 Subject: [PATCH] Inconsistent inference results for hello_classification sample between Windows and Linux (44369) (#3849) * Fix image load issue * remove extra line --- inference-engine/samples/hello_classification/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inference-engine/samples/hello_classification/main.cpp b/inference-engine/samples/hello_classification/main.cpp index 07268715e9c..11be6821db6 100644 --- a/inference-engine/samples/hello_classification/main.cpp +++ b/inference-engine/samples/hello_classification/main.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -34,12 +35,13 @@ cv::Mat imreadW(std::wstring input_image_path) { std::iostream::binary | std::ios_base::ate | std::ios_base::in); if (input_image_stream.is_open()) { if (input_image_stream.good()) { + input_image_stream.seekg(0, std::ios::end); std::size_t file_size = input_image_stream.tellg(); input_image_stream.seekg(0, std::ios::beg); std::vector buffer(0); std::copy( - std::istream_iterator(input_image_stream), - std::istream_iterator(), + std::istreambuf_iterator(input_image_stream), + std::istreambuf_iterator(), std::back_inserter(buffer)); image = cv::imdecode(cv::Mat(1, file_size, CV_8UC1, &buffer[0]), cv::IMREAD_COLOR); } else {