bazar  1.3.1
image_classification_tree.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_TREE_H
22 #define IMAGE_CLASSIFICATION_TREE_H
23 
24 #include <vector>
25 using namespace std;
26 
27 #include "image_classifier.h"
29 
35 {
36 public:
38 
39  image_classification_tree(int image_width, int image_height,
40  int class_number, int max_depth,
41  LEARNPROGRESSION LearnProgress=0);
42 
44 
45  bool load(string filename);
46  bool save(string filename);
47 
48  virtual void refine(example_generator * vg, int call_number);
49  virtual void test(example_generator * vg, int call_number);
50  int recognize(image_class_example * pv, float * confidence = 0, int dummy = 0);
51  virtual float * posterior_probabilities(image_class_example * pv, int dummy = 0);
52 
53  void change_class_number_and_reset_probabilities(int new_class_number);
54 
55  int node_number(void);
56  int leaves_number(void);
57  int actual_max_depth(void);
58 
59  double entropy(void);
60 
62  int max_depth;
63 
64  private:
65  image_classification_node * extract_node(vector <image_classification_node*> * L);
66 
67  int depth, new_node_index;
68 };
69 
70 #endif // IMAGE_CLASSIFICATION_TREE_H