From 1a52a322b50b7756464e8021f7225fa75f5a8dc2 Mon Sep 17 00:00:00 2001 From: "marina.kolpakova" Date: Fri, 21 Sep 2012 16:10:40 +0400 Subject: [PATCH] add performance test for GPU soft cascade --- modules/gpu/perf/perf_objdetect.cpp | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/modules/gpu/perf/perf_objdetect.cpp b/modules/gpu/perf/perf_objdetect.cpp index 6b864a3..cebcbdb 100644 --- a/modules/gpu/perf/perf_objdetect.cpp +++ b/modules/gpu/perf/perf_objdetect.cpp @@ -89,6 +89,45 @@ PERF_TEST_P(HOG, CalTech, Values("gpu/caltech/image_00000009_0.png", "gp SANITY_CHECK(found_locations); } +typedef pair pair_string; +DEF_PARAM_TEST_1(SoftCascade, pair_string); + +PERF_TEST_P(SoftCascade, detect, Values(make_pair("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml", + "cv/cascadeandhog/bahnhof/image_00000000_0.png"))) +{ + if (runOnGpu) + { + cv::Mat cpu = readImage(GetParam().second); + ASSERT_FALSE(cpu.empty()); + cv::gpu::GpuMat colored(cpu); + + cv::gpu::SoftCascade cascade; + ASSERT_TRUE(cascade.load(GetParam().first)); + + cv::gpu::GpuMat rois, objectBoxes; + cascade.detectMultiScale(colored, rois, objectBoxes); + + TEST_CYCLE() + { + cascade.detectMultiScale(colored, rois, objectBoxes); + } + } else + { + cv::Mat colored = readImage(GetParam().second); + ASSERT_FALSE(colored.empty()); + + cv::SoftCascade cascade; + ASSERT_TRUE(cascade.load(GetParam().first)); + + std::vector rois, objectBoxes; + cascade.detectMultiScale(colored, rois, objectBoxes); + + TEST_CYCLE() + { + cascade.detectMultiScale(colored, rois, objectBoxes); + } + } +} /////////////////////////////////////////////////////////////// // HaarClassifier -- 2.7.4