master-like performance tests
This commit is contained in:
@@ -47,20 +47,17 @@
|
||||
|
||||
using namespace perf;
|
||||
|
||||
#define OCL_BFMATCHER_TYPICAL_MAT_SIZES ::testing::Values(cv::Size(128, 500), cv::Size(128, 1000), cv::Size(128, 2000))
|
||||
|
||||
//////////////////// BruteForceMatch /////////////////
|
||||
|
||||
typedef TestBaseWithParam<Size> BruteForceMatcherFixture;
|
||||
|
||||
PERF_TEST_P(BruteForceMatcherFixture, match,
|
||||
OCL_BFMATCHER_TYPICAL_MAT_SIZES)
|
||||
OCL_PERF_TEST_P(BruteForceMatcherFixture, Match, OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3))
|
||||
{
|
||||
const Size srcSize = GetParam();
|
||||
|
||||
vector<DMatch> matches;
|
||||
Mat query(srcSize, CV_32F), train(srcSize, CV_32F);
|
||||
declare.in(query, train).time(srcSize.height == 2000 ? 9 : 4 );
|
||||
Mat query(srcSize, CV_32FC1), train(srcSize, CV_32FC1);
|
||||
declare.in(query, train);
|
||||
randu(query, 0.0f, 1.0f);
|
||||
randu(train, 0.0f, 1.0f);
|
||||
|
||||
@@ -75,12 +72,9 @@ PERF_TEST_P(BruteForceMatcherFixture, match,
|
||||
{
|
||||
ocl::BruteForceMatcher_OCL_base oclMatcher(ocl::BruteForceMatcher_OCL_base::L2Dist);
|
||||
ocl::oclMat oclQuery(query), oclTrain(train);
|
||||
ocl::oclMat oclTrainIdx, oclDistance;
|
||||
|
||||
OCL_TEST_CYCLE()
|
||||
oclMatcher.matchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance);
|
||||
|
||||
oclMatcher.matchDownload(oclTrainIdx, oclDistance, matches);
|
||||
oclMatcher.match(oclQuery, oclTrain, matches);
|
||||
|
||||
SANITY_CHECK_MATCHES(matches, 1e-5);
|
||||
}
|
||||
@@ -88,8 +82,7 @@ PERF_TEST_P(BruteForceMatcherFixture, match,
|
||||
OCL_PERF_ELSE
|
||||
}
|
||||
|
||||
PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
|
||||
OCL_BFMATCHER_TYPICAL_MAT_SIZES)
|
||||
OCL_PERF_TEST_P(BruteForceMatcherFixture, KnnMatch, OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3))
|
||||
{
|
||||
const Size srcSize = GetParam();
|
||||
|
||||
@@ -99,8 +92,6 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
|
||||
randu(train, 0.0f, 1.0f);
|
||||
|
||||
declare.in(query, train);
|
||||
if (srcSize.height == 2000)
|
||||
declare.time(9);
|
||||
|
||||
if (RUN_PLAIN_IMPL)
|
||||
{
|
||||
@@ -115,10 +106,10 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
|
||||
{
|
||||
ocl::BruteForceMatcher_OCL_base oclMatcher(ocl::BruteForceMatcher_OCL_base::L2Dist);
|
||||
ocl::oclMat oclQuery(query), oclTrain(train);
|
||||
ocl::oclMat oclTrainIdx, oclDistance, oclAllDist;
|
||||
ocl::oclMat oclTrainIdx, oclDistance;
|
||||
|
||||
OCL_TEST_CYCLE()
|
||||
oclMatcher.knnMatchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance, oclAllDist, 2);
|
||||
oclMatcher.knnMatch(oclQuery, oclTrain, matches, 2);
|
||||
|
||||
oclMatcher.knnMatchDownload(oclTrainIdx, oclDistance, matches);
|
||||
|
||||
@@ -130,22 +121,18 @@ PERF_TEST_P(BruteForceMatcherFixture, knnMatch,
|
||||
OCL_PERF_ELSE
|
||||
}
|
||||
|
||||
PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
|
||||
OCL_BFMATCHER_TYPICAL_MAT_SIZES)
|
||||
OCL_PERF_TEST_P(BruteForceMatcherFixture, RadiusMatch, OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3))
|
||||
{
|
||||
const Size srcSize = GetParam();
|
||||
|
||||
const float max_distance = 2.0f;
|
||||
vector<vector<DMatch> > matches(2);
|
||||
Mat query(srcSize, CV_32F), train(srcSize, CV_32F);
|
||||
Mat query(srcSize, CV_32FC1), train(srcSize, CV_32FC1);
|
||||
declare.in(query, train);
|
||||
|
||||
randu(query, 0.0f, 1.0f);
|
||||
randu(train, 0.0f, 1.0f);
|
||||
|
||||
if (srcSize.height == 2000)
|
||||
declare.time(9.15);
|
||||
|
||||
if (RUN_PLAIN_IMPL)
|
||||
{
|
||||
cv::BFMatcher matcher(NORM_L2);
|
||||
@@ -162,7 +149,7 @@ PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
|
||||
ocl::oclMat oclTrainIdx, oclDistance, oclNMatches;
|
||||
|
||||
OCL_TEST_CYCLE()
|
||||
oclMatcher.radiusMatchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance, oclNMatches, max_distance);
|
||||
oclMatcher.radiusMatch(oclQuery, oclTrain, matches, max_distance);
|
||||
|
||||
oclMatcher.radiusMatchDownload(oclTrainIdx, oclDistance, oclNMatches, matches);
|
||||
|
||||
@@ -173,5 +160,3 @@ PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
|
||||
else
|
||||
OCL_PERF_ELSE
|
||||
}
|
||||
|
||||
#undef OCL_BFMATCHER_TYPICAL_MAT_SIZES
|
||||
|
Reference in New Issue
Block a user