|
@@ -55,6 +55,7 @@ SemSegContextTree3D::SemSegContextTree3D () : SemanticSegmentation ()
|
|
this->useGradient = true;
|
|
this->useGradient = true;
|
|
this->useWeijer = false;
|
|
this->useWeijer = false;
|
|
this->useAdditionalLayer = false;
|
|
this->useAdditionalLayer = false;
|
|
|
|
+ this->numAdditionalLayer = 0;
|
|
this->useHoiemFeatures = false;
|
|
this->useHoiemFeatures = false;
|
|
this->useCategorization = false;
|
|
this->useCategorization = false;
|
|
this->cndir = "";
|
|
this->cndir = "";
|
|
@@ -101,8 +102,12 @@ SemSegContextTree3D::SemSegContextTree3D (
|
|
this->useAltTristimulus = conf->gB ( featsec, "use_alt_trist", false );
|
|
this->useAltTristimulus = conf->gB ( featsec, "use_alt_trist", false );
|
|
this->useGradient = conf->gB ( featsec, "use_gradient", true );
|
|
this->useGradient = conf->gB ( featsec, "use_gradient", true );
|
|
this->useWeijer = conf->gB ( featsec, "use_weijer", true );
|
|
this->useWeijer = conf->gB ( featsec, "use_weijer", true );
|
|
- this->useAdditionalLayer = conf->gB ( featsec, "use_additional_layer", false );
|
|
|
|
this->useHoiemFeatures = conf->gB ( featsec, "use_hoiem_features", false );
|
|
this->useHoiemFeatures = conf->gB ( featsec, "use_hoiem_features", false );
|
|
|
|
+ this->useAdditionalLayer = conf->gB ( featsec, "use_additional_layer", false );
|
|
|
|
+ if (useAdditionalLayer)
|
|
|
|
+ this->numAdditionalLayer = conf->gI ( featsec, "num_additional_layer", 1 );
|
|
|
|
+ else
|
|
|
|
+ this->numAdditionalLayer = 0;
|
|
|
|
|
|
this->useCategorization = conf->gB ( section, "use_categorization", false );
|
|
this->useCategorization = conf->gB ( section, "use_categorization", false );
|
|
this->cndir = conf->gS ( "SSContextTree", "cndir", "" );
|
|
this->cndir = conf->gS ( "SSContextTree", "cndir", "" );
|
|
@@ -548,7 +553,7 @@ void SemSegContextTree3D::train ( const LabeledSet * trainp )
|
|
rawChannels += 8;
|
|
rawChannels += 8;
|
|
|
|
|
|
if ( useAdditionalLayer ) // beliebige Merkmale in extra Bilddateien
|
|
if ( useAdditionalLayer ) // beliebige Merkmale in extra Bilddateien
|
|
- rawChannels += 1;
|
|
|
|
|
|
+ rawChannels += numAdditionalLayer;
|
|
|
|
|
|
|
|
|
|
///////////////////////////// read input data /////////////////////////////////
|
|
///////////////////////////// read input data /////////////////////////////////
|
|
@@ -1233,20 +1238,29 @@ void SemSegContextTree3D::addFeatureMaps (
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // arbitrary additional layer as image
|
|
|
|
|
|
+ // arbitrary amount of additional layers as feature maps
|
|
if ( useAdditionalLayer )
|
|
if ( useAdditionalLayer )
|
|
{
|
|
{
|
|
- int currentsize = imgData.channels();
|
|
|
|
- imgData.addChannel ( 1 );
|
|
|
|
- for ( int z = 0; z < zsize; z++ )
|
|
|
|
|
|
+ for ( int a = 0; a < numAdditionalLayer; a++ )
|
|
{
|
|
{
|
|
- vector<string> list;
|
|
|
|
- StringTools::split ( filelist[z], '/', list );
|
|
|
|
- string layerPath = StringTools::trim ( filelist[z], list.back() ) + "addlayer/" + list.back();
|
|
|
|
- NICE::Image layer ( layerPath );
|
|
|
|
- for ( int y = 0; y < ysize; y++ )
|
|
|
|
- for ( int x = 0; x < xsize; x++ )
|
|
|
|
- imgData.set(x, y, z, layer.getPixelQuick(x,y), currentsize);
|
|
|
|
|
|
+ ostringstream convert;
|
|
|
|
+ convert << a;
|
|
|
|
+#ifdef DEBUG
|
|
|
|
+ cout << "Using additional layer #" << a << endl;
|
|
|
|
+#endif
|
|
|
|
+ int currentsize = imgData.channels();
|
|
|
|
+ imgData.addChannel ( 1 );
|
|
|
|
+ for ( int z = 0; z < zsize; z++ )
|
|
|
|
+ {
|
|
|
|
+ vector<string> list;
|
|
|
|
+ StringTools::split ( filelist[z], '/', list );
|
|
|
|
+ string layerPath = StringTools::trim ( filelist[z], list.back() )
|
|
|
|
+ + "addlayer" + convert.str() + "/" + list.back();
|
|
|
|
+ NICE::Image layer ( layerPath );
|
|
|
|
+ for ( int y = 0; y < ysize; y++ )
|
|
|
|
+ for ( int x = 0; x < xsize; x++ )
|
|
|
|
+ imgData.set(x, y, z, layer.getPixelQuick(x,y), currentsize);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|