Commit c590ee67 authored by Davis King's avatar Davis King

Turned some DLIB_ASSERT() statements into DLIB_CASSERT() since it gives

better error reporting and is not a speed bottleneck.
parent f0ccfd40
...@@ -341,7 +341,7 @@ namespace dlib ...@@ -341,7 +341,7 @@ namespace dlib
boxes_overlap(overlap_tester) boxes_overlap(overlap_tester)
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(scanner_.get_num_detection_templates() > 0 && w_.size() > 0, DLIB_CASSERT(scanner_.get_num_detection_templates() > 0 && w_.size() > 0,
"\t object_detector::object_detector(scanner_,overlap_tester,w_)" "\t object_detector::object_detector(scanner_,overlap_tester,w_)"
<< "\n\t Invalid inputs were given to this function " << "\n\t Invalid inputs were given to this function "
<< "\n\t scanner_.get_num_detection_templates(): " << scanner_.get_num_detection_templates() << "\n\t scanner_.get_num_detection_templates(): " << scanner_.get_num_detection_templates()
...@@ -349,10 +349,9 @@ namespace dlib ...@@ -349,10 +349,9 @@ namespace dlib
<< "\n\t this: " << this << "\n\t this: " << this
); );
#ifdef ENABLE_ASSERTS
for (unsigned long i = 0; i < w_.size(); ++i) for (unsigned long i = 0; i < w_.size(); ++i)
{ {
DLIB_ASSERT(w_[i].size() == scanner_.get_num_dimensions() + 1, DLIB_CASSERT(w_[i].size() == scanner_.get_num_dimensions() + 1,
"\t object_detector::object_detector(scanner_,overlap_tester,w_)" "\t object_detector::object_detector(scanner_,overlap_tester,w_)"
<< "\n\t Invalid inputs were given to this function " << "\n\t Invalid inputs were given to this function "
<< "\n\t scanner_.get_num_detection_templates(): " << scanner_.get_num_detection_templates() << "\n\t scanner_.get_num_detection_templates(): " << scanner_.get_num_detection_templates()
...@@ -361,7 +360,6 @@ namespace dlib ...@@ -361,7 +360,6 @@ namespace dlib
<< "\n\t this: " << this << "\n\t this: " << this
); );
} }
#endif
scanner.copy_configuration(scanner_); scanner.copy_configuration(scanner_);
w.resize(w_.size()); w.resize(w_.size());
...@@ -382,7 +380,7 @@ namespace dlib ...@@ -382,7 +380,7 @@ namespace dlib
const std::vector<object_detector>& detectors const std::vector<object_detector>& detectors
) )
{ {
DLIB_ASSERT(detectors.size() != 0, DLIB_CASSERT(detectors.size() != 0,
"\t object_detector::object_detector(detectors)" "\t object_detector::object_detector(detectors)"
<< "\n\t Invalid inputs were given to this function " << "\n\t Invalid inputs were given to this function "
<< "\n\t this: " << this << "\n\t this: " << this
......
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