2011-09-12 15:48:09 +08:00
|
|
|
#include "perf_precomp.hpp"
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
#ifdef HAVE_CUDA
|
|
|
|
|
2012-05-23 20:58:01 +08:00
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
// HOG
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo)
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GetParam();
|
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat img_host = readImage("gpu/hog/road.png", cv::IMREAD_GRAYSCALE);
|
2012-05-23 20:58:01 +08:00
|
|
|
ASSERT_FALSE(img_host.empty());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat img(img_host);
|
|
|
|
std::vector<cv::Rect> found_locations;
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::HOGDescriptor hog;
|
|
|
|
hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2012-05-23 20:58:01 +08:00
|
|
|
hog.detectMultiScale(img, found_locations);
|
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
|
|
|
hog.detectMultiScale(img, found_locations);
|
|
|
|
}
|
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ObjDetect, HOG, ALL_DEVICES);
|
|
|
|
|
2012-05-23 20:58:01 +08:00
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
// HaarClassifier
|
2012-05-23 02:58:01 +08:00
|
|
|
|
2012-05-23 02:59:26 +08:00
|
|
|
GPU_PERF_TEST_1(HaarClassifier, cv::gpu::DeviceInfo)
|
2012-05-23 02:58:01 +08:00
|
|
|
{
|
|
|
|
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);
|
2012-05-23 20:58:01 +08:00
|
|
|
ASSERT_FALSE(img_host.empty());
|
2012-05-23 02:59:26 +08:00
|
|
|
|
2012-05-23 02:58:01 +08:00
|
|
|
cv::gpu::CascadeClassifier_GPU cascade;
|
|
|
|
|
2012-05-23 20:58:01 +08:00
|
|
|
ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/perf/haarcascade_frontalface_alt.xml")));
|
2012-05-23 02:58:01 +08:00
|
|
|
|
|
|
|
cv::gpu::GpuMat img(img_host);
|
2012-05-23 20:58:01 +08:00
|
|
|
cv::gpu::GpuMat objects_buffer;
|
|
|
|
|
|
|
|
cascade.detectMultiScale(img, objects_buffer);
|
2012-05-23 02:59:26 +08:00
|
|
|
|
2012-05-23 02:58:01 +08:00
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-23 02:59:26 +08:00
|
|
|
cascade.detectMultiScale(img, objects_buffer);
|
2012-05-23 02:58:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES);
|
|
|
|
|
2012-07-04 20:11:07 +08:00
|
|
|
//===================== 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::GpuMat img(img_host);
|
|
|
|
cv::gpu::GpuMat gpu_rects, buffer;
|
2012-07-05 00:03:48 +08:00
|
|
|
cv::gpu::CascadeClassifier_GPU_LBP cascade(img.size());
|
|
|
|
ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/lbpcascade/lbpcascade_frontalface.xml")));
|
2012-07-04 20:11:07 +08:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
#endif
|