1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #20107 from sivanov-work:gapi_transpose_op

G-API: Add transpose operation

* Add kernels decl & def

* Add draft for UT

* Fix UT for Transpose

* Add perf test

* Fix docs

* Apply comments
This commit is contained in:
Sergey Ivanov
2021-05-25 20:36:01 +03:00
committed by GitHub
parent 5f637e5a02
commit 2b06208bbd
13 changed files with 140 additions and 0 deletions
@@ -79,6 +79,7 @@ namespace opencv_test
cv::GCompileArgs>> {};
class KMeans3DPerfTest : public TestPerfParams<tuple<int, int, cv::KmeansFlags,
cv::GCompileArgs>> {};
class TransposePerfTest : public TestPerfParams<tuple<compare_f, cv::Size, MatType, cv::GCompileArgs>> {};
class ResizePerfTest : public TestPerfParams<tuple<compare_f, MatType, int, cv::Size, cv::Size, cv::GCompileArgs>> {};
class ResizeFxFyPerfTest : public TestPerfParams<tuple<compare_f, MatType, int, cv::Size, double, double, cv::GCompileArgs>> {};
class ParseSSDBLPerfTest : public TestPerfParams<tuple<cv::Size, float, int, cv::GCompileArgs>>, public ParserSSDTest {};
@@ -2036,6 +2036,42 @@ PERF_TEST_P_(KMeans3DPerfTest, TestPerformance)
//------------------------------------------------------------------------------
PERF_TEST_P_(TransposePerfTest, TestPerformance)
{
compare_f cmpF;
cv::Size sz_in;
MatType type = -1;
cv::GCompileArgs compile_args;
std::tie(cmpF, sz_in, type, compile_args) = GetParam();
initMatrixRandU(type, sz_in, type, false);
// OpenCV code ///////////////////////////////////////////////////////////
cv::transpose(in_mat1, out_mat_ocv);
// G-API code ////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::transpose(in);
cv::GComputation c(cv::GIn(in), cv::GOut(out));
// Warm-up graph engine:
c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi), std::move(compile_args));
TEST_CYCLE()
{
c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi));
}
// Comparison ////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
}
SANITY_CHECK_NOTHING();
}
//------------------------------------------------------------------------------
PERF_TEST_P_(ResizePerfTest, TestPerformance)
{
compare_f cmpF = get<0>(GetParam());