From 551d4a8ec161278e31fa5caec65ce74c1c78decd Mon Sep 17 00:00:00 2001 From: Anastasia M Date: Wed, 24 Mar 2021 01:16:09 +0300 Subject: [PATCH 1/5] Merge pull request #19477 from LupusSanctus:am/eltwice_vec * Aligned OpenCV DNN and TF sum op behaviour Support Mat (shape: [1, m, k, n] ) + Vec (shape: [1, 1, 1, n]) operation by vec to mat expansion * Added code corrections: backend, minor refactoring --- .../dnn/include/opencv2/dnn/shape_utils.hpp | 17 +++ modules/dnn/src/layers/eltwise_layer.cpp | 102 +++++++++++++++++- modules/dnn/test/test_tf_importer.cpp | 5 + 3 files changed, 121 insertions(+), 3 deletions(-) diff --git a/modules/dnn/include/opencv2/dnn/shape_utils.hpp b/modules/dnn/include/opencv2/dnn/shape_utils.hpp index 609809e110..b77333bd48 100644 --- a/modules/dnn/include/opencv2/dnn/shape_utils.hpp +++ b/modules/dnn/include/opencv2/dnn/shape_utils.hpp @@ -235,6 +235,23 @@ Range normalize_axis_range(const Range& r, int axisSize) return clamped; } +static inline +bool isAllOnes(const MatShape &inputShape, int startPos, int endPos) +{ + CV_Assert(!inputShape.empty()); + + CV_CheckGE((int) inputShape.size(), startPos, ""); + CV_CheckGE(startPos, 0, ""); + CV_CheckLE(startPos, endPos, ""); + CV_CheckLE((size_t)endPos, inputShape.size(), ""); + + for (size_t i = startPos; i < endPos; i++) + { + if (inputShape[i] != 1) + return false; + } + return true; +} CV__DNN_EXPERIMENTAL_NS_END } } diff --git a/modules/dnn/src/layers/eltwise_layer.cpp b/modules/dnn/src/layers/eltwise_layer.cpp index 77e1a1171a..f30bb6b43d 100644 --- a/modules/dnn/src/layers/eltwise_layer.cpp +++ b/modules/dnn/src/layers/eltwise_layer.cpp @@ -45,6 +45,7 @@ #include "../op_halide.hpp" #include "../op_inf_engine.hpp" #include "../ie_ngraph.hpp" +#include #ifdef HAVE_OPENCL #include "opencl_kernels_dnn.hpp" @@ -90,6 +91,7 @@ public: : outputChannels(0) { setParamsFrom(params); + hasVecInput = false; op = SUM; if (params.has("operation")) { @@ -149,6 +151,9 @@ public: virtual bool supportBackend(int backendId) CV_OVERRIDE { + if (hasVecInput && ELTWISE_CHANNNELS_SAME) + return backendId == DNN_BACKEND_OPENCV; + return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE || ((((backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && (preferableTarget != DNN_TARGET_OPENCL || coeffs.empty())) @@ -197,9 +202,6 @@ public: { CV_Assert(0 && "Internal error"); } - - for (size_t j = 2; j < dims; j++) - CV_Assert(inputs[0][j] == inputs[i][j]); } channelsMode = variableChannels ? channelsModeInput : ELTWISE_CHANNNELS_SAME; @@ -207,9 +209,56 @@ public: outputs.assign(1, inputs[0]); outputs[0][1] = numChannels; + + if (dims > 2) + { + size_t vecIdx = 0; + bool isVecFound = false; + for (size_t i = 0; i < inputs.size(); i++) + { + bool allOnes = isAllOnes(inputs[i], 2, dims); + if (!allOnes && !isVecFound) + { + vecIdx = i; + isVecFound = true; + } + + if (!allOnes && i != vecIdx) + { + for (size_t j = 2; j < dims; j++) + { + CV_Assert(inputs[vecIdx][j] == inputs[i][j]); + } + } + } + + if (channelsModeInput == ELTWISE_CHANNNELS_SAME && isVecFound) + { + for (size_t j = 2; j < dims; j++) + { + outputs[0][j] = inputs[vecIdx][j]; + } + } + } + return false; } + void finalize(InputArrayOfArrays inputs_arr, OutputArrayOfArrays) CV_OVERRIDE + { + std::vector inputs; + inputs_arr.getMatVector(inputs); + + for (size_t i = 0; i < inputs.size(); i++) + { + MatShape inpShape = shape(inputs[i].size); + if (isAllOnes(inpShape, 2, inputs[i].dims)) + { + hasVecInput = true; + return; + } + } + } class EltwiseInvoker : public ParallelLoopBody { @@ -502,6 +551,9 @@ public: if ((inputs_.depth() == CV_16S && op != SUM) || (channelsMode != ELTWISE_CHANNNELS_SAME)) return false; + if (hasVecInput) + return false; // TODO not implemented yet: https://github.com/opencv/opencv/pull/19477 + inputs_.getUMatVector(inputs); outputs_.getUMatVector(outputs); @@ -602,6 +654,47 @@ public: CV_Assert(outputs.size() == 1); const int nstripes = getNumThreads(); + + if (channelsModeInput == ELTWISE_CHANNNELS_SAME && inputs[0].dims > 2) + { + for (size_t i = 0; i < inputs.size(); i++) + { + MatShape inpShape = shape(inputs[i].size); + bool allOnes = isAllOnes(inpShape, 2, inputs[i].dims); + + if (allOnes) + { + Mat tmpInput = inputs[i]; + MatShape outShape = shape(outputs[0].size); + size_t xSize = outShape[2]; + for (size_t j = 3; j < outShape.size(); j++) + xSize *= outShape[j]; + + int dimVec[3] = {outShape[0], outShape[1], (int) xSize}; + std::vector matSizesVec(&dimVec[0], &dimVec[0] + 3); + inputs[i] = Mat(matSizesVec, tmpInput.type()); + + std::vector idx(outShape.size(), 0); + std::vector outIdx(inpShape.size(), 0); + + for (size_t j = 0; j < outShape[0]; j++) + { + outIdx[0] = idx[0] = j; + for(size_t k = 0; k < outShape[1]; k++) + { + outIdx[1] = idx[1] = k; + for (size_t x = 0; x < xSize; x++) + { + outIdx[2] = x; + inputs[i].at(outIdx.data()) = tmpInput.at(idx.data()); + } + } + } + inputs[i] = inputs[i].reshape(0, outShape); + } + } + } + EltwiseInvoker::run(*this, &inputs[0], (int)inputs.size(), outputs[0], nstripes); @@ -739,6 +832,9 @@ public: } Ptr activ; + +private: + bool hasVecInput; }; Ptr EltwiseLayer::create(const LayerParams& params) diff --git a/modules/dnn/test/test_tf_importer.cpp b/modules/dnn/test/test_tf_importer.cpp index 6a1a44f03a..62a559a672 100644 --- a/modules/dnn/test/test_tf_importer.cpp +++ b/modules/dnn/test/test_tf_importer.cpp @@ -205,6 +205,11 @@ TEST_P(Test_TensorFlow_layers, eltwise) runTensorFlowNet("eltwise_sub"); } +TEST_P(Test_TensorFlow_layers, eltwise_add_vec) +{ + runTensorFlowNet("eltwise_add_vec"); +} + TEST_P(Test_TensorFlow_layers, channel_broadcast) { if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) From 7a2b3ed471403a8a0e975363eac6427c59464aa3 Mon Sep 17 00:00:00 2001 From: Anastasia Murzova Date: Mon, 22 Mar 2021 22:37:49 +0300 Subject: [PATCH 2/5] Corrected DNN elementwise multiplication --- modules/dnn/src/tensorflow/tf_importer.cpp | 6 +++++- modules/dnn/test/test_tf_importer.cpp | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/dnn/src/tensorflow/tf_importer.cpp b/modules/dnn/src/tensorflow/tf_importer.cpp index 53d62fc9f7..bdab0663a7 100644 --- a/modules/dnn/src/tensorflow/tf_importer.cpp +++ b/modules/dnn/src/tensorflow/tf_importer.cpp @@ -12,6 +12,7 @@ Implementation of Tensorflow models parser #include "../precomp.hpp" #include +#include #undef CV_LOG_STRIP_LEVEL #define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_DEBUG + 1 #include @@ -1825,6 +1826,7 @@ void TFImporter::parseNode(const tensorflow::NodeDef& layer_) { // Check if all the inputs have the same shape. bool equalInpShapes = true; + bool isShapeOnes = false; MatShape outShape0; for (int ii = 0; ii < num_inputs && !netInputShapes.empty(); ii++) { @@ -1845,12 +1847,14 @@ void TFImporter::parseNode(const tensorflow::NodeDef& layer_) else if (outShape != outShape0) { equalInpShapes = false; + isShapeOnes = isAllOnes(outShape, 2, outShape.size()) || + isAllOnes(outShape0, 2, outShape0.size()); break; } } int id; - if (equalInpShapes || netInputShapes.empty()) + if (equalInpShapes || netInputShapes.empty() || (!equalInpShapes && isShapeOnes)) { layerParams.set("operation", type == "RealDiv" ? "div" : "prod"); id = dstNet.addLayer(name, "Eltwise", layerParams); diff --git a/modules/dnn/test/test_tf_importer.cpp b/modules/dnn/test/test_tf_importer.cpp index 62a559a672..5e45a5c0f0 100644 --- a/modules/dnn/test/test_tf_importer.cpp +++ b/modules/dnn/test/test_tf_importer.cpp @@ -210,6 +210,12 @@ TEST_P(Test_TensorFlow_layers, eltwise_add_vec) runTensorFlowNet("eltwise_add_vec"); } +TEST_P(Test_TensorFlow_layers, eltwise_mul_vec) +{ + runTensorFlowNet("eltwise_mul_vec"); +} + + TEST_P(Test_TensorFlow_layers, channel_broadcast) { if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) From e75f1b071b098cb40108ab0d14c39099ada1f1fc Mon Sep 17 00:00:00 2001 From: Anastasia Murzova Date: Tue, 23 Mar 2021 22:28:26 +0300 Subject: [PATCH 3/5] Added reshape corrections --- modules/dnn/src/tensorflow/tf_importer.cpp | 2 +- modules/dnn/test/test_tf_importer.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/dnn/src/tensorflow/tf_importer.cpp b/modules/dnn/src/tensorflow/tf_importer.cpp index bdab0663a7..a0fcffff2e 100644 --- a/modules/dnn/src/tensorflow/tf_importer.cpp +++ b/modules/dnn/src/tensorflow/tf_importer.cpp @@ -306,7 +306,7 @@ bool hasAllOnes(const Mat &inputs, int startPos, int endPos) for (int i = startPos; i < endPos; i++) { - if (inputs.at(i) != 1 || inputs.at(i)!= -1) + if (inputs.at(i) != 1 && inputs.at(i) != -1) return false; } return true; diff --git a/modules/dnn/test/test_tf_importer.cpp b/modules/dnn/test/test_tf_importer.cpp index 5e45a5c0f0..cbf2c60ccb 100644 --- a/modules/dnn/test/test_tf_importer.cpp +++ b/modules/dnn/test/test_tf_importer.cpp @@ -478,6 +478,11 @@ TEST_P(Test_TensorFlow_layers, reshape_nchw) runTensorFlowNet("reshape_nchw"); } +TEST_P(Test_TensorFlow_layers, reshape_conv) +{ + runTensorFlowNet("reshape_conv"); +} + TEST_P(Test_TensorFlow_layers, leaky_relu) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2018050000) From 56bdd7db5c4b28d8957749b7c9e7fb53cad5b13a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 3 Mar 2021 03:32:25 +0300 Subject: [PATCH 4/5] dnn: use OpenVINO 2021.3 defines original commit: 62915037939f13a55b973b84fea05218f73e15ae --- cmake/OpenCVDetectInferenceEngine.cmake | 4 ++-- modules/dnn/src/op_inf_engine.hpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/OpenCVDetectInferenceEngine.cmake b/cmake/OpenCVDetectInferenceEngine.cmake index 34f3df17dc..aa4bb4a864 100644 --- a/cmake/OpenCVDetectInferenceEngine.cmake +++ b/cmake/OpenCVDetectInferenceEngine.cmake @@ -141,9 +141,9 @@ endif() if(INF_ENGINE_TARGET) if(NOT INF_ENGINE_RELEASE) - message(WARNING "InferenceEngine version has not been set, 2021.2 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.") + message(WARNING "InferenceEngine version has not been set, 2021.3 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.") endif() - set(INF_ENGINE_RELEASE "2021020000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)") + set(INF_ENGINE_RELEASE "2021030000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)") set_target_properties(${INF_ENGINE_TARGET} PROPERTIES INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}" ) diff --git a/modules/dnn/src/op_inf_engine.hpp b/modules/dnn/src/op_inf_engine.hpp index 25844710b9..42008b0f10 100644 --- a/modules/dnn/src/op_inf_engine.hpp +++ b/modules/dnn/src/op_inf_engine.hpp @@ -29,10 +29,11 @@ #define INF_ENGINE_RELEASE_2020_4 2020040000 #define INF_ENGINE_RELEASE_2021_1 2021010000 #define INF_ENGINE_RELEASE_2021_2 2021020000 +#define INF_ENGINE_RELEASE_2021_3 2021030000 #ifndef INF_ENGINE_RELEASE -#warning("IE version have not been provided via command-line. Using 2021.2 by default") -#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2021_2 +#warning("IE version have not been provided via command-line. Using 2021.3 by default") +#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2021_3 #endif #define INF_ENGINE_VER_MAJOR_GT(ver) (((INF_ENGINE_RELEASE) / 10000) > ((ver) / 10000)) From e56e4876e7a3a3e9ab8ced04bd3bbe5731c33a55 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 24 Mar 2021 09:28:05 +0000 Subject: [PATCH 5/5] dnn(test): update tests for OpenVINO 2021.3 --- modules/dnn/test/test_common.hpp | 1 + modules/dnn/test/test_common.impl.hpp | 4 ++-- modules/dnn/test/test_darknet_importer.cpp | 4 ++++ modules/dnn/test/test_layers.cpp | 5 +++++ modules/dnn/test/test_onnx_importer.cpp | 21 +++++++++++++++++++++ modules/dnn/test/test_tf_importer.cpp | 18 ++++++++++++++++++ modules/dnn/test/test_torch_importer.cpp | 14 ++++++++++++++ 7 files changed, 65 insertions(+), 2 deletions(-) diff --git a/modules/dnn/test/test_common.hpp b/modules/dnn/test/test_common.hpp index e98fbf4f91..5fc7447705 100644 --- a/modules/dnn/test/test_common.hpp +++ b/modules/dnn/test/test_common.hpp @@ -30,6 +30,7 @@ #define CV_TEST_TAG_DNN_SKIP_IE_2019R1_1 "dnn_skip_ie_2019r1_1" #define CV_TEST_TAG_DNN_SKIP_IE_2019R2 "dnn_skip_ie_2019r2" #define CV_TEST_TAG_DNN_SKIP_IE_2019R3 "dnn_skip_ie_2019r3" +#define CV_TEST_TAG_DNN_SKIP_IE_CPU "dnn_skip_ie_cpu" #define CV_TEST_TAG_DNN_SKIP_IE_OPENCL "dnn_skip_ie_ocl" #define CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16 "dnn_skip_ie_ocl_fp16" #define CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2 "dnn_skip_ie_myriad2" diff --git a/modules/dnn/test/test_common.impl.hpp b/modules/dnn/test/test_common.impl.hpp index e55e6cb7b3..a11c6641b2 100644 --- a/modules/dnn/test/test_common.impl.hpp +++ b/modules/dnn/test/test_common.impl.hpp @@ -385,13 +385,13 @@ void initDNNTests() #ifdef HAVE_DNN_IE_NN_BUILDER_2019 CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, #endif - "" + CV_TEST_TAG_DNN_SKIP_IE_CPU ); -#endif registerGlobalSkipTag( // see validateVPUType(): CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2, CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16 ); +#endif } } // namespace diff --git a/modules/dnn/test/test_darknet_importer.cpp b/modules/dnn/test/test_darknet_importer.cpp index 8a633fa566..9983d99ef5 100644 --- a/modules/dnn/test/test_darknet_importer.cpp +++ b/modules/dnn/test/test_darknet_importer.cpp @@ -694,6 +694,10 @@ TEST_P(Test_Darknet_layers, shortcut) TEST_P(Test_Darknet_layers, upsample) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif testDarknetLayer("upsample"); } diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp index 73491fcf25..53b555a56b 100644 --- a/modules/dnn/test/test_layers.cpp +++ b/modules/dnn/test/test_layers.cpp @@ -1553,6 +1553,11 @@ TEST_P(Test_Caffe_layers, Interp) TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (available in OpenCV source tree only) #endif { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD); diff --git a/modules/dnn/test/test_onnx_importer.cpp b/modules/dnn/test/test_onnx_importer.cpp index ad28cad61a..acc88c9713 100644 --- a/modules/dnn/test/test_onnx_importer.cpp +++ b/modules/dnn/test/test_onnx_importer.cpp @@ -406,11 +406,19 @@ TEST_P(Test_ONNX_layers, BatchNormalization3D) TEST_P(Test_ONNX_layers, BatchNormalizationUnfused) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif testONNXModels("frozenBatchNorm2d"); } TEST_P(Test_ONNX_layers, BatchNormalizationSubgraph) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif testONNXModels("batch_norm_subgraph"); } @@ -746,6 +754,13 @@ TEST_P(Test_ONNX_layers, Conv1d_variable_weight_bias) TEST_P(Test_ONNX_layers, GatherMultiOutput) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif + #if defined(INF_ENGINE_RELEASE) if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE); @@ -842,6 +857,7 @@ TEST_P(Test_ONNX_layers, PoolConv1d) TEST_P(Test_ONNX_layers, ConvResizePool1d) { +#if defined(INF_ENGINE_RELEASE) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) { if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER); @@ -849,7 +865,12 @@ TEST_P(Test_ONNX_layers, ConvResizePool1d) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) { if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); +#if INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (target == DNN_TARGET_OPENCL) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception + if (target == DNN_TARGET_OPENCL_FP16) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif } +#endif testONNXModels("conv_resize_pool_1d"); } diff --git a/modules/dnn/test/test_tf_importer.cpp b/modules/dnn/test/test_tf_importer.cpp index cbf2c60ccb..ff9360c600 100644 --- a/modules/dnn/test/test_tf_importer.cpp +++ b/modules/dnn/test/test_tf_importer.cpp @@ -230,6 +230,12 @@ TEST_P(Test_TensorFlow_layers, pad_and_concat) TEST_P(Test_TensorFlow_layers, concat_axis_1) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif runTensorFlowNet("concat_axis_1"); } @@ -290,6 +296,10 @@ TEST_P(Test_TensorFlow_layers, batch_norm_10) } TEST_P(Test_TensorFlow_layers, batch_norm_11) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // nan +#endif if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); runTensorFlowNet("mvn_batch_norm_1x1"); @@ -1018,12 +1028,20 @@ TEST_P(Test_TensorFlow_layers, keras_mobilenet_head) // TF case: align_corners=False, half_pixel_centers=False TEST_P(Test_TensorFlow_layers, resize_bilinear) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif runTensorFlowNet("resize_bilinear"); } // TF case: align_corners=True, half_pixel_centers=False TEST_P(Test_TensorFlow_layers, resize_bilinear_align_corners) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif runTensorFlowNet("resize_bilinear", false, 0.0, 0.0, false, // default parameters "_align_corners"); diff --git a/modules/dnn/test/test_torch_importer.cpp b/modules/dnn/test/test_torch_importer.cpp index 9eb89f3d78..eb608b52e5 100644 --- a/modules/dnn/test/test_torch_importer.cpp +++ b/modules/dnn/test/test_torch_importer.cpp @@ -242,6 +242,15 @@ TEST_P(Test_Torch_layers, net_padding) TEST_P(Test_Torch_layers, net_non_spatial) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // crash + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +#endif + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, @@ -537,6 +546,11 @@ private: TEST_P(Test_Torch_layers, upsampling_nearest) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // TODO +#endif + // Test a custom layer. CV_DNN_REGISTER_LAYER_CLASS(SpatialUpSamplingNearest, SpatialUpSamplingNearestLayer); try