123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- /**
- * @file VCPreRandomForest.h
- * @brief Combination of a classifier with a pre-clustering using a random forest
- * @author Erik Rodner
- * @date 06/17/2010
- */
- #ifndef VCPRERANDOMFORESTINCLUDE
- #define VCPRERANDOMFORESTINCLUDE
- #include "core/vector/VectorT.h"
- #include "core/vector/MatrixT.h"
- #include "core/image/ImageT.h"
- #include "core/imagedisplay/ImageDisplay.h"
- #include <map>
- #include "vislearning/cbaselib/LabeledSet.h"
- #include "vislearning/classifier/classifierbase/VecClassifier.h"
- #include "vislearning/classifier/fpclassifier/randomforest/FPCRandomForests.h"
- #define ROADWORKS fthrow(Exception,"VCPreRandomForest: not yet implemented.");
- namespace OBJREC {
- /** Combination of a classifier with a pre-clustering using a random forest */
- class VCPreRandomForest : public VecClassifier
- {
- protected:
- /** the classifier prototype used to classify
- all examples in a leaf */
- VecClassifier *leafClassifierPrototype;
- /** classifiers of each leaf */
- std::map<DecisionNode *, VecClassifier *> leafClassifiers;
- /** the random forest used to pre-cluster the features */
- FPCRandomForests *randomforest;
- /** feature pool needed for the random forest */
- FeaturePool fp;
-
- /** maximum number of Examples in a leaf*/
- int mEx;
- public:
-
- /** simple constructor */
- VCPreRandomForest( const NICE::Config *conf, const std::string & section, VecClassifier *leafClassifier );
-
- /** simple destructor */
- virtual ~VCPreRandomForest();
-
- /** classify using simple vector */
- ClassificationResult classify ( const NICE::Vector & x ) const;
- /** teach the classifier using a training set */
- void teach ( const LabeledSetVector & teachSet );
-
- void finishTeaching() { /* nothing to do */ };
- void clear();
- void store ( std::ostream & os, int format = 0 ) const {
- #if 0
- // not working yet, no store functino for DecisionNode
- os << leafClassifiers.size() << endl;
- std::map<DecisionNode *, VecClassifier *>::iterator iter;
-
- for( iter = leafClassifiers.begin(); iter != leafClassifiers.end(); ++iter )
- {
- iter->first->store(os,format);
- iter->second->store(os,format);
- }
-
- randomforest->store(os,format);
- leafClassifierPrototype->store(os,format);
- #endif
-
- };
- void restore ( std::istream & is, int format = 0 ) {
- #if 0
- // not working yet, no restore function for DecisionNode, no idea how generic classifier restore
- int size;
- is >> size;
-
- for(int i = 0; i < size; i++)
- {
- DecisionNode *dn = new DecisionNode();
- dn->restore(is);
- VecClassifier *
- }
- #endif
- };
- };
- } // namespace
- #undef ROADWORKS
- #endif
|