Browse Source

minor changes & bugfixes

Sven Sickert 11 năm trước cách đây
mục cha
commit
589ef63935

+ 1 - 1
progs/testSemanticSegmentation.cpp

@@ -156,7 +156,7 @@ int main ( int argc, char **argv )
 //   pb.show();
 
   vector< int > zsizeVec;
-  semseg->getDepthVector ( testFiles, zsizeVec );
+  semseg->getDepthVector ( testFiles, zsizeVec, run_3dseg );
 
   int depthCount = 0, idx = 0;
   vector< string > filelist;

+ 8 - 10
semseg/SemSegContextTree.cpp

@@ -571,9 +571,9 @@ void SemSegContextTree::train ( const LabeledSet * trainp )
   Timer timer;
   timer.start();
   
-  vector<int> zsizeVec;
-  getDepthVector ( trainp, zsizeVec );
   bool run_3dseg = conf->gB ( "debug", "run_3dseg", true );
+  vector<int> zsizeVec;
+  getDepthVector ( trainp, zsizeVec, run_3dseg );
 
 //   ProgressBar pb ( "compute feats" );
 //   pb.show();
@@ -766,16 +766,14 @@ void SemSegContextTree::train ( const LabeledSet * trainp )
   }
 
   // Type 3: type 2 features on context channels
-  for ( int i = 0; i < classes; i++ )
-  {
-    channelType.push_back ( 3 );
-  }
+  if ( ftypes > 3 )
+    for ( int i = 0; i < classes; i++ )
+      channelType.push_back ( 3 );
 
   // Type 4: type 0 features on context channels
-  for ( int i = 0; i < classes; i++ )
-  {
-    channelType.push_back ( 4 );
-  }
+  if ( ftypes > 4 )
+    for ( int i = 0; i < classes; i++ )
+      channelType.push_back ( 4 );
 
   // 'amountTypes' sets upper bound for usable feature types
   int amountTypes = 5;

+ 5 - 3
semseg/SemanticSegmentation.cpp

@@ -163,7 +163,9 @@ SemanticSegmentation::~SemanticSegmentation()
 {
 }
 
-void SemanticSegmentation::getDepthVector ( const LabeledSet *Files, vector<int> & depthVec )
+void SemanticSegmentation::getDepthVector ( const LabeledSet *Files,
+                                            vector<int> & depthVec,
+                                            const bool run3Dseg )
 {
   std::string oldName;
   int zsize = 0;
@@ -181,7 +183,7 @@ void SemanticSegmentation::getDepthVector ( const LabeledSet *Files, vector<int>
       StringTools::split ( file, '/', list );
       std::string filename = list.back();
       uint found = filename.find_last_of ( "_" );
-      if (found < filename.size() )
+      if (run3Dseg && found < filename.size() && found-3 > 0 )
       {
         std::string curName = filename.substr ( found-3,3 );
         if ( !isInit )
@@ -189,7 +191,7 @@ void SemanticSegmentation::getDepthVector ( const LabeledSet *Files, vector<int>
           oldName = curName;
           isInit = true;
         }
-        if ( curName.compare ( oldName ) == 0 )
+        if ( curName.compare ( oldName ) == 0 ) // if strings match up
         {
           zsize++;
         }

+ 2 - 1
semseg/SemanticSegmentation.h

@@ -71,8 +71,9 @@ public:
    * collect information about the depth of 3d images
    * @param *Files a labeled set of data
    * @param depthVec output of depth values
+   * @param run3dseg whether slice counting is necessary or not
    */
-  void getDepthVector ( const LabeledSet *Files, std::vector<int> & depthVec );
+  void getDepthVector ( const LabeledSet *Files, std::vector<int> & depthVec, const bool run3dseg );
 
   /**
    * convert different datatypes