From: Francois Fleuret Date: Tue, 14 Oct 2008 12:37:06 +0000 (+0200) Subject: automatic commit X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd28e9c7489bae20e3abf67331efd1cab45d83df;p=folded-ctf.git automatic commit --- diff --git a/README.txt b/README.txt index 75fae3e..9ed0e63 100644 --- a/README.txt +++ b/README.txt @@ -36,15 +36,18 @@ INSTALLATION You can run the full thing with the following commands if you have wget installed - > wget http://www.idiap.ch/folded-ctf/data/folding-gpl.tgz - > tar zxvf folding-gpl.tgz - > cd folding - > wget http://www.idiap.ch/folded-ctf/data/rmk.tgz - > tar zxvf rmk.tgz - > ./run.sh - - Note that every one of the twenty rounds of training/testing takes - more than three days on a powerful PC. However, the script detects + > wget http://www.idiap.ch/folded-ctf/data/folding-gpl.tgz + > tar zxvf folding-gpl.tgz + > cd folding + > wget http://www.idiap.ch/folded-ctf/data/rmk.tgz + > tar zxvf rmk.tgz + > ./run.sh + + Note that for every round, we have to fully train a detector and run + the test through all the test scenes at 10 different thresholds, + including at very conservative thresholds for which the + computational efforts is very high. Hence, each round takes more + than three days on a powerful PC. However, the script detects already running computations by looking at the presence of the corresponding result directories. Hence, it can be run in parallel on several machines as long as they see the same result directory. diff --git a/boosted_classifier.cc b/boosted_classifier.cc index bd4f511..03e1fe3 100644 --- a/boosted_classifier.cc +++ b/boosted_classifier.cc @@ -25,13 +25,11 @@ #include "tools.h" BoostedClassifier::BoostedClassifier(int nb_weak_learners) { - _loss_type = global.loss_type; _nb_weak_learners = nb_weak_learners; _weak_learners = 0; } BoostedClassifier::BoostedClassifier() { - _loss_type = global.loss_type; _nb_weak_learners = 0; _weak_learners = 0; } diff --git a/boosted_classifier.h b/boosted_classifier.h index dc43811..27599e7 100644 --- a/boosted_classifier.h +++ b/boosted_classifier.h @@ -37,7 +37,6 @@ class BoostedClassifier : public Classifier { public: - int _loss_type; int _nb_weak_learners; DecisionTree **_weak_learners; diff --git a/decision_tree.h b/decision_tree.h index 1601836..5adcb0f 100644 --- a/decision_tree.h +++ b/decision_tree.h @@ -38,14 +38,14 @@ class DecisionTree : public Classifier { + static const int min_nb_samples_for_split = 5; + int _feature_index; scalar_t _threshold; scalar_t _weight; DecisionTree *_subtree_lesser, *_subtree_greater; - static const int min_nb_samples_for_split = 5; - void pick_best_split(SampleSet *sample_set, scalar_t *loss_derivatives); diff --git a/detector.h b/detector.h index 11f128d..7a80be6 100644 --- a/detector.h +++ b/detector.h @@ -68,6 +68,9 @@ public: LabelledImagePool *validation_pool, LabelledImagePool *hierarchy_pool); + // Compute the thresholds at the various levels to reach the desired + // overall true positive rate + virtual void compute_thresholds(LabelledImagePool *validation_pool, scalar_t wanted_tp); virtual void parse(RichImage *image, PoseCellScoredSet *result_cell_set); diff --git a/folding.cc b/folding.cc index ac45ee1..5d13bdb 100644 --- a/folding.cc +++ b/folding.cc @@ -50,8 +50,6 @@ void check(bool condition, const char *message) { ////////////////////////////////////////////////////////////////////// int main(int argc, char **argv) { - char *new_argv[argc]; - int new_argc = 0; #ifdef DEBUG cout << endl; @@ -61,7 +59,11 @@ int main(int argc, char **argv) { cout << endl; #endif + char *new_argv[argc]; + int new_argc = 0; + cout << "-- ARGUMENTS ---------------------------------------------------------" << endl; + for(int i = 0; i < argc; i++) cout << (i > 0 ? " " : "") << argv[i] << (i < argc - 1 ? " \\" : "") << endl; @@ -180,8 +182,6 @@ int main(int argc, char **argv) { } } - ////////////////////////////////////////////////////////////////////// - else if(strcmp(new_argv[c], "sequence-test-detector") == 0) { cout << "-- SEQUENCE TEST DETECTOR --------------------------------------------" << endl; diff --git a/progress_bar.cc b/progress_bar.cc index 67370a9..50a4d16 100644 --- a/progress_bar.cc +++ b/progress_bar.cc @@ -21,8 +21,6 @@ #include #include "progress_bar.h" -const int ProgressBar::_width = 80; - ProgressBar::ProgressBar() : _visible(false), _value_max(-1) { } void ProgressBar::set_visible(bool visible) { @@ -41,7 +39,7 @@ void ProgressBar::refresh(ostream *out, scalar_t value) { int step = int((value * 40) / _value_max); if(1 || step > _last_step) { - char buffer[_width + 1], date_buffer[buffer_size]; + char buffer[width + 1], date_buffer[buffer_size]; int i, j; j = sprintf(buffer, "Timer: "); @@ -58,19 +56,19 @@ void ProgressBar::refresh(ostream *out, scalar_t value) { time(¤t); current += rt; strftime(date_buffer, buffer_size, "%a %b %e %H:%M", localtime(¤t)); - j += snprintf(buffer + j, _width - j - 1, " (end ~ %s)", date_buffer); + j += snprintf(buffer + j, width - j - 1, " (end ~ %s)", date_buffer); } else { int hours = rt/3600, min = (rt%3600)/60, sec = rt%60; if(hours > 0) - j += snprintf(buffer + j, _width - j - 1, " (~%dh%dmin left)", hours, min); + j += snprintf(buffer + j, width - j - 1, " (~%dh%dmin left)", hours, min); else if(min > 0) - j += snprintf(buffer + j, _width - j - 1, " (~%dmin%ds left)", min, sec); + j += snprintf(buffer + j, width - j - 1, " (~%dmin%ds left)", min, sec); else - j += snprintf(buffer + j, _width - j - 1, " (~%ds left)", sec); + j += snprintf(buffer + j, width - j - 1, " (~%ds left)", sec); } } - for(; j < _width; j++) buffer[j] = ' '; + for(; j < width; j++) buffer[j] = ' '; buffer[j] = '\0'; (*out) << buffer << "\r"; out->flush(); @@ -81,13 +79,13 @@ void ProgressBar::refresh(ostream *out, scalar_t value) { void ProgressBar::finish(ostream *out) { if(_visible) { - char buffer[_width + 1]; + char buffer[width + 1]; int j; time_t current_time; time(¤t_time); int rt = int(current_time - _initial_time); int min = rt/60, sec = rt%60; j = sprintf(buffer, "Timer: Total %dmin%ds", min, sec); - for(; j < _width; j++) buffer[j] = ' '; + for(; j < width; j++) buffer[j] = ' '; buffer[j] = '\0'; (*out) << buffer << endl; out->flush(); diff --git a/progress_bar.h b/progress_bar.h index 4449fdd..ec9e4eb 100644 --- a/progress_bar.h +++ b/progress_bar.h @@ -35,10 +35,10 @@ using namespace std; #include "misc.h" class ProgressBar { + const static int width = 80; bool _visible; scalar_t _value_max, _last_step; time_t _initial_time; - const static int _width; public: ProgressBar(); void set_visible(bool visible); diff --git a/rich_image.cc b/rich_image.cc index 61b7a84..a728950 100644 --- a/rich_image.cc +++ b/rich_image.cc @@ -90,7 +90,7 @@ void RichImage::compute_one_scale_edge_maps(int width, int height, } } - const int var_square_size = 16; + const unsigned int var_square_size = 16; int k00 = - 2 + width * (- 2); int k01 = - 1 + width * (- 2); @@ -145,22 +145,22 @@ void RichImage::compute_one_scale_edge_maps(int width, int height, scale_edge_map[first_gray_tag + (local_pixel_map[0] / gray_bin_width)][0][d]++; - if(x - int(var_square_size/2) >= 0 && - x + int(var_square_size/2) < width && - y - int(var_square_size/2) >= 0 && - y + int(var_square_size/2) < height) { - - int s = - + local_sum_pixel_map[ - var_square_size/2 + width * ( - var_square_size / 2)] - + local_sum_pixel_map[ + var_square_size/2 + width * ( + var_square_size / 2)] - - local_sum_pixel_map[ - var_square_size/2 + width * ( + var_square_size / 2)] - - local_sum_pixel_map[ + var_square_size/2 + width * ( - var_square_size / 2)]; - - int s_sq = - + local_sum_sq_pixel_map[ - var_square_size/2 + width * ( - var_square_size / 2)] - + local_sum_sq_pixel_map[ + var_square_size/2 + width * ( + var_square_size / 2)] - - local_sum_sq_pixel_map[ - var_square_size/2 + width * ( + var_square_size / 2)] - - local_sum_sq_pixel_map[ + var_square_size/2 + width * ( - var_square_size / 2)]; + if(x - int(var_square_size / 2) >= 0 && + x + int(var_square_size / 2) < width && + y - int(var_square_size / 2) >= 0 && + y + int(var_square_size / 2) < height) { + + unsigned int s = + + *(local_sum_pixel_map - var_square_size / 2 + width * ( - var_square_size / 2)) + + *(local_sum_pixel_map + var_square_size / 2 + width * ( + var_square_size / 2)) + - *(local_sum_pixel_map - var_square_size / 2 + width * ( + var_square_size / 2)) + - *(local_sum_pixel_map + var_square_size / 2 + width * ( - var_square_size / 2)); + + unsigned int s_sq = + + *(local_sum_sq_pixel_map - var_square_size / 2 + width * ( - var_square_size / 2)) + + *(local_sum_sq_pixel_map + var_square_size / 2 + width * ( + var_square_size / 2)) + - *(local_sum_sq_pixel_map - var_square_size / 2 + width * ( + var_square_size / 2)) + - *(local_sum_sq_pixel_map + var_square_size / 2 + width * ( - var_square_size / 2)); if(sq(var_square_size) * s_sq - sq(s) >= 100 * sq(var_square_size) * (sq(var_square_size) - 1)) {