Commit bdfb7b0e authored by Fm's avatar Fm

Added regression test for corellation_tracker

parent 13ea9e58
// Copyright (C) 2013 Davis E. King (davis@dlib.net) // Copyright (C) 2016 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license. // License: Boost Software License See LICENSE.txt for the full license.
#include "tester.h" #include "tester.h"
...@@ -60,18 +60,21 @@ namespace ...@@ -60,18 +60,21 @@ namespace
{ {
std::istringstream sin(frames[i]()); std::istringstream sin(frames[i]());
load_bmp(img, sin); load_bmp(img, sin);
double res = tracker.update(img); double res = tracker.update(img);
double correct_res = correct_update_results[i]; double correct_res = correct_update_results[i];
double res_diff = abs(correct_res - res); double res_diff = abs(correct_res - res);
// small error possible due to rounding and different optimization options
drectangle pos = tracker.get_position(); drectangle pos = tracker.get_position();
drectangle correct_pos = correct_rects[i]; drectangle correct_pos = correct_rects[i];
drectangle pos_intresect = pos.intersect(correct_pos); drectangle pos_intresect = pos.intersect(correct_pos);
double pos_area = pos.area(); double pos_area = pos.area();
double intersect_area = pos_intresect.area(); double intersect_area = pos_intresect.area();
double rect_confidence = intersect_area / pos_area; double rect_confidence = intersect_area / pos_area;
dlog << LINFO << "Frame #" << i << " res: " << res << " correct res: " << correct_res << " pos: " << pos dlog << LINFO << "Frame #" << i << " res: " << res << " correct res: " << correct_res << " pos: " << pos
<< " correct pos: " << correct_pos << " rect confidence: " << rect_confidence; << " correct pos: " << correct_pos << " rect confidence: " << rect_confidence;
// small error possible due to rounding and different optimization options // small error possible due to rounding and different optimization options
DLIB_TEST(res_diff <= 1); DLIB_TEST(res_diff <= 1);
DLIB_TEST(rect_confidence >= 0.99); DLIB_TEST(rect_confidence >= 0.99);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment