Browse Source

write globfeats

Bjoern Froehlich 13 years ago
parent
commit
60ff4daeab
1 changed files with 14 additions and 9 deletions
  1. 14 9
      semseg/SemSegContextTree.cpp

+ 14 - 9
semseg/SemSegContextTree.cpp

@@ -1993,6 +1993,7 @@ void SemSegContextTree::semanticseg ( CachedExample *ce, NICE::Image & segresult
 #else
 #else
     int c = 0;
     int c = 0;
     vector<double> probs(classes, 0.0);
     vector<double> probs(classes, 0.0);
+    
     while ( !infile.eof() && infile.good() )
     while ( !infile.eof() && infile.good() )
     {
     {
       infile >> probs[c];
       infile >> probs[c];
@@ -2003,7 +2004,9 @@ void SemSegContextTree::semanticseg ( CachedExample *ce, NICE::Image & segresult
     sort (sorted.begin(), sorted.end());
     sort (sorted.begin(), sorted.end());
     
     
     double thr = sorted[3];
     double thr = sorted[3];
-    thr = 0.0;
+    
+    if(thr < 0.0)
+      thr = 0.0;
     
     
     for(int c = 0; c < classes; c++)
     for(int c = 0; c < classes; c++)
     {
     {
@@ -2013,6 +2016,7 @@ void SemSegContextTree::semanticseg ( CachedExample *ce, NICE::Image & segresult
       }
       }
     }
     }
     
     
+    
 #endif
 #endif
     
     
     for(int c = 0; c < classes; c++)
     for(int c = 0; c < classes; c++)
@@ -2040,17 +2044,18 @@ void SemSegContextTree::semanticseg ( CachedExample *ce, NICE::Image & segresult
         for ( uint i = 0; i < s; i++ )
         for ( uint i = 0; i < s; i++ )
         {
         {
           int currentclass = labelmapback[i];
           int currentclass = labelmapback[i];
-          probabilities.data[currentclass][offset] = getMeanProb ( x, y, i, currentfeats );
-
-          if ( probabilities.data[currentclass][offset] > maxvalue )
+          if(useclass[currentclass])
           {
           {
-            maxvalue = probabilities.data[currentclass][offset];
-            maxindex = labelmapback[i];
-          }
+            probabilities.data[currentclass][offset] = getMeanProb ( x, y, i, currentfeats );
 
 
-          segresult.setPixel ( x, y, maxindex );
+            if ( probabilities.data[currentclass][offset] > maxvalue )
+            {
+              maxvalue = probabilities.data[currentclass][offset];
+              maxindex = currentclass;
+            }
+          }
         }
         }
-
+        segresult.setPixel ( x, y, maxindex );
         if ( maxvalue > 1 )
         if ( maxvalue > 1 )
           cout << "maxvalue: " << maxvalue << endl;
           cout << "maxvalue: " << maxvalue << endl;
       }
       }