Merge pull request #1363 from ilya-lavrenov:ocl_enable_tests

pull/1375/head
Roman Donchenko 12 years ago committed by OpenCV Buildbot
commit 114bec52fe
  1. 38
      modules/ocl/perf/perf_brute_force_matcher.cpp
  2. 11
      modules/ocl/perf/perf_calib3d.cpp
  3. 9
      modules/ocl/perf/perf_canny.cpp
  4. 5
      modules/ocl/perf/perf_gemm.cpp
  5. 40
      modules/ocl/perf/perf_opticalflow.cpp

@ -60,7 +60,7 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_match,
vector<DMatch> matches;
Mat query(srcSize, CV_32F), train(srcSize, CV_32F);
declare.in(query, train).time(srcSize.height == 2000 ? 8 : 4 );
declare.in(query, train).time(srcSize.height == 2000 ? 9 : 4 );
randu(query, 0.0f, 1.0f);
randu(train, 0.0f, 1.0f);
@ -75,8 +75,12 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_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.match(oclQuery, oclTrain, matches);
OCL_TEST_CYCLE()
oclMatcher.matchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance);
oclMatcher.matchDownload(oclTrainIdx, oclDistance, matches);
SANITY_CHECK_MATCHES(matches);
}
@ -85,7 +89,7 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_match,
}
PERF_TEST_P(BruteForceMatcherFixture, DISABLED_knnMatch,
OCL_BFMATCHER_TYPICAL_MAT_SIZES) // TODO too many outliers
OCL_BFMATCHER_TYPICAL_MAT_SIZES) // TODO too big difference between implementations
{
const Size srcSize = GetParam();
@ -96,11 +100,11 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_knnMatch,
declare.in(query, train);
if (srcSize.height == 2000)
declare.time(8);
declare.time(9);
if (RUN_PLAIN_IMPL)
{
BFMatcher matcher (NORM_L2);
BFMatcher matcher(NORM_L2);
TEST_CYCLE() matcher.knnMatch(query, train, matches, 2);
std::vector<DMatch> & matches0 = matches[0], & matches1 = matches[1];
@ -111,8 +115,12 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_knnMatch,
{
ocl::BruteForceMatcher_OCL_base oclMatcher(ocl::BruteForceMatcher_OCL_base::L2Dist);
ocl::oclMat oclQuery(query), oclTrain(train);
ocl::oclMat oclTrainIdx, oclDistance, oclAllDist;
OCL_TEST_CYCLE()
oclMatcher.knnMatchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance, oclAllDist, 2);
OCL_TEST_CYCLE() oclMatcher.knnMatch(oclQuery, oclTrain, matches, 2);
oclMatcher.knnMatchDownload(oclTrainIdx, oclDistance, matches);
std::vector<DMatch> & matches0 = matches[0], & matches1 = matches[1];
SANITY_CHECK_MATCHES(matches0);
@ -122,8 +130,8 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_knnMatch,
OCL_PERF_ELSE
}
PERF_TEST_P(BruteForceMatcherFixture, DISABLED_radiusMatch,
OCL_BFMATCHER_TYPICAL_MAT_SIZES) // TODO too many outliers
PERF_TEST_P(BruteForceMatcherFixture, radiusMatch,
OCL_BFMATCHER_TYPICAL_MAT_SIZES)
{
const Size srcSize = GetParam();
@ -131,15 +139,17 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_radiusMatch,
vector<vector<DMatch> > matches(2);
Mat query(srcSize, CV_32F), train(srcSize, CV_32F);
declare.in(query, train);
Mat trainIdx, distance, allDist;
randu(query, 0.0f, 1.0f);
randu(train, 0.0f, 1.0f);
if (srcSize.height == 2000)
declare.time(9.15);
if (RUN_PLAIN_IMPL)
{
BFMatcher matcher (NORM_L2);
TEST_CYCLE() matcher.radiusMatch(query, matches, max_distance);
cv::BFMatcher matcher(NORM_L2);
TEST_CYCLE() matcher.radiusMatch(query, train, matches, max_distance);
std::vector<DMatch> & matches0 = matches[0], & matches1 = matches[1];
SANITY_CHECK_MATCHES(matches0);
@ -149,8 +159,12 @@ PERF_TEST_P(BruteForceMatcherFixture, DISABLED_radiusMatch,
{
ocl::oclMat oclQuery(query), oclTrain(train);
ocl::BruteForceMatcher_OCL_base oclMatcher(ocl::BruteForceMatcher_OCL_base::L2Dist);
ocl::oclMat oclTrainIdx, oclDistance, oclNMatches;
OCL_TEST_CYCLE()
oclMatcher.radiusMatchSingle(oclQuery, oclTrain, oclTrainIdx, oclDistance, oclNMatches, max_distance);
OCL_TEST_CYCLE() oclMatcher.radiusMatch(oclQuery, oclTrain, matches, max_distance);
oclMatcher.radiusMatchDownload(oclTrainIdx, oclDistance, oclNMatches, matches);
std::vector<DMatch> & matches0 = matches[0], & matches1 = matches[1];
SANITY_CHECK_MATCHES(matches0);

@ -48,7 +48,7 @@
///////////// StereoMatchBM ////////////////////////
PERF_TEST(StereoMatchBMFixture, DISABLED_StereoMatchBM) // TODO doesn't work properly
PERF_TEST(StereoMatchBMFixture, StereoMatchBM)
{
Mat left_image = imread(getDataPath("gpu/stereobm/aloe-L.png"), cv::IMREAD_GRAYSCALE);
Mat right_image = imread(getDataPath("gpu/stereobm/aloe-R.png"), cv::IMREAD_GRAYSCALE);
@ -70,19 +70,16 @@ PERF_TEST(StereoMatchBMFixture, DISABLED_StereoMatchBM) // TODO doesn't work pro
ocl::StereoBM_OCL oclBM(0, n_disp, winSize);
OCL_TEST_CYCLE() oclBM(oclLeft, oclRight, oclDisp);
oclDisp.download(disp);
SANITY_CHECK(disp);
}
else if (RUN_PLAIN_IMPL)
{
StereoBM bm(0, n_disp, winSize);
TEST_CYCLE() bm(left_image, right_image, disp);
SANITY_CHECK(disp);
}
else
OCL_PERF_ELSE
int value = 0;
SANITY_CHECK(value);
}

@ -49,7 +49,7 @@ using namespace perf;
///////////// Canny ////////////////////////
PERF_TEST(CannyFixture, DISABLED_Canny) // TODO difference between implmentations
PERF_TEST(CannyFixture, Canny)
{
Mat img = imread(getDataPath("gpu/stereobm/aloe-L.png"), cv::IMREAD_GRAYSCALE),
edges(img.size(), CV_8UC1);
@ -63,15 +63,14 @@ PERF_TEST(CannyFixture, DISABLED_Canny) // TODO difference between implmentation
OCL_TEST_CYCLE() ocl::Canny(oclImg, oclEdges, 50.0, 100.0);
oclEdges.download(edges);
SANITY_CHECK(edges);
}
else if (RUN_PLAIN_IMPL)
{
TEST_CYCLE() Canny(img, edges, 50.0, 100.0);
SANITY_CHECK(edges);
}
else
OCL_PERF_ELSE
int value = 0;
SANITY_CHECK(value);
}

@ -51,13 +51,14 @@ using namespace perf;
typedef TestBaseWithParam<Size> gemmFixture;
PERF_TEST_P(gemmFixture, DISABLED_gemm, OCL_TYPICAL_MAT_SIZES) // TODO not implemented
PERF_TEST_P(gemmFixture, DISABLED_gemm,
::testing::Values(OCL_SIZE_1000, OCL_SIZE_2000)) // TODO not implemented
{
const Size srcSize = GetParam();
Mat src1(srcSize, CV_32FC1), src2(srcSize, CV_32FC1),
src3(srcSize, CV_32FC1), dst(srcSize, CV_32FC1);
declare.in(src1, src2, src3).out(dst);
declare.in(src1, src2, src3).out(dst).time(srcSize == OCL_SIZE_2000 ? 65 : 8);
randu(src1, -10.0f, 10.0f);
randu(src2, -10.0f, 10.0f);
randu(src3, -10.0f, 10.0f);

@ -52,25 +52,13 @@ using std::tr1::get;
using std::tr1::tuple;
using std::tr1::make_tuple;
template <typename T>
static vector<T> & MatToVector(const ocl::oclMat & oclSrc, vector<T> & instance)
{
Mat src;
oclSrc.download(src);
for (int i = 0; i < src.cols; ++i)
instance.push_back(src.at<T>(0, i));
return instance;
}
CV_ENUM(LoadMode, IMREAD_GRAYSCALE, IMREAD_COLOR)
typedef tuple<int, tuple<string, string, LoadMode> > PyrLKOpticalFlowParamType;
typedef TestBaseWithParam<PyrLKOpticalFlowParamType> PyrLKOpticalFlowFixture;
PERF_TEST_P(PyrLKOpticalFlowFixture,
DISABLED_PyrLKOpticalFlow,
PyrLKOpticalFlow,
::testing::Combine(
::testing::Values(1000, 2000, 4000),
::testing::Values(
@ -79,8 +67,8 @@ PERF_TEST_P(PyrLKOpticalFlowFixture,
string("gpu/opticalflow/rubberwhale1.png"),
string("gpu/opticalflow/rubberwhale2.png"),
LoadMode(IMREAD_COLOR)
)
, make_tuple<string, string, LoadMode>
),
make_tuple<string, string, LoadMode>
(
string("gpu/stereobm/aloe-L.png"),
string("gpu/stereobm/aloe-R.png"),
@ -88,7 +76,7 @@ PERF_TEST_P(PyrLKOpticalFlowFixture,
)
)
)
) // TODO to big difference between implementations
)
{
PyrLKOpticalFlowParamType params = GetParam();
tuple<string, string, LoadMode> fileParam = get<1>(params);
@ -98,6 +86,8 @@ PERF_TEST_P(PyrLKOpticalFlowFixture,
Mat frame0 = imread(getDataPath(fileName0), openMode);
Mat frame1 = imread(getDataPath(fileName1), openMode);
declare.in(frame0, frame1);
ASSERT_FALSE(frame0.empty()) << "can't load " << fileName0;
ASSERT_FALSE(frame1.empty()) << "can't load " << fileName1;
@ -111,36 +101,28 @@ PERF_TEST_P(PyrLKOpticalFlowFixture,
vector<unsigned char> status;
vector<float> err;
goodFeaturesToTrack(grayFrame, pts, pointsCount, 0.01, 0.0);
Mat ptsMat(1, static_cast<int>(pts.size()), CV_32FC2, (void *)&pts[0]);
if (RUN_PLAIN_IMPL)
{
TEST_CYCLE()
cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, err);
SANITY_CHECK(nextPts);
SANITY_CHECK(status);
SANITY_CHECK(err);
}
else if (RUN_OCL_IMPL)
{
ocl::PyrLKOpticalFlow oclPyrLK;
ocl::oclMat oclFrame0(frame0), oclFrame1(frame1);
ocl::oclMat oclPts(1, static_cast<int>(pts.size()), CV_32FC2, (void *)&pts[0]);
ocl::oclMat oclPts(ptsMat);
ocl::oclMat oclNextPts, oclStatus, oclErr;
OCL_TEST_CYCLE()
oclPyrLK.sparse(oclFrame0, oclFrame1, oclPts, oclNextPts, oclStatus, &oclErr);
MatToVector(oclNextPts, nextPts);
MatToVector(oclStatus, status);
MatToVector(oclErr, err);
SANITY_CHECK(nextPts);
SANITY_CHECK(status);
SANITY_CHECK(err);
}
else
OCL_PERF_ELSE
int value = 0;
SANITY_CHECK(value);
}
PERF_TEST(tvl1flowFixture, tvl1flow)

Loading…
Cancel
Save