added performance test for LBP classifier.

This commit is contained in:
Marina Kolpakova 2012-07-04 12:11:07 +00:00
parent 51f6127e0a
commit 248f39e13e
6 changed files with 57 additions and 10 deletions

View File

@ -57,4 +57,31 @@ GPU_PERF_TEST_1(HaarClassifier, cv::gpu::DeviceInfo)
INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES); INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES);
//===================== LBP cascade ==========================//
GPU_PERF_TEST_1(LBPClassifier, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_host = readImage("gpu/haarcascade/group_1_640x480_VGA.pgm", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img_host.empty());
cv::gpu::CascadeClassifier_GPU_LBP cascade;
ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/lbpcascade/lbpcascade_frontalface.xml")));
cv::gpu::GpuMat img(img_host);
cv::gpu::GpuMat gpu_rects, buffer;
// cascade.detectMultiScale(img, objects_buffer);
cascade.detectMultiScale(img, buffer, gpu_rects);
TEST_CYCLE()
{
cascade.detectMultiScale(img, buffer, gpu_rects);
}
}
INSTANTIATE_TEST_CASE_P(ObjDetect, LBPClassifier, ALL_DEVICES);
#endif #endif

View File

@ -49,4 +49,26 @@ GPU_PERF_TEST_1(HaarClassifier, cv::gpu::DeviceInfo)
INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES); INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES);
//===================== LBP cascade ==========================//
GPU_PERF_TEST_1(LBPClassifier, cv::gpu::DeviceInfo)
{
cv::Mat img = readImage("gpu/haarcascade/group_1_640x480_VGA.pgm", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img.empty());
cv::CascadeClassifier cascade;
ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/lbpcascade/lbpcascade_frontalface.xml")));
std::vector<cv::Rect> rects;
cascade.detectMultiScale(img, rects);
TEST_CYCLE()
{
cascade.detectMultiScale(img, rects);
}
}
INSTANTIATE_TEST_CASE_P(ObjDetect, LBPClassifier, ALL_DEVICES);
#endif #endif

View File

@ -350,7 +350,9 @@ int cv::gpu::CascadeClassifier_GPU_LBP::detectMultiScale(const GpuMat& image, Gp
if (groupThreshold <= 0 || objects.empty()) if (groupThreshold <= 0 || objects.empty())
return 0; return 0;
return cv::gpu::device::lbp::connectedConmonents(candidates, groupThreshold, grouping_eps, dclassified); cv::gpu::device::lbp::connectedConmonents(candidates, groupThreshold, grouping_eps, dclassified);
cudaSafeCall( cudaDeviceSynchronize() );
return *classified;
} }
// ============ old fashioned haar cascade ==============================================// // ============ old fashioned haar cascade ==============================================//

View File

@ -1,11 +1,11 @@
/* /*
* Copyright 1993-2010 NVIDIA Corporation. All rights reserved. * Copyright 1993-2010 NVIDIA Corporation. All rights reserved.
* *
* NVIDIA Corporation and its licensors retain all intellectual * NVIDIA Corporation and its licensors retain all intellectual
* property and proprietary rights in and to this software and * property and proprietary rights in and to this software and
* related documentation and any modifications thereto. * related documentation and any modifications thereto.
* Any use, reproduction, disclosure, or distribution of this * Any use, reproduction, disclosure, or distribution of this
* software and related documentation without an express license * software and related documentation without an express license
* agreement from NVIDIA Corporation is strictly prohibited. * agreement from NVIDIA Corporation is strictly prohibited.
*/ */

View File

@ -185,8 +185,6 @@ PARAM_TEST_CASE(WarpAffine, cv::gpu::DeviceInfo, cv::Size, MatType, Inverse, Int
int borderType; int borderType;
bool useRoi; bool useRoi;
cv::Mat M;
virtual void SetUp() virtual void SetUp()
{ {
devInfo = GET_PARAM(0); devInfo = GET_PARAM(0);

View File

@ -185,8 +185,6 @@ PARAM_TEST_CASE(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, MatType, Inverse
int borderType; int borderType;
bool useRoi; bool useRoi;
cv::Mat M;
virtual void SetUp() virtual void SetUp()
{ {
devInfo = GET_PARAM(0); devInfo = GET_PARAM(0);