diff --git a/modules/gapi/perf/common/gapi_core_perf_tests.hpp b/modules/gapi/perf/common/gapi_core_perf_tests.hpp index 8af7b1abfbaed10045b266ee7c1e88796a34dd6c..8b743f0b23be7bbe3609011382b3c723aaa53ef4 100644 --- a/modules/gapi/perf/common/gapi_core_perf_tests.hpp +++ b/modules/gapi/perf/common/gapi_core_perf_tests.hpp @@ -50,9 +50,9 @@ namespace opencv_test class MaxPerfTest : public TestPerfParams> {}; class AbsDiffPerfTest : public TestPerfParams> {}; class AbsDiffCPerfTest : public TestPerfParams> {}; - class SumPerfTest : public TestPerfParams> {}; - class AddWeightedPerfTest : public TestPerfParams> {}; - class NormPerfTest : public TestPerfParams> {}; + class SumPerfTest : public TestPerfParams> {}; + class AddWeightedPerfTest : public TestPerfParams> {}; + class NormPerfTest : public TestPerfParams> {}; class IntegralPerfTest : public TestPerfParams> {}; class ThresholdPerfTest : public TestPerfParams> {}; class ThresholdOTPerfTest : public TestPerfParams> {}; diff --git a/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp b/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp index f49e06161533b26acba67eb06bb5ef70768c57d3..04e73ab5efd39c4c6e6a83453d4418d6130c963e 100644 --- a/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp +++ b/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp @@ -900,13 +900,13 @@ PERF_TEST_P_(AbsDiffCPerfTest, TestPerformance) PERF_TEST_P_(SumPerfTest, TestPerformance) { - cv::Size sz_in = get<0>(GetParam()); - MatType type = get<1>(GetParam()); - double tolerance = get<2>(GetParam()); + compare_scalar_f cmpF = get<0>(GetParam()); + cv::Size sz_in = get<1>(GetParam()); + MatType type = get<2>(GetParam()); cv::GCompileArgs compile_args = get<3>(GetParam()); - initMatrixRandU(type, sz_in, false); + initMatrixRandU(type, sz_in, type, false); cv::Scalar out_sum; cv::Scalar out_sum_ocv; @@ -928,8 +928,7 @@ PERF_TEST_P_(SumPerfTest, TestPerformance) // Comparison //////////////////////////////////////////////////////////// { - EXPECT_LE(std::abs(out_sum[0] - out_sum_ocv[0]) / std::max(1.0, std::abs(out_sum_ocv[0])), tolerance) - << "OCV=" << out_sum_ocv[0] << " GAPI=" << out_sum[0]; + EXPECT_TRUE(cmpF(out_sum, out_sum_ocv)); } SANITY_CHECK_NOTHING(); @@ -939,10 +938,10 @@ PERF_TEST_P_(SumPerfTest, TestPerformance) PERF_TEST_P_(AddWeightedPerfTest, TestPerformance) { - cv::Size sz_in = get<0>(GetParam()); - MatType type = get<1>(GetParam()); - int dtype = get<2>(GetParam()); - double tolerance = get<3>(GetParam()); + compare_f cmpF = get<0>(GetParam()); + cv::Size sz_in = get<1>(GetParam()); + MatType type = get<2>(GetParam()); + int dtype = get<3>(GetParam()); cv::GCompileArgs compile_args = get<4>(GetParam()); auto& rng = cv::theRNG(); @@ -968,45 +967,9 @@ PERF_TEST_P_(AddWeightedPerfTest, TestPerformance) } // Comparison //////////////////////////////////////////////////////////// - // FIXIT unrealiable check - if (0) - { - // Note, that we cannot expect bitwise results for add-weighted: - // - // tmp = src1*alpha + src2*beta + gamma; - // dst = saturate( round(tmp) ); - // - // Because tmp is floating-point, dst depends on compiler optimizations - // - // However, we must expect good accuracy of tmp, and rounding correctly - - cv::Mat failures; - - if (out_mat_ocv.type() == CV_32FC1) - { - // result: float - may vary in 7th decimal digit - failures = abs(out_mat_gapi - out_mat_ocv) > abs(out_mat_ocv) * 1e-6; - } - else - { - // result: integral - rounding may vary if fractional part of tmp - // is nearly 0.5 - - cv::Mat inexact, incorrect, diff, tmp; - - inexact = out_mat_gapi != out_mat_ocv; - - // even if rounded differently, check if still rounded correctly - cv::addWeighted(in_mat1, alpha, in_mat2, beta, gamma, tmp, CV_32F); - cv::subtract(out_mat_gapi, tmp, diff, cv::noArray(), CV_32F); - incorrect = abs(diff) >= tolerance;// 0.5000005f; // relative to 6 digits - - failures = inexact & incorrect; - } - - EXPECT_EQ(0, cv::countNonZero(failures)); - EXPECT_EQ(out_mat_gapi.size(), sz_in); - } + EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); + EXPECT_EQ(out_mat_gapi.size(), sz_in); + SANITY_CHECK_NOTHING(); } @@ -1015,10 +978,10 @@ PERF_TEST_P_(AddWeightedPerfTest, TestPerformance) PERF_TEST_P_(NormPerfTest, TestPerformance) { - NormTypes opType = get<0>(GetParam()); - cv::Size sz = get<1>(GetParam()); - MatType type = get<2>(GetParam()); - double tolerance = get<3>(GetParam()); + compare_scalar_f cmpF = get<0>(GetParam()); + NormTypes opType = get<1>(GetParam()); + cv::Size sz = get<2>(GetParam()); + MatType type = get<3>(GetParam()); cv::GCompileArgs compile_args = get<4>(GetParam()); @@ -1051,8 +1014,7 @@ PERF_TEST_P_(NormPerfTest, TestPerformance) // Comparison //////////////////////////////////////////////////////////// { - EXPECT_LE(std::abs(out_norm[0] - out_norm_ocv[0]) / std::max(1.0, std::abs(out_norm_ocv[0])), tolerance) - << "OCV=" << out_norm_ocv[0] << " GAPI=" << out_norm[0]; + EXPECT_TRUE(cmpF(out_norm, out_norm_ocv)); } SANITY_CHECK_NOTHING(); diff --git a/modules/gapi/perf/cpu/gapi_core_perf_tests_cpu.cpp b/modules/gapi/perf/cpu/gapi_core_perf_tests_cpu.cpp index 6957401adfd3f5d303726ee75b736ec5227263bf..82fabfdfddf03387611e1b7633b634c913e842b5 100644 --- a/modules/gapi/perf/cpu/gapi_core_perf_tests_cpu.cpp +++ b/modules/gapi/perf/cpu/gapi_core_perf_tests_cpu.cpp @@ -152,24 +152,24 @@ INSTANTIATE_TEST_CASE_P(AbsDiffCPerfTestCPU, AbsDiffCPerfTest, Values(cv::compile_args(CORE_CPU)))); INSTANTIATE_TEST_CASE_P(SumPerfTestCPU, SumPerfTest, - Combine(Values(szSmall128, szVGA, sz720p, sz1080p), + Combine(Values(AbsToleranceScalar(0.0).to_compare_f()), + Values(szSmall128, szVGA, sz720p, sz1080p), Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1), - Values(0.0), + //Values(0.0), Values(cv::compile_args(CORE_CPU)))); -// FIXME: Comparison introduced by YL doesn't work with C3 INSTANTIATE_TEST_CASE_P(AddWeightedPerfTestCPU, AddWeightedPerfTest, - Combine(Values(szSmall128, szVGA, sz720p, sz1080p), - Values(CV_8UC1, /*CV_8UC3,*/ CV_16UC1, CV_16SC1, CV_32FC1), + Combine(Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f()), + Values(szSmall128, szVGA, sz720p, sz1080p), + Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1), Values(-1, CV_8U, CV_16U, CV_32F), - Values(0.5000005), Values(cv::compile_args(CORE_CPU)))); INSTANTIATE_TEST_CASE_P(NormPerfTestCPU, NormPerfTest, - Combine(Values(NORM_INF, NORM_L1, NORM_L2), + Combine(Values(AbsToleranceScalar(0.0).to_compare_f()), + Values(NORM_INF, NORM_L1, NORM_L2), Values(szSmall128, szVGA, sz720p, sz1080p), Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1), - Values(0.0), Values(cv::compile_args(CORE_CPU)))); INSTANTIATE_TEST_CASE_P(IntegralPerfTestCPU, IntegralPerfTest, diff --git a/modules/gapi/perf/gpu/gapi_core_perf_tests_gpu.cpp b/modules/gapi/perf/gpu/gapi_core_perf_tests_gpu.cpp index 652cbae6b78220ba59cc6d25f87625d9d1020c4e..5ec4f28c263f5480cfda1231a235c4303bf47dcf 100644 --- a/modules/gapi/perf/gpu/gapi_core_perf_tests_gpu.cpp +++ b/modules/gapi/perf/gpu/gapi_core_perf_tests_gpu.cpp @@ -153,24 +153,23 @@ INSTANTIATE_TEST_CASE_P(AbsDiffCPerfTestGPU, AbsDiffCPerfTest, Values(cv::compile_args(CORE_GPU)))); INSTANTIATE_TEST_CASE_P(SumPerfTestGPU, SumPerfTest, - Combine(Values( szSmall128, szVGA, sz720p, sz1080p ), + Combine(Values(AbsToleranceScalar(1e-5).to_compare_f()), + Values( szSmall128, szVGA, sz720p, sz1080p ), Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ), - Values(4.0), //TODO: too relaxed? Values(cv::compile_args(CORE_GPU)))); -// FIXME: Comparison introduced by YL doesn't work with C3 INSTANTIATE_TEST_CASE_P(AddWeightedPerfTestGPU, AddWeightedPerfTest, - Combine(Values( szSmall128, szVGA, sz720p, sz1080p ), - Values( CV_8UC1, /*CV_8UC3,*/ CV_16UC1, CV_16SC1, CV_32FC1 ), + Combine(Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f()), + Values( szSmall128, szVGA, sz720p, sz1080p ), + Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ), Values( -1, CV_8U, CV_16U, CV_32F ), - Values(0.50005), Values(cv::compile_args(CORE_GPU)))); INSTANTIATE_TEST_CASE_P(NormPerfTestGPU, NormPerfTest, - Combine(Values(NORM_INF, NORM_L1, NORM_L2), + Combine(Values(AbsToleranceScalar(1e-5).to_compare_f()), + Values(NORM_INF, NORM_L1, NORM_L2), Values( szSmall128, szVGA, sz720p, sz1080p ), Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ), - Values(4.0), //TODO: too relaxed? Values(cv::compile_args(CORE_GPU)))); INSTANTIATE_TEST_CASE_P(IntegralPerfTestGPU, IntegralPerfTest, diff --git a/modules/gapi/perf/gpu/gapi_imgproc_perf_tests_gpu.cpp b/modules/gapi/perf/gpu/gapi_imgproc_perf_tests_gpu.cpp index 14ef60606a1bf581f73f36e3cf5cd79e989a428f..0864265e27b17131d5fabec698583074e34ce321 100644 --- a/modules/gapi/perf/gpu/gapi_imgproc_perf_tests_gpu.cpp +++ b/modules/gapi/perf/gpu/gapi_imgproc_perf_tests_gpu.cpp @@ -109,10 +109,20 @@ INSTANTIATE_TEST_CASE_P(Dilate3x3PerfTestGPU, Dilate3x3PerfTest, INSTANTIATE_TEST_CASE_P(SobelPerfTestGPU, SobelPerfTest, Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()), - Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1/*, CV_32FC1*/), //TODO: CV_32FC1 fails accuracy + Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1), Values(3, 5), Values(szVGA, sz720p, sz1080p), - Values(-1, CV_32F), + Values(-1, CV_16S, CV_32F), + Values(0, 1), + Values(1, 2), + Values(cv::compile_args(IMGPROC_GPU)))); + +INSTANTIATE_TEST_CASE_P(SobelPerfTestGPU32F, SobelPerfTest, + Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()), + Values(CV_32FC1), + Values(3, 5), + Values(szVGA, sz720p, sz1080p), + Values(CV_32F), Values(0, 1), Values(1, 2), Values(cv::compile_args(IMGPROC_GPU)))); diff --git a/modules/gapi/test/common/gapi_core_tests.hpp b/modules/gapi/test/common/gapi_core_tests.hpp index 77a82dfd20559ec12798a0d7b3831384ecaf2329..69028fdf20421a25bc5159e6341628340da35cb6 100644 --- a/modules/gapi/test/common/gapi_core_tests.hpp +++ b/modules/gapi/test/common/gapi_core_tests.hpp @@ -124,9 +124,9 @@ struct MinTest : public TestParams>{}; struct AbsDiffTest : public TestParams>{}; struct AbsDiffCTest : public TestParams> {}; -struct SumTest : public TestParams> {}; -struct AddWeightedTest : public TestParams>{}; -struct NormTest : public TestParams>{}; +struct SumTest : public TestParams> {}; +struct AddWeightedTest : public TestParams>{}; +struct NormTest : public TestParams>{}; struct IntegralTest : public TestWithParam> {}; struct ThresholdTest : public TestParams> {}; struct ThresholdOTTest : public TestParams> {}; diff --git a/modules/gapi/test/common/gapi_core_tests_inl.hpp b/modules/gapi/test/common/gapi_core_tests_inl.hpp index 1f07131bfe996f31c10f5aec329923d075bfa903..bc4359d66ba85a9f8d95b4aa3f8ec2b127030a0a 100644 --- a/modules/gapi/test/common/gapi_core_tests_inl.hpp +++ b/modules/gapi/test/common/gapi_core_tests_inl.hpp @@ -681,10 +681,11 @@ TEST_P(AbsDiffCTest, AccuracyTest) TEST_P(SumTest, AccuracyTest) { auto param = GetParam(); + compare_scalar_f cmpF = get<3>(GetParam()); + MatType type = std::get<0>(param); cv::Size sz_in = std::get<1>(param); - auto tolerance = std::get<3>(param); auto compile_args = std::get<4>(param); - initMatrixRandU(std::get<0>(param), sz_in, std::get<2>(param)); + initMatrixRandU(type, sz_in, type, std::get<2>(param)); cv::Scalar out_sum; @@ -702,8 +703,7 @@ TEST_P(SumTest, AccuracyTest) } // Comparison ////////////////////////////////////////////////////////////// { - EXPECT_LE(std::abs(out_sum[0] - out_sum_ocv[0]) / std::max(1.0, std::abs(out_sum_ocv[0])), tolerance) - << "OCV=" << out_sum_ocv[0] << " GAPI=" << out_sum[0]; + EXPECT_TRUE(cmpF(out_sum, out_sum_ocv)); } } @@ -713,8 +713,8 @@ TEST_P(AddWeightedTest, AccuracyTest) cv::Size sz_in; bool initOut = false; cv::GCompileArgs compile_args; - double tolerance = 0.0; - std::tie(type, sz_in, dtype, initOut, tolerance, compile_args) = GetParam(); + compare_f cmpF; + std::tie(type, sz_in, dtype, initOut, cmpF, compile_args) = GetParam(); auto& rng = cv::theRNG(); double alpha = rng.uniform(0.0, 1.0); @@ -734,53 +734,19 @@ TEST_P(AddWeightedTest, AccuracyTest) cv::addWeighted(in_mat1, alpha, in_mat2, beta, gamma, out_mat_ocv, dtype); } // Comparison ////////////////////////////////////////////////////////////// - { - // Note, that we cannot expect bitwise results for add-weighted: - // - // tmp = src1*alpha + src2*beta + gamma; - // dst = saturate( round(tmp) ); - // - // Because tmp is floating-point, dst depends on compiler optimizations - // - // However, we must expect good accuracy of tmp, and rounding correctly - - cv::Mat failures; - - if (out_mat_ocv.type() == CV_32FC1) - { - // result: float - may vary in 7th decimal digit - failures = abs(out_mat_gapi - out_mat_ocv) > abs(out_mat_ocv) * 1e-6; - } - else - { - // result: integral - rounding may vary if fractional part of tmp - // is nearly 0.5 - - cv::Mat inexact, incorrect, diff, tmp; - - inexact = out_mat_gapi != out_mat_ocv; - - // even if rounded differently, check if still rounded correctly - cv::addWeighted(in_mat1, alpha, in_mat2, beta, gamma, tmp, CV_32F); - cv::subtract(out_mat_gapi, tmp, diff, cv::noArray(), CV_32F); - incorrect = abs(diff) >= tolerance;// 0.5000005f; // relative to 6 digits - - failures = inexact & incorrect; - } + EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); + EXPECT_EQ(out_mat_gapi.size(), sz_in); - EXPECT_EQ(0, cv::countNonZero(failures)); - EXPECT_EQ(out_mat_gapi.size(), sz_in); - } } TEST_P(NormTest, AccuracyTest) { + compare_scalar_f cmpF; NormTypes opType = NORM_INF; int type = 0; cv::Size sz; - double tolerance = 0.0; cv::GCompileArgs compile_args; - std::tie(opType, type, sz, tolerance, compile_args) = GetParam(); + std::tie(opType, type, sz, cmpF, compile_args) = GetParam(); initMatrixRandU(type, sz, type, false); cv::Scalar out_norm; @@ -802,8 +768,7 @@ TEST_P(NormTest, AccuracyTest) // Comparison ////////////////////////////////////////////////////////////// { - EXPECT_LE(std::abs(out_norm[0] - out_norm_ocv[0]) / std::max(1.0, std::abs(out_norm_ocv[0])), tolerance) - << "OCV=" << out_norm_ocv[0] << " GAPI=" << out_norm[0]; + EXPECT_TRUE(cmpF(out_norm, out_norm_ocv)); } } diff --git a/modules/gapi/test/common/gapi_tests_common.hpp b/modules/gapi/test/common/gapi_tests_common.hpp index be0fc3c7e6e019db4c327086e877c0ef9fea9155..937587c0bd5ed579cf727c3ca646f1a696af1215 100644 --- a/modules/gapi/test/common/gapi_tests_common.hpp +++ b/modules/gapi/test/common/gapi_tests_common.hpp @@ -115,6 +115,9 @@ class TestPerfParams: public TestFunctional, public perf::TestBaseWithParam{} using compare_f = std::function; +using compare_scalar_f = std::function; + + template struct Wrappable { @@ -128,6 +131,20 @@ struct Wrappable } }; +template +struct WrappableScalar +{ + compare_scalar_f to_compare_f() + { + T t = *static_cast(this); + return [t](const cv::Scalar &a, const cv::Scalar &b) + { + return t(a, b); + }; + } +}; + + class AbsExact : public Wrappable { public: @@ -285,6 +302,28 @@ private: double _tol; double _inf_tol; }; + +class AbsToleranceScalar : public WrappableScalar +{ +public: + AbsToleranceScalar(double tol) : _tol(tol) {} + bool operator() (const cv::Scalar& in1, const cv::Scalar& in2) const + { + double abs_err = std::abs(in1[0] - in2[0]) / std::max(1.0, std::abs(in2[0])); + if (abs_err > _tol) + { + std::cout << "AbsToleranceScalar error: abs_err=" << abs_err << " tolerance=" << _tol << " in1[0]" << in1[0] << " in2[0]" << in2[0] << std::endl;; + return false; + } + else + { + return true; + } + } +private: + double _tol; +}; + } // namespace opencv_test namespace @@ -294,3 +333,11 @@ namespace return os << "compare_f"; } } + +namespace +{ + inline std::ostream& operator<<(std::ostream& os, const opencv_test::compare_scalar_f&) + { + return os << "compare_scalar_f"; + } +} diff --git a/modules/gapi/test/cpu/gapi_core_tests_cpu.cpp b/modules/gapi/test/cpu/gapi_core_tests_cpu.cpp index 11e78bd99d3468729639dfd5982aa53a162e3e98..608f6d184077a1d06c84ed5bfc20b983f03f220d 100644 --- a/modules/gapi/test/cpu/gapi_core_tests_cpu.cpp +++ b/modules/gapi/test/cpu/gapi_core_tests_cpu.cpp @@ -203,7 +203,8 @@ INSTANTIATE_TEST_CASE_P(SumTestCPU, SumTest, cv::Size(640, 480), cv::Size(128, 128)), /*init output matrices or not*/ testing::Bool(), - Values(1e-5), + //Values(1e-5), + Values(AbsToleranceScalar(1e-5).to_compare_f()), Values(cv::compile_args(CORE_CPU)))); INSTANTIATE_TEST_CASE_P(AbsDiffTestCPU, AbsDiffTest, @@ -222,15 +223,14 @@ INSTANTIATE_TEST_CASE_P(AbsDiffCTestCPU, AbsDiffCTest, /*init output matrices or not*/ testing::Bool(), Values(cv::compile_args(CORE_CPU)))); -// FIXME: Comparison introduced by YL doesn't work with C3 INSTANTIATE_TEST_CASE_P(AddWeightedTestCPU, AddWeightedTest, - Combine(Values( CV_8UC1/*, CV_8UC3*/, CV_16UC1, CV_16SC1, CV_32FC1 ), + Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ), Values(cv::Size(1280, 720), cv::Size(640, 480), cv::Size(128, 128)), Values( -1, CV_8U, CV_16U, CV_32F ), /*init output matrices or not*/ testing::Bool(), - Values(0.5000005), + Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f()), Values(cv::compile_args(CORE_CPU)))); INSTANTIATE_TEST_CASE_P(NormTestCPU, NormTest, @@ -239,7 +239,8 @@ INSTANTIATE_TEST_CASE_P(NormTestCPU, NormTest, Values(cv::Size(1280, 720), cv::Size(640, 480), cv::Size(128, 128)), - Values(1e-5), + //Values(1e-5), + Values(AbsToleranceScalar(1e-5).to_compare_f()), Values(cv::compile_args(CORE_CPU))), opencv_test::PrintNormCoreParams()); diff --git a/modules/gapi/test/cpu/gapi_core_tests_fluid.cpp b/modules/gapi/test/cpu/gapi_core_tests_fluid.cpp index c65052b36760fb7928521c9aff5226d74c6d40e8..ccf864660aef58b99e2210ad9ff55cac5f2c7a6f 100644 --- a/modules/gapi/test/cpu/gapi_core_tests_fluid.cpp +++ b/modules/gapi/test/cpu/gapi_core_tests_fluid.cpp @@ -121,7 +121,8 @@ INSTANTIATE_TEST_CASE_P(AddWeightedTestFluid, AddWeightedTest, cv::Size(128, 128)), Values(-1, CV_8U, CV_32F), testing::Bool(), - Values(0.5000005), + Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f()), + //Values(0.5000005), Values(cv::compile_args(CORE_FLUID)))); INSTANTIATE_TEST_CASE_P(LUTTestFluid, LUTTest, diff --git a/modules/gapi/test/gpu/gapi_core_tests_gpu.cpp b/modules/gapi/test/gpu/gapi_core_tests_gpu.cpp index 6c331c033d1666534d84e3dbdebaebc74f8bed3a..98333151ff0cfccdcd6b13f11a0ff57b49abf8b7 100644 --- a/modules/gapi/test/gpu/gapi_core_tests_gpu.cpp +++ b/modules/gapi/test/gpu/gapi_core_tests_gpu.cpp @@ -190,7 +190,7 @@ INSTANTIATE_TEST_CASE_P(SumTestGPU, SumTest, cv::Size(640, 480), cv::Size(128, 128)), /*init output matrices or not*/ testing::Bool(), - Values(1e-3), //TODO: too relaxed? + Values(AbsToleranceScalar(1e-3).to_compare_f()),//TODO: too relaxed? Values(cv::compile_args(CORE_GPU)))); INSTANTIATE_TEST_CASE_P(AbsDiffTestGPU, AbsDiffTest, @@ -209,15 +209,14 @@ INSTANTIATE_TEST_CASE_P(AbsDiffCTestGPU, AbsDiffCTest, /*init output matrices or not*/ testing::Bool(), Values(cv::compile_args(CORE_GPU)))); -// FIXME: Comparison introduced by YL doesn't work with C3 INSTANTIATE_TEST_CASE_P(AddWeightedTestGPU, AddWeightedTest, - Combine(Values( CV_8UC1/*, CV_8UC3*/, CV_16UC1, CV_16SC1, CV_32FC1 ), + Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ), Values(cv::Size(1280, 720), cv::Size(640, 480), cv::Size(128, 128)), Values( -1, CV_8U, CV_16U, CV_32F ), /*init output matrices or not*/ testing::Bool(), - Values(0.50005), + Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f()), Values(cv::compile_args(CORE_GPU)))); INSTANTIATE_TEST_CASE_P(NormTestGPU, NormTest, @@ -226,7 +225,7 @@ INSTANTIATE_TEST_CASE_P(NormTestGPU, NormTest, Values(cv::Size(1280, 720), cv::Size(640, 480), cv::Size(128, 128)), - Values(1e-3), //TODO: too relaxed? + Values(AbsToleranceScalar(1e-3).to_compare_f()), //TODO: too relaxed? Values(cv::compile_args(CORE_GPU))), opencv_test::PrintNormCoreParams()); diff --git a/modules/gapi/test/gpu/gapi_imgproc_tests_gpu.cpp b/modules/gapi/test/gpu/gapi_imgproc_tests_gpu.cpp index 65d452c34f6a2043547f0c8d7bd9f0563cb35ce1..47b6aefdecf146f232ab6f147496517c47bf279b 100644 --- a/modules/gapi/test/gpu/gapi_imgproc_tests_gpu.cpp +++ b/modules/gapi/test/gpu/gapi_imgproc_tests_gpu.cpp @@ -131,11 +131,23 @@ INSTANTIATE_TEST_CASE_P(Dilate3x3TestGPU, Dilate3x3Test, INSTANTIATE_TEST_CASE_P(SobelTestGPU, SobelTest, Combine(Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()), - Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1/*, CV_32FC1*/), //TODO: CV_32FC1 fails accuracy + Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1), Values(3, 5), Values(cv::Size(1280, 720), cv::Size(640, 480)), - Values(-1, CV_32F), + Values(-1, CV_16S, CV_32F), + Values(0, 1), + Values(1, 2), +/*init output matrices or not*/ testing::Bool(), + Values(cv::compile_args(IMGPROC_GPU)))); + +INSTANTIATE_TEST_CASE_P(SobelTestGPU32F, SobelTest, + Combine(Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()), + Values(CV_32FC1), + Values(3, 5), + Values(cv::Size(1280, 720), + cv::Size(640, 480)), + Values(CV_32F), Values(0, 1), Values(1, 2), /*init output matrices or not*/ testing::Bool(),