Преглед на файлове

adding resource statistics to programs

Sven Sickert преди 9 години
родител
ревизия
f31d70f0bf
променени са 2 файла, в които са добавени 13 реда и са изтрити 21 реда
  1. 3 1
      progs/testSemSegObliqueTrees.cpp
  2. 10 20
      progs/testSemanticSegmentation3D.cpp

+ 3 - 1
progs/testSemSegObliqueTrees.cpp

@@ -7,7 +7,6 @@
 */
 
 #include "core/basics/StringTools.h"
-#include "core/basics/ResourceStatistics.h"
 #include "core/basics/Timer.h"
 #include "core/image/Morph.h"
 
@@ -118,6 +117,9 @@ int main ( int argc, char **argv )
         }
     }
 
+    // resource statistics
+    SemSegTools::computeResourceStatistics ( rs );
+
     // evaluation & analysis
     SemSegTools::computeClassificationStatistics(
                 M, classNames, forbiddenClasses, classMappingInv );

+ 10 - 20
progs/testSemanticSegmentation3D.cpp

@@ -1,7 +1,7 @@
-// Beispielhafter Aufruf: BUILD_x86_64/progs/testSemanticSegmentation -config <CONFIGFILE>
+// Beispielhafter Aufruf: BUILD_x86_64/progs/testSemanticSegmentation3D -config <CONFIGFILE>
 
 /**
-* @file testSemanticSegmentation.cpp
+* @file testSemanticSegmentation3D.cpp
 * @brief test semantic segmentation routines for 3d images and 2d images
 * @author Erik Rodner, Björn Fröhlich, Sven Sickert
 * @date 03/20/2008
@@ -13,15 +13,14 @@
 
 #include "core/basics/Config.h"
 #include "core/basics/StringTools.h"
+#include "core/image/Morph.h"
+#include "core/image/MultiChannelImage3DT.h"
+
 #include "vislearning/baselib/ICETools.h"
 
-#include "core/image/MultiChannelImage3DT.h"
 #include "semseg/semseg/SemSegContextTree3D.h"
 #include "semseg/semseg/SemSegTools.h"
 
-#include "core/basics/ResourceStatistics.h"
-#include "core/image/Morph.h"
-
 #include <fstream>
 #include <vector>
 
@@ -39,8 +38,7 @@ void startClassification (SemanticSegmentation *semseg,
                           const LabeledSet* testFiles,
                           const ClassNames & classNames,
                           const set<int> & forbidden_classes,
-                          map<int,int> & classMapping,
-                          const string & resultdir,
+                          std::map<int,int> & classMapping,
                           const bool doCrossVal)
 {
     bool write_results = conf.gB ( "debug", "write_results", false );
@@ -184,7 +182,6 @@ int main ( int argc, char **argv )
 
     /*---------------CONFIGURATION---------------*/
     bool doCrossVal = conf.gB ( "debug", "do_crossval", false );
-    string resultdir = conf.gS ( "debug", "resultdir", "." );
     /*-------------------------------------------*/
 
 #ifdef DEBUG
@@ -235,7 +232,7 @@ int main ( int argc, char **argv )
         cout << "##############\n" << endl;
         const LabeledSet *testFiles = md["test"];
         startClassification (semseg, M_vec, conf, testFiles, classNames,
-                             forbidden_classes, classMapping, resultdir, doCrossVal );
+                             forbidden_classes, classMapping, doCrossVal );
 
         delete semseg;
     }
@@ -260,21 +257,14 @@ int main ( int argc, char **argv )
             cout << "#################\n" << endl;
             const LabeledSet *testFiles = md[cvaltest];
             startClassification (semseg, M_vec, conf, testFiles, classNames,
-                                 forbidden_classes, classMapping, resultdir, doCrossVal );
+                                 forbidden_classes, classMapping, doCrossVal );
 
             delete semseg;
         }
     }
 
-    cout << "\nSTATISTICS" << endl;
-    cout << "##########\n" << endl;
-
-    long maxMemory;
-    double userCPUTime, sysCPUTime;
-    rs.getStatistics ( maxMemory, userCPUTime, sysCPUTime );
-    cout << "Memory (max):    " << maxMemory << " KB" << endl;
-    cout << "CPU Time (user): " << userCPUTime << " seconds" << endl;
-    cout << "CPU Time (sys):  " << sysCPUTime << " seconds" << endl;
+    // resource statistics
+    SemSegTools::computeResourceStatistics ( rs );
 
     NICE::Matrix M ( classMapping.size(), classMapping.size() );
     M.set ( 0 );