From 435b6df9897461cd8ec4a9f913fdb910c1e5a42d Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 19 May 2020 11:48:05 +0000 Subject: [PATCH 1/4] dnn: use OpenVINO 2020.4 defines original commit: 2813aa7eb9c81e7bc8c765d10e508ad134f6b376 --- cmake/OpenCVDetectInferenceEngine.cmake | 4 ++-- modules/dnn/src/op_inf_engine.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/OpenCVDetectInferenceEngine.cmake b/cmake/OpenCVDetectInferenceEngine.cmake index c0379c32b3..3eaf890f32 100644 --- a/cmake/OpenCVDetectInferenceEngine.cmake +++ b/cmake/OpenCVDetectInferenceEngine.cmake @@ -135,9 +135,9 @@ endif() if(INF_ENGINE_TARGET) if(NOT INF_ENGINE_RELEASE) - message(WARNING "InferenceEngine version has not been set, 2020.3 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.") + message(WARNING "InferenceEngine version has not been set, 2020.4 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.") endif() - set(INF_ENGINE_RELEASE "2020030000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)") + set(INF_ENGINE_RELEASE "2020040000" 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 351840f3f2..8c494ac918 100644 --- a/modules/dnn/src/op_inf_engine.hpp +++ b/modules/dnn/src/op_inf_engine.hpp @@ -29,8 +29,8 @@ #define INF_ENGINE_RELEASE_2020_4 2020040000 #ifndef INF_ENGINE_RELEASE -#warning("IE version have not been provided via command-line. Using 2020.3 by default") -#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2020_3 +#warning("IE version have not been provided via command-line. Using 2020.4 by default") +#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2020_4 #endif #define INF_ENGINE_VER_MAJOR_GT(ver) (((INF_ENGINE_RELEASE) / 10000) > ((ver) / 10000)) From f8d6c5b330e7bdb5a74e3f7e634c74a2c400ec1a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 15 Jul 2020 20:44:53 +0000 Subject: [PATCH 2/4] winpack_dldt: switch defaults to OpenVINO 2020.4 --- platforms/winpack_dldt/build_package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platforms/winpack_dldt/build_package.py b/platforms/winpack_dldt/build_package.py index 8f3724135d..c33e07026b 100644 --- a/platforms/winpack_dldt/build_package.py +++ b/platforms/winpack_dldt/build_package.py @@ -150,7 +150,7 @@ def git_apply_patch(src_dir, patch_file): patch_file = str(patch_file) # Python 3.5 may not handle Path assert os.path.exists(patch_file), patch_file execute(cmd=['git', 'apply', '--3way', '-v', '--ignore-space-change', str(patch_file)], cwd=src_dir) - execute(cmd=['git', 'diff', 'HEAD'], cwd=src_dir) + execute(cmd=['git', '--no-pager', 'diff', 'HEAD'], cwd=src_dir) #=================================================================================================== @@ -443,8 +443,8 @@ class Builder: def main(): dldt_src_url = 'https://github.com/openvinotoolkit/openvino' - dldt_src_commit = '2020.3.0' - dldt_release = '2020030000' + dldt_src_commit = '2020.4' + dldt_release = '2020040000' build_cache_dir_default = os.environ.get('BUILD_CACHE_DIR', '.build_cache') build_subst_drive = os.environ.get('BUILD_SUBST_DRIVE', None) From 55e85498394b990ed224b109c7b2b88bf7c2553d Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 15 Jul 2020 22:10:45 +0000 Subject: [PATCH 3/4] dnn: eliminate IE deprecation warning --- modules/dnn/src/op_inf_engine.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/dnn/src/op_inf_engine.hpp b/modules/dnn/src/op_inf_engine.hpp index 8c494ac918..e8fdada99a 100644 --- a/modules/dnn/src/op_inf_engine.hpp +++ b/modules/dnn/src/op_inf_engine.hpp @@ -44,7 +44,7 @@ #pragma GCC diagnostic ignored "-Wsuggest-override" #endif -#ifdef HAVE_DNN_IE_NN_BUILDER_2019 +#if defined(HAVE_DNN_IE_NN_BUILDER_2019) || INF_ENGINE_VER_MAJOR_EQ(INF_ENGINE_RELEASE_2020_4) //#define INFERENCE_ENGINE_DEPRECATED // turn off deprecation warnings from IE //there is no way to suppress warnings from IE only at this moment, so we are forced to suppress warnings globally #if defined(__GNUC__) @@ -53,7 +53,7 @@ #ifdef _MSC_VER #pragma warning(disable: 4996) // was declared deprecated #endif -#endif // HAVE_DNN_IE_NN_BUILDER_2019 +#endif #if defined(__GNUC__) && INF_ENGINE_VER_MAJOR_LT(INF_ENGINE_RELEASE_2020_1) #pragma GCC visibility push(default) From 1c371d07b571beb3ba69daf9b7ee7f289f2e0169 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 15 Jul 2020 22:52:08 +0000 Subject: [PATCH 4/4] dnn(test): adjust tests for OpenVINO 2020.4 --- modules/dnn/perf/perf_net.cpp | 15 +++++++++-- modules/dnn/test/test_backends.cpp | 2 ++ modules/dnn/test/test_caffe_importer.cpp | 9 +++++-- modules/dnn/test/test_darknet_importer.cpp | 29 ++++++++++++++++++++-- modules/dnn/test/test_ie_models.cpp | 8 +++++- modules/dnn/test/test_layers.cpp | 10 ++++++++ modules/dnn/test/test_onnx_importer.cpp | 14 +++++++++++ 7 files changed, 80 insertions(+), 7 deletions(-) diff --git a/modules/dnn/perf/perf_net.cpp b/modules/dnn/perf/perf_net.cpp index 3bee2313c0..23ece025e7 100644 --- a/modules/dnn/perf/perf_net.cpp +++ b/modules/dnn/perf/perf_net.cpp @@ -196,6 +196,13 @@ PERF_TEST_P_(DNNTestNetwork, YOLOv3) { if (backend == DNN_BACKEND_HALIDE) throw SkipTestException(""); +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL) + throw SkipTestException("Test is disabled in OpenVINO 2020.4"); + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + throw SkipTestException("Test is disabled in OpenVINO 2020.4"); +#endif + Mat sample = imread(findDataFile("dnn/dog416.png")); cvtColor(sample, sample, COLOR_BGR2RGB); Mat inp; @@ -209,6 +216,12 @@ PERF_TEST_P_(DNNTestNetwork, YOLOv4) throw SkipTestException(""); if (target == DNN_TARGET_MYRIAD) throw SkipTestException(""); +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL) + throw SkipTestException("Test is disabled in OpenVINO 2020.4"); + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + throw SkipTestException("Test is disabled in OpenVINO 2020.4"); +#endif Mat sample = imread(findDataFile("dnn/dog416.png")); cvtColor(sample, sample, COLOR_BGR2RGB); Mat inp; @@ -220,8 +233,6 @@ PERF_TEST_P_(DNNTestNetwork, YOLOv4_tiny) { if (backend == DNN_BACKEND_HALIDE) throw SkipTestException(""); - if (target == DNN_TARGET_MYRIAD) - throw SkipTestException(""); Mat sample = imread(findDataFile("dnn/dog416.png")); cvtColor(sample, sample, COLOR_BGR2RGB); Mat inp; diff --git a/modules/dnn/test/test_backends.cpp b/modules/dnn/test/test_backends.cpp index f1cb2663eb..c88f48754c 100644 --- a/modules/dnn/test/test_backends.cpp +++ b/modules/dnn/test/test_backends.cpp @@ -390,6 +390,8 @@ TEST_P(DNNTestNetwork, DenseNet_121) if (target == DNN_TARGET_OPENCL_FP16) { l1 = 2e-2; lInf = 9e-2; + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) + lInf = 0.1f; } else if (target == DNN_TARGET_MYRIAD) { diff --git a/modules/dnn/test/test_caffe_importer.cpp b/modules/dnn/test/test_caffe_importer.cpp index 4d4f2d0d10..91a68099ce 100644 --- a/modules/dnn/test/test_caffe_importer.cpp +++ b/modules/dnn/test/test_caffe_importer.cpp @@ -489,6 +489,11 @@ TEST_P(Test_Caffe_nets, Colorization) { l1 = 0.5; lInf = 11; } + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + { + l1 = 0.26; lInf = 6.5; + } + normAssert(out, ref, "", l1, lInf); expectNoFallbacksFromIE(net); } @@ -515,8 +520,8 @@ TEST_P(Test_Caffe_nets, DenseNet_121) float l1 = default_l1, lInf = default_lInf; if (target == DNN_TARGET_OPENCL_FP16) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019020000) - l1 = 0.04; lInf = 0.21; +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019020000) + l1 = 0.045; lInf = 0.21; #else l1 = 0.017; lInf = 0.0795; #endif diff --git a/modules/dnn/test/test_darknet_importer.cpp b/modules/dnn/test/test_darknet_importer.cpp index f328b29b20..552c1fa111 100644 --- a/modules/dnn/test/test_darknet_importer.cpp +++ b/modules/dnn/test/test_darknet_importer.cpp @@ -323,6 +323,12 @@ TEST_P(Test_Darknet_nets, YoloVoc) CV_TEST_TAG_LONG ); +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure + 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_VERSION); + 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_VERSION); +#endif #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_OPENCL_FP16) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16); @@ -363,6 +369,12 @@ TEST_P(Test_Darknet_nets, TinyYoloVoc) { applyTestTag(CV_TEST_TAG_MEMORY_512MB); +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure + 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_VERSION); + 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_VERSION); +#endif #if defined(INF_ENGINE_RELEASE) if ((backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 || backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && target == DNN_TARGET_MYRIAD && getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X) @@ -466,6 +478,13 @@ TEST_P(Test_Darknet_nets, YOLOv3) { applyTestTag(CV_TEST_TAG_LONG, (target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_1GB : CV_TEST_TAG_MEMORY_2GB)); +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure + 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_VERSION); + 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_VERSION); +#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); @@ -530,6 +549,12 @@ TEST_P(Test_Darknet_nets, YOLOv4) { applyTestTag(CV_TEST_TAG_LONG, (target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_1GB : CV_TEST_TAG_MEMORY_2GB)); +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure + 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_VERSION); + 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_VERSION); +#endif #if defined(INF_ENGINE_RELEASE) if (target == DNN_TARGET_MYRIAD) // NC_OUT_OF_MEMORY applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -626,7 +651,7 @@ TEST_P(Test_Darknet_nets, YOLOv4_tiny) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_OPENCL) iouDiff = std::numeric_limits::quiet_NaN(); if ((backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 || - backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && DNN_TARGET_OPENCL_FP16) + backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && target == DNN_TARGET_OPENCL_FP16) iouDiff = std::numeric_limits::quiet_NaN(); #endif @@ -646,7 +671,7 @@ TEST_P(Test_Darknet_nets, YOLOv4_tiny) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_OPENCL) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_VERSION); if ((backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 || - backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && DNN_TARGET_OPENCL_FP16) + 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_VERSION); #endif } diff --git a/modules/dnn/test/test_ie_models.cpp b/modules/dnn/test/test_ie_models.cpp index f6685676f9..2ba7d80f58 100644 --- a/modules/dnn/test/test_ie_models.cpp +++ b/modules/dnn/test/test_ie_models.cpp @@ -73,7 +73,8 @@ struct OpenVINOModelTestCaseInfo static const std::map& getOpenVINOTestModels() { static std::map g_models { -#if INF_ENGINE_RELEASE >= 2018050000 +#if INF_ENGINE_RELEASE >= 2018050000 && \ + INF_ENGINE_RELEASE <= 2020999999 // don't use IRv5 models with 2020.1+ // layout is defined by open_model_zoo/model_downloader // Downloaded using these parameters for Open Model Zoo downloader (2019R1): // ./downloader.py -o ${OPENCV_DNN_TEST_DATA_PATH}/omz_intel_models --cache_dir ${OPENCV_DNN_TEST_DATA_PATH}/.omz_cache/ \ @@ -295,6 +296,11 @@ TEST_P(DNNTestOpenVINO, models) } #endif +#if INF_ENGINE_VER_MAJOR_EQ(2020040000) + if (targetId == DNN_TARGET_MYRIAD && modelName == "person-detection-retail-0002") // IRv5, OpenVINO 2020.4 regression + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); +#endif + if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) setInferenceEngineBackendType(CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API); else if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp index 88f44d3ba7..41a587e45f 100644 --- a/modules/dnn/test/test_layers.cpp +++ b/modules/dnn/test/test_layers.cpp @@ -364,6 +364,16 @@ TEST_P(Test_Caffe_layers, layer_prelu_fc) // Reference output values are in range [-0.0001, 10.3906] double l1 = (target == DNN_TARGET_MYRIAD) ? 0.005 : 0.0; double lInf = (target == DNN_TARGET_MYRIAD) ? 0.021 : 0.0; +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL) + { + l1 = 0.006f; lInf = 0.05f; + } + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + { + l1 = 0.01f; lInf = 0.05f; + } +#endif testLayerUsingCaffeModels("layer_prelu_fc", true, false, l1, lInf); } diff --git a/modules/dnn/test/test_onnx_importer.cpp b/modules/dnn/test/test_onnx_importer.cpp index 181d32d861..4c8e66aae1 100644 --- a/modules/dnn/test/test_onnx_importer.cpp +++ b/modules/dnn/test/test_onnx_importer.cpp @@ -704,6 +704,13 @@ TEST_P(Test_ONNX_nets, TinyYolov2) // output range: [-11; 8] double l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.017 : default_l1; double lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.14 : default_lInf; +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + { + l1 = 0.018f; lInf = 0.16f; + } +#endif + testONNXModels("tiny_yolo2", pb, l1, lInf); } @@ -781,6 +788,13 @@ TEST_P(Test_ONNX_nets, Emotion_ferplus) l1 = 2.4e-4; lInf = 6e-4; } +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16) + { + l1 = 0.012f; lInf = 0.035f; + } +#endif + testONNXModels("emotion_ferplus", pb, l1, lInf); }