mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +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:
@@ -154,6 +154,8 @@ GAPI_TEST_FIXTURE(WarpAffineTest, initMatrixRandU,
|
||||
GAPI_TEST_FIXTURE(KMeansNDTest, initMatrixRandU, FIXTURE_API(CompareMats, int, cv::KmeansFlags), 3, cmpF, K, flags)
|
||||
GAPI_TEST_FIXTURE(KMeans2DTest, initNothing, FIXTURE_API(int, cv::KmeansFlags), 2, K, flags)
|
||||
GAPI_TEST_FIXTURE(KMeans3DTest, initNothing, FIXTURE_API(int, cv::KmeansFlags), 2, K, flags)
|
||||
GAPI_TEST_FIXTURE(TransposeTest, initMatrixRandU, FIXTURE_API(CompareMats), 1, cmpF)
|
||||
|
||||
|
||||
GAPI_TEST_EXT_BASE_FIXTURE(ParseSSDBLTest, ParserSSDTest, initNothing,
|
||||
FIXTURE_API(float, int), 2, confidence_threshold, filter_label)
|
||||
|
||||
@@ -1403,6 +1403,23 @@ TEST_P(KMeans3DTest, AccuracyTest)
|
||||
kmeansTestBody(in_vector, sz, type, K, flags, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(TransposeTest, Test)
|
||||
{
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::transpose(in);
|
||||
|
||||
cv::GComputation c(in, out);
|
||||
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::transpose(in_mat1, out_mat_ocv);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_ocv, out_mat_gapi));
|
||||
}
|
||||
}
|
||||
// PLEASE DO NOT PUT NEW ACCURACY TESTS BELOW THIS POINT! //////////////////////
|
||||
|
||||
TEST_P(BackendOutputAllocationTest, EmptyOutput)
|
||||
|
||||
@@ -542,6 +542,7 @@ struct TestWithParamsSpecific : public TestWithParamsBase<ParamsSpecific<Specifi
|
||||
* @param ... list of names of user-defined parameters. if there are no parameters, the list
|
||||
* must be empty.
|
||||
*/
|
||||
//TODO: Consider to remove `Number` and use `std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value`
|
||||
#define GAPI_TEST_FIXTURE(Fixture, InitF, API, Number, ...) \
|
||||
struct Fixture : public TestWithParams API { \
|
||||
static_assert(Number == AllParams::specific_params_size, \
|
||||
|
||||
@@ -551,6 +551,16 @@ INSTANTIATE_TEST_CASE_P(KMeans3DInitTestCPU, KMeans3DTest,
|
||||
Values(cv::KMEANS_RANDOM_CENTERS | cv::KMEANS_USE_INITIAL_LABELS,
|
||||
cv::KMEANS_PP_CENTERS | cv::KMEANS_USE_INITIAL_LABELS)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(TransposeTestCPU, TransposeTest,
|
||||
Combine(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::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
cv::Size(128, 128)),
|
||||
Values(-1),
|
||||
Values(CORE_CPU),
|
||||
Values(AbsExact().to_compare_obj())));
|
||||
// PLEASE DO NOT PUT NEW ACCURACY TESTS BELOW THIS POINT! //////////////////////
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BackendOutputAllocationTestCPU, BackendOutputAllocationTest,
|
||||
|
||||
@@ -402,6 +402,16 @@ INSTANTIATE_TEST_CASE_P(ConcatVertTestGPU, ConcatVertTest,
|
||||
Values(-1),
|
||||
Values(CORE_GPU)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(TransposeTestGPU, TransposeTest,
|
||||
Combine(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::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
cv::Size(128, 128)),
|
||||
Values(-1),
|
||||
Values(CORE_GPU),
|
||||
Values(AbsExact().to_compare_obj())));
|
||||
// PLEASE DO NOT PUT NEW ACCURACY TESTS BELOW THIS POINT! //////////////////////
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BackendOutputAllocationTestGPU, BackendOutputAllocationTest,
|
||||
|
||||
Reference in New Issue
Block a user