From a0debc3a9a4871d08bb8d07bad68df246c7207ab Mon Sep 17 00:00:00 2001 From: Dmitry Kurtaev Date: Wed, 23 Aug 2023 10:31:14 +0300 Subject: [PATCH] Enable OpenVINO max pooling with indices since 2022.1 --- modules/dnn/src/layers/pooling_layer.cpp | 7 ++++++- modules/dnn/test/test_tflite_importer.cpp | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/dnn/src/layers/pooling_layer.cpp b/modules/dnn/src/layers/pooling_layer.cpp index 5caaa36ba0..1337657127 100644 --- a/modules/dnn/src/layers/pooling_layer.cpp +++ b/modules/dnn/src/layers/pooling_layer.cpp @@ -209,7 +209,8 @@ public: #ifdef HAVE_INF_ENGINE if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) { - return type != STOCHASTIC && kernel_size.size() > 1 && (kernel_size.size() != 3 || !isArmComputePlugin()); + return type != STOCHASTIC && kernel_size.size() > 1 && (kernel_size.size() != 3 || !isArmComputePlugin()) && + (!computeMaxIdx || INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2022_1)); } #endif if (backendId == DNN_BACKEND_OPENCV) @@ -615,10 +616,14 @@ public: else if (type == MAX) { std::shared_ptr max_pool; if (computeMaxIdx) { +#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2022_1) std::vector dilations(kernel_size.size(), 1); max_pool = std::make_shared(ieInpNode, ngraph::Strides(strides), ngraph::Strides(dilations), ngraph::Shape(pads_begin), ngraph::Shape(pads_end), ngraph::Shape(kernel_size), rounding_type, pad_type); +#else + CV_Error(Error::StsNotImplemented, "OpenVINO MaxPool with indices"); +#endif } else { max_pool = std::make_shared(ieInpNode, ngraph::Strides(strides), ngraph::Shape(pads_begin), ngraph::Shape(pads_end), ngraph::Shape(kernel_size), diff --git a/modules/dnn/test/test_tflite_importer.cpp b/modules/dnn/test/test_tflite_importer.cpp index 19b3f3a94a..beb586f126 100644 --- a/modules/dnn/test/test_tflite_importer.cpp +++ b/modules/dnn/test/test_tflite_importer.cpp @@ -128,6 +128,11 @@ TEST_P(Test_TFLite, max_unpooling) if (backend == DNN_BACKEND_CUDA) applyTestTag(CV_TEST_TAG_DNN_SKIP_CUDA); +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2022010000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); +#endif + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target != DNN_TARGET_CPU) { if (target == DNN_TARGET_OPENCL_FP16) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); if (target == DNN_TARGET_OPENCL) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);