From 2243645d36f2465d5b632c81b704e12cdb2c5e64 Mon Sep 17 00:00:00 2001 From: "marina.kolpakova" Date: Wed, 10 Oct 2012 10:26:48 +0400 Subject: [PATCH] add sanity checks into the objdetect gpu performance tests --- modules/gpu/perf/perf_objdetect.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/gpu/perf/perf_objdetect.cpp b/modules/gpu/perf/perf_objdetect.cpp index ec12100..0c5af17 100644 --- a/modules/gpu/perf/perf_objdetect.cpp +++ b/modules/gpu/perf/perf_objdetect.cpp @@ -17,7 +17,7 @@ PERF_TEST_P(Image, ObjDetect_HOG, Values("gpu/hog/road.png")) std::vector found_locations; - if (runOnGpu) + if (PERF_RUN_GPU()) { cv::gpu::GpuMat d_img(img); @@ -43,6 +43,8 @@ PERF_TEST_P(Image, ObjDetect_HOG, Values("gpu/hog/road.png")) hog.detectMultiScale(img, found_locations); } } + + SANITY_CHECK(found_locations); } //===========test for CalTech data =============// @@ -57,7 +59,7 @@ PERF_TEST_P(HOG, CalTech, Values("gpu/caltech/image_00000009_0.png", "gp std::vector found_locations; - if (runOnGpu) + if (PERF_RUN_GPU()) { cv::gpu::GpuMat d_img(img); @@ -83,6 +85,8 @@ PERF_TEST_P(HOG, CalTech, Values("gpu/caltech/image_00000009_0.png", "gp hog.detectMultiScale(img, found_locations); } } + + SANITY_CHECK(found_locations); } @@ -98,7 +102,7 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_HaarClassifier, cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); - if (runOnGpu) + if (PERF_RUN_GPU()) { cv::gpu::CascadeClassifier_GPU d_cascade; ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second))); @@ -112,6 +116,8 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_HaarClassifier, { d_cascade.detectMultiScale(d_img, d_objects_buffer); } + + GPU_SANITY_CHECK(d_objects_buffer); } else { @@ -126,6 +132,8 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_HaarClassifier, { cascade.detectMultiScale(img, rects); } + + CPU_SANITY_CHECK(rects); } } @@ -138,7 +146,7 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier, cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); - if (runOnGpu) + if (PERF_RUN_GPU()) { cv::gpu::CascadeClassifier_GPU d_cascade; ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second))); @@ -152,6 +160,8 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier, { d_cascade.detectMultiScale(d_img, d_gpu_rects); } + + GPU_SANITY_CHECK(d_gpu_rects); } else { @@ -166,6 +176,8 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier, { cascade.detectMultiScale(img, rects); } + + CPU_SANITY_CHECK(rects); } } -- 2.7.4