Commit fe4366bcfb8c4b464e6ec450dd70d1548abc9502
1 parent
3f516c6d
Train, store, and load representations as necessary
Showing
1 changed file
with
6 additions
and
0 deletions
openbr/plugins/classification/boostedforest.cpp
| @@ -106,6 +106,8 @@ class BoostedForestClassifier : public Classifier | @@ -106,6 +106,8 @@ class BoostedForestClassifier : public Classifier | ||
| 106 | 106 | ||
| 107 | void train(const QList<Mat> &images, const QList<float> &labels) | 107 | void train(const QList<Mat> &images, const QList<float> &labels) |
| 108 | { | 108 | { |
| 109 | + representation->train(images, labels); | ||
| 110 | + | ||
| 109 | CascadeBoostParams params(CvBoost::GENTLE, minTAR, maxFAR, trimRate, maxDepth, maxWeakCount); | 111 | CascadeBoostParams params(CvBoost::GENTLE, minTAR, maxFAR, trimRate, maxDepth, maxWeakCount); |
| 110 | 112 | ||
| 111 | FeatureEvaluator featureEvaluator; | 113 | FeatureEvaluator featureEvaluator; |
| @@ -180,6 +182,8 @@ class BoostedForestClassifier : public Classifier | @@ -180,6 +182,8 @@ class BoostedForestClassifier : public Classifier | ||
| 180 | 182 | ||
| 181 | void load(QDataStream &stream) | 183 | void load(QDataStream &stream) |
| 182 | { | 184 | { |
| 185 | + representation->load(stream); | ||
| 186 | + | ||
| 183 | stream >> threshold; | 187 | stream >> threshold; |
| 184 | int numClassifiers; stream >> numClassifiers; | 188 | int numClassifiers; stream >> numClassifiers; |
| 185 | for (int i = 0; i < numClassifiers; i++) { | 189 | for (int i = 0; i < numClassifiers; i++) { |
| @@ -191,6 +195,8 @@ class BoostedForestClassifier : public Classifier | @@ -191,6 +195,8 @@ class BoostedForestClassifier : public Classifier | ||
| 191 | 195 | ||
| 192 | void store(QDataStream &stream) const | 196 | void store(QDataStream &stream) const |
| 193 | { | 197 | { |
| 198 | + representation->store(stream); | ||
| 199 | + | ||
| 194 | stream << threshold; | 200 | stream << threshold; |
| 195 | stream << classifiers.size(); | 201 | stream << classifiers.size(); |
| 196 | foreach (const Node *classifier, classifiers) | 202 | foreach (const Node *classifier, classifiers) |