Merge branch 2.4

This commit is contained in:
Andrey Kamaev
2012-12-14 14:46:41 +04:00
13 changed files with 187 additions and 110 deletions

View File

@@ -16,7 +16,8 @@ const std::string command_line_keys =
"{ perf_force_samples |100 |force set maximum number of samples for all tests}"
"{ perf_seed |809564 |seed for random numbers generator}"
"{ perf_threads |-1 |the number of worker threads, if parallel execution is enabled}"
"{ perf_write_sanity | |allow to create new records for sanity checks}"
"{ perf_write_sanity | |create new records for sanity checks}"
"{ perf_verify_sanity | |fail tests having no regression data for sanity checks}"
#ifdef ANDROID
"{ perf_time_limit |6.0 |default time limit for a single test (in seconds)}"
"{ perf_affinity_mask |0 |set affinity mask for the main thread}"
@@ -41,6 +42,7 @@ static uint64 param_seed;
static double param_time_limit;
static int param_threads;
static bool param_write_sanity;
static bool param_verify_sanity;
#ifdef HAVE_CUDA
static bool param_run_cpu;
static int param_cuda_device;
@@ -491,7 +493,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
cv::minMaxLoc(diff.reshape(1), 0, &max);
FAIL() << " Absolute difference (=" << max << ") between argument \""
<< node.name() << "[" << idx << "]\" and expected value is bugger than " << eps;
<< node.name() << "[" << idx << "]\" and expected value is greater than " << eps;
}
}
else if (err == ERROR_RELATIVE)
@@ -501,7 +503,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
if (violations > 0)
{
FAIL() << " Relative difference (" << maxv << " of " << maxa << " allowed) between argument \""
<< node.name() << "[" << idx << "]\" and expected value is bugger than " << eps << " in " << violations << " points";
<< node.name() << "[" << idx << "]\" and expected value is greater than " << eps << " in " << violations << " points";
}
}
}
@@ -545,7 +547,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
cv::minMaxLoc(diff.reshape(1), 0, &max);
FAIL() << " Difference (=" << max << ") between argument1 \"" << node.name()
<< "\" and expected value is bugger than " << eps;
<< "\" and expected value is greater than " << eps;
}
}
else if (err == ERROR_RELATIVE)
@@ -555,7 +557,7 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
if (violations > 0)
{
FAIL() << " Relative difference (" << maxv << " of " << maxa << " allowed) between argument \"" << node.name()
<< "\" and expected value is bugger than " << eps << " in " << violations << " points";
<< "\" and expected value is greater than " << eps << " in " << violations << " points";
}
}
}
@@ -595,10 +597,15 @@ Regression& Regression::operator() (const std::string& name, cv::InputArray arra
write() << nodename << "{";
}
// TODO: verify that name is alphanumeric, current error message is useless
write() << name << "{";
write(array);
write() << "}";
}
else if(param_verify_sanity)
{
ADD_FAILURE() << " No regression data for " << name << " argument";
}
}
else
{
@@ -656,6 +663,7 @@ void TestBase::Init(int argc, const char* const argv[])
param_time_limit = std::max(0., args.get<double>("perf_time_limit"));
param_force_samples = args.get<unsigned int>("perf_force_samples");
param_write_sanity = args.has("perf_write_sanity");
param_verify_sanity = args.has("perf_verify_sanity");
param_threads = args.get<int>("perf_threads");
#ifdef ANDROID
param_affinity_mask = args.get<int>("perf_affinity_mask");
@@ -970,7 +978,7 @@ void TestBase::validateMetrics()
if (m.gstddev > DBL_EPSILON)
{
EXPECT_GT(/*m.gmean * */1., /*m.gmean * */ 2 * sinh(m.gstddev * param_max_deviation))
<< " Test results are not reliable ((mean-sigma,mean+sigma) deviation interval is bigger than measured time interval).";
<< " Test results are not reliable ((mean-sigma,mean+sigma) deviation interval is greater than measured time interval).";
}
EXPECT_LE(m.outliers, std::max((unsigned int)cvCeil(m.samples * param_max_outliers / 100.), 1u))