From b068d26fad1de316de4d6357e38afcf2193f6e32 Mon Sep 17 00:00:00 2001 From: Liubov Batanina Date: Thu, 7 Feb 2019 11:52:27 +0300 Subject: [PATCH 1/3] Using IE backend for normalize layer tests --- modules/dnn/src/layers/normalize_bbox_layer.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/dnn/src/layers/normalize_bbox_layer.cpp b/modules/dnn/src/layers/normalize_bbox_layer.cpp index 4766f1704e..b5d98e0054 100644 --- a/modules/dnn/src/layers/normalize_bbox_layer.cpp +++ b/modules/dnn/src/layers/normalize_bbox_layer.cpp @@ -65,16 +65,12 @@ public: { if (backendId == DNN_BACKEND_INFERENCE_ENGINE) { - if (pnorm != 2) + if (!(pnorm == 2 || pnorm == 1)) { return false; - if (!blobs.empty()) - return true; - if (preferableTarget == DNN_TARGET_MYRIAD) - return !acrossSpatial; - return startAxis == 1 && (!acrossSpatial || endAxis > 1); + } + return preferableTarget == DNN_TARGET_MYRIAD ? !acrossSpatial : startAxis == 1; } - else - return backendId == DNN_BACKEND_OPENCV; + return backendId == DNN_BACKEND_OPENCV; } bool getMemoryShapes(const std::vector &inputs, From 6b4becfd0397158a4686d0c13d6f98f4660f6301 Mon Sep 17 00:00:00 2001 From: Liubov Batanina Date: Mon, 11 Feb 2019 12:39:28 +0300 Subject: [PATCH 2/3] Enabled tests on IE backend --- modules/dnn/src/layers/normalize_bbox_layer.cpp | 2 +- modules/dnn/test/test_backends.cpp | 2 +- modules/dnn/test/test_torch_importer.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/dnn/src/layers/normalize_bbox_layer.cpp b/modules/dnn/src/layers/normalize_bbox_layer.cpp index b5d98e0054..53a5f407d0 100644 --- a/modules/dnn/src/layers/normalize_bbox_layer.cpp +++ b/modules/dnn/src/layers/normalize_bbox_layer.cpp @@ -65,7 +65,7 @@ public: { if (backendId == DNN_BACKEND_INFERENCE_ENGINE) { - if (!(pnorm == 2 || pnorm == 1)) { + if (pnorm != 2) { return false; } return preferableTarget == DNN_TARGET_MYRIAD ? !acrossSpatial : startAxis == 1; diff --git a/modules/dnn/test/test_backends.cpp b/modules/dnn/test/test_backends.cpp index 1d97cfc088..66e80a1fe9 100644 --- a/modules/dnn/test/test_backends.cpp +++ b/modules/dnn/test/test_backends.cpp @@ -226,7 +226,7 @@ TEST_P(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages) TEST_P(DNNTestNetwork, OpenFace) { #if defined(INF_ENGINE_RELEASE) -#if (INF_ENGINE_RELEASE < 2018030000 || INF_ENGINE_RELEASE == 2018050000) +#if (INF_ENGINE_RELEASE < 2018030000) if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD) throw SkipTestException(""); #elif INF_ENGINE_RELEASE < 2018040000 diff --git a/modules/dnn/test/test_torch_importer.cpp b/modules/dnn/test/test_torch_importer.cpp index 046bd65b86..99695ca031 100644 --- a/modules/dnn/test/test_torch_importer.cpp +++ b/modules/dnn/test/test_torch_importer.cpp @@ -272,12 +272,12 @@ class Test_Torch_nets : public DNNTestLayer {}; TEST_P(Test_Torch_nets, OpenFace_accuracy) { -#if defined(INF_ENGINE_RELEASE) && (INF_ENGINE_RELEASE < 2018030000 || INF_ENGINE_RELEASE == 2018050000) +#if defined(INF_ENGINE_RELEASE) && (INF_ENGINE_RELEASE < 2018030000) if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD) throw SkipTestException(""); #endif checkBackend(); - if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16) + if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16 && INF_ENGINE_RELEASE != 2018050000) throw SkipTestException(""); const string model = findDataFile("dnn/openface_nn4.small2.v1.t7", false); From 183c0fcab199b32774d1e4f1261f8b3a4d12777f Mon Sep 17 00:00:00 2001 From: Liubov Batanina Date: Wed, 13 Feb 2019 15:59:51 +0300 Subject: [PATCH 3/3] Changed condition for resize and lrn layers --- modules/dnn/perf/perf_net.cpp | 3 +-- modules/dnn/src/layers/lrn_layer.cpp | 2 +- modules/dnn/src/layers/normalize_bbox_layer.cpp | 4 ++-- modules/dnn/src/layers/resize_layer.cpp | 5 ++--- modules/dnn/test/test_backends.cpp | 2 +- modules/dnn/test/test_tf_importer.cpp | 2 -- modules/dnn/test/test_torch_importer.cpp | 4 +--- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/modules/dnn/perf/perf_net.cpp b/modules/dnn/perf/perf_net.cpp index d06689a7fb..54388fda34 100644 --- a/modules/dnn/perf/perf_net.cpp +++ b/modules/dnn/perf/perf_net.cpp @@ -124,8 +124,7 @@ PERF_TEST_P_(DNNTestNetwork, SSD) PERF_TEST_P_(DNNTestNetwork, OpenFace) { if (backend == DNN_BACKEND_HALIDE || - (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16) || - (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)) + (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)) throw SkipTestException(""); processNet("dnn/openface_nn4.small2.v1.t7", "", "", Mat(cv::Size(96, 96), CV_32FC3)); diff --git a/modules/dnn/src/layers/lrn_layer.cpp b/modules/dnn/src/layers/lrn_layer.cpp index f34faff338..145793959b 100644 --- a/modules/dnn/src/layers/lrn_layer.cpp +++ b/modules/dnn/src/layers/lrn_layer.cpp @@ -92,7 +92,7 @@ public: { return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE || - (backendId == DNN_BACKEND_INFERENCE_ENGINE && (preferableTarget != DNN_TARGET_MYRIAD || type == CHANNEL_NRM)); + backendId == DNN_BACKEND_INFERENCE_ENGINE; } #ifdef HAVE_OPENCL diff --git a/modules/dnn/src/layers/normalize_bbox_layer.cpp b/modules/dnn/src/layers/normalize_bbox_layer.cpp index 53a5f407d0..9a3162859a 100644 --- a/modules/dnn/src/layers/normalize_bbox_layer.cpp +++ b/modules/dnn/src/layers/normalize_bbox_layer.cpp @@ -65,9 +65,9 @@ public: { if (backendId == DNN_BACKEND_INFERENCE_ENGINE) { - if (pnorm != 2) { + if (pnorm != 2) return false; - } + return preferableTarget == DNN_TARGET_MYRIAD ? !acrossSpatial : startAxis == 1; } return backendId == DNN_BACKEND_OPENCV; diff --git a/modules/dnn/src/layers/resize_layer.cpp b/modules/dnn/src/layers/resize_layer.cpp index 03d806ad2c..249b689341 100644 --- a/modules/dnn/src/layers/resize_layer.cpp +++ b/modules/dnn/src/layers/resize_layer.cpp @@ -54,12 +54,11 @@ public: #ifdef HAVE_INF_ENGINE if (backendId == DNN_BACKEND_INFERENCE_ENGINE) { - return (interpolation == "nearest" && preferableTarget != DNN_TARGET_MYRIAD) || + return (interpolation == "nearest" && scaleWidth == scaleHeight) || (interpolation == "bilinear" && INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2018R4)); } - else #endif - return backendId == DNN_BACKEND_OPENCV; + return backendId == DNN_BACKEND_OPENCV; } virtual void finalize(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr) CV_OVERRIDE diff --git a/modules/dnn/test/test_backends.cpp b/modules/dnn/test/test_backends.cpp index 66e80a1fe9..1d97cfc088 100644 --- a/modules/dnn/test/test_backends.cpp +++ b/modules/dnn/test/test_backends.cpp @@ -226,7 +226,7 @@ TEST_P(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages) TEST_P(DNNTestNetwork, OpenFace) { #if defined(INF_ENGINE_RELEASE) -#if (INF_ENGINE_RELEASE < 2018030000) +#if (INF_ENGINE_RELEASE < 2018030000 || INF_ENGINE_RELEASE == 2018050000) if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD) throw SkipTestException(""); #elif INF_ENGINE_RELEASE < 2018040000 diff --git a/modules/dnn/test/test_tf_importer.cpp b/modules/dnn/test/test_tf_importer.cpp index 7ddda7f03a..b722ffc964 100644 --- a/modules/dnn/test/test_tf_importer.cpp +++ b/modules/dnn/test/test_tf_importer.cpp @@ -558,8 +558,6 @@ TEST_P(Test_TensorFlow_layers, split) TEST_P(Test_TensorFlow_layers, resize_nearest_neighbor) { - if (backend == DNN_BACKEND_INFERENCE_ENGINE && target != DNN_TARGET_MYRIAD) - throw SkipTestException(""); runTensorFlowNet("resize_nearest_neighbor"); runTensorFlowNet("keras_upsampling2d"); } diff --git a/modules/dnn/test/test_torch_importer.cpp b/modules/dnn/test/test_torch_importer.cpp index 99695ca031..547e9f775e 100644 --- a/modules/dnn/test/test_torch_importer.cpp +++ b/modules/dnn/test/test_torch_importer.cpp @@ -272,13 +272,11 @@ class Test_Torch_nets : public DNNTestLayer {}; TEST_P(Test_Torch_nets, OpenFace_accuracy) { -#if defined(INF_ENGINE_RELEASE) && (INF_ENGINE_RELEASE < 2018030000) +#if defined(INF_ENGINE_RELEASE) && (INF_ENGINE_RELEASE < 2018030000 || INF_ENGINE_RELEASE == 2018050000) if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD) throw SkipTestException(""); #endif checkBackend(); - if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16 && INF_ENGINE_RELEASE != 2018050000) - throw SkipTestException(""); const string model = findDataFile("dnn/openface_nn4.small2.v1.t7", false); Net net = readNetFromTorch(model);