Browse Source

first running version of 3D oblique forests

Sven Sickert 9 years ago
parent
commit
a7f2f20e8f

+ 9 - 0
progs/testSemSegObliqueTrees.cpp

@@ -103,6 +103,8 @@ int main ( int argc, char **argv )
             if ( run3Dseg )
                 depthBoundary = zsizeVec[idx];
 
+            std::cout << "Slice " << depthCount << "/"
+                      << depthBoundary << std::endl;
             if ( depthCount < depthBoundary )
                 continue;
 
@@ -141,6 +143,13 @@ int main ( int argc, char **argv )
                 SemSegTools::saveResultsToImageFile( &conf, "analysis", orig,
                             rgb_gt, rgb, fname, outStr );
             }
+
+            // prepare for new 3d image
+            filelist.clear();
+            segresult.reInit(0,0,0);
+            gt.reInit(0,0,0);
+            depthCount = 0;
+            idx++;
         }
     }
 

+ 4 - 4
semseg/SemSegObliqueTree.cpp

@@ -147,7 +147,7 @@ void SemSegObliqueTree::train ( const MultiDataset *md )
 {
     if ( saveLoadData && FileMgt::fileExists( fileLocation ) )
     {
-        read( fileLocation );
+        read( fileLocation, 1 );
     }
     else
     {
@@ -180,7 +180,7 @@ void SemSegObliqueTree::train ( const MultiDataset *md )
         fpc->train( fp, examples);
 
         // save trained classifier to file
-        if (saveLoadData) save( fileLocation );
+        if (saveLoadData) save( fileLocation, 1 );
 
         // Cleaning up
         for ( vector<CachedExample *>::iterator i = imgexamples.begin();
@@ -254,9 +254,9 @@ void SemSegObliqueTree::semanticseg(
                 pce.y = y;
                 pce.z = z;
                 ClassificationResult r = fpcrf->classify ( pce );
-                segresult.set ( x, y, z, r.classno );
+                segresult.set ( x, y, r.classno, (unsigned int)z );
                 for ( int i = 0 ; i < ( int ) probabilities.channels(); i++ )
-                    probabilities[i](x,y,z) = r.scores[i];
+                    probabilities.set ( x, y, z, r.scores[i], i );
             }
 }
 

+ 1 - 1
semseg/SemSegTools.cpp

@@ -301,7 +301,7 @@ void SemSegTools::collectTrainingExamples (
     imgexamples.clear();
 
     vector<int> zsizeVec;
-    SemSegTools::getDepthVector ( &train, zsizeVec, true );
+    SemSegTools::getDepthVector ( &train, zsizeVec, run3Dseg );
 
     int grid_size_x = conf->gI(section, "grid_size_x", 5 );
     int grid_size_y = conf->gI(section, "grid_size_y", 5 );

+ 3 - 3
semseg/SemanticSegmentation.cpp

@@ -99,9 +99,9 @@ void SemanticSegmentation::semanticseg (
         NICE::MultiChannelImageT<int> & segresult,
         NICE::MultiChannelImage3DT<double> & probabilities )
 {
-    NICE::MultiChannelImage3DT<int> img;
-    make3DImage( filelist, img );
-    CachedExample *ce = new CachedExample (img);
+    //NICE::MultiChannelImage3DT<int> img;
+    //make3DImage( filelist, img );
+    CachedExample *ce = new CachedExample (filelist);
 
     this->semanticseg ( ce, segresult, probabilities );
     delete ce;