Browse Source

extern classification reimplemented

Bjoern Froehlich 12 years ago
parent
commit
6dc7c6cab3
1 changed files with 21 additions and 7 deletions
  1. 21 7
      semseg/SemSegContextTree.cpp

+ 21 - 7
semseg/SemSegContextTree.cpp

@@ -1552,15 +1552,29 @@ void SemSegContextTree::semanticseg (CachedExample *ce, NICE::Image & segresult,
   
   if(useCategorization)
   {
-    globalCategorFeat->setDim(uniquenumber);
-    globalCategorFeat->normalize();
-    ClassificationResult cr = fasthik->classify(globalCategorFeat);
-    for (uint i = 0; i < classes; i++)
+    if(cndir != "")
+    {
+      ifstream infile ((cndir + "/" + orgname + ".dat").c_str());
+      while (!infile.eof() && infile.good())
+      {
+        int tmp;
+        infile >> tmp;
+        assert (tmp >= 0 && tmp < allClasses);
+        classesInImg.push_back(tmp);
+      }
+    }
+    else
     {
-      cerr << cr.scores[i] << " ";
-      if(cr.scores[i] > 0.0/*-0.3*/)
+      globalCategorFeat->setDim(uniquenumber);
+      globalCategorFeat->normalize();
+      ClassificationResult cr = fasthik->classify(globalCategorFeat);
+      for (uint i = 0; i < classes; i++)
       {
-        classesInImg.push_back(i);
+        cerr << cr.scores[i] << " ";
+        if(cr.scores[i] > 0.0/*-0.3*/)
+        {
+          classesInImg.push_back(i);
+        }
       }
     }
     cerr << "amount of classes: " << classes << " used classes: " << classesInImg.size() << endl;