Jelajahi Sumber

added possibility to output probability maps as grayscale

Sven Sickert 11 tahun lalu
induk
melakukan
c83f7a414c
1 mengubah file dengan 14 tambahan dan 7 penghapusan
  1. 14 7
      progs/testSemanticSegmentation3D.cpp

+ 14 - 7
progs/testSemanticSegmentation3D.cpp

@@ -155,9 +155,6 @@ int main ( int argc, char **argv )
 
 
   classNames.getSelection ( forbidden_classes_s, forbidden_classes );
   classNames.getSelection ( forbidden_classes_s, forbidden_classes );
 
 
-//   ProgressBar pb ( "Semantic Segmentation Analysis" );
-//   pb.show();
-
   vector< int > zsizeVec;
   vector< int > zsizeVec;
   semseg->getDepthVector ( testFiles, zsizeVec, run_3Dseg );
   semseg->getDepthVector ( testFiles, zsizeVec, run_3Dseg );
 
 
@@ -224,10 +221,12 @@ int main ( int argc, char **argv )
           NICE::ColorImage rgb_gt;
           NICE::ColorImage rgb_gt;
           NICE::ColorImage ov_rgb;
           NICE::ColorImage ov_rgb;
           NICE::ColorImage ov_rgb_gt;
           NICE::ColorImage ov_rgb_gt;
+          NICE::ColorImage prob_map( probabilities.width(), probabilities.height() );
+          prob_map.set(0,0,0);
 
 
-          for ( int y = 0 ; y < segresult.height(); y++ )
+          for ( int y = 0 ; y < orig.height(); y++ )
           {
           {
-            for ( int x = 0 ; x < segresult.width(); x++ )
+            for ( int x = 0 ; x < orig.width(); x++ )
             {
             {
               lm.setPixel ( x, y, segresult.get ( x, y, ( uint ) z ) );
               lm.setPixel ( x, y, segresult.get ( x, y, ( uint ) z ) );
               if ( run_3Dseg )
               if ( run_3Dseg )
@@ -235,6 +234,15 @@ int main ( int argc, char **argv )
             }
             }
           }
           }
 
 
+          for ( int y = 0 ; y < probabilities.height(); y++ )
+            for ( int x = 0 ; x < probabilities.width(); x++ )
+            {
+              double probVal = probabilities.get( x, y, z, 1 ) * 255.0;
+              int tmp = round(probVal);
+              for ( int c = 0 ; c < 3 ; c++ )
+                prob_map.setPixel( x, y, c, tmp );
+            }
+
           // confusion matrix
           // confusion matrix
           NICE::Matrix M ( classNames.getMaxClassno() + 1, classNames.getMaxClassno() + 1 );
           NICE::Matrix M ( classNames.getMaxClassno() + 1, classNames.getMaxClassno() + 1 );
           M.set ( 0 );
           M.set ( 0 );
@@ -275,6 +283,7 @@ int main ( int argc, char **argv )
             rgb_gt.write ( out.str() + "_groundtruth." + output_type );
             rgb_gt.write ( out.str() + "_groundtruth." + output_type );
             ov_rgb.write ( out.str() + "_overlay_res." + output_type );
             ov_rgb.write ( out.str() + "_overlay_res." + output_type );
             ov_rgb_gt.write ( out.str() + "_overlay_gt." + output_type );
             ov_rgb_gt.write ( out.str() + "_overlay_gt." + output_type );
+            prob_map.write ( out.str() + "_probs." + output_type );
           }
           }
         }
         }
       }
       }
@@ -285,12 +294,10 @@ int main ( int argc, char **argv )
       gt.reInit(0,0,0);
       gt.reInit(0,0,0);
       depthCount = 0;
       depthCount = 0;
       idx++;
       idx++;
-//       pb.update ( testFiles->count() );
     }
     }
   }
   }
   
   
   segresult.freeData();
   segresult.freeData();
-//   pb.hide();
 
 
   cout << "\nSTATISTICS" << endl;
   cout << "\nSTATISTICS" << endl;
   cout << "##########\n" << endl;
   cout << "##########\n" << endl;