Pārlūkot izejas kodu

removing redundant code

Sven Sickert 9 gadi atpakaļ
vecāks
revīzija
c4ec5c087d

+ 1 - 4
progs/testSemSegObliqueTrees.cpp

@@ -78,11 +78,7 @@ int main ( int argc, char **argv )
             if ( info.hasLocalizationInfo() )
             {
                 const LocalizationResult *l_gt = info.localization();
-
-                segresult.resize ( l_gt->xsize, l_gt->ysize );
-                segresult.set( 0 );
                 gtruth.resize( l_gt->xsize, l_gt->ysize );
-                gtruth.set ( 0 );
                 l_gt->calcLabeledImage ( gtruth, classNames.getBackgroundClass() );
             }
             else
@@ -90,6 +86,7 @@ int main ( int argc, char **argv )
                 std::cerr << "testSemSegConvTrees: WARNING: NO localization info found for "
                           << file << std::endl;
             }
+            segresult = gtruth;
 
             // actual testing
             NICE::MultiChannelImageT<double> probabilities;

+ 9 - 10
progs/testSemanticSegmentation3D.cpp

@@ -65,26 +65,22 @@ void startClassification (SemanticSegmentation *semseg,
             std::string file = info.img();
             filelist.push_back ( file );
             depthCount++;
+            NICE::ImageT<int> lm, lm_gt;
 
-            NICE::ImageT<int> lm;
-            NICE::ImageT<int> lm_gt;
             if ( info.hasLocalizationInfo() )
             {
                 const LocalizationResult *l_gt = info.localization();
-
-                lm.resize ( l_gt->xsize, l_gt->ysize );
-                lm.set ( 0 );
-
                 lm_gt.resize ( l_gt->xsize, l_gt->ysize );
-                lm_gt.set ( 0 );
-
-                l_gt->calcLabeledImage ( lm, classNames.getBackgroundClass() );
 #ifdef DEBUG
                 cout << "testSemanticSegmentation3D: Generating Labeled NICE::Image (Ground-Truth)" << endl;
 #endif
                 l_gt->calcLabeledImage ( lm_gt, classNames.getBackgroundClass() );
+
             }
-            segresult.addChannel ( lm );
+            else
+                continue;
+
+            segresult.addChannel ( lm_gt );
             gt.addChannel ( lm_gt );
 
             int depthBoundary = 0;
@@ -100,6 +96,7 @@ void startClassification (SemanticSegmentation *semseg,
             semseg->classify ( filelist, segresult, probabilities );
 
             // save to file
+            lm = lm_gt;
             for ( int z = 0; z < segresult.channels(); z++ )
             {
                 NICE::ColorImage orig ( filelist[z] );
@@ -110,6 +107,8 @@ void startClassification (SemanticSegmentation *semseg,
                     for ( int x = 0 ; x < orig.width(); x++ )
                     {
                         lm.setPixel ( x, y, segresult.get ( x, y, ( uint ) z ) );
+
+                        // get current <slice> of ground truth
                         if ( run_3Dseg )
                             lm_gt.setPixel ( x, y, gt.get ( x, y, ( uint ) z ) );
                     }