gapi(test): use relative error check for Norm/Sum tests

This commit is contained in:
Alexander Alekhin 2018-11-09 12:46:39 +03:00
parent 8b7f805642
commit dd6f5949c2
4 changed files with 12 additions and 8 deletions

View File

@ -921,7 +921,8 @@ PERF_TEST_P_(SumPerfTest, TestPerformance)
// Comparison ////////////////////////////////////////////////////////////
{
EXPECT_LE(abs(out_sum[0] - out_sum_ocv[0]), tolerance);
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];
}
SANITY_CHECK_NOTHING();
@ -1041,7 +1042,8 @@ PERF_TEST_P_(NormPerfTest, TestPerformance)
// Comparison ////////////////////////////////////////////////////////////
{
EXPECT_LE(abs(out_norm[0] - out_norm_ocv[0]), tolerance);
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];
}
SANITY_CHECK_NOTHING();

View File

@ -703,7 +703,8 @@ TEST_P(SumTest, AccuracyTest)
}
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_LE(abs(out_sum[0] - out_sum_ocv[0]), tolerance);
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];
}
}
@ -802,7 +803,8 @@ TEST_P(NormTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_LE(abs(out_norm[0] - out_norm_ocv[0]), tolerance);
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];
}
}

View File

@ -188,7 +188,7 @@ INSTANTIATE_TEST_CASE_P(SumTestCPU, SumTest,
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(0.0),
Values(1e-5),
Values(cv::compile_args(CORE_CPU))));
INSTANTIATE_TEST_CASE_P(AbsDiffTestCPU, AbsDiffTest,
@ -224,7 +224,7 @@ INSTANTIATE_TEST_CASE_P(NormTestCPU, NormTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(0.0),
Values(1e-5),
Values(cv::compile_args(CORE_CPU))),
opencv_test::PrintNormCoreParams());

View File

@ -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(0.5), //Values(0.04), //TODO: too relaxed?
Values(1e-3), //TODO: too relaxed?
Values(cv::compile_args(CORE_GPU))));
INSTANTIATE_TEST_CASE_P(AbsDiffTestGPU, AbsDiffTest,
@ -226,7 +226,7 @@ INSTANTIATE_TEST_CASE_P(NormTestGPU, NormTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(0.04), //TODO: too relaxed?
Values(1e-3), //TODO: too relaxed?
Values(cv::compile_args(CORE_GPU))),
opencv_test::PrintNormCoreParams());