Commit 316dfecc61fa2a079b239c8d57358462a8c50f1a

Authored by Scott Klum
1 parent b51e4c55

Exposed CvBoost type param

openbr/core/boost.cpp
... ... @@ -172,7 +172,7 @@ CascadeBoostParams::CascadeBoostParams( int _boostType,
172 172 double _weightTrimRate, int _maxDepth, int _maxWeakCount ) :
173 173 CvBoostParams( _boostType, _maxWeakCount, _weightTrimRate, _maxDepth, false, 0 )
174 174 {
175   - boost_type = CvBoost::GENTLE;
  175 + boost_type = _boostType;
176 176 minHitRate = _minHitRate;
177 177 maxFalseAlarm = _maxFalseAlarm;
178 178 use_surrogates = use_1se_rule = truncate_pruned_tree = false;
... ...
openbr/plugins/classification/boostedforest.cpp
... ... @@ -89,6 +89,7 @@ static void writeRecursive(FileStorage &fs, const Node *node, int maxCatCount)
89 89 class BoostedForestClassifier : public Classifier
90 90 {
91 91 Q_OBJECT
  92 + Q_ENUMS(Type)
92 93  
93 94 Q_PROPERTY(br::Representation *representation READ get_representation WRITE set_representation RESET reset_representation STORED false)
94 95 Q_PROPERTY(float minTAR READ get_minTAR WRITE set_minTAR RESET reset_minTAR STORED false)
... ... @@ -96,20 +97,28 @@ class BoostedForestClassifier : public Classifier
96 97 Q_PROPERTY(float trimRate READ get_trimRate WRITE set_trimRate RESET reset_trimRate STORED false)
97 98 Q_PROPERTY(int maxDepth READ get_maxDepth WRITE set_maxDepth RESET reset_maxDepth STORED false)
98 99 Q_PROPERTY(int maxWeakCount READ get_maxWeakCount WRITE set_maxWeakCount RESET reset_maxWeakCount STORED false)
99   -
  100 + Q_PROPERTY(Type type READ get_type WRITE set_type RESET reset_type STORED false)
  101 +
  102 +public:
  103 + enum Type { Discrete = CvBoost::DISCRETE,
  104 + Real = CvBoost::REAL,
  105 + Logit = CvBoost::LOGIT,
  106 + Gentle = CvBoost::GENTLE};
  107 +private:
100 108 BR_PROPERTY(br::Representation *, representation, NULL)
101 109 BR_PROPERTY(float, minTAR, 0.995)
102 110 BR_PROPERTY(float, maxFAR, 0.5)
103 111 BR_PROPERTY(float, trimRate, 0.95)
104 112 BR_PROPERTY(int, maxDepth, 1)
105 113 BR_PROPERTY(int, maxWeakCount, 100)
  114 + BR_PROPERTY(Type, type, Gentle)
106 115  
107 116 QList<Node*> classifiers;
108 117 float threshold;
109 118  
110 119 void train(const QList<Mat> &images, const QList<float> &labels)
111 120 {
112   - CascadeBoostParams params(CvBoost::GENTLE, minTAR, maxFAR, trimRate, maxDepth, maxWeakCount);
  121 + CascadeBoostParams params(type, minTAR, maxFAR, trimRate, maxDepth, maxWeakCount);
113 122  
114 123 FeatureEvaluator featureEvaluator;
115 124 featureEvaluator.init(representation, images.size());
... ...