fixed check for excessive detections in loss_mmod_ (#1625)

fixed check for excessive detections in loss_mmod_

Ran into the problem where dets.size() was equal to max_num_initial_dets which then throws a subscript out of range error when accesing: dets[max_num_initial_dets].detection_confidence.  This fixes that issue.
This commit is contained in:
davemers0160 2019-01-19 20:45:46 -05:00 committed by Davis E. King
parent ea45199572
commit 84b72278b5
1 changed files with 1 additions and 1 deletions

View File

@ -1135,7 +1135,7 @@ namespace dlib
// Prevent calls to tensor_to_dets() from running for a really long time // Prevent calls to tensor_to_dets() from running for a really long time
// due to the production of an obscene number of detections. // due to the production of an obscene number of detections.
const unsigned long max_num_initial_dets = max_num_dets*100; const unsigned long max_num_initial_dets = max_num_dets*100;
if (dets.size() >= max_num_initial_dets) if (dets.size() > max_num_initial_dets)
{ {
det_thresh_speed_adjust = std::max(det_thresh_speed_adjust,dets[max_num_initial_dets].detection_confidence + options.loss_per_false_alarm); det_thresh_speed_adjust = std::max(det_thresh_speed_adjust,dets[max_num_initial_dets].detection_confidence + options.loss_per_false_alarm);
} }