|
@@ -150,8 +150,6 @@ SemSegContextTree::SemSegContextTree ( const Config *conf, const MultiDataset *m
|
|
|
|
|
|
useAdditionalLayer = conf->gB ( featsec, "use_additional_layer", false );
|
|
|
|
|
|
- useVariance = conf->gB ( featsec, "use_variance", false );
|
|
|
-
|
|
|
// geometric features of hoiem
|
|
|
useHoiemFeatures = conf->gB ( featsec, "use_hoiem_features", false );
|
|
|
if ( useHoiemFeatures )
|
|
@@ -512,22 +510,27 @@ void SemSegContextTree::computeIntegralImage ( const NICE::MultiChannelImage3DT<
|
|
|
int channels = ( int ) forest[0][0].dist.size(); // channels = classes
|
|
|
|
|
|
// integral images for context channels (probability maps for each class)
|
|
|
-#pragma omp parallel for
|
|
|
- for ( int c = 0; c < channels; c++ )
|
|
|
+ if (ftypes > 3)
|
|
|
{
|
|
|
- for ( int z = 0; z < zsize; z++ )
|
|
|
+#pragma omp parallel for
|
|
|
+ for ( int c = 0; c < channels; c++ )
|
|
|
{
|
|
|
- for ( int y = 0; y < ysize; y++ )
|
|
|
+ for ( int z = 0; z < zsize; z++ )
|
|
|
{
|
|
|
- for ( int x = 0; x < xsize; x++ )
|
|
|
+ for ( int y = 0; y < ysize; y++ )
|
|
|
{
|
|
|
- double val = getMeanProb ( x, y, z, c, nodeIndices );
|
|
|
- feats ( x, y, z, firstChannel + c ) = val;
|
|
|
- feats ( x, y, z, firstChannel + channels + c ) = val;
|
|
|
+ for ( int x = 0; x < xsize; x++ )
|
|
|
+ {
|
|
|
+ double val = getMeanProb ( x, y, z, c, nodeIndices );
|
|
|
+ feats ( x, y, z, firstChannel + c ) = val;
|
|
|
+
|
|
|
+ if (ftypes == 5)
|
|
|
+ feats ( x, y, z, firstChannel + channels + c ) = val;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ feats.calcIntegral ( firstChannel + c );
|
|
|
}
|
|
|
- feats.calcIntegral ( firstChannel + c );
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -609,9 +612,6 @@ void SemSegContextTree::train ( const LabeledSet * trainp )
|
|
|
|
|
|
if ( useAdditionalLayer )
|
|
|
rawChannels += 1;
|
|
|
-
|
|
|
- if ( useVariance )
|
|
|
- rawChannels += 1;
|
|
|
|
|
|
|
|
|
///////////////////////////// read input data /////////////////////////////////
|
|
@@ -673,7 +673,6 @@ void SemSegContextTree::train ( const LabeledSet * trainp )
|
|
|
nodeIndices.push_back ( MultiChannelImage3DT<unsigned short int> ( xsize, ysize, zsize, nbTrees ) );
|
|
|
nodeIndices[imgCounter].setAll ( 0 );
|
|
|
|
|
|
- //TODO: resize image?!
|
|
|
MultiChannelImage3DT<double> feats;
|
|
|
allfeats.push_back ( feats );
|
|
|
|
|
@@ -776,8 +775,6 @@ void SemSegContextTree::train ( const LabeledSet * trainp )
|
|
|
channelType.push_back ( 4 );
|
|
|
}
|
|
|
|
|
|
- // configure to include all possible feature types (just a subset
|
|
|
- // defined by ftypes is actually used)
|
|
|
// 'amountTypes' sets upper bound for usable feature types
|
|
|
int amountTypes = 5;
|
|
|
channelsPerType = vector<vector<int> > ( amountTypes, vector<int>() );
|
|
@@ -787,10 +784,10 @@ void SemSegContextTree::train ( const LabeledSet * trainp )
|
|
|
channelsPerType[channelType[i]].push_back ( i );
|
|
|
}
|
|
|
|
|
|
- for ( int i = 0; i < classes; i++ )
|
|
|
- {
|
|
|
- channelsPerType[channelsPerType.size()-1].push_back ( i );
|
|
|
- }
|
|
|
+// for ( int i = 0; i < classes; i++ )
|
|
|
+// {
|
|
|
+// channelsPerType[channelsPerType.size()-1].push_back ( i );
|
|
|
+// }
|
|
|
ftypes = std::min ( amountTypes, ftypes );
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -1129,9 +1126,11 @@ void SemSegContextTree::train ( const LabeledSet * trainp )
|
|
|
//compute integral images
|
|
|
if ( firstiteration )
|
|
|
{
|
|
|
+ // only add context layers if necessary
|
|
|
+ int multi = std::max(0, ftypes-3);
|
|
|
for ( int i = 0; i < imgCounter; i++ )
|
|
|
{
|
|
|
- allfeats[i].addChannel ( (2*classes) + rawChannels );
|
|
|
+ allfeats[i].addChannel ( (multi*classes) + rawChannels );
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1273,12 +1272,13 @@ void SemSegContextTree::extractBasicFeatures ( NICE::MultiChannelImage3DT<double
|
|
|
int xsize = imgData.width();
|
|
|
int ysize = imgData.height();
|
|
|
int zsize = imgData.depth();
|
|
|
- //TODO: resize image?!
|
|
|
|
|
|
amountRegions = 0;
|
|
|
feats.reInit ( xsize, ysize, zsize, imgData.channels() );
|
|
|
feats.setAll ( 0 );
|
|
|
|
|
|
+ //TODO: expand imgData instead of building feats!!! --> SAVING MEMORY
|
|
|
+
|
|
|
for ( int z = 0; z < zsize; z++ )
|
|
|
{
|
|
|
NICE::MultiChannelImageT<double> feats_tmp;
|
|
@@ -1462,25 +1462,6 @@ void SemSegContextTree::extractBasicFeatures ( NICE::MultiChannelImage3DT<double
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // variance maps (textural information)
|
|
|
- if ( useVariance )
|
|
|
- {
|
|
|
- int cchannel = feats.channels();
|
|
|
- if (imagetype == IMAGETYPE_RGB)
|
|
|
- {
|
|
|
- feats.addChannel( 3 );
|
|
|
- for (int c = 0; c < 3; c++)
|
|
|
- {
|
|
|
- feats.calcVariance( c, cchannel+c );
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- feats.addChannel( 1 );
|
|
|
- feats.calcVariance( 0, cchannel );
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|