CVB++ 14.1
learn_parameters.hpp
1#pragma once
2
3#include "../_cexports/c_minos.h"
4
5#include "../global.hpp"
6
7namespace Cvb
8{
9CVB_BEGIN_INLINE_NS
10
12namespace Minos
13{
14
16
19{
20public:
21 LearnParameters (int minFeatureCount, int polydromy, int ensembleSize, int contrastTrigger, int indifferenceRadius, double negativeDensity) noexcept
22 : minFeatureCount_ (minFeatureCount), polydromy_ (polydromy), ensembleSize_ (ensembleSize), contrastTrigger_ (contrastTrigger),
23 indifferenceRadius_ (indifferenceRadius), negativeDensity_ (negativeDensity)
24 {}
25
26 LearnParameters () noexcept
27 : minFeatureCount_ (MinFeatureCountDefault()), polydromy_ (PolydromyDefault()), ensembleSize_ (EnsembleSizeDefault()), contrastTrigger_ (ContrastTriggerDefault()),
28 indifferenceRadius_ (IndifferenceRadiusDefault()), negativeDensity_ (NegativeDensityDefault())
29 {}
30
31public:
33
37 static int IndifferenceRadiusDefault () noexcept
38 {
39 return 6;
40 }
41
43
47 static double NegativeDensityDefault () noexcept
48 {
49 return 1.0;
50 }
51
53
57 static int ContrastTriggerDefault () noexcept
58 {
59 return 8;
60 }
61
63
67 static int EnsembleSizeDefault () noexcept
68 {
69 return 15;
70 }
71
73
77 static int PolydromyDefault () noexcept
78 {
79 return 2;
80 }
81
83
87 static int MinFeatureCountDefault () noexcept
88 {
89 return 50;
90 }
91
93
97 int MinFeatureCount() const noexcept
98 {
99 return minFeatureCount_;
100 }
101
103
107 void SetMinFeatureCount(int minFeatureCount)
108 {
109 if (minFeatureCount < 1)
110 {
111 throw std::invalid_argument ("minimum feature count value must be >0");
112 }
113 minFeatureCount_ = minFeatureCount;
114 }
115
117
121 int Polydromy() const noexcept
122 {
123 return polydromy_;
124 }
125
127
131 void SetPolydromy(int polydromy)
132 {
133 if (polydromy < 1)
134 {
135 throw std::invalid_argument ("polydromy value must be >0");
136 }
137 polydromy_ = polydromy;
138 }
139
141
145 int EnsembleSize() const noexcept
146 {
147 return ensembleSize_;
148 }
149
151
155 void SetEnsembleSize(int ensembleSize)
156 {
157 if (ensembleSize < 1)
158 {
159 throw std::invalid_argument ("ensemble size value must be >0");
160 }
161 ensembleSize_ = ensembleSize;
162 }
163
165
169 int ContrastTrigger() const noexcept
170 {
171 return contrastTrigger_;
172 }
173
175
179 void SetContrastTrigger(int contrastTrigger)
180 {
181 if (contrastTrigger < 1)
182 {
183 throw std::invalid_argument ("contrast trigger value must be >0");
184 }
185 contrastTrigger_ = contrastTrigger;
186 }
187
189
193 int IndifferenceRadius() const noexcept
194 {
195 return indifferenceRadius_;
196 }
197
199
203 void SetIndifferenceRadius(int indifferenceRadius)
204 {
205 if (indifferenceRadius < 1)
206 {
207 throw std::invalid_argument ("indifference radius value must be >0");
208 }
209 indifferenceRadius_ = indifferenceRadius;
210 }
211
213
217 double NegativeDensity() const noexcept
218 {
219 return negativeDensity_;
220 }
221
223
227 void SetNegativeDensity(double negativeDensity)
228 {
229 if (negativeDensity < 0.0 || negativeDensity > 1.0)
230 {
231 throw std::invalid_argument ("negative density value must be in [0.0, 1.0]");
232 }
233 negativeDensity_ = negativeDensity;
234 }
235
236private:
237 int minFeatureCount_;
238 int polydromy_;
239 int ensembleSize_;
240 int contrastTrigger_;
241 int indifferenceRadius_;
242 double negativeDensity_;
243};
244
245} /* namespace Minos */
246CVB_END_INLINE_NS
247} /* namespace Cvb */
The set of parameters, which controls, how a classifier is being learned from a training set.
Definition: learn_parameters.hpp:19
static int ContrastTriggerDefault() noexcept
Default value for the ContrastTrigger.
Definition: learn_parameters.hpp:57
void SetEnsembleSize(int ensembleSize)
Sets the maximum size of the Ensembles of similar instance images to be used for pair feature calcula...
Definition: learn_parameters.hpp:155
static int PolydromyDefault() noexcept
Default value for the Polydromy.
Definition: learn_parameters.hpp:77
int IndifferenceRadius() const noexcept
Gets the radius (L1 norm!) around a positive instance from which no counter sample is to be extracted...
Definition: learn_parameters.hpp:193
void SetIndifferenceRadius(int indifferenceRadius)
Sets the radius (L1 norm!) around a positive instance from which no counter sample is to be extracted...
Definition: learn_parameters.hpp:203
int ContrastTrigger() const noexcept
Gets the minimum gray value difference the two regions of one pair feature must have to be eligible t...
Definition: learn_parameters.hpp:169
int MinFeatureCount() const noexcept
Gets the minimum feature count defining, how many features must be extracted at the very least per cl...
Definition: learn_parameters.hpp:97
static double NegativeDensityDefault() noexcept
Default value for the NegativeDensity.
Definition: learn_parameters.hpp:47
int Polydromy() const noexcept
Gets the polydromy value controlling the complexity of the feature search tree in the classifier.
Definition: learn_parameters.hpp:121
static int EnsembleSizeDefault() noexcept
Default value for the EnsembleSize.
Definition: learn_parameters.hpp:67
int EnsembleSize() const noexcept
Gets the maximum size of the Ensembles of similar instance images to be used for pair feature calcula...
Definition: learn_parameters.hpp:145
void SetContrastTrigger(int contrastTrigger)
Sets the minimum gray value difference the two regions of one pair feature must have to be eligible t...
Definition: learn_parameters.hpp:179
void SetMinFeatureCount(int minFeatureCount)
Sets the minimum feature count defining, how many features must be extracted at the very least per cl...
Definition: learn_parameters.hpp:107
void SetNegativeDensity(double negativeDensity)
Sets the density at which counter samples are extracted from the training set images during the learn...
Definition: learn_parameters.hpp:227
static int IndifferenceRadiusDefault() noexcept
Default value for the IndifferenceRadius.
Definition: learn_parameters.hpp:37
static int MinFeatureCountDefault() noexcept
Default value for the MinFeatureCount.
Definition: learn_parameters.hpp:87
double NegativeDensity() const noexcept
Gets the density at which counter samples are extracted from the training set images during the learn...
Definition: learn_parameters.hpp:217
void SetPolydromy(int polydromy)
Sets the polydromy value controlling the complexity of the feature search tree in the classifier....
Definition: learn_parameters.hpp:131
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24