Browse Source

added parameter to stop classification at certain depth (using config file)

Sven Sickert 11 years ago
parent
commit
68194197a3
1 changed files with 9 additions and 4 deletions
  1. 9 4
      semseg/SemSegContextTree3D.cpp

+ 9 - 4
semseg/SemSegContextTree3D.cpp

@@ -1666,6 +1666,11 @@ void SemSegContextTree3D::classify (
   firstiteration = true;
   depth = 0;
 
+  // anytime classification ability
+  int classificationDepth = conf->gI( "SSContextTree", "classification_depth", maxDepth );
+  if (classificationDepth > maxDepth || classificationDepth < 1 )
+      classificationDepth = maxDepth;
+
   Timer timer;
   timer.start();
 
@@ -1719,7 +1724,7 @@ void SemSegContextTree3D::classify (
   /////////////////////////////////////////////////////////////////////////////
 
   bool noNewSplit = false;
-  for ( int d = 0; d < maxDepth && !noNewSplit; d++ )
+  for ( int d = 0; d < classificationDepth && !noNewSplit; d++ )
   {
     depth++;
     vector<vector<double> > lastRegionProbs = regionProbs;
@@ -1732,7 +1737,7 @@ void SemSegContextTree3D::classify (
           regionProbs[r][c] = 0.0;
     }
 
-    if ( depth < maxDepth )
+    if ( depth < classificationDepth )
     {
       int firstChannel = rawChannels + shift;
       if ( useFeat3 || useFeat4 )
@@ -1834,7 +1839,7 @@ void SemSegContextTree3D::classify (
       }
     }
 
-    if ( (depth < maxDepth) && firstiteration ) firstiteration = false;
+    if ( (depth < classificationDepth) && firstiteration ) firstiteration = false;
   }
 
   vector<int> classesInImg;
@@ -1901,7 +1906,7 @@ void SemSegContextTree3D::classify (
           {
             int i = classesInImg[c];
             double curProb = getMeanProb ( x, y, z, i, nodeIndices );
-            probabilities ( x, y, z, labelmapback[i] ) = curProb;
+            probabilities.set ( x, y, z, curProb, labelmapback[i] );
 
             if ( curProb > maxProb )
             {