CVB++ 15.0
learn_parameters.hpp
1#pragma once
2
3#include "../_cexports/c_minos.h"
4
5#include "../global.hpp"
6
7namespace Cvb
8{
9 CVB_BEGIN_INLINE_NS
10
12 namespace Minos
13 {
14
16
18 class LearnParameters
19 {
20 public:
21 LearnParameters(int minFeatureCount, int polydromy, int ensembleSize, int contrastTrigger, int indifferenceRadius,
22 double negativeDensity) noexcept
23 : minFeatureCount_(minFeatureCount)
24 , polydromy_(polydromy)
25 , ensembleSize_(ensembleSize)
26 , contrastTrigger_(contrastTrigger)
27 , indifferenceRadius_(indifferenceRadius)
28 , negativeDensity_(negativeDensity)
29 {
30 }
31
32 LearnParameters() noexcept
33 : minFeatureCount_(MinFeatureCountDefault())
34 , polydromy_(PolydromyDefault())
35 , ensembleSize_(EnsembleSizeDefault())
36 , contrastTrigger_(ContrastTriggerDefault())
37 , indifferenceRadius_(IndifferenceRadiusDefault())
38 , negativeDensity_(NegativeDensityDefault())
39 {
40 }
41
42 public:
44
48 static int IndifferenceRadiusDefault() noexcept
49 {
50 return 6;
51 }
52
54
58 static double NegativeDensityDefault() noexcept
59 {
60 return 1.0;
61 }
62
64
68 static int ContrastTriggerDefault() noexcept
69 {
70 return 8;
71 }
72
74
78 static int EnsembleSizeDefault() noexcept
79 {
80 return 15;
81 }
82
84
88 static int PolydromyDefault() noexcept
89 {
90 return 2;
91 }
92
94
98 static int MinFeatureCountDefault() noexcept
99 {
100 return 50;
101 }
102
105
109 int MinFeatureCount() const noexcept
110 {
111 return minFeatureCount_;
112 }
113
116
120 void SetMinFeatureCount(int minFeatureCount)
121 {
122 if (minFeatureCount < 1)
123 {
124 throw std::invalid_argument("minimum feature count value must be >0");
125 }
126 minFeatureCount_ = minFeatureCount;
127 }
128
130
134 int Polydromy() const noexcept
135 {
136 return polydromy_;
137 }
138
141
145 void SetPolydromy(int polydromy)
146 {
147 if (polydromy < 1)
148 {
149 throw std::invalid_argument("polydromy value must be >0");
150 }
151 polydromy_ = polydromy;
152 }
153
156
160 int EnsembleSize() const noexcept
161 {
162 return ensembleSize_;
163 }
164
167
171 void SetEnsembleSize(int ensembleSize)
172 {
173 if (ensembleSize < 1)
174 {
175 throw std::invalid_argument("ensemble size value must be >0");
176 }
177 ensembleSize_ = ensembleSize;
178 }
179
182
186 int ContrastTrigger() const noexcept
187 {
188 return contrastTrigger_;
189 }
190
193
197 void SetContrastTrigger(int contrastTrigger)
198 {
199 if (contrastTrigger < 1)
200 {
201 throw std::invalid_argument("contrast trigger value must be >0");
202 }
203 contrastTrigger_ = contrastTrigger;
204 }
205
207
211 int IndifferenceRadius() const noexcept
212 {
213 return indifferenceRadius_;
214 }
215
218
222 void SetIndifferenceRadius(int indifferenceRadius)
223 {
224 if (indifferenceRadius < 1)
225 {
226 throw std::invalid_argument("indifference radius value must be >0");
227 }
228 indifferenceRadius_ = indifferenceRadius;
229 }
230
233
237 double NegativeDensity() const noexcept
238 {
239 return negativeDensity_;
240 }
241
244
248 void SetNegativeDensity(double negativeDensity)
249 {
250 if (negativeDensity < 0.0 || negativeDensity > 1.0)
251 {
252 throw std::invalid_argument("negative density value must be in [0.0, 1.0]");
253 }
254 negativeDensity_ = negativeDensity;
255 }
256
257 private:
258 int minFeatureCount_;
259 int polydromy_;
260 int ensembleSize_;
261 int contrastTrigger_;
262 int indifferenceRadius_;
263 double negativeDensity_;
264 };
265
266 } /* namespace Minos */
267 CVB_END_INLINE_NS
268} /* namespace Cvb */
static int ContrastTriggerDefault() noexcept
Default value for the ContrastTrigger.
Definition learn_parameters.hpp:68
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:171
static int PolydromyDefault() noexcept
Default value for the Polydromy.
Definition learn_parameters.hpp:88
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:211
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:222
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:186
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:109
static double NegativeDensityDefault() noexcept
Default value for the NegativeDensity.
Definition learn_parameters.hpp:58
int Polydromy() const noexcept
Gets the polydromy value controlling the complexity of the feature search tree in the classifier.
Definition learn_parameters.hpp:134
static int EnsembleSizeDefault() noexcept
Default value for the EnsembleSize.
Definition learn_parameters.hpp:78
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:160
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:197
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:120
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:248
static int IndifferenceRadiusDefault() noexcept
Default value for the IndifferenceRadius.
Definition learn_parameters.hpp:48
static int MinFeatureCountDefault() noexcept
Default value for the MinFeatureCount.
Definition learn_parameters.hpp:98
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:237
void SetPolydromy(int polydromy)
Sets the polydromy value controlling the complexity of the feature search tree in the classifier....
Definition learn_parameters.hpp:145
Namespace for the Minos package.
Definition classifier.hpp:29
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17