bazar  1.3.1
image_classification_forest.h
Go to the documentation of this file.
1 /*
2 Copyright 2005, 2006 Computer Vision Lab,
3 Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland.
4 All rights reserved.
5 
6 This file is part of BazAR.
7 
8 BazAR is free software; you can redistribute it and/or modify it under the
9 terms of the GNU General Public License as published by the Free Software
10 Foundation; either version 2 of the License, or (at your option) any later
11 version.
12 
13 BazAR is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License along with
18 BazAR; if not, write to the Free Software Foundation, Inc., 51 Franklin
19 Street, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21 #ifndef IMAGE_CLASSIFICATION_FOREST_H
22 #define IMAGE_CLASSIFICATION_FOREST_H
23 
24 #include "image_classifier.h"
26 
33 {
34 public:
36 
38  int max_depth, int trees_number,
39  LEARNPROGRESSION LearnProgress=0);
40 
42 
44  void create_trees_at_random(void);
45  virtual void refine(example_generator * vg, int call_number);
46  void restore_occurances();
47  void reset_class_occurances(int class_index);
48  virtual void test(example_generator * vg, int call_number);
49  int recognize(image_class_example * pv, float * confidence = 0, int tree_number = -1);
50 
51  virtual float * posterior_probabilities(image_class_example * pv, int tree_number = -1);
52  virtual void posterior_probabilities(image_class_example * pv, float * pp, int tree_number = -1);
53 
54  void change_class_number_and_reset_probabilities(int new_class_number);
55 
56  float * thresholds;
58 
59  bool load(string directory_name);
60  bool save(string directory_name);
61 
62  bool is_ok() { return trees.size() != 0; }
63 
64 //private:
65  vector<image_classification_tree *> trees;
67 
68  float* weights;
69 
71 };
72 
73 #endif // IMAGE_CLASSIFICATION_FOREST_H