Prechádzať zdrojové kódy

Merge branch 'master' of dbv.inf-cv.uni-jena.de:nice/nice-semseg

Johannes Ruehle 11 rokov pred
rodič
commit
518eade771

+ 12 - 4
progs/testSemanticSegmentation.cpp

@@ -11,19 +11,27 @@
 #include <omp.h>
 #endif
 
-#include "core/basics/Config.h"
-#include "core/basics/StringTools.h"
+// STL includes
+#include <fstream>
+
+// nice-core includes
+#include <core/basics/Config.h>
+#include <core/basics/StringTools.h>
+#include <core/basics/ResourceStatistics.h>
+
+// nice-vislearning includes
 #include <vislearning/baselib/ICETools.h>
 
+// nice-semseg includes
 #include <semseg/semseg/SemanticSegmentation.h>
 #include <semseg/semseg/SemSegLocal.h>
 #include <semseg/semseg/SemSegCsurka.h>
 #include <semseg/semseg/SemSegNovelty.h>
 #include <semseg/semseg/SemSegContextTree.h>
 
-#include <core/basics/ResourceStatistics.h>
 
-#include <fstream>
+
+
 
 using namespace OBJREC;
 

+ 7 - 2
semseg/SemSegContextTree.cpp

@@ -31,7 +31,7 @@ SemSegContextTree::SemSegContextTree (const Config *conf, const MultiDataset *md
 {
   this->conf = conf;
   string section = "SSContextTree";
-  lfcw = new LFColorWeijer (conf);
+  lfcw = new LocalFeatureColorWeijer (conf);
   firstiteration = true;
 
   maxSamples = conf->gI (section, "max_samples", 2000);
@@ -1181,7 +1181,12 @@ void SemSegContextTree::train (const MultiDataset *md)
       }
     }
 
-    fasthik->train(globalCategorFeats, ys);
+    //NOTE
+    // Compiler doesn't know how to automatically convert
+    // std::vector<T*> to std::vector<T const*> because the way
+    // the template system works means that in theory the two may
+    // be specialised differently.  This is an explicit conversion.
+    fasthik->train( reinterpret_cast<vector<const NICE::SparseVector *>&>(globalCategorFeats), ys);
     
   }
   

+ 15 - 5
semseg/SemSegContextTree.h

@@ -8,14 +8,24 @@
 #ifndef SemSegContextTreeINCLUDE
 #define SemSegContextTreeINCLUDE
 
-#include "SemanticSegmentation.h"
+// nice-core includes
 #include <core/vector/VVector.h>
-#include "vislearning/features/localfeatures/LFColorWeijer.h"
-#include "segmentation/RegionSegmentationMethod.h"
 
+// nice-gphik-core includes
+#include <gp-hik-exp/GPHIKClassifierNICE.h>
+
+// nice-vislearning includes
+#include <vislearning/features/localfeatures/LocalFeatureColorWeijer.h>
+
+// nice-segmentation includes
+#include <segmentation/RegionSegmentationMethod.h>
+
+
+// nice-semseg includes
 #include "semseg/semseg/operations/Operations.h"
+#include "SemanticSegmentation.h"
+
 
-#include "gp-hik-exp/GPHIKClassifierNICE.h"
 
 namespace OBJREC {
 
@@ -30,7 +40,7 @@ class SemSegContextTree : public SemanticSegmentation, public NICE::Persistent
     std::vector<std::vector<TreeNode> > forest;
 
     /** local features */
-    LFColorWeijer *lfcw;
+    LocalFeatureColorWeijer *lfcw;
 
     /** number of featuretype -> currently: local and context features = 2 */
     int ftypes;

+ 2 - 2
semseg/SemSegCsurka.cpp

@@ -633,7 +633,7 @@ void SemSegCsurka::train ( const MultiDataset *md )
   }
 
   // additional Colorfeatures
-  LFColorWeijer lcw ( conf );
+  LocalFeatureColorWeijer lcw ( conf );
 
   int lfdimension = -1;
 
