From 2c0d9fa81f9af696f3933bf065a64390899b6724 Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <alexander.alekhin@intel.com>
Date: Mon, 16 Dec 2019 17:43:06 +0300
Subject: [PATCH] dnn(test): fix Test_Model.Keypoints* tests

---
 modules/dnn/test/test_model.cpp | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/modules/dnn/test/test_model.cpp b/modules/dnn/test/test_model.cpp
index 2a1c0b72ab..5704c4b3fd 100644
--- a/modules/dnn/test/test_model.cpp
+++ b/modules/dnn/test/test_model.cpp
@@ -83,6 +83,9 @@ public:
         model.setInputSize(size).setInputMean(mean).setInputScale(scale)
              .setInputSwapRB(swapRB).setInputCrop(crop);
 
+        model.setPreferableBackend(backend);
+        model.setPreferableTarget(target);
+
         points = model.estimate(frame, 0.5);
 
         Mat out = Mat(points).reshape(1);
@@ -242,8 +245,15 @@ TEST_P(Test_Model, DetectionMobilenetSSD)
 
 TEST_P(Test_Model, Keypoints_pose)
 {
+    if (target == DNN_TARGET_OPENCL_FP16)
+        applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
+#ifdef HAVE_INF_ENGINE
+    if (target == DNN_TARGET_MYRIAD)
+        applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
+#endif
+
     Mat inp = imread(_tf("pose.png"));
-    std::string weights = _tf("lightweight_pose_estimation.onnx");
+    std::string weights = _tf("onnx/models/lightweight_pose_estimation.onnx");
     Mat exp = blobFromNPY(_tf("keypoints_exp.npy"));
 
 
@@ -258,12 +268,17 @@ TEST_P(Test_Model, Keypoints_pose)
 
 TEST_P(Test_Model, Keypoints_face)
 {
+#if defined(INF_ENGINE_RELEASE)
+    if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
+        applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
+#endif
+
     Mat inp = imread(_tf("gray_face.png"), 0);
-    std::string weights = _tf("facial_keypoints.onnx");
+    std::string weights = _tf("onnx/models/facial_keypoints.onnx");
     Mat exp = blobFromNPY(_tf("facial_keypoints_exp.npy"));
 
     Size size{224, 224};
-    float norm = 1e-4;
+    float norm = (target == DNN_TARGET_OPENCL_FP16) ? 5e-3 : 1e-4;
     double scale = 1.0/255;
     Scalar mean = Scalar();
     bool swapRB = false;
-- 
2.18.0