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 version 3 as
13 * published by the Free Software Foundation.
15 * folded-ctf is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with folded-ctf. If not, see <http://www.gnu.org/licenses/>.
27 This is the main class, a detector as a folded hierarchy of
36 #include "boosted_classifier.h"
37 #include "labelled_image_pool.h"
38 #include "parsing_pool.h"
39 #include "pose_cell_scored_set.h"
41 class Detector : public Storable {
43 PoseCellHierarchy *_hierarchy;
44 int _nb_levels, _nb_classifiers_per_level, _nb_classifiers;
45 scalar_t *_thresholds;
46 Classifier **_classifiers;
47 PiFeatureFamily **_pi_feature_families;
51 virtual void train_classifier(int level,
52 LossMachine *loss_machine,
54 PiFeatureFamily *pi_feature_family,
55 Classifier *classifier);
57 virtual void parse_rec(RichImage *image, int level,
58 PoseCell *cell, scalar_t response,
59 PoseCellScoredSet *result);
66 inline int nb_levels() { return _nb_levels; }
68 // The validation set is only used to save ROCs curves during
69 // training for monitoring the learning
71 virtual void train(LabelledImagePool *train_pool,
72 LabelledImagePool *validation_pool,
73 LabelledImagePool *hierarchy_pool);
75 // Compute the thresholds at the various levels to reach the desired
76 // overall true positive rate
78 virtual void compute_thresholds(LabelledImagePool *validation_pool, scalar_t wanted_tp);
80 virtual void parse(RichImage *image, PoseCellScoredSet *result_cell_set);
82 virtual void read(istream *is);
83 virtual void write(ostream *os);