Bjoern Froehlich 12 年之前
父節點
當前提交
8a0af72423
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      semseg/SemSegContextTree.cpp

+ 12 - 0
semseg/SemSegContextTree.cpp

@@ -969,6 +969,10 @@ void SemSegContextTree::train (const MultiDataset *md)
                     feat.tree = &forest[tree];
                     feat.tree = &forest[tree];
                     feat.rProbs = &lastRegionProbs[iCounter];
                     feat.rProbs = &lastRegionProbs[iCounter];
                     double val = splitfeat->getVal (feat, x, y);
                     double val = splitfeat->getVal (feat, x, y);
+                    if(!isfinite(val))
+                    {
+                      val = 0.0;
+                    }
 
 
 #pragma omp critical
 #pragma omp critical
                     if (val < splitval)
                     if (val < splitval)
@@ -1043,6 +1047,10 @@ void SemSegContextTree::train (const MultiDataset *md)
                       feat.rProbs = &lastRegionProbs[iCounter];
                       feat.rProbs = &lastRegionProbs[iCounter];
 
 
                       double val = splitfeat->getVal (feat, x, y);
                       double val = splitfeat->getVal (feat, x, y);
+                      if(!isfinite(val))
+                      {
+                        val = 0.0;
+                      }
 
 
                       cout << "splitval: " << splitval << " val: " << val << endl;
                       cout << "splitval: " << splitval << " val: " << val << endl;
                     }
                     }
@@ -1469,6 +1477,10 @@ void SemSegContextTree::semanticseg (CachedExample *ce, NICE::Image & segresult,
             feat.rProbs = &lastRegionProbs;
             feat.rProbs = &lastRegionProbs;
 
 
             double val = forest[tree][t].feat->getVal (feat, x, y);
             double val = forest[tree][t].feat->getVal (feat, x, y);
+            if(!isfinite(val))
+            {
+              val = 0.0;
+            }
 
 
             if (val < forest[tree][t].decision)
             if (val < forest[tree][t].decision)
             {
             {