mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
Merge pull request #12573 from alalek:fixes_3.4
This commit is contained in:
commit
de54d45afd
@ -3,7 +3,7 @@ import os
|
|||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from tests_common import NewOpenCVTests
|
from tests_common import NewOpenCVTests, unittest
|
||||||
|
|
||||||
def normAssert(test, a, b, lInf=1e-5):
|
def normAssert(test, a, b, lInf=1e-5):
|
||||||
test.assertLess(np.max(np.abs(a - b)), lInf)
|
test.assertLess(np.max(np.abs(a - b)), lInf)
|
||||||
@ -95,7 +95,7 @@ if haveInfEngine:
|
|||||||
if cv.ocl.haveOpenCL() and cv.ocl.useOpenCL():
|
if cv.ocl.haveOpenCL() and cv.ocl.useOpenCL():
|
||||||
dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_OPENCL])
|
dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_OPENCL])
|
||||||
dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_OPENCL_FP16])
|
dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_OPENCL_FP16])
|
||||||
if haveInfEngine:
|
if haveInfEngine: # FIXIT Check Intel iGPU only
|
||||||
dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL])
|
dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL])
|
||||||
dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL_FP16])
|
dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL_FP16])
|
||||||
|
|
||||||
@ -116,8 +116,8 @@ def printParams(backend, target):
|
|||||||
|
|
||||||
class dnn_test(NewOpenCVTests):
|
class dnn_test(NewOpenCVTests):
|
||||||
|
|
||||||
def find_dnn_file(self, filename):
|
def find_dnn_file(self, filename, required=True):
|
||||||
return self.find_file(filename, [os.environ['OPENCV_DNN_TEST_DATA_PATH']])
|
return self.find_file(filename, [os.environ.get('OPENCV_DNN_TEST_DATA_PATH', os.getcwd())], required=required)
|
||||||
|
|
||||||
def test_blobFromImage(self):
|
def test_blobFromImage(self):
|
||||||
np.random.seed(324)
|
np.random.seed(324)
|
||||||
@ -147,8 +147,11 @@ class dnn_test(NewOpenCVTests):
|
|||||||
|
|
||||||
|
|
||||||
def test_face_detection(self):
|
def test_face_detection(self):
|
||||||
proto = self.find_dnn_file('dnn/opencv_face_detector.prototxt')
|
testdata_required = bool(os.environ.get('OPENCV_DNN_TEST_REQUIRE_TESTDATA', False))
|
||||||
model = self.find_dnn_file('dnn/opencv_face_detector.caffemodel')
|
proto = self.find_dnn_file('dnn/opencv_face_detector.prototxt2', required=testdata_required)
|
||||||
|
model = self.find_dnn_file('dnn/opencv_face_detector.caffemodel', required=testdata_required)
|
||||||
|
if proto is None or model is None:
|
||||||
|
raise unittest.SkipTest("Missing DNN test files (dnn/opencv_face_detector.{prototxt/caffemodel}). Verify OPENCV_DNN_TEST_DATA_PATH configuration parameter.")
|
||||||
|
|
||||||
img = self.get_sample('gpu/lbpcascade/er.png')
|
img = self.get_sample('gpu/lbpcascade/er.png')
|
||||||
blob = cv.dnn.blobFromImage(img, mean=(104, 177, 123), swapRB=False, crop=False)
|
blob = cv.dnn.blobFromImage(img, mean=(104, 177, 123), swapRB=False, crop=False)
|
||||||
|
@ -26,13 +26,14 @@ class NewOpenCVTests(unittest.TestCase):
|
|||||||
# github repository url
|
# github repository url
|
||||||
repoUrl = 'https://raw.github.com/opencv/opencv/master'
|
repoUrl = 'https://raw.github.com/opencv/opencv/master'
|
||||||
|
|
||||||
def find_file(self, filename, searchPaths=[]):
|
def find_file(self, filename, searchPaths=[], required=True):
|
||||||
searchPaths = searchPaths if searchPaths else [self.repoPath, self.extraTestDataPath]
|
searchPaths = searchPaths if searchPaths else [self.repoPath, self.extraTestDataPath]
|
||||||
for path in searchPaths:
|
for path in searchPaths:
|
||||||
if path is not None:
|
if path is not None:
|
||||||
candidate = path + '/' + filename
|
candidate = path + '/' + filename
|
||||||
if os.path.isfile(candidate):
|
if os.path.isfile(candidate):
|
||||||
return candidate
|
return candidate
|
||||||
|
if required:
|
||||||
self.fail('File ' + filename + ' not found')
|
self.fail('File ' + filename + ' not found')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -58,6 +58,10 @@
|
|||||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CV_UNUSED // Required for standalone compilation mode (OpenCV defines this in base.hpp)
|
||||||
|
#define CV_UNUSED(name) (void)name
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user