Commit 316dfecc61fa2a079b239c8d57358462a8c50f1a
1 parent
b51e4c55
Exposed CvBoost type param
Showing
2 changed files
with
12 additions
and
3 deletions
openbr/core/boost.cpp
| @@ -172,7 +172,7 @@ CascadeBoostParams::CascadeBoostParams( int _boostType, | @@ -172,7 +172,7 @@ CascadeBoostParams::CascadeBoostParams( int _boostType, | ||
| 172 | double _weightTrimRate, int _maxDepth, int _maxWeakCount ) : | 172 | double _weightTrimRate, int _maxDepth, int _maxWeakCount ) : |
| 173 | CvBoostParams( _boostType, _maxWeakCount, _weightTrimRate, _maxDepth, false, 0 ) | 173 | CvBoostParams( _boostType, _maxWeakCount, _weightTrimRate, _maxDepth, false, 0 ) |
| 174 | { | 174 | { |
| 175 | - boost_type = CvBoost::GENTLE; | 175 | + boost_type = _boostType; |
| 176 | minHitRate = _minHitRate; | 176 | minHitRate = _minHitRate; |
| 177 | maxFalseAlarm = _maxFalseAlarm; | 177 | maxFalseAlarm = _maxFalseAlarm; |
| 178 | use_surrogates = use_1se_rule = truncate_pruned_tree = false; | 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,6 +89,7 @@ static void writeRecursive(FileStorage &fs, const Node *node, int maxCatCount) | ||
| 89 | class BoostedForestClassifier : public Classifier | 89 | class BoostedForestClassifier : public Classifier |
| 90 | { | 90 | { |
| 91 | Q_OBJECT | 91 | Q_OBJECT |
| 92 | + Q_ENUMS(Type) | ||
| 92 | 93 | ||
| 93 | Q_PROPERTY(br::Representation *representation READ get_representation WRITE set_representation RESET reset_representation STORED false) | 94 | Q_PROPERTY(br::Representation *representation READ get_representation WRITE set_representation RESET reset_representation STORED false) |
| 94 | Q_PROPERTY(float minTAR READ get_minTAR WRITE set_minTAR RESET reset_minTAR STORED false) | 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,20 +97,28 @@ class BoostedForestClassifier : public Classifier | ||
| 96 | Q_PROPERTY(float trimRate READ get_trimRate WRITE set_trimRate RESET reset_trimRate STORED false) | 97 | Q_PROPERTY(float trimRate READ get_trimRate WRITE set_trimRate RESET reset_trimRate STORED false) |
| 97 | Q_PROPERTY(int maxDepth READ get_maxDepth WRITE set_maxDepth RESET reset_maxDepth STORED false) | 98 | Q_PROPERTY(int maxDepth READ get_maxDepth WRITE set_maxDepth RESET reset_maxDepth STORED false) |
| 98 | Q_PROPERTY(int maxWeakCount READ get_maxWeakCount WRITE set_maxWeakCount RESET reset_maxWeakCount STORED false) | 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 | BR_PROPERTY(br::Representation *, representation, NULL) | 108 | BR_PROPERTY(br::Representation *, representation, NULL) |
| 101 | BR_PROPERTY(float, minTAR, 0.995) | 109 | BR_PROPERTY(float, minTAR, 0.995) |
| 102 | BR_PROPERTY(float, maxFAR, 0.5) | 110 | BR_PROPERTY(float, maxFAR, 0.5) |
| 103 | BR_PROPERTY(float, trimRate, 0.95) | 111 | BR_PROPERTY(float, trimRate, 0.95) |
| 104 | BR_PROPERTY(int, maxDepth, 1) | 112 | BR_PROPERTY(int, maxDepth, 1) |
| 105 | BR_PROPERTY(int, maxWeakCount, 100) | 113 | BR_PROPERTY(int, maxWeakCount, 100) |
| 114 | + BR_PROPERTY(Type, type, Gentle) | ||
| 106 | 115 | ||
| 107 | QList<Node*> classifiers; | 116 | QList<Node*> classifiers; |
| 108 | float threshold; | 117 | float threshold; |
| 109 | 118 | ||
| 110 | void train(const QList<Mat> &images, const QList<float> &labels) | 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 | FeatureEvaluator featureEvaluator; | 123 | FeatureEvaluator featureEvaluator; |
| 115 | featureEvaluator.init(representation, images.size()); | 124 | featureEvaluator.init(representation, images.size()); |