X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=global.h;fp=global.h;h=a053d3d4f46d64912ba2e5f6dc4cdc0c3360901e;hb=d922ad61d35e9a6996730bec24b16f8bf7bc426c;hp=0000000000000000000000000000000000000000;hpb=3bb118f5a9462d02ff7d99ef28ecc0d7e23529f9;p=folded-ctf.git diff --git a/global.h b/global.h new file mode 100644 index 0000000..a053d3d --- /dev/null +++ b/global.h @@ -0,0 +1,101 @@ + +/////////////////////////////////////////////////////////////////////////// +// 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 . // +// // +// Written by Francois Fleuret, (C) IDIAP // +// Contact for comments & bug reports // +/////////////////////////////////////////////////////////////////////////// + +#ifndef GLOBAL_H +#define GLOBAL_H + +#include + +using namespace std; + +#include "misc.h" +#include "param_parser.h" +#include "progress_bar.h" + +enum { LOSS_EXPONENTIAL, + LOSS_EV_REGULARIZED, + LOSS_HINGE, + LOSS_LOGISTIC }; + +class Global { +public: + int niceness; + int random_seed; + int pictures_for_article; + + char pool_name[buffer_size]; + char test_pool_name[buffer_size]; + char detector_name[buffer_size]; + char result_path[buffer_size]; + + char materials_image_numbers[buffer_size]; + char materials_pf_numbers[buffer_size]; + + int loss_type; + + int nb_images; + + int tree_depth_max; + + int nb_weak_learners_per_classifier; + int nb_classifiers_per_level; + int nb_levels; + + scalar_t proportion_negative_cells_for_training; + int nb_negative_samples_per_positive; + int nb_features_for_boosting_optimization; + int force_head_belly_independence; + + scalar_t proportion_for_train; + scalar_t proportion_for_validation; + scalar_t proportion_for_test; + bool write_validation_rocs; + bool write_parse_images; + bool write_tag_images; + scalar_t wanted_true_positive_rate; + int nb_wanted_true_positive_rates; + + int nb_scales_per_power_of_two; + scalar_t min_head_radius; + scalar_t max_head_radius; + int root_cell_nb_xy_per_scale; + + scalar_t pi_feature_window_min_size; + + ProgressBar bar; + + Global(); + ~Global(); + + void init_parser(ParamParser *parser); + void read_parser(ParamParser *parser); + + ostream *log_stream; + + inline int scale_to_discrete_log_scale(scalar_t scale_ratio) { + return int(floor(log(scale_ratio) / log(2.0) * nb_scales_per_power_of_two)); + } + + inline scalar_t discrete_log_scale_to_scale(int discrete_scale) { + return exp( - scalar_t(discrete_scale) * log(2.0) / scalar_t(nb_scales_per_power_of_two)); + } +}; + +extern Global global; + +#endif