Explorar o código

result images as ImageT<int>

Sven Sickert %!s(int64=9) %!d(string=hai) anos
pai
achega
1bed099596

+ 3 - 3
progs/testActiveSemanticSegmentation.cpp

@@ -34,7 +34,7 @@ using namespace NICE;
 
 using namespace std;
 
-void updateMatrix( const NICE::Image & img, const NICE::Image & gt,
+void updateMatrix( const NICE::ImageT<int> & img, const NICE::ImageT<int> & gt,
                    NICE::Matrix & M, const set<int> & forbidden_classes )
 {
   double subsamplex = gt.width() / ( double )img.width();
@@ -156,7 +156,7 @@ int main( int argc, char **argv )
       EACH_INFO( classno, info );
       std::string file = info.img();
 
-      NICE::Image lm;
+      NICE::ImageT<int> lm;
       NICE::MultiChannelImageT<double> probabilities;
 
       if ( info.hasLocalizationInfo() )
@@ -174,7 +174,7 @@ int main( int argc, char **argv )
 
       //ground truth image, needed for updating the confusion matrix
       //TODO check whether this is really needed, since we computed such a label image already within SemSegNovelty
-      NICE::Image lm_gt;
+      NICE::ImageT<int> lm_gt;
 
       if ( info.hasLocalizationInfo() )
       {

+ 2 - 2
progs/testActiveSemanticSegmentationBinary.cpp

@@ -140,7 +140,7 @@ int main( int argc, char **argv )
       EACH_INFO( classno, info );
       std::string file = info.img();
 
-      NICE::Image lm;
+      NICE::ImageT<int> lm;
       NICE::MultiChannelImageT<double> probabilities;
 
       if ( info.hasLocalizationInfo() )
@@ -158,7 +158,7 @@ int main( int argc, char **argv )
 
       //ground truth image, needed for updating the confusion matrix
       //TODO check whether this is really needed, since we computed such a label image already within SemSegNovelty
-      NICE::Image lm_gt;
+      NICE::ImageT<int> lm_gt;
 
       if ( info.hasLocalizationInfo() )
       {

+ 22 - 8
progs/testSemSegObliqueTrees.cpp

@@ -33,8 +33,23 @@ int main ( int argc, char **argv )
     classNames.getSelection ( conf.gS ( "analysis", "forbidden_classes", "" ),
                               forbiddenClasses );
 
-    NICE::Matrix M ( classNames.getMaxClassno() + 1,
-                     classNames.getMaxClassno() + 1 );
+    std::vector<bool> usedClasses ( classNames.numClasses(), true );
+    for ( std::set<int>::const_iterator it = forbiddenClasses.begin();
+          it != forbiddenClasses.end(); ++it)
+    {
+        usedClasses [ *it ] = false;
+    }
+
+    std::map<int,int> classMapping;
+    int j = 0;
+    for ( int i = 0; i < usedClasses.size(); i++ )
+        if (usedClasses[i])
+        {
+            classMapping[i] = j;
+            j++;
+        }
+
+    NICE::Matrix M ( classMapping.size(), classMapping.size() );
     M.set( 0 );
 
     // initialize semantic segmentation method
@@ -60,7 +75,7 @@ int main ( int argc, char **argv )
             ImageInfo & info = *(*jt);
             std::string file = info.img();
 
-            NICE::Image segresult, gtruth;
+            NICE::ImageT<int> segresult, gtruth;
             if ( info.hasLocalizationInfo() )
             {
                 const LocalizationResult *l_gt = info.localization();
@@ -89,14 +104,13 @@ int main ( int argc, char **argv )
             // post processing results
             if (postProcessing)
             {
-                NICE::Image postIm(segresult.width(), segresult.height());
-                NICE::median(segresult, &postIm, 1);
-                segresult = postIm;
+                std::cerr << "testSemSegConvTrees: WARNING: Post processing not yet supported."
+                          << std::endl;
             }
 
             // updating confusion matrix
-            SemSegTools::updateConfusionMatrix (
-                        segresult, gtruth, M, forbiddenClasses );
+            SemSegTools::updateConfusionMatrix ( segresult, gtruth, M,
+                forbiddenClasses, classMapping );
 
             // saving results to image file
             NICE::ColorImage rgb;

+ 3 - 3
progs/testSemanticSegmentation.cpp

@@ -39,7 +39,7 @@ using namespace NICE;
 
 using namespace std;
 
-void updateMatrix( const NICE::Image & img, const NICE::Image & gt,
+void updateMatrix( const NICE::ImageT<int> & img, const NICE::ImageT<int> & gt,
                    NICE::Matrix & M, const set<int> & forbidden_classes )
 {
   double subsamplex = gt.width() / ( double )img.width();
@@ -142,7 +142,7 @@ int main( int argc, char **argv )
     EACH_INFO( classno, info );
     std::string file = info.img();
 
-    NICE::Image lm;
+    NICE::ImageT<int> lm;
     NICE::MultiChannelImageT<double> probabilities;
 
     if ( info.hasLocalizationInfo() )
@@ -158,7 +158,7 @@ int main( int argc, char **argv )
 
     fprintf( stderr, "testSemanticSegmentation: Segmentation finished !\n" );
 
-    NICE::Image lm_gt;
+    NICE::ImageT<int> lm_gt;
 
     if ( info.hasLocalizationInfo() )
     {

+ 2 - 1
progs/testSemanticSegmentation3D.cpp

@@ -164,7 +164,8 @@ void startClassification (SemanticSegmentation *semseg,
           // confusion matrix
           NICE::Matrix M ( classMapping.size(), classMapping.size() );
           M.set ( 0 );
-          updateMatrix ( lm, lm_gt, M, forbidden_classes, classMapping );
+          SemSegTools::updateConfusionMatrix ( lm, lm_gt, M, forbidden_classes,
+                                               classMapping );
           M_vec.push_back ( M );
 
           classNames.labelToRGB ( lm, rgb );

+ 1 - 1
semseg/SemSegContextTree.cpp

@@ -1375,7 +1375,7 @@ void SemSegContextTree::extractBasicFeatures (NICE::MultiChannelImageT<double> &
   }
 }
 
-void SemSegContextTree::semanticseg (CachedExample *ce, NICE::Image & segresult, NICE::MultiChannelImageT<double> & probabilities)
+void SemSegContextTree::semanticseg (CachedExample *ce, NICE::ImageT<int> & segresult, NICE::MultiChannelImageT<double> & probabilities)
 {
   int xsize;
   int ysize;

+ 1 - 1
semseg/SemSegContextTree.h

@@ -168,7 +168,7 @@ class SemSegContextTree : public SemanticSegmentation
      * @param segresult segmentation results
      * @param probabilities probabilities for each pixel
      */
-    void semanticseg ( CachedExample *ce,   NICE::Image & segresult,  NICE::MultiChannelImageT<double> & probabilities );
+    void semanticseg ( CachedExample *ce,   NICE::ImageT<int> & segresult,  NICE::MultiChannelImageT<double> & probabilities );
 
     /**
      * the main training method

+ 1 - 1
semseg/SemSegContextTree3D.h

@@ -246,7 +246,7 @@ public:
 
   // deprecated stuff
   virtual void semanticseg ( OBJREC::CachedExample *ce,
-                             NICE::Image & segresult,
+                             NICE::ImageT<int> & segresult,
                              NICE::MultiChannelImageT<double> & probabilities )
   {}
 

+ 6 - 3
semseg/SemSegCsurka.cpp

@@ -1202,7 +1202,7 @@ void SemSegCsurka::trainpostprocess ( const MultiDataset *md )
       }
       Globals::setCurrentImgFN ( currentFile );
 
-      NICE::Image segresult;
+      NICE::ImageT<int> segresult;
 
       NICE::MultiChannelImageT<double> probabilities ( xsize, ysize, classno );
 
@@ -1277,7 +1277,7 @@ void SemSegCsurka::trainpostprocess ( const MultiDataset *md )
   cout << "finished postprocess" << endl;
 }
 
-void SemSegCsurka::classifyregions ( CachedExample *ce, NICE::Image & segresult, NICE::MultiChannelImageT<double> & probabilities, Examples &Regionen, NICE::Matrix & mask )
+void SemSegCsurka::classifyregions ( CachedExample *ce, NICE::ImageT<int> & segresult, NICE::MultiChannelImageT<double> & probabilities, Examples &Regionen, NICE::Matrix & mask )
 {
   /* die einzelnen Testschritte:
   1.x  auf dem Testbild alle SIFT Merkmale an den Gitterpunkten bei allen Auflösungen bestimmen
@@ -2307,7 +2307,10 @@ void SemSegCsurka::classifyregions ( CachedExample *ce, NICE::Image & segresult,
   getFeats = NULL;
 }
 
-void SemSegCsurka::semanticseg ( CachedExample *ce, NICE::Image & segresult, NICE::MultiChannelImageT<double> & probabilities )
+void SemSegCsurka::semanticseg (
+        CachedExample *ce,
+        NICE::ImageT<int> & segresult,
+        NICE::MultiChannelImageT<double> & probabilities )
 {
   Examples regions;
   NICE::Matrix regionmask;

+ 2 - 2
semseg/SemSegCsurka.h

@@ -230,7 +230,7 @@ class SemSegCsurka : public SemanticSegmentation
       * @param probabilities multi-channel image with one channel for each class and corresponding probabilities for each pixel
       */
     void semanticseg ( CachedExample *ce,
-                       NICE::Image & segresult,
+                       NICE::ImageT<int> & segresult,
                        NICE::MultiChannelImageT<double> & probabilities );
 
     /** this procedure is equal semanticseg, if there is no post process
@@ -240,7 +240,7 @@ class SemSegCsurka : public SemanticSegmentation
     * @param Regionen the output regions
     * @param mask the positions of the regions
     */
-    void classifyregions ( CachedExample *ce, NICE::Image & segresult, NICE::MultiChannelImageT<double> & probabilities, Examples &Regionen, NICE::Matrix &mask );
+    void classifyregions ( CachedExample *ce, NICE::ImageT<int> & segresult, NICE::MultiChannelImageT<double> & probabilities, Examples &Regionen, NICE::Matrix &mask );
     void getFeats ( NICE::Image arg1, NICE::VVector arg2, NICE::VVector arg3 );
 };
 

+ 1 - 1
semseg/SemSegLocal.cpp

@@ -83,7 +83,7 @@ SemSegLocal::~SemSegLocal()
 
 
 void SemSegLocal::semanticseg ( CachedExample *ce,
-                                NICE::Image & segresult,
+                                NICE::ImageT<int> & segresult,
                                 NICE::MultiChannelImageT<double> & probabilities )
 {
   // for speed optimization

+ 1 - 1
semseg/SemSegLocal.h

@@ -37,7 +37,7 @@ class SemSegLocal : public SemanticSegmentation
     void train ( const NICE::Config *conf, const MultiDataset *md );
 
     void semanticseg ( CachedExample *ce,
-                       NICE::Image & segresult,
+                       NICE::ImageT<int> & segresult,
                        NICE::MultiChannelImageT<double> & probabilities );
 
 };

+ 13 - 10
semseg/SemSegNovelty.cpp

@@ -491,14 +491,17 @@ void SemSegNovelty::train ( const MultiDataset *md )
 }
 
 
-void SemSegNovelty::semanticseg ( CachedExample *ce, NICE::Image & segresult, NICE::MultiChannelImageT<double> & probabilities )
+void SemSegNovelty::semanticseg (
+        CachedExample *ce,
+        NICE::ImageT<int> & segresult,
+        NICE::MultiChannelImageT<double> & probabilities )
 {  
   Timer timer;
   timer.start();
   
   //segResult contains the GT labels when this method is called
   // we simply store them in labels, to have an easy access to the GT information lateron
-  NICE::Image labels = segresult;
+  NICE::ImageT<int> labels = segresult;
   //just to be sure that we do not have a GT-biased result :)
   segresult.set(0);
 
@@ -820,7 +823,7 @@ void SemSegNovelty::semanticseg ( CachedExample *ce, NICE::Image & segresult, NI
 }
 
 inline void SemSegNovelty::computeClassificationResults( const NICE::MultiChannelImageT<double> & feats, 
-                                                   NICE::Image & segresult,
+                                                   NICE::ImageT<int> & segresult,
                                                    NICE::MultiChannelImageT<double> & probabilities,
                                                    const int & xsize,
                                                    const int & ysize,
@@ -915,7 +918,7 @@ inline void SemSegNovelty::computeClassificationResults( const NICE::MultiChanne
 
 void SemSegNovelty::computeNoveltyByRandom(         NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim  )
 {
@@ -963,7 +966,7 @@ void SemSegNovelty::computeNoveltyByRandom(         NICE::FloatImage & noveltyIm
 
 void SemSegNovelty::computeNoveltyByVariance(       NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1011,7 +1014,7 @@ void SemSegNovelty::computeNoveltyByVariance(       NICE::FloatImage & noveltyIm
 
 void SemSegNovelty::computeNoveltyByGPUncertainty(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1087,7 +1090,7 @@ void SemSegNovelty::computeNoveltyByGPUncertainty(  NICE::FloatImage & noveltyIm
 
 void SemSegNovelty::computeNoveltyByGPMean(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1154,7 +1157,7 @@ void SemSegNovelty::computeNoveltyByGPMean(  NICE::FloatImage & noveltyImage,
 
 void SemSegNovelty::computeNoveltyByGPMeanRatio(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1234,7 +1237,7 @@ void SemSegNovelty::computeNoveltyByGPMeanRatio(  NICE::FloatImage & noveltyImag
 
 void SemSegNovelty::computeNoveltyByGPWeightAll(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1345,7 +1348,7 @@ void SemSegNovelty::computeNoveltyByGPWeightAll(  NICE::FloatImage & noveltyImag
 
 void SemSegNovelty::computeNoveltyByGPWeightRatio(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {

+ 9 - 9
semseg/SemSegNovelty.h

@@ -164,7 +164,7 @@ class SemSegNovelty : public SemanticSegmentation
     
   
     inline void computeClassificationResults( const NICE::MultiChannelImageT<double> & feats, 
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                                     const int & xsize,
                                                     const int & ysize,
@@ -172,40 +172,40 @@ class SemSegNovelty : public SemanticSegmentation
 
    void computeNoveltyByRandom(         NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );    
     
    void computeNoveltyByVariance(       NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );
    
    void computeNoveltyByGPUncertainty ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );
    
    void computeNoveltyByGPMean        ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );  
    void computeNoveltyByGPMeanRatio   ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );  
    void computeNoveltyByGPWeightAll   ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );  
    void computeNoveltyByGPWeightRatio ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );     
    
@@ -242,7 +242,7 @@ class SemSegNovelty : public SemanticSegmentation
       * @param probabilities multi-channel image with one channel for each class and corresponding probabilities for each pixel
       */
     void semanticseg ( CachedExample *ce,
-                       NICE::Image & segresult,
+                       NICE::ImageT<int> & segresult,
                        NICE::MultiChannelImageT<double> & probabilities );
 
     /**

+ 13 - 10
semseg/SemSegNoveltyBinary.cpp

@@ -463,14 +463,17 @@ void SemSegNoveltyBinary::train ( const MultiDataset *md )
 }
 
 
-void SemSegNoveltyBinary::semanticseg ( CachedExample *ce, NICE::Image & segresult, NICE::MultiChannelImageT<double> & probabilities )
+void SemSegNoveltyBinary::semanticseg (
+        CachedExample *ce,
+        NICE::ImageT<int> & segresult,
+        NICE::MultiChannelImageT<double> & probabilities )
 {  
   Timer timer;
   timer.start();
   
   //segResult contains the GT labels when this method is called
   // we simply store them in labels, to have an easy access to the GT information lateron
-  Image labels = segresult;
+  ImageT<int> labels = segresult;
   //just to be sure that we do not have a GT-biased result :)
   segresult.set(0);
 
@@ -838,7 +841,7 @@ void SemSegNoveltyBinary::semanticseg ( CachedExample *ce, NICE::Image & segresu
 }
 
 inline void SemSegNoveltyBinary::computeClassificationResults( const NICE::MultiChannelImageT<double> & feats, 
-                                                   NICE::Image & segresult,
+                                                   NICE::ImageT<int> & segresult,
                                                    NICE::MultiChannelImageT<double> & probabilities,
                                                    const int & xsize,
                                                    const int & ysize,
@@ -942,7 +945,7 @@ inline void SemSegNoveltyBinary::computeClassificationResults( const NICE::Multi
 
 void SemSegNoveltyBinary::computeNoveltyByRandom(         NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim  )
 {
@@ -998,7 +1001,7 @@ void SemSegNoveltyBinary::computeNoveltyByRandom(         NICE::FloatImage & nov
 
 void SemSegNoveltyBinary::computeNoveltyByVariance(       NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1054,7 +1057,7 @@ void SemSegNoveltyBinary::computeNoveltyByVariance(       NICE::FloatImage & nov
 
 void SemSegNoveltyBinary::computeNoveltyByGPUncertainty(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1120,7 +1123,7 @@ void SemSegNoveltyBinary::computeNoveltyByGPUncertainty(  NICE::FloatImage & nov
 
 void SemSegNoveltyBinary::computeNoveltyByGPMean(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1173,7 +1176,7 @@ void SemSegNoveltyBinary::computeNoveltyByGPMean(  NICE::FloatImage & noveltyIma
 
 void SemSegNoveltyBinary::computeNoveltyByGPMeanRatio(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1237,7 +1240,7 @@ void SemSegNoveltyBinary::computeNoveltyByGPMeanRatio(  NICE::FloatImage & novel
 
 void SemSegNoveltyBinary::computeNoveltyByGPWeightAll(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {
@@ -1303,7 +1306,7 @@ void SemSegNoveltyBinary::computeNoveltyByGPWeightAll(  NICE::FloatImage & novel
 
 void SemSegNoveltyBinary::computeNoveltyByGPWeightRatio(  NICE::FloatImage & noveltyImage, 
                                               const NICE::MultiChannelImageT<double> & feats,  
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                              const int & xsize, const int & ysize, const int & featdim )
 {

+ 9 - 9
semseg/SemSegNoveltyBinary.h

@@ -127,7 +127,7 @@ class SemSegNoveltyBinary : public SemanticSegmentation
     std::string classifierString;
     
     inline void computeClassificationResults( const NICE::MultiChannelImageT<double> & feats, 
-                                                    NICE::Image & segresult,
+                                                    NICE::ImageT<int> & segresult,
                                                     NICE::MultiChannelImageT<double> & probabilities,
                                                     const int & xsize,
                                                     const int & ysize,
@@ -135,40 +135,40 @@ class SemSegNoveltyBinary : public SemanticSegmentation
 
    void computeNoveltyByRandom(         NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );    
     
    void computeNoveltyByVariance(       NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );
    
    void computeNoveltyByGPUncertainty ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );
    
    void computeNoveltyByGPMean        ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );  
    void computeNoveltyByGPMeanRatio   ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );  
    void computeNoveltyByGPWeightAll   ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );  
    void computeNoveltyByGPWeightRatio ( NICE::FloatImage & noveltyImage, 
                                   const NICE::MultiChannelImageT<double> & feats,  
-                                        NICE::Image & segresult,
+                                        NICE::ImageT<int> & segresult,
                                         NICE::MultiChannelImageT<double> & probabilities,
                                   const int & xsize, const int & ysize, const int & featdim );     
    
@@ -194,7 +194,7 @@ class SemSegNoveltyBinary : public SemanticSegmentation
       * @param probabilities multi-channel image with one channel for each class and corresponding probabilities for each pixel
       */
     void semanticseg ( CachedExample *ce,
-                       NICE::Image & segresult,
+                       NICE::ImageT<int> & segresult,
                        NICE::MultiChannelImageT<double> & probabilities );
     
     /**

+ 1 - 1
semseg/SemSegObliqueTree.cpp

@@ -193,7 +193,7 @@ void SemSegObliqueTree::train ( const MultiDataset *md )
 /** classification function */
 void SemSegObliqueTree::semanticseg(
         CachedExample *ce,
-        Image &segresult,
+        ImageT<int> &segresult,
         NICE::MultiChannelImageT<double> &probabilities )
 {
     // for speed optimization

+ 1 - 1
semseg/SemSegObliqueTree.h

@@ -82,7 +82,7 @@ class SemSegObliqueTree : public SemanticSegmentation
                   each class and corresponding probabilities for each pixel
          */
         void semanticseg ( CachedExample *ce,
-                           NICE::Image &segresult,
+                           NICE::ImageT<int> &segresult,
                            NICE::MultiChannelImageT<double> &probabilities );
 
 

+ 5 - 4
semseg/SemSegTools.cpp

@@ -56,10 +56,11 @@ void SemSegTools::segmentToOverlay (
 }
 
 void SemSegTools::updateConfusionMatrix(
-        const Image &img,
-        const Image &gt,
+        const ImageT<int> &img,
+        const ImageT<int> &gt,
         Matrix &M,
-        const std::set<int> &forbiddenClasses )
+        const std::set<int> &forbiddenClasses,
+        map<int,int> & classMapping )
 {
     double subsamplex = gt.width() / ( double ) img.width();
     double subsampley = gt.height() / ( double ) img.height();
@@ -83,7 +84,7 @@ void SemSegTools::updateConfusionMatrix(
 
             if ( forbiddenClasses.find ( gimg ) == forbiddenClasses.end() )
             {
-                M ( gimg, cimg ) ++;
+                M ( classMapping[gimg], classMapping[cimg] ) ++;
             }
         }
 }

+ 5 - 3
semseg/SemSegTools.h

@@ -42,12 +42,14 @@ class SemSegTools
      * @param gt ground truth data
      * @param M confusion matrix
      * @param forbidden_classes set of classes, that should be ignored
+     * @param classMapping mapping for a subset of classes
      */
     static void updateConfusionMatrix (
-            const NICE::Image & img,
-            const NICE::Image & gt,
+            const NICE::ImageT<int> & img,
+            const NICE::ImageT<int> & gt,
             NICE::Matrix & M,
-            const std::set<int> & forbiddenClasses );
+            const std::set<int> & forbiddenClasses,
+            std::map<int,int> & classMapping );
 
     /**
      * @brief compute typical classification statistics using confusion matrix

+ 2 - 2
semseg/SemanticSegmentation.cpp

@@ -75,7 +75,7 @@ void SemanticSegmentation::initFromConfig(const Config* conf, const string& s_co
 ///////////////////// ///////////////////// /////////////////////
 
 void SemanticSegmentation::semanticseg ( const std::string & filename,
-    NICE::Image & segresult,
+    NICE::ImageT<int> & segresult,
     NICE::MultiChannelImageT<double> & probabilities )
 {
   Globals::setCurrentImgFN ( filename );
@@ -103,7 +103,7 @@ void SemanticSegmentation::classify ( const std::vector<std::string> & filelist,
   for ( int it = 0; it < ( int ) filelist.size(); it++ )
   {
     NICE::MultiChannelImageT<double> probs;
-    NICE::Image res ( segresult.width(), segresult.height() );
+    NICE::ImageT<int> res ( segresult.width(), segresult.height() );
     this->semanticseg( filelist[it], res, probs );
     probabilities.addChannel( probs );
     segresult.addChannel( res );

+ 2 - 2
semseg/SemanticSegmentation.h

@@ -102,7 +102,7 @@ class SemanticSegmentation : public NICE::Persistent
 
     /** load img from file call localize(CachedExample *ce) etc. */
     void semanticseg ( const std::string & filename,
-                       NICE::Image & segresult,
+                       NICE::ImageT<int> & segresult,
                        NICE::MultiChannelImageT<double> & probabilities );
 
     /**
@@ -124,7 +124,7 @@ class SemanticSegmentation : public NICE::Persistent
                corresponding probabilities for each pixel
     */
     virtual void semanticseg ( OBJREC::CachedExample *ce,
-                               NICE::Image & segresult,
+                               NICE::ImageT<int> & segresult,
                                NICE::MultiChannelImageT<double> & probabilities ) = 0;
 
 

+ 1 - 1
semseg/postsegmentation/PSSImageLevelPrior.cpp

@@ -36,7 +36,7 @@ void PSSImageLevelPrior::setPrior ( FullVector & prior )
   this->prior = prior;
 }
 
-void PSSImageLevelPrior::postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities )
+void PSSImageLevelPrior::postprocess ( NICE::ImageT<int> & result, NICE::MultiChannelImageT<double> & probabilities )
 {
   assert ( prior.size() == ( int ) probabilities.channels() );
   int xsize = probabilities.width();

+ 1 - 1
semseg/postsegmentation/PSSImageLevelPrior.h

@@ -42,7 +42,7 @@ class PSSImageLevelPrior : public PostSemSeg
 
     void setPrior ( FullVector & prior );
 
-    void postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities );
+    void postprocess ( NICE::ImageT<int> & result, NICE::MultiChannelImageT<double> & probabilities );
 };
 
 

+ 1 - 1
semseg/postsegmentation/PostSemSeg.h

@@ -28,7 +28,7 @@ class PostSemSeg
     /** simple destructor */
     virtual ~PostSemSeg();
 
-    virtual void postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities ) = 0;
+    virtual void postprocess ( NICE::ImageT<int> & result, NICE::MultiChannelImageT<double> & probabilities ) = 0;
 
 };