2 ///////////////////////////////////////////////////////////////////////////
3 // This program is free software: you can redistribute it and/or modify //
4 // it under the terms of the version 3 of the GNU General Public License //
5 // as published by the Free Software Foundation. //
7 // This program is distributed in the hope that it will be useful, but //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
10 // General Public License for more details. //
12 // You should have received a copy of the GNU General Public License //
13 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
15 // Written by Francois Fleuret, (C) IDIAP //
16 // Contact <francois.fleuret@idiap.ch> for comments & bug reports //
17 ///////////////////////////////////////////////////////////////////////////
21 This is the main class, a folded hierarchy of classifiers.
29 #include "boosted_classifier.h"
30 #include "labelled_image_pool.h"
31 #include "parsing_pool.h"
32 #include "pose_cell_scored_set.h"
34 class Detector : public Storable {
36 PoseCellHierarchy *_hierarchy;
37 int _nb_levels, _nb_classifiers_per_level, _nb_classifiers;
38 scalar_t *_thresholds;
39 Classifier **_classifiers;
40 PiFeatureFamily **_pi_feature_families;
44 virtual void train_classifier(int level,
45 LossMachine *loss_machine,
47 PiFeatureFamily *pi_feature_family,
48 Classifier *classifier);
50 virtual void parse_rec(RichImage *image, int level,
51 PoseCell *cell, scalar_t response,
52 PoseCellScoredSet *result);
59 inline int nb_levels() { return _nb_levels; }
61 // The validation set is only used to save ROCs curves during
62 // training for monitoring the learning
64 virtual void train(LabelledImagePool *train_pool,
65 LabelledImagePool *validation_pool,
66 LabelledImagePool *hierarchy_pool);
68 virtual void compute_thresholds(LabelledImagePool *validation_pool, scalar_t wanted_tp);
70 virtual void parse(RichImage *image, PoseCellScoredSet *result_cell_set);
72 virtual void read(istream *is);
73 virtual void write(ostream *os);