From c918ac298c16eab75abd4e3dc46cc47dbb4c8fa6 Mon Sep 17 00:00:00 2001 From: Dmitry Kurtaev Date: Thu, 31 Jan 2019 13:38:24 +0300 Subject: [PATCH] Fix IE tests --- modules/dnn/src/layers/blank_layer.cpp | 21 +++++++++++++++----- modules/dnn/src/layers/convolution_layer.cpp | 2 +- modules/dnn/test/test_layers.cpp | 4 ++++ modules/dnn/test/test_onnx_importer.cpp | 2 +- modules/dnn/test/test_tf_importer.cpp | 4 ++-- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/modules/dnn/src/layers/blank_layer.cpp b/modules/dnn/src/layers/blank_layer.cpp index 9f8590bea7..96336808a0 100644 --- a/modules/dnn/src/layers/blank_layer.cpp +++ b/modules/dnn/src/layers/blank_layer.cpp @@ -110,14 +110,25 @@ public: virtual Ptr initInfEngine(const std::vector >& inputs) CV_OVERRIDE { #ifdef HAVE_INF_ENGINE + InferenceEngine::DataPtr input = infEngineDataNode(inputs[0]); + CV_Assert(!input->dims.empty()); #if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2018R5) - InferenceEngine::Builder::SplitLayer ieLayer(name); - ieLayer.setOutputPorts({InferenceEngine::Port()}); + InferenceEngine::Builder::Layer ieLayer(name); + ieLayer.setName(name); + if (preferableTarget == DNN_TARGET_MYRIAD) + { + ieLayer.setType("Copy"); + } + else + { + ieLayer.setType("Split"); + ieLayer.getParameters()["axis"] = input->dims.size() - 1; + ieLayer.getParameters()["out_sizes"] = input->dims[0]; + } + ieLayer.setInputPorts(std::vector(1)); + ieLayer.setOutputPorts(std::vector(1)); return Ptr(new InfEngineBackendNode(ieLayer)); #else - InferenceEngine::DataPtr input = infEngineDataNode(inputs[0]); - CV_Assert(!input->dims.empty()); - InferenceEngine::LayerParams lp; lp.name = name; lp.type = "Split"; diff --git a/modules/dnn/src/layers/convolution_layer.cpp b/modules/dnn/src/layers/convolution_layer.cpp index 46eb6f7a54..af2415b0ad 100644 --- a/modules/dnn/src/layers/convolution_layer.cpp +++ b/modules/dnn/src/layers/convolution_layer.cpp @@ -1150,7 +1150,7 @@ public: #ifdef HAVE_INF_ENGINE if (backendId == DNN_BACKEND_INFERENCE_ENGINE) { - if (INF_ENGINE_RELEASE == 2018050000 && (adjustPad.height || adjustPad.width)) + if (INF_ENGINE_RELEASE >= 2018050000 && (adjustPad.height || adjustPad.width)) return false; const int outGroupCn = blobs[0].size[1]; // Weights are in IOHW layout diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp index 77651ba617..06aec7da13 100644 --- a/modules/dnn/test/test_layers.cpp +++ b/modules/dnn/test/test_layers.cpp @@ -236,6 +236,10 @@ TEST_P(Test_Caffe_layers, Dropout) TEST_P(Test_Caffe_layers, Concat) { +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE > 2018050000 + if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD) + throw SkipTestException(""); +#endif testLayerUsingCaffeModels("layer_concat"); testLayerUsingCaffeModels("layer_concat_optim", true, false); testLayerUsingCaffeModels("layer_concat_shared_input", true, false); diff --git a/modules/dnn/test/test_onnx_importer.cpp b/modules/dnn/test/test_onnx_importer.cpp index acdd66631c..217ef34421 100644 --- a/modules/dnn/test/test_onnx_importer.cpp +++ b/modules/dnn/test/test_onnx_importer.cpp @@ -395,7 +395,7 @@ TEST_P(Test_ONNX_nets, DenseNet121) TEST_P(Test_ONNX_nets, Inception_v1) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE == 2018050000 +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE >= 2018050000 if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD) throw SkipTestException("Test is disabled for OpenVINO 2018R5"); #endif diff --git a/modules/dnn/test/test_tf_importer.cpp b/modules/dnn/test/test_tf_importer.cpp index b20b166551..7ddda7f03a 100644 --- a/modules/dnn/test/test_tf_importer.cpp +++ b/modules/dnn/test/test_tf_importer.cpp @@ -241,7 +241,7 @@ TEST_P(Test_TensorFlow_layers, unfused_flatten) TEST_P(Test_TensorFlow_layers, leaky_relu) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE == 2018050000 +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE >= 2018050000 if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL) throw SkipTestException(""); #endif @@ -388,7 +388,7 @@ TEST_P(Test_TensorFlow_nets, Faster_RCNN) TEST_P(Test_TensorFlow_nets, MobileNet_v1_SSD_PPN) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE == 2018050000 +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE >= 2018050000 if (backend == DNN_BACKEND_INFERENCE_ENGINE && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) throw SkipTestException("Unstable test case"); #endif -- GitLab