Переглянути джерело

no need to save all randomly chosen split tests (slightly reduced memory consumption)

Sven Sickert 7 роки тому
батько
коміт
840a3d6cbc
1 змінених файлів з 5 додано та 12 видалено
  1. 5 12
      semseg/SemSegContextTree3D.cpp

+ 5 - 12
semseg/SemSegContextTree3D.cpp

@@ -280,9 +280,7 @@ double SemSegContextTree3D::getBestSplit (
     if ( globent < 0.5 )
         return 0.0;
 
-    // pointers to all randomly chosen features
-    std::vector<Operation3D*> featsel;
-    for ( int i = 0; i < featsPerSplit; i++ )
+    for ( int f = 0; f < featsPerSplit; f++ )
     {
         int x1, x2, y1, y2, z1, z2, ft;
 
@@ -312,12 +310,7 @@ double SemSegContextTree3D::getBestSplit (
         op->set ( x1, y1, z1, x2, y2, z2, f1, f2, ft );
         op->setWSize( windowSize );
 
-        featsel.push_back ( op );
-    }
-
-    // do actual split tests
-    for ( int f = 0; f < featsPerSplit; f++ )
-    {
+        /* do actual split tests */
         double l_bestig = -numeric_limits< double >::max();
         double l_splitval = -1.0;
         vector<double> vals;
@@ -336,12 +329,12 @@ double SemSegContextTree3D::getBestSplit (
             assert ( forest[tree][0].dist.size() > 0 );
 
             double val = 0.0;
-            val = featsel[f]->getVal ( feat, ( *it ).second, ( *it ).third, ( *it ).fourth );
+            val = op->getVal ( feat, ( *it ).second, ( *it ).third, ( *it ).fourth );
             if ( !isfinite ( val ) )
             {
 #ifdef DEBUG
                 cerr << "feat " << feat.feats->width() << " " << feat.feats->height() << " " << feat.feats->depth() << endl;
-                cerr << "non finite value " << val << " for " << featsel[f]->writeInfos() <<  endl << (*it).second << " " <<  (*it).third << " " << (*it).fourth << endl;
+                cerr << "non finite value " << val << " for " << op->writeInfos() <<  endl << (*it).second << " " <<  (*it).third << " " << (*it).fourth << endl;
 #endif
                 val = 0.0;
             }
@@ -423,7 +416,7 @@ double SemSegContextTree3D::getBestSplit (
         if ( l_bestig > bestig )
         {
             bestig = l_bestig;
-            splitop = featsel[f];
+            splitop = op;
             splitval = l_splitval;
         }
     }