@@ -1348,7 +1348,7 @@ void SemSegCsurka::classifyregions ( CachedExample *ce, NICE::Image & segresult,
 
 
   // additional Colorfeatures
-  LFColorWeijer lcw ( conf );
+  LocalFeatureColorWeijer lcw ( conf );
 
   NICE::ColorImage img;
 

+ 1 - 1
semseg/SemSegCsurka.h

@@ -14,7 +14,7 @@
 #include "vislearning/features/localfeatures/GenericLocalFeatureSelection.h"
 #include "vislearning/features/localfeatures/LFonHSG.h"
 #include "vislearning/features/localfeatures/LFColorSande.h"
-#include "vislearning/features/localfeatures/LFColorWeijer.h"
+#include "vislearning/features/localfeatures/LocalFeatureColorWeijer.h"
 #include "vislearning/features/localfeatures/LFReadCache.h"
 #include "vislearning/features/localfeatures/LFWriteCache.h"
 #include "vislearning/cbaselib/VectorFeature.h"

+ 2 - 2
semseg/SemSegNovelty.cpp

@@ -29,7 +29,7 @@ SemSegNovelty::SemSegNovelty ( const Config *conf,
   
   string section = "SemSegNovelty";
 
-  featExtract = new LFColorWeijer ( conf );
+  featExtract = new LocalFeatureColorWeijer ( conf );
 
   this->reuseSegmentation = conf->gB ( "FPCPixel", "reuseSegmentation", true ); //save and read segmentation results from files
   this->save_classifier = conf->gB ( "FPCPixel", "save_classifier", true ); //save the classifier to a file
@@ -666,7 +666,7 @@ void SemSegNovelty::semanticseg ( CachedExample *ce, NICE::Image & segresult, NI
               if ( forbidden_classesActiveLearning.find(classnoTmp) != forbidden_classesActiveLearning.end() )
                 continue;
               
-              Example example;
+              Example example(NULL, x, y);
               example.vec = NULL;
               example.svec = new SparseVector ( featdim );
               

+ 2 - 2
semseg/SemSegNovelty.h

@@ -12,7 +12,7 @@
 #include "SemSegTools.h"
 #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
 #include "vislearning/classifier/genericClassifierSelection.h"
-#include "vislearning/features/localfeatures/LFColorWeijer.h"
+#include "vislearning/features/localfeatures/LocalFeatureColorWeijer.h"
 
 #include "segmentation/RegionSegmentationMethod.h"
 
@@ -42,7 +42,7 @@ class SemSegNovelty : public SemanticSegmentation
     VecClassifier *vclassifier;
     
     //! feature extraction
-    LFColorWeijer *featExtract;
+    LocalFeatureColorWeijer *featExtract;
     
     //! Configuration File
     const NICE::Config *conf;

+ 1 - 1
semseg/SemSegNoveltyBinary.cpp

@@ -29,7 +29,7 @@ SemSegNoveltyBinary::SemSegNoveltyBinary ( const Config *conf,
   
   string section = "SemSegNoveltyBinary";
 
-  featExtract = new LFColorWeijer ( conf );
+  featExtract = new LocalFeatureColorWeijer ( conf );
 
   this->reuseSegmentation = conf->gB ( "FPCPixel", "reuseSegmentation", true ); //save and read segmentation results from files
   this->save_classifier = conf->gB ( "FPCPixel", "save_classifier", true ); //save the classifier to a file

+ 2 - 2
semseg/SemSegNoveltyBinary.h

@@ -12,7 +12,7 @@
 #include "SemSegTools.h"
 #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
 #include "vislearning/classifier/genericClassifierSelection.h"
-#include "vislearning/features/localfeatures/LFColorWeijer.h"
+#include "vislearning/features/localfeatures/LocalFeatureColorWeijer.h"
 #include "vislearning/cbaselib/ClassificationResults.h"
 
 #include "segmentation/RegionSegmentationMethod.h"
@@ -43,7 +43,7 @@ class SemSegNoveltyBinary : public SemanticSegmentation
     VecClassifier *vclassifier;
     
     //! feature extraction
-    LFColorWeijer *featExtract;
+    LocalFeatureColorWeijer *featExtract;
     
     //! Configuration File
     const NICE::Config *conf;