--- /dev/null
+
+///////////////////////////////////////////////////////////////////////////
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the version 3 of the GNU General Public License //
+// as published by the Free Software Foundation. //
+// //
+// This program is distributed in the hope that it will be useful, but //
+// WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+// General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// Written by Francois Fleuret, (C) IDIAP //
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports //
+///////////////////////////////////////////////////////////////////////////
+
+/*
+
+ This is the main class, a folded hierarchy of classifiers.
+
+*/
+
+#ifndef DETECTOR_H
+#define DETECTOR_H
+
+#include "storable.h"
+#include "boosted_classifier.h"
+#include "labelled_image_pool.h"
+#include "parsing_pool.h"
+#include "pose_cell_scored_set.h"
+
+class Detector : public Storable {
+public:
+ PoseCellHierarchy *_hierarchy;
+ int _nb_levels, _nb_classifiers_per_level, _nb_classifiers;
+ scalar_t *_thresholds;
+ Classifier **_classifiers;
+ PiFeatureFamily **_pi_feature_families;
+
+ void free();
+
+ virtual void train_classifier(int level,
+ LossMachine *loss_machine,
+ ParsingPool *parsing,
+ PiFeatureFamily *pi_feature_family,
+ Classifier *classifier);
+
+ virtual void parse_rec(RichImage *image, int level,
+ PoseCell *cell, scalar_t response,
+ PoseCellScoredSet *result);
+
+public:
+
+ Detector();
+ virtual ~Detector();
+
+ inline int nb_levels() { return _nb_levels; }
+
+ // The validation set is only used to save ROCs curves during
+ // training for monitoring the learning
+
+ virtual void train(LabelledImagePool *train_pool,
+ LabelledImagePool *validation_pool,
+ LabelledImagePool *hierarchy_pool);
+
+ virtual void compute_thresholds(LabelledImagePool *validation_pool, scalar_t wanted_tp);
+
+ virtual void parse(RichImage *image, PoseCellScoredSet *result_cell_set);
+
+ virtual void read(istream *is);
+ virtual void write(ostream *os);
+};
+
+#endif