Made the box overlap testing stuff a little more robust to differences in floating

point behavior on different compilers.  In particular, this change avoids having
false "impossible truth box" exceptions being thrown when the object detection
tools are used with the mingw gcc compiler.
This commit is contained in:
Davis King 2014-01-11 18:16:31 -05:00
parent 1b402f4f48
commit 4ff173aad5
1 changed files with 7 additions and 0 deletions

View File

@ -124,6 +124,13 @@ namespace dlib
}
}
// Relax these thresholds very slightly. We do this because on some systems the
// boxes that generated the max values erroneously trigger a box overlap match
// even though their overlap and match values are *equal* to the thresholds but not
// greater. That is, sometimes when double values get moved around they change
// their values slightly, so this avoids the problems that can create.
max_match_score = std::min(1.0000001*max_match_score, 1.0);
max_overlap = std::min(1.0000001*max_overlap, 1.0);
return test_box_overlap(max_match_score, max_overlap);
}