2 * folded-ctf is an implementation of the folded hierarchy of
3 * classifiers for object detection, developed by Francois Fleuret
6 * Copyright (c) 2008 Idiap Research Institute, http://www.idiap.ch/
7 * Written by Francois Fleuret <francois.fleuret@idiap.ch>
9 * This file is part of folded-ctf.
11 * folded-ctf is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published
13 * by the Free Software Foundation, either version 3 of the License,
14 * or (at your option) any later version.
16 * folded-ctf is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with folded-ctf. If not, see <http://www.gnu.org/licenses/>.
28 This is the main class, a detector as a folded hierarchy of
37 #include "boosted_classifier.h"
38 #include "labelled_image_pool.h"
39 #include "parsing_pool.h"
40 #include "pose_cell_scored_set.h"
42 class Detector : public Storable {
44 PoseCellHierarchy *_hierarchy;
45 int _nb_levels, _nb_classifiers_per_level, _nb_classifiers;
46 scalar_t *_thresholds;
47 Classifier **_classifiers;
48 PiFeatureFamily **_pi_feature_families;
52 virtual void train_classifier(int level,
53 LossMachine *loss_machine,
55 PiFeatureFamily *pi_feature_family,
56 Classifier *classifier);
58 virtual void parse_rec(RichImage *image, int level,
59 PoseCell *cell, scalar_t response,
60 PoseCellScoredSet *result);
67 inline int nb_levels() { return _nb_levels; }
69 // The validation set is only used to save ROCs curves during
70 // training for monitoring the learning
72 virtual void train(LabelledImagePool *train_pool,
73 LabelledImagePool *validation_pool,
74 LabelledImagePool *hierarchy_pool);
76 // Compute the thresholds at the various levels to reach the desired
77 // overall true positive rate
79 virtual void compute_thresholds(LabelledImagePool *validation_pool, scalar_t wanted_tp);
81 virtual void parse(RichImage *image, PoseCellScoredSet *result_cell_set);
83 virtual void read(istream *is);
84 virtual void write(ostream *os);