automatic commit
[folded-ctf.git] / detector.cc
index 358c66b..5eb0867 100644 (file)
@@ -72,15 +72,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 +163,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 +172,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 +189,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 +306,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 +323,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;
 }
 
@@ -453,10 +409,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) {