Преглед на файлове

updated Extreme Randomized Clustering Forest

Johannes Ruehle преди 11 години
родител
ревизия
3ab95f2ca3
променени са 3 файла, в които са добавени 28 реда и са изтрити 21 реда
  1. 4 2
      features/simplefeatures/Codebook.h
  2. 0 5
      features/simplefeatures/CodebookRandomForest.cpp
  3. 24 14
      features/simplefeatures/CodebookRandomForest.h

+ 4 - 2
features/simplefeatures/Codebook.h

@@ -119,13 +119,15 @@ namespace OBJREC {
         
         
         //for backward-compatibility
-        virtual void   vote (const NICE::Vector &feature, NICE::Vector &histogram, int &codebookEntry , double &weight , double &distance ) const { this->voteVQ ( feature, histogram, codebookEntry, weight, distance ); };
+        virtual void   vote (const NICE::Vector &feature, NICE::Vector &histogram, int &codebookEntry , double &weight , double &distance ) const {
+            this->voteVQ ( feature, histogram, codebookEntry, weight, distance );
+        }
         
         virtual void   vote (const NICE::Vector &feature, NICE::SparseVector &histogram ) const {
           int codebookEntry;
           double weight, distance;
           this->voteVQ ( feature, histogram, codebookEntry, weight, distance );          
-        };        
+        }
    
         
         

+ 0 - 5
features/simplefeatures/CodebookRandomForest.cpp

@@ -5,11 +5,6 @@
 * @date 02/15/2008
 
 */
-//#ifdef NOVISUAL
-//#include <objrec/nice_nonvis.h>
-//#else
-//#include <objrec/nice.h>
-//#endif
 
 #include <queue>
 #include <iostream>

+ 24 - 14
features/simplefeatures/CodebookRandomForest.h

@@ -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 );