|
@@ -8,18 +8,12 @@
|
|
|
#ifndef CodebookRandomForestINCLUDE
|
|
|
#define CodebookRandomForestINCLUDE
|
|
|
|
|
|
-//#ifdef NOVISUAL
|
|
|
-//#include <objrec/nice_nonvis.h>
|
|
|
-//#else
|
|
|
-//#include <objrec/nice.h>
|
|
|
-//#endif
|
|
|
-
|
|
|
-#include <string>
|
|
|
|
|
|
#include "core/vector/VVector.h"
|
|
|
#include "vislearning/features/simplefeatures/Codebook.h"
|
|
|
#include "vislearning/classifier/fpclassifier/randomforest/FPCRandomForests.h"
|
|
|
|
|
|
+#include <string>
|
|
|
|
|
|
namespace OBJREC {
|
|
|
|
|
@@ -73,24 +67,40 @@ class CodebookRandomForest : public Codebook
|
|
|
/**
|
|
|
* not supported, please use one of the other vote functions
|
|
|
*/
|
|
|
- void vote ( const NICE::Vector & feature,
|
|
|
- int & codebookEntry, double & weight, double & distance ) const;
|
|
|
-
|
|
|
- void vote ( const NICE::Vector & feature, NICE::Vector & histogram,
|
|
|
- int & codebookEntry, double & weight, double & distance ) const;
|
|
|
+ void vote ( const NICE::Vector & feature, int & codebookEntry, double & weight, double & distance ) const;
|
|
|
+ virtual void voteVQ ( const NICE::Vector & feature, int & codebookEntry, double & weight, double & distance ) const
|
|
|
+ {
|
|
|
+ this->vote(feature,codebookEntry, weight, distance);
|
|
|
+ }
|
|
|
+
|
|
|
+ void vote ( const NICE::Vector & feature, NICE::Vector & histogram, int & codebookEntry, double & weight, double & distance ) const;
|
|
|
+ virtual void voteVQ (const NICE::Vector &feature, NICE::Vector &histogram, int & codebookEntry, double & weight, double & distance ) const {
|
|
|
+ this->vote(feature, histogram, codebookEntry, weight, distance);
|
|
|
+ }
|
|
|
+ virtual void voteVA ( const NICE::Vector & feature, NICE::Vector & votes ) const {
|
|
|
+ int codebookEntry = 0;
|
|
|
+ double weight = 0.0f;
|
|
|
+ double distance = 0.0f;
|
|
|
+ this->vote(feature, votes, codebookEntry, weight, distance);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/** this is the preferred voting interface for this codebook */
|
|
|
void vote ( const NICE::Vector & feature, NICE::SparseVector & votes ) const;
|
|
|
|
|
|
/** normal codebook voting, but additionally returns a probability distribution for the class label **/
|
|
|
void voteAndClassify ( const NICE::Vector & feature, NICE::SparseVector & votes, FullVector & distribution ) const;
|
|
|
+ virtual void voteVA ( const NICE::Vector & feature, NICE::SparseVector & votes ) const {
|
|
|
+ this->vote(feature, votes);
|
|
|
+ }
|
|
|
|
|
|
/** this codebook method gives multiple votes for each local feature (depending
|
|
|
on the number of decision trees in the forest */
|
|
|
- bool allowsMultipleVoting () { return true; };
|
|
|
+ bool allowsMultipleVoting () { return true; }
|
|
|
|
|
|
/** get the random forest for direct access */
|
|
|
- FPCRandomForests *getRandomForest (void) { return clusterforest; };
|
|
|
+ FPCRandomForests *getRandomForest (void) { return clusterforest; }
|
|
|
|
|
|
void add ( const Codebook *codebook );
|
|
|
void copy ( const Codebook *codebook );
|