Commit d9ef460c authored by Davis King's avatar Davis King

Removed some testing/debugging code like internal asserts, cout

statements, and other cruft.
parent 167ddaf9
......@@ -205,14 +205,9 @@ namespace dlib
std::vector<std::pair<double, rectangle> > dets;
const double thresh = w(scanner.get_num_dimensions());
std::cout << "!!!!! thresh: "<< thresh << std::endl;
scanner.load(img);
scanner.detect(w, dets, thresh);
std::cout << "dets.size(): "<< dets.size() << std::endl;
for (unsigned long i = 0; i < dets.size() && final_dets.size() < 100; ++i)
{
if (overlaps_any_box(final_dets, dets[i].second))
......
......@@ -212,7 +212,6 @@ namespace dlib
if (levels >= max_pyramid_levels)
break;
}
std::cout << "levels: " << levels << std::endl;
if (feats.max_size() < levels)
feats.set_max_size(levels);
......@@ -518,29 +517,14 @@ namespace dlib
point p = point_dets[j].second;
p = feats[l].feat_to_image_space(p);
rectangle rect = translate_rect(det_templates[i].object_box, p);
rectangle old_rect = rect; // TODO remove later
rect = pyr.rect_up(rect, l);
DLIB_CASSERT(pyr.rect_down(rect,l) == old_rect,"");
dets.push_back(std::make_pair(score, rect));
{
rectangle r = pyr.rect_down(rect,l);
const point origin = center(r);
DLIB_CASSERT(origin == p , origin << " " << p);
DLIB_CASSERT(feats[l].image_to_feat_space(origin) == point_dets[j].second, "");
}
}
}
}
std::cout << "THRESH: " << thresh << std::endl;
std::cout << "NUM POINT DETS FOUND: " << dets.size() << std::endl;
std::sort(dets.rbegin(), dets.rend(), compare_pair_rect);
}
// ----------------------------------------------------------------------------------------
......
......@@ -104,9 +104,6 @@ namespace dlib
std::vector<rectangle> mapped_rects;
scanner.get_feature_vector(rects[idx], psi, mapped_rects);
psi(scanner.get_num_dimensions()) = -1.0*rects[idx].size();
std::cout << "truth psi length: "<< length(psi) << std::endl;
std::cout << "max truth psi: "<< max(abs(psi)) << std::endl;
std::cout << "index of max truth psi: "<< index_of_max(abs(psi)) << std::endl;
// check if any of the boxes overlap. If they do then it is impossible for
// us to learn to correctly classify this sample
......@@ -149,9 +146,6 @@ namespace dlib
}
}
//std::cout << "TRUTH PSI: "<< trans(psi) << std::endl;
//abort();
}
virtual void separation_oracle (
......@@ -178,7 +172,7 @@ namespace dlib
// on a truth rectangle.
loss = rects[idx].size()*loss_per_error;
// Measure the risk loss augmented score for the detections which hit a truth rect.
// Measure the loss augmented score for the detections which hit a truth rect.
std::vector<double> truth_score_hits(rects[idx].size(), 0);
std::vector<rectangle> final_dets;
......@@ -206,7 +200,6 @@ namespace dlib
}
double expected_psi_dot_w = 0;
// keep track of which truth boxes we have hit so far.
std::vector<bool> hit_truth_table(rects[idx].size(), false);
final_dets.clear();
......@@ -230,13 +223,11 @@ namespace dlib
{
hit_truth_table[truth.second] = true;
final_dets.push_back(dets[i].second);
expected_psi_dot_w += dets[i].first;
loss -= loss_per_error;
}
else
{
final_dets.push_back(dets[i].second);
expected_psi_dot_w += dets[i].first;
loss += loss_per_error;
}
}
......@@ -245,41 +236,16 @@ namespace dlib
{
// didn't hit anything
final_dets.push_back(dets[i].second);
expected_psi_dot_w += dets[i].first;
loss += loss_per_error;
}
}
psi.set_size(get_num_dimensions());
psi = 0;
//feature_vector_type other_psi;
//other_psi.set_size(get_num_dimensions());
//other_psi = 0;
//scanner.get_feature_vector(final_dets, other_psi);
std::vector<rectangle> mapped_rects;
scanner.get_feature_vector(final_dets, psi, mapped_rects);
DLIB_CASSERT(mapped_rects.size() == final_dets.size(),"");
if (std::abs(expected_psi_dot_w - dot(psi,current_solution)) > 1e-8)
{
std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " psi dot w: "<< dot(psi,current_solution) << std::endl;
std::cout << " expected psi dot w: "<< expected_psi_dot_w << std::endl;
std::cout << " final_dets.size(): "<< final_dets.size() << std::endl;
for (unsigned long i = 0; i < final_dets.size(); ++i)
{
DLIB_CASSERT(final_dets[i] == mapped_rects[i], final_dets[i] << " " << mapped_rects[i] << " i: " << i);
}
abort();
}
for (unsigned long i = 0; i < final_dets.size(); ++i)
{
DLIB_CASSERT(final_dets[i] == mapped_rects[i], final_dets[i] << " " << mapped_rects[i] << " i: " << i);
}
psi(scanner.get_num_dimensions()) = -1.0*final_dets.size();
std::cout << "LOSS: "<< loss << std::endl;
std::cout << " final_dets.size(): "<< final_dets.size() << std::endl;
//std::cout << "PSI: "<< trans(psi) << std::endl;
psi(scanner.get_num_dimensions()) = -1.0*final_dets.size();
}
......
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