Commit 6763bd6d authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

added padded performance tests for gpu module

parent 6167469b
......@@ -215,6 +215,96 @@ PERF_TEST_P(DevInfo_Size_MatType, addScalar, testing::Combine(testing::ValuesIn(
SANITY_CHECK(c_host);
}
PERF_TEST_P(DevInfo_Size_MatType, subtractMat, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_8UC4, CV_16SC1, CV_32FC1)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int type = std::tr1::get<2>(GetParam());
setDevice(devInfo.deviceID());
Mat a_host(size, type);
Mat b_host(size, type);
declare.in(a_host, b_host, WARMUP_RNG);
GpuMat a(a_host);
GpuMat b(b_host);
GpuMat c(size, type);
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
subtract(a, b, c);
}
Mat c_host = c;
SANITY_CHECK(c_host);
}
PERF_TEST_P(DevInfo_Size, multiplyMat, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
setDevice(devInfo.deviceID());
Mat a_host(size, CV_8UC1);
Mat b_host(size, CV_32FC1);
declare.in(a_host, b_host, WARMUP_RNG);
GpuMat a(a_host);
GpuMat b(b_host);
GpuMat c;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
multiply(a, b, c);
}
Mat c_host = c;
SANITY_CHECK(c_host);
}
PERF_TEST_P(DevInfo_Size_MatType, multiplyScalar, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_32FC1)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int type = std::tr1::get<2>(GetParam());
setDevice(devInfo.deviceID());
Mat a_host(size, type);
declare.in(a_host, WARMUP_RNG);
GpuMat a(a_host);
Scalar b(1,2,3,4);
GpuMat c(size, type);
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
multiply(a, b, c);
}
Mat c_host = c;
SANITY_CHECK(c_host);
}
PERF_TEST_P(DevInfo_Size, exp, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
......@@ -394,3 +484,204 @@ PERF_TEST_P(DevInfo_Size_MatType, min, testing::Combine(testing::ValuesIn(device
SANITY_CHECK(dst_host);
}
PERF_TEST_P(DevInfo_Size, meanStdDev, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, CV_8UC1);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
Scalar mean;
Scalar stddev;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
meanStdDev(src, mean, stddev);
}
SANITY_CHECK(mean);
SANITY_CHECK(stddev);
}
PERF_TEST_P(DevInfo_Size_MatType_NormType, norm, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16UC1, CV_32SC1),
testing::Values((int)NORM_INF, (int)NORM_L1, (int)NORM_L2)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int type = std::tr1::get<2>(GetParam());
int normType = std::tr1::get<3>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, type);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
double dst;
GpuMat buf;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
dst = norm(src, normType, buf);
}
SANITY_CHECK(dst);
}
PERF_TEST_P(DevInfo_Size_NormType, normDiff, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values((int)NORM_INF, (int)NORM_L1, (int)NORM_L2)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int normType = std::tr1::get<2>(GetParam());
setDevice(devInfo.deviceID());
Mat src1_host(size, CV_8UC1);
Mat src2_host(size, CV_8UC1);
declare.in(src1_host, src2_host, WARMUP_RNG);
GpuMat src1(src1_host);
GpuMat src2(src2_host);
double dst;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
dst = norm(src1, src2, normType);
}
SANITY_CHECK(dst);
}
PERF_TEST_P(DevInfo_Size_MatType, sum, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int type = std::tr1::get<2>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, type);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
Scalar dst;
GpuMat buf;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
dst = sum(src, buf);
}
SANITY_CHECK(dst);
}
PERF_TEST_P(DevInfo_Size_MatType, minMax, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int type = std::tr1::get<2>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, type);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
double minVal, maxVal;
GpuMat buf;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
minMax(src, &minVal, &maxVal, GpuMat(), buf);
}
SANITY_CHECK(minVal);
SANITY_CHECK(maxVal);
}
PERF_TEST_P(DevInfo_Size_MatType, minMaxLoc, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int type = std::tr1::get<2>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, type);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
double minVal, maxVal;
Point minLoc, maxLoc;
GpuMat valbuf, locbuf;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc, GpuMat(), valbuf, locbuf);
}
SANITY_CHECK(minVal);
SANITY_CHECK(maxVal);
}
PERF_TEST_P(DevInfo_Size_MatType, countNonZero, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int type = std::tr1::get<2>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, type);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
int dst;
GpuMat buf;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
dst = countNonZero(src, buf);
}
SANITY_CHECK(dst);
}
#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);
}
#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);
}
......@@ -47,7 +47,7 @@ PERF_TEST_P(DevInfo, meanShiftFiltering, testing::ValuesIn(devices()))
setDevice(devInfo.deviceID());
Mat img = readImage("meanshift/cones.png");
Mat img = readImage("gpu/meanshift/cones.png");
ASSERT_FALSE(img.empty());
Mat rgba;
......@@ -74,7 +74,7 @@ PERF_TEST_P(DevInfo, meanShiftProc, testing::ValuesIn(devices()))
setDevice(devInfo.deviceID());
Mat img = readImage("meanshift/cones.png");
Mat img = readImage("gpu/meanshift/cones.png");
ASSERT_FALSE(img.empty());
Mat rgba;
......@@ -104,7 +104,7 @@ PERF_TEST_P(DevInfo, meanShiftSegmentation, testing::ValuesIn(devices()))
setDevice(devInfo.deviceID());
Mat img = readImage("meanshift/cones.png");
Mat img = readImage("gpu/meanshift/cones.png");
ASSERT_FALSE(img.empty());
Mat rgba;
......@@ -123,6 +123,35 @@ PERF_TEST_P(DevInfo, meanShiftSegmentation, testing::ValuesIn(devices()))
SANITY_CHECK(dst);
}
PERF_TEST_P(DevInfo_Size_MatType, drawColorDisp, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16SC1)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
int type = std::tr1::get<2>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, CV_8UC1);
declare.in(src_host, WARMUP_RNG);
src_host.convertTo(src_host, type);
GpuMat src(src_host);
GpuMat dst(size, CV_8UC4);
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
drawColorDisp(src, dst, 255);
}
Mat dst_host(dst);
SANITY_CHECK(dst_host);
}
PERF_TEST_P(DevInfo_Size_MatType, reprojectImageTo3D, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16SC1)))
......@@ -156,7 +185,8 @@ PERF_TEST_P(DevInfo_Size_MatType_CvtColorInfo, cvtColor, testing::Combine(testin
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1),
testing::Values(CvtColorInfo(4, 4, CV_RGBA2BGRA), CvtColorInfo(4, 1, CV_BGRA2GRAY), CvtColorInfo(1, 4, CV_GRAY2BGRA),
CvtColorInfo(4, 4, CV_BGR2XYZ), CvtColorInfo(4, 4, CV_BGR2YCrCb), CvtColorInfo(4, 4, CV_BGR2HSV))))
CvtColorInfo(4, 4, CV_BGR2XYZ), CvtColorInfo(4, 4, CV_BGR2YCrCb), CvtColorInfo(4, 4, CV_YCrCb2BGR),
CvtColorInfo(4, 4, CV_BGR2HSV), CvtColorInfo(4, 4, CV_HSV2BGR))))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
......@@ -321,6 +351,81 @@ PERF_TEST_P(DevInfo_Size_MatType_Interpolation, warpPerspective, testing::Combin
SANITY_CHECK(dst_host);
}
PERF_TEST_P(DevInfo_Size, buildWarpPlaneMaps, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
setDevice(devInfo.deviceID());
GpuMat map_x(size, CV_32FC1);
GpuMat map_y(size, CV_32FC1);
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
buildWarpPlaneMaps(size, Rect(0, 0, size.width, size.height), Mat::ones(3, 3, CV_32FC1), 1.0, 1.0, 1.0, map_x, map_y);
}
Mat map_x_host(map_x);
Mat map_y_host(map_y);
SANITY_CHECK(map_x_host);
SANITY_CHECK(map_y_host);
}
PERF_TEST_P(DevInfo_Size, buildWarpCylindricalMaps, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
setDevice(devInfo.deviceID());
GpuMat map_x(size, CV_32FC1);
GpuMat map_y(size, CV_32FC1);
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
buildWarpCylindricalMaps(size, Rect(0, 0, size.width, size.height), Mat::ones(3, 3, CV_32FC1), 1.0, 1.0, map_x, map_y);
}
Mat map_x_host(map_x);
Mat map_y_host(map_y);
SANITY_CHECK(map_x_host);
SANITY_CHECK(map_y_host);
}
PERF_TEST_P(DevInfo_Size, buildWarpSphericalMaps, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
setDevice(devInfo.deviceID());
GpuMat map_x(size, CV_32FC1);
GpuMat map_y(size, CV_32FC1);
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
buildWarpSphericalMaps(size, Rect(0, 0, size.width, size.height), Mat::ones(3, 3, CV_32FC1), 1.0, 1.0, map_x, map_y);
}
Mat map_x_host(map_x);
Mat map_y_host(map_y);
SANITY_CHECK(map_x_host);
SANITY_CHECK(map_y_host);
}
PERF_TEST_P(DevInfo_Size_MatType_Interpolation, rotate, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_8UC4),
......@@ -381,8 +486,8 @@ PERF_TEST_P(DevInfo_Size_MatType, copyMakeBorder, testing::Combine(testing::Valu
SANITY_CHECK(dst_host);
}
PERF_TEST_P(DevInfo_Size, integral, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
PERF_TEST_P(DevInfo_Size, integralBuffered, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
......@@ -409,6 +514,35 @@ PERF_TEST_P(DevInfo_Size, integral, testing::Combine(testing::ValuesIn(devices()
SANITY_CHECK(dst_host);
}
PERF_TEST_P(DevInfo_Size, integral, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, CV_8UC1);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
GpuMat sum, sqsum;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
integral(src, sum, sqsum);
}
Mat sum_host(sum);
Mat sqsum_host(sqsum);
SANITY_CHECK(sum_host);
SANITY_CHECK(sqsum_host);
}
PERF_TEST_P(DevInfo_Size, sqrIntegral, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
......@@ -471,7 +605,7 @@ PERF_TEST_P(DevInfo_MatType, cornerHarris, testing::Combine(testing::ValuesIn(de
setDevice(devInfo.deviceID());
Mat img = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
Mat img = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
ASSERT_FALSE(img.empty());
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
......@@ -509,7 +643,7 @@ PERF_TEST_P(DevInfo_MatType, cornerMinEigenVal, testing::Combine(testing::Values
setDevice(devInfo.deviceID());
Mat img = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
Mat img = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
ASSERT_FALSE(img.empty());
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
......@@ -723,7 +857,7 @@ PERF_TEST_P(DevInfo, Canny, testing::ValuesIn(devices()))
setDevice(devInfo.deviceID());
Mat image_host = readImage("perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
Mat image_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
ASSERT_FALSE(image_host.empty());
GpuMat image(image_host);
......@@ -741,3 +875,60 @@ PERF_TEST_P(DevInfo, Canny, testing::ValuesIn(devices()))
SANITY_CHECK(dst_host);
}
PERF_TEST_P(DevInfo_Size, calcHist, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, CV_8UC1);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
GpuMat hist;
GpuMat buf;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
calcHist(src, hist, buf);
}
Mat hist_host(hist);
SANITY_CHECK(hist_host);
}
PERF_TEST_P(DevInfo_Size, equalizeHist, testing::Combine(testing::ValuesIn(devices()),
testing::Values(GPU_TYPICAL_MAT_SIZES)))
{
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
Size size = std::tr1::get<1>(GetParam());
setDevice(devInfo.deviceID());
Mat src_host(size, CV_8UC1);
declare.in(src_host, WARMUP_RNG);
GpuMat src(src_host);
GpuMat dst;
GpuMat hist;
GpuMat buf;
declare.time(0.5).iterations(100);
SIMPLE_TEST_CYCLE()
{
equalizeHist(src, dst, hist, buf);
}
Mat dst_host(dst);
SANITY_CHECK(dst_host);
}
......@@ -5,7 +5,6 @@
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
//cvtest::TS::ptr()->init("gpu");
Regression::Init("gpu");
TestBase::Init(argc, argv);
return RUN_ALL_TESTS();
......
#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);
}
}
......@@ -19,6 +19,7 @@ CV_ENUM(FlipCode, HORIZONTAL_AXIS, VERTICAL_AXIS, BOTH_AXIS)
CV_ENUM(CmpOp, CMP_EQ, CMP_GT, CMP_GE, CMP_LT, CMP_LE, CMP_NE)
CV_ENUM(Interpolation, INTER_NEAREST, INTER_LINEAR, INTER_CUBIC)
CV_ENUM(MatchMethod, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED)
CV_ENUM(NormType, NORM_INF, NORM_L1, NORM_L2)
struct CvtColorInfo
{
......@@ -44,6 +45,10 @@ typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, Interpolat
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, Interpolation, BorderMode> > DevInfo_Size_MatType_Interpolation_BorderMode;
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, CvtColorInfo> > DevInfo_Size_MatType_CvtColorInfo;
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, MatchMethod> > DevInfo_Size_MatType_MatchMethod;
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, NormType> > DevInfo_Size_NormType;
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, NormType> > DevInfo_Size_MatType_NormType;
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, int> > DevInfo_DescSize;
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, int, int> > DevInfo_K_DescSize;
const cv::Size sz1800x1500 = cv::Size(1800, 1500);
const cv::Size sz4700x3000 = cv::Size(4700, 3000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment