parent
6167469bbd
commit
6763bd6d01
7 changed files with 850 additions and 10 deletions
@ -0,0 +1,199 @@ |
|||||||
|
#include "perf_precomp.hpp" |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, transformPoints, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat src_host(1, 10000, CV_32FC3); |
||||||
|
|
||||||
|
declare.in(src_host, WARMUP_RNG); |
||||||
|
|
||||||
|
GpuMat src(src_host); |
||||||
|
GpuMat dst; |
||||||
|
|
||||||
|
declare.time(0.5).iterations(100); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
transformPoints(src, Mat::ones(1, 3, CV_32FC1), Mat::ones(1, 3, CV_32FC1), dst); |
||||||
|
} |
||||||
|
|
||||||
|
Mat dst_host = dst; |
||||||
|
|
||||||
|
SANITY_CHECK(dst_host); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, projectPoints, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat src_host(1, 10000, CV_32FC3); |
||||||
|
|
||||||
|
declare.in(src_host, WARMUP_RNG); |
||||||
|
|
||||||
|
GpuMat src(src_host); |
||||||
|
GpuMat dst; |
||||||
|
|
||||||
|
declare.time(0.5).iterations(100); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
projectPoints(src, Mat::ones(1, 3, CV_32FC1), Mat::ones(1, 3, CV_32FC1), Mat::ones(3, 3, CV_32FC1), Mat(), dst); |
||||||
|
} |
||||||
|
|
||||||
|
Mat dst_host = dst; |
||||||
|
|
||||||
|
SANITY_CHECK(dst_host); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, solvePnPRansac, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat object(1, 10000, CV_32FC3); |
||||||
|
Mat image(1, 10000, CV_32FC2); |
||||||
|
|
||||||
|
declare.in(object, image, WARMUP_RNG); |
||||||
|
|
||||||
|
Mat rvec, tvec; |
||||||
|
|
||||||
|
declare.time(3.0); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
solvePnPRansac(object, image, Mat::ones(3, 3, CV_32FC1), Mat(1, 8, CV_32F, Scalar::all(0)), rvec, tvec); |
||||||
|
} |
||||||
|
|
||||||
|
SANITY_CHECK(rvec); |
||||||
|
SANITY_CHECK(tvec); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, StereoBM, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat img_l_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
Mat img_r_host = readImage("gpu/perf/aloeR.jpg", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
|
||||||
|
ASSERT_FALSE(img_l_host.empty()); |
||||||
|
ASSERT_FALSE(img_r_host.empty()); |
||||||
|
|
||||||
|
GpuMat img_l(img_l_host); |
||||||
|
GpuMat img_r(img_r_host); |
||||||
|
|
||||||
|
GpuMat dst; |
||||||
|
|
||||||
|
StereoBM_GPU bm(0, 256); |
||||||
|
|
||||||
|
declare.time(0.5).iterations(100); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
bm(img_l, img_r, dst); |
||||||
|
} |
||||||
|
|
||||||
|
Mat dst_host(dst); |
||||||
|
|
||||||
|
SANITY_CHECK(dst_host); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, StereoBeliefPropagation, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat img_l_host = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
Mat img_r_host = readImage("gpu/stereobm/aloe-R.png", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
|
||||||
|
ASSERT_FALSE(img_l_host.empty()); |
||||||
|
ASSERT_FALSE(img_r_host.empty()); |
||||||
|
|
||||||
|
GpuMat img_l(img_l_host); |
||||||
|
GpuMat img_r(img_r_host); |
||||||
|
|
||||||
|
GpuMat dst; |
||||||
|
|
||||||
|
StereoBeliefPropagation bp(128); |
||||||
|
|
||||||
|
declare.time(10.0); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
bp(img_l, img_r, dst); |
||||||
|
} |
||||||
|
|
||||||
|
Mat dst_host(dst); |
||||||
|
|
||||||
|
SANITY_CHECK(dst_host); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, StereoConstantSpaceBP, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat img_l_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
Mat img_r_host = readImage("gpu/perf/aloeR.jpg", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
|
||||||
|
ASSERT_FALSE(img_l_host.empty()); |
||||||
|
ASSERT_FALSE(img_r_host.empty()); |
||||||
|
|
||||||
|
GpuMat img_l(img_l_host); |
||||||
|
GpuMat img_r(img_r_host); |
||||||
|
|
||||||
|
GpuMat dst; |
||||||
|
|
||||||
|
StereoConstantSpaceBP bp(128); |
||||||
|
|
||||||
|
declare.time(10.0); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
bp(img_l, img_r, dst); |
||||||
|
} |
||||||
|
|
||||||
|
Mat dst_host(dst); |
||||||
|
|
||||||
|
SANITY_CHECK(dst_host); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, DisparityBilateralFilter, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat img_host = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
Mat disp_host = readImage("gpu/stereobm/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
|
||||||
|
ASSERT_FALSE(img_host.empty()); |
||||||
|
ASSERT_FALSE(disp_host.empty()); |
||||||
|
|
||||||
|
GpuMat img(img_host); |
||||||
|
GpuMat disp(disp_host); |
||||||
|
|
||||||
|
GpuMat dst; |
||||||
|
|
||||||
|
DisparityBilateralFilter f(128); |
||||||
|
|
||||||
|
declare.time(0.5).iterations(100); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
f(disp, img, dst); |
||||||
|
} |
||||||
|
|
||||||
|
Mat dst_host(dst); |
||||||
|
|
||||||
|
SANITY_CHECK(dst_host); |
||||||
|
} |
@ -0,0 +1,132 @@ |
|||||||
|
#include "perf_precomp.hpp" |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo_DescSize, BruteForceMatcher_match, testing::Combine(testing::ValuesIn(devices()), |
||||||
|
testing::Values(64, 128))) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = std::tr1::get<0>(GetParam()); |
||||||
|
int desc_size = std::tr1::get<1>(GetParam()); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat query_host(3000, desc_size, CV_32FC1); |
||||||
|
Mat train_host(3000, desc_size, CV_32FC1); |
||||||
|
|
||||||
|
declare.in(query_host, train_host, WARMUP_RNG); |
||||||
|
|
||||||
|
GpuMat query(query_host); |
||||||
|
GpuMat train(train_host); |
||||||
|
GpuMat trainIdx, distance; |
||||||
|
|
||||||
|
BruteForceMatcher_GPU< L2<float> > matcher; |
||||||
|
|
||||||
|
declare.time(0.5).iterations(100); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
matcher.matchSingle(query, train, trainIdx, distance); |
||||||
|
} |
||||||
|
|
||||||
|
Mat trainIdx_host(trainIdx); |
||||||
|
Mat distance_host(distance); |
||||||
|
|
||||||
|
SANITY_CHECK(trainIdx_host); |
||||||
|
SANITY_CHECK(distance_host); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo_K_DescSize, BruteForceMatcher_knnMatch, testing::Combine(testing::ValuesIn(devices()), |
||||||
|
testing::Values(2, 3), |
||||||
|
testing::Values(64, 128))) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = std::tr1::get<0>(GetParam()); |
||||||
|
int k = std::tr1::get<1>(GetParam()); |
||||||
|
int desc_size = std::tr1::get<2>(GetParam()); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat query_host(3000, desc_size, CV_32FC1); |
||||||
|
Mat train_host(3000, desc_size, CV_32FC1); |
||||||
|
|
||||||
|
declare.in(query_host, train_host, WARMUP_RNG); |
||||||
|
|
||||||
|
GpuMat query(query_host); |
||||||
|
GpuMat train(train_host); |
||||||
|
GpuMat trainIdx, distance, allDist; |
||||||
|
|
||||||
|
BruteForceMatcher_GPU< L2<float> > matcher; |
||||||
|
|
||||||
|
declare.time(0.5).iterations(100); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
matcher.knnMatch(query, train, trainIdx, distance, allDist, k); |
||||||
|
} |
||||||
|
|
||||||
|
Mat trainIdx_host(trainIdx); |
||||||
|
Mat distance_host(distance); |
||||||
|
|
||||||
|
SANITY_CHECK(trainIdx_host); |
||||||
|
SANITY_CHECK(distance_host); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo_DescSize, BruteForceMatcher_radiusMatch, testing::Combine(testing::ValuesIn(devices(GLOBAL_ATOMICS)), |
||||||
|
testing::Values(64, 128))) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = std::tr1::get<0>(GetParam()); |
||||||
|
int desc_size = std::tr1::get<1>(GetParam()); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat query_host = cvtest::randomMat(theRNG(), Size(desc_size, 3000), CV_32FC1, 0, 1, false); |
||||||
|
Mat train_host = cvtest::randomMat(theRNG(), Size(desc_size, 3000), CV_32FC1, 0, 1, false); |
||||||
|
|
||||||
|
GpuMat query(query_host); |
||||||
|
GpuMat train(train_host); |
||||||
|
GpuMat trainIdx, nMatches, distance; |
||||||
|
|
||||||
|
BruteForceMatcher_GPU< L2<float> > matcher; |
||||||
|
|
||||||
|
declare.time(0.5).iterations(100); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
matcher.radiusMatch(query, train, trainIdx, nMatches, distance, 2.0); |
||||||
|
} |
||||||
|
|
||||||
|
Mat trainIdx_host(trainIdx); |
||||||
|
Mat nMatches_host(nMatches); |
||||||
|
Mat distance_host(distance); |
||||||
|
|
||||||
|
SANITY_CHECK(trainIdx_host); |
||||||
|
SANITY_CHECK(nMatches_host); |
||||||
|
SANITY_CHECK(distance_host); |
||||||
|
} |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, SURF, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat img_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
|
||||||
|
ASSERT_FALSE(img_host.empty()); |
||||||
|
|
||||||
|
GpuMat img(img_host); |
||||||
|
GpuMat keypoints, descriptors; |
||||||
|
|
||||||
|
SURF_GPU surf; |
||||||
|
|
||||||
|
declare.time(2.0); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
surf(img, GpuMat(), keypoints, descriptors); |
||||||
|
} |
||||||
|
|
||||||
|
Mat keypoints_host(keypoints); |
||||||
|
Mat descriptors_host(descriptors); |
||||||
|
|
||||||
|
SANITY_CHECK(keypoints_host); |
||||||
|
SANITY_CHECK(descriptors_host); |
||||||
|
} |
||||||
|
|
@ -0,0 +1,23 @@ |
|||||||
|
#include "perf_precomp.hpp" |
||||||
|
|
||||||
|
PERF_TEST_P(DevInfo, HOGDescriptor, testing::ValuesIn(devices())) |
||||||
|
{ |
||||||
|
DeviceInfo devInfo = GetParam(); |
||||||
|
|
||||||
|
setDevice(devInfo.deviceID()); |
||||||
|
|
||||||
|
Mat img_host = readImage("gpu/hog/road.png", CV_LOAD_IMAGE_GRAYSCALE); |
||||||
|
|
||||||
|
GpuMat img(img_host); |
||||||
|
vector<Rect> found_locations; |
||||||
|
|
||||||
|
declare.time(0.5).iterations(100); |
||||||
|
|
||||||
|
gpu::HOGDescriptor hog; |
||||||
|
hog.setSVMDetector(gpu::HOGDescriptor::getDefaultPeopleDetector()); |
||||||
|
|
||||||
|
SIMPLE_TEST_CYCLE() |
||||||
|
{ |
||||||
|
hog.detectMultiScale(img, found_locations); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue