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.
#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;
}
class BoostedClassifier : public Classifier {
public:
- int _loss_type;
int _nb_weak_learners;
DecisionTree **_weak_learners;
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);
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);
//////////////////////////////////////////////////////////////////////
int main(int argc, char **argv) {
- char *new_argv[argc];
- int new_argc = 0;
#ifdef DEBUG
cout << endl;
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;
}
}
- //////////////////////////////////////////////////////////////////////
-
else if(strcmp(new_argv[c], "sequence-test-detector") == 0) {
cout << "-- SEQUENCE TEST DETECTOR --------------------------------------------" << endl;
#include <time.h>
#include "progress_bar.h"
-const int ProgressBar::_width = 80;
-
ProgressBar::ProgressBar() : _visible(false), _value_max(-1) { }
void ProgressBar::set_visible(bool visible) {
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: ");
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();
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();
#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);
}
}
- const int var_square_size = 16;
+ const unsigned int var_square_size = 16;
int k00 = - 2 + width * (- 2);
int k01 = - 1 + width * (- 2);
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)) {