X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=detector.cc;h=5ae1de03111360e626fa72e39b532f796bd1be3c;hb=20ec321944108cd1fe74b37ea45db3ba1a2d526a;hp=1c3ef23b07aef58df2a57a899453da8e7623952c;hpb=d922ad61d35e9a6996730bec24b16f8bf7bc426c;p=folded-ctf.git
diff --git a/detector.cc b/detector.cc
index 1c3ef23..5ae1de0 100644
--- a/detector.cc
+++ b/detector.cc
@@ -12,7 +12,9 @@
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see . //
// //
-// Written by Francois Fleuret, (C) IDIAP //
+// Written by Francois Fleuret //
+// (C) Idiap Research Institute //
+// //
// Contact for comments & bug reports //
///////////////////////////////////////////////////////////////////////////
@@ -72,15 +74,11 @@ void Detector::train_classifier(int level,
scalar_t *responses = new scalar_t[nb_positives + nb_negatives_to_sample];
- (*global.log_stream) << "Collecting the sampled training set." << endl;
-
parsing_pool->weighted_sampling(loss_machine,
&full_pi_feature_family,
sample_set,
responses);
- (*global.log_stream) << "Training the classifier." << endl;
-
(*global.log_stream) << "Initial train_loss "
<< loss_machine->loss(sample_set, responses)
<< endl;
@@ -167,8 +165,6 @@ void Detector::train(LabelledImagePool *train_pool,
for(int c = 0; c < _nb_classifiers_per_level; c++) {
int q = l * _nb_classifiers_per_level + c;
- (*global.log_stream) << "Building classifier " << q << " (level " << l << ")" << endl;
-
// Train the classifier
train_classifier(l,
@@ -178,8 +174,6 @@ void Detector::train(LabelledImagePool *train_pool,
// Update the cell responses on the training set
- (*global.log_stream) << "Updating training cell responses." << endl;
-
train_parsing->update_cell_responses(_pi_feature_families[q],
_classifiers[q]);
@@ -197,8 +191,6 @@ void Detector::train(LabelledImagePool *train_pool,
// Update the cell responses on the validation set
- (*global.log_stream) << "Updating validation cell responses." << endl;
-
validation_parsing->update_cell_responses(_pi_feature_families[q],
_classifiers[q]);
@@ -316,11 +308,6 @@ void Detector::compute_thresholds(LabelledImagePool *validation_pool, scalar_t w
int wanted_nb_fn_at_this_classifier
= int(nb_targets_total * (1 - wanted_tp_at_this_classifier));
- (*global.log_stream) << "q = " << q
- << " wanted_tp_at_this_classifier = " << wanted_tp_at_this_classifier
- << " wanted_nb_fn_at_this_classifier = " << wanted_nb_fn_at_this_classifier
- << endl;
-
indexed_fusion_sort(nb_targets_total, indexes, sorted_indexes,
responses + q * nb_targets_total);
@@ -338,35 +325,6 @@ void Detector::compute_thresholds(LabelledImagePool *validation_pool, scalar_t w
delete[] still_detected;
delete[] indexes;
delete[] sorted_indexes;
-
- { ////////////////////////////////////////////////////////////////////
- // Sanity check
-
- int nb_positives = 0;
-
- for(int t = 0; t < nb_targets_total; t++) {
- int positive = 1;
- for(int q = 0; q < _nb_classifiers; q++) {
- if(responses[t + nb_targets_total * q] < _thresholds[q]) positive = 0;
- }
- if(positive) nb_positives++;
- }
-
- scalar_t actual_tp = scalar_t(nb_positives) / scalar_t(nb_targets_total);
-
- (*global.log_stream) << "Overall detection rate " << nb_positives << "/" << nb_targets_total
- << " "
- << "actual_tp = " << actual_tp
- << " "
- << "wanted_tp = " << wanted_tp
- << endl;
-
- if(actual_tp < wanted_tp) {
- cerr << "INCONSISTENCY" << endl;
- abort();
- }
- } ////////////////////////////////////////////////////////////////////
-
delete[] responses;
}
@@ -446,7 +404,6 @@ void Detector::read(istream *is) {
_thresholds = new scalar_t[_nb_classifiers];
for(int q = 0; q < _nb_classifiers; q++) {
- cout << "Read classifier " << q << endl;
_pi_feature_families[q] = new PiFeatureFamily();
_pi_feature_families[q]->read(is);
_classifiers[q] = read_classifier(is);
@@ -454,10 +411,6 @@ void Detector::read(istream *is) {
}
_hierarchy = read_hierarchy(is);
-
- (*global.log_stream) << "Read Detector" << endl
- << " _nb_levels " << _nb_levels << endl
- << " _nb_classifiers_per_level " << _nb_classifiers_per_level << endl;
}
void Detector::write(ostream *os) {