add sanity checks into the objdetect gpu performance tests

pull/40/head
marina.kolpakova 12 years ago
parent 3de2023c61
commit 2243645d36
  1. 20
      modules/gpu/perf/perf_objdetect.cpp

@ -17,7 +17,7 @@ PERF_TEST_P(Image, ObjDetect_HOG, Values<string>("gpu/hog/road.png"))
std::vector<cv::Rect> found_locations; std::vector<cv::Rect> found_locations;
if (runOnGpu) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_img(img); cv::gpu::GpuMat d_img(img);
@ -43,6 +43,8 @@ PERF_TEST_P(Image, ObjDetect_HOG, Values<string>("gpu/hog/road.png"))
hog.detectMultiScale(img, found_locations); hog.detectMultiScale(img, found_locations);
} }
} }
SANITY_CHECK(found_locations);
} }
//===========test for CalTech data =============// //===========test for CalTech data =============//
@ -57,7 +59,7 @@ PERF_TEST_P(HOG, CalTech, Values<string>("gpu/caltech/image_00000009_0.png", "gp
std::vector<cv::Rect> found_locations; std::vector<cv::Rect> found_locations;
if (runOnGpu) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_img(img); cv::gpu::GpuMat d_img(img);
@ -83,6 +85,8 @@ PERF_TEST_P(HOG, CalTech, Values<string>("gpu/caltech/image_00000009_0.png", "gp
hog.detectMultiScale(img, found_locations); 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); cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img.empty()); ASSERT_FALSE(img.empty());
if (runOnGpu) if (PERF_RUN_GPU())
{ {
cv::gpu::CascadeClassifier_GPU d_cascade; cv::gpu::CascadeClassifier_GPU d_cascade;
ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second))); 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); d_cascade.detectMultiScale(d_img, d_objects_buffer);
} }
GPU_SANITY_CHECK(d_objects_buffer);
} }
else else
{ {
@ -126,6 +132,8 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_HaarClassifier,
{ {
cascade.detectMultiScale(img, rects); 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); cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img.empty()); ASSERT_FALSE(img.empty());
if (runOnGpu) if (PERF_RUN_GPU())
{ {
cv::gpu::CascadeClassifier_GPU d_cascade; cv::gpu::CascadeClassifier_GPU d_cascade;
ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second))); 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); d_cascade.detectMultiScale(d_img, d_gpu_rects);
} }
GPU_SANITY_CHECK(d_gpu_rects);
} }
else else
{ {
@ -166,6 +176,8 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier,
{ {
cascade.detectMultiScale(img, rects); cascade.detectMultiScale(img, rects);
} }
CPU_SANITY_CHECK(rects);
} }
} }

Loading…
Cancel
Save