|
@@ -1,6 +1,6 @@
|
|
|
#include "RelativeLocationPrior.h"
|
|
|
|
|
|
-#include "core/image/Filter.h"
|
|
|
+#include "core/image/FilterT.h"
|
|
|
|
|
|
using namespace std;
|
|
|
using namespace NICE;
|
|
@@ -104,9 +104,9 @@ void RelativeLocationPrior::finishPriorsMaps ( ClassNames &cn )
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- double sigma = 0.1 * ( double ) mapsize; // 10% der Breite/Höhe der Maps
|
|
|
+ double sigma = 0.1 * ( double ) mapsize; // 10 percent of the maps height/width
|
|
|
|
|
|
- // alle Priormaps weichzeichnen
|
|
|
+ // Smoothing the maps
|
|
|
for ( int j = 0; j < classno; j++ )
|
|
|
{
|
|
|
for ( int i = 0; i < classno; i++ )
|
|
@@ -122,8 +122,8 @@ void RelativeLocationPrior::finishPriorsMaps ( ClassNames &cn )
|
|
|
}
|
|
|
|
|
|
NICE::FloatImage out;
|
|
|
- //FourierLibrary::gaussFilterD(tmp, out, sigma);
|
|
|
- NICE::filterGaussSigmaApproximate<float, float, float> ( tmp, sigma, &out );
|
|
|
+ NICE::FilterT<float,float,float> filter;
|
|
|
+ filter.filterGaussSigmaApproximate( tmp, sigma, &out );
|
|
|
|
|
|
for ( int x = 0; x < mapsize; x++ )
|
|
|
{
|
|
@@ -135,7 +135,7 @@ void RelativeLocationPrior::finishPriorsMaps ( ClassNames &cn )
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Summe aller Pixel an einer Position über jede Klasse = 1
|
|
|
+ // Sum of all pixels over all classes at a certain position equals 1
|
|
|
for ( int i = 0; i < classno; i++ )
|
|
|
{
|
|
|
for ( int x = 0; x < mapsize; x++ )
|
|
@@ -239,7 +239,7 @@ void RelativeLocationPrior::finishPriorsMaps ( ClassNames &cn )
|
|
|
|
|
|
void RelativeLocationPrior::trainClassifier ( Examples ®ions, NICE::MultiChannelImageT<double> & probabilities )
|
|
|
{
|
|
|
- // für alle Regionen einen Merkmalsvektor erzeugen und diesen der Trainingsmenge hinzufügen
|
|
|
+ // Creating a feature vector for all regions and adding it to the training set
|
|
|
getFeature ( regions, probabilities );
|
|
|
|
|
|
for ( int i = 0; i < ( int ) regions.size(); i++ )
|
|
@@ -251,9 +251,9 @@ void RelativeLocationPrior::trainClassifier ( Examples ®ions, NICE::MultiChan
|
|
|
|
|
|
void RelativeLocationPrior::finishClassifier()
|
|
|
{
|
|
|
- //////////////////////////////
|
|
|
- // Klassifikatoren anlernen //
|
|
|
- //////////////////////////////
|
|
|
+ //////////////////////
|
|
|
+ // Train Classifier //
|
|
|
+ //////////////////////
|
|
|
FeaturePool fp;
|
|
|
Feature *f = new SparseVectorFeature ( featdim );
|
|
|
f->explode ( fp );
|
|
@@ -404,7 +404,7 @@ void RelativeLocationPrior::getFeature ( Examples ®ions, NICE::MultiChannelIm
|
|
|
alpha.push_back ( tmpalpha );
|
|
|
}
|
|
|
|
|
|
- //erzeuge f_relloc
|
|
|
+ // create f_relloc
|
|
|
vector<vector<double> > vother;
|
|
|
vector<vector<double> > vself;
|
|
|
for ( int i = 0; i < ( int ) regions.size(); i++ )
|
|
@@ -430,7 +430,7 @@ void RelativeLocationPrior::getFeature ( Examples ®ions, NICE::MultiChannelIm
|
|
|
|
|
|
double val = priormaps[c]->get ( x, y, bestclasses[j] ) * alpha[j]; ;
|
|
|
|
|
|
- if ( bestclasses[j] == bestclasses[i] ) //Objektbestandteile
|
|
|
+ if ( bestclasses[j] == bestclasses[i] ) //parts of the object
|
|
|
{
|
|
|
tmp_self += val;
|
|
|
}
|
|
@@ -469,7 +469,7 @@ void RelativeLocationPrior::getFeature ( Examples ®ions, NICE::MultiChannelIm
|
|
|
|
|
|
for ( int i = 0; i < classno; i++ )
|
|
|
{
|
|
|
- //appearence feature (old probability for each class
|
|
|
+ //appearence feature (old probability for each class)
|
|
|
double fapp = log ( probabilities.get ( regions[r].second.x, regions[r].second.y, i ) );
|
|
|
|
|
|
if ( fabs ( fapp ) > 10e-7 )
|
|
@@ -497,7 +497,7 @@ void RelativeLocationPrior::restore ( istream & is, int format )
|
|
|
is >> mapsize;
|
|
|
is >> featdim;
|
|
|
|
|
|
- //Priorsmaps erzeugen
|
|
|
+ // Create prior maps
|
|
|
for ( int i = 0; i < classno; i++ )
|
|
|
{
|
|
|
NICE::MultiChannelImageT<double> *tmp = new NICE::MultiChannelImageT<double> ( mapsize, mapsize, classno);
|