mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43: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:
@@ -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());
|
||||
|
||||
@@ -311,6 +311,14 @@ INSTANTIATE_TEST_CASE_P(KMeans3DPerfTestCPU, KMeans3DPerfTest,
|
||||
cv::KMEANS_PP_CENTERS | cv::KMEANS_USE_INITIAL_LABELS),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(TransposePerfTestCPU, TransposePerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1,
|
||||
CV_8UC2, CV_16UC2, CV_16SC2, CV_32FC2,
|
||||
CV_8UC3, CV_16UC3, CV_16SC3, CV_32FC3),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ResizePerfTestCPU, ResizePerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
|
||||
@@ -276,6 +276,14 @@ INSTANTIATE_TEST_CASE_P(ConvertToPerfTestGPU, ConvertToPerfTest,
|
||||
Values(0.0),
|
||||
Values(cv::compile_args(CORE_GPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(TransposePerfTestGPU, TransposePerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1,
|
||||
CV_8UC2, CV_16UC2, CV_16SC2, CV_32FC2,
|
||||
CV_8UC3, CV_16UC3, CV_16SC3, CV_32FC3),
|
||||
Values(cv::compile_args(CORE_GPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ResizePerfTestGPU, ResizePerfTest,
|
||||
Combine(Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
|
||||
Reference in New Issue
Block a user