Skip to content

Commit 46110c3

Browse files
dcanelhasalalek
authored andcommitted
Merge pull request #1993 from dcanelhas:master
waldboost_detector train: avoid failed asserts while training by exiting early * Avoids a failed assert which crashes training * xobjdetect: improve waldboost messages
1 parent 766bf77 commit 46110c3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/xobjdetect/src/waldboost.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,14 @@ void WaldBoost::fit(Mat& data_pos, Mat& data_neg)
333333

334334

335335
if (loss < 1e-50 || min_err > 0.5) {
336-
std::cerr << "Stopping early" << std::endl;
336+
std::cerr << "Stopping early. loss=" << loss << " min_err=" << min_err << std::endl;
337+
weak_count_ = i + 1;
338+
break;
339+
}
340+
341+
// Avoid crashing on next Mat creation
342+
if (pos <= 1) {
343+
std::cerr << "Stopping early. pos=" << pos << std::endl;
337344
weak_count_ = i + 1;
338345
break;
339346
}

0 commit comments

Comments
 (0)