*** empty log message ***
[folded-ctf.git] / global.h
1
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.                         //
6 //                                                                       //
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.                              //
11 //                                                                       //
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/>.  //
14 //                                                                       //
15 // Written by Francois Fleuret, (C) IDIAP                                //
16 // Contact <francois.fleuret@idiap.ch> for comments & bug reports        //
17 ///////////////////////////////////////////////////////////////////////////
18
19 #ifndef GLOBAL_H
20 #define GLOBAL_H
21
22 #include <iostream>
23
24 using namespace std;
25
26 #include "misc.h"
27 #include "param_parser.h"
28 #include "progress_bar.h"
29
30 enum { LOSS_EXPONENTIAL,
31        LOSS_EV_REGULARIZED,
32        LOSS_HINGE,
33        LOSS_LOGISTIC };
34
35 class Global {
36 public:
37   int niceness;
38   int random_seed;
39   int pictures_for_article;
40
41   char pool_name[buffer_size];
42   char test_pool_name[buffer_size];
43   char detector_name[buffer_size];
44   char result_path[buffer_size];
45
46   char materials_image_numbers[buffer_size];
47   char materials_pf_numbers[buffer_size];
48
49   int loss_type;
50
51   int nb_images;
52
53   int tree_depth_max;
54
55   int nb_weak_learners_per_classifier;
56   int nb_classifiers_per_level;
57   int nb_levels;
58
59   scalar_t proportion_negative_cells_for_training;
60   int nb_negative_samples_per_positive;
61   int nb_features_for_boosting_optimization;
62   int force_head_belly_independence;
63
64   scalar_t proportion_for_train;
65   scalar_t proportion_for_validation;
66   scalar_t proportion_for_test;
67   bool write_validation_rocs;
68   bool write_parse_images;
69   bool write_tag_images;
70   scalar_t wanted_true_positive_rate;
71   int nb_wanted_true_positive_rates;
72
73   int nb_scales_per_power_of_two;
74   scalar_t min_head_radius;
75   scalar_t max_head_radius;
76   int root_cell_nb_xy_per_scale;
77
78   scalar_t pi_feature_window_min_size;
79
80   ProgressBar bar;
81
82   Global();
83   ~Global();
84
85   void init_parser(ParamParser *parser);
86   void read_parser(ParamParser *parser);
87
88   ostream *log_stream;
89
90   inline int scale_to_discrete_log_scale(scalar_t scale_ratio) {
91     return int(floor(log(scale_ratio) / log(2.0) * nb_scales_per_power_of_two));
92   }
93
94   inline scalar_t discrete_log_scale_to_scale(int discrete_scale) {
95     return exp( - scalar_t(discrete_scale) * log(2.0) / scalar_t(nb_scales_per_power_of_two));
96   }
97 };
98
99 extern Global global;
100
101 #endif