|
@@ -137,7 +137,7 @@ void SemSegNovelty::initFromConfig(const Config* conf, const string _confSection
|
|
|
this->findMaximumUncert = conf->gB(_confSection, "findMaximumUncert", true);
|
|
|
this->whs = conf->gI ( _confSection, "window_size", 10 );
|
|
|
//distance to next descriptor during training
|
|
|
- this->trainWsize = conf->gI ( _confSection, "train_window_size", 10 );
|
|
|
+ this->trainWSize = conf->gI ( _confSection, "train_window_size", 10 );
|
|
|
//distance to next descriptor during testing
|
|
|
this->testWSize = conf->gI (_confSection, "test_window_size", 10);
|
|
|
// select your segmentation method here
|
|
@@ -375,9 +375,9 @@ void SemSegNovelty::train ( const MultiDataset *md )
|
|
|
feats.calcIntegral ( c );
|
|
|
}
|
|
|
|
|
|
- for ( int y = 0; y < ysize; y += trainWsize)
|
|
|
+ for ( int y = 0; y < ysize; y += trainWSize)
|
|
|
{
|
|
|
- for ( int x = 0; x < xsize; x += trainWsize )
|
|
|
+ for ( int x = 0; x < xsize; x += trainWSize )
|
|
|
{
|
|
|
|
|
|
int classnoTmp = labels.getPixel ( x, y );
|
|
@@ -511,7 +511,7 @@ void SemSegNovelty::semanticseg ( CachedExample *ce, NICE::Image & segresult, NI
|
|
|
ce->getImageSize ( xsize, ysize );
|
|
|
|
|
|
probabilities.reInit( xsize, ysize, this->classNames->getMaxClassno() + 1);
|
|
|
- probabilities.setAll ( 0.0 );
|
|
|
+ probabilities.setAll ( -std::numeric_limits<double>::max() );
|
|
|
|
|
|
NICE::ColorImage img;
|
|
|
try {
|
|
@@ -627,20 +627,23 @@ void SemSegNovelty::semanticseg ( CachedExample *ce, NICE::Image & segresult, NI
|
|
|
int amountRegions = regionSeg->segRegions ( img, mask );
|
|
|
|
|
|
//compute probs per region
|
|
|
- std::vector<std::vector<double> > regionProb(amountRegions, std::vector<double>(probabilities.channels(),0.0));
|
|
|
+ std::vector<std::vector<double> > regionProb(amountRegions, std::vector<double>(probabilities.channels(), -std::numeric_limits<double>::max() ));
|
|
|
std::vector<double> regionNoveltyMeasure (amountRegions, 0.0);
|
|
|
|
|
|
std::vector<int> regionCounter(amountRegions, 0);
|
|
|
std::vector<int> regionCounterNovelty(amountRegions, 0);
|
|
|
- for ( int y = 0; y < ysize; y += trainWsize) //y++)
|
|
|
+ for ( int y = 0; y < ysize; y += testWSize) //y++)
|
|
|
{
|
|
|
- for (int x = 0; x < xsize; x += trainWsize) //x++)
|
|
|
+ for (int x = 0; x < xsize; x += testWSize) //x++)
|
|
|
{
|
|
|
int r = mask(x,y);
|
|
|
regionCounter[r]++;
|
|
|
+
|
|
|
for(int j = 0; j < probabilities.channels(); j++)
|
|
|
{
|
|
|
- regionProb[r][j] += probabilities ( x, y, j );
|
|
|
+ if( regionProb[r][j] == -std::numeric_limits<double>::max() )
|
|
|
+ regionProb[r][j] = 0.0f;
|
|
|
+ regionProb[r][j] += probabilities ( x, y, j );
|
|
|
}
|
|
|
|
|
|
if ( forbidden_classesActiveLearning.find( labels(x,y) ) == forbidden_classesActiveLearning.end() )
|
|
@@ -721,9 +724,9 @@ void SemSegNovelty::semanticseg ( CachedExample *ce, NICE::Image & segresult, NI
|
|
|
//current most novel region of the image has "higher" novelty score then previous most novel region of all test images worked on so far
|
|
|
// -> save new important features of this region
|
|
|
Examples examples;
|
|
|
- for ( int y = 0; y < ysize; y += trainWsize )
|
|
|
+ for ( int y = 0; y < ysize; y += testWSize )
|
|
|
{
|
|
|
- for ( int x = 0; x < xsize; x += trainWsize)
|
|
|
+ for ( int x = 0; x < xsize; x += testWSize)
|
|
|
{
|
|
|
if(mask(x,y) == maxUncertRegion)
|
|
|
{
|
|
@@ -1116,7 +1119,7 @@ void SemSegNovelty::computeNoveltyByGPMean( NICE::FloatImage & noveltyImage,
|
|
|
}
|
|
|
|
|
|
//check whether we found a class with higher smaller abs mean than the current minimum
|
|
|
- if (abs(probabilities(x,y,j)) < minMeanAbs)
|
|
|
+ if (abs( cr.scores[j] ) < minMeanAbs)
|
|
|
{
|
|
|
minMeanAbs = abs(cr.scores[j]);
|
|
|
}
|
|
@@ -1663,9 +1666,9 @@ void SemSegNovelty::restore ( std::istream & is, int format )
|
|
|
is >> tmp; // end of block
|
|
|
tmp = this->removeEndTag ( tmp );
|
|
|
}
|
|
|
- else if ( tmp.compare("trainWsize") == 0 )
|
|
|
+ else if ( tmp.compare("trainWSize") == 0 )
|
|
|
{
|
|
|
- is >> trainWsize;
|
|
|
+ is >> trainWSize;
|
|
|
is >> tmp; // end of block
|
|
|
tmp = this->removeEndTag ( tmp );
|
|
|
}
|
|
@@ -2021,7 +2024,7 @@ void SemSegNovelty::store ( std::ostream & os, int format ) const
|
|
|
os << this->createStartTag( "featExtract" ) << std::endl;
|
|
|
|
|
|
os << this->createStartTag( "trainWsize" ) << std::endl;
|
|
|
- os << this->trainWsize << std::endl;
|
|
|
+ os << this->trainWSize << std::endl;
|
|
|
os << this->createStartTag( "trainWsize" ) << std::endl;
|
|
|
|
|
|
os << this->createStartTag( "whs" ) << std::endl;
|