Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::extras::OutexClassificationEngine< T, I, C > Class Template Reference

#include <OutexClassificationEngine.h>

List of all members.


Detailed Description

template<class T, class I = std::string, class C = int>
class prapi::extras::OutexClassificationEngine< T, I, C >

This class automatically parses and classifies Outex test suites.

It automatically creates sample sets and asks a subclass to perform the actual classification on each iteration of the test suite.


Public Methods

 OutexClassificationEngine (bool precalculate=true)
 Construct a classification engine.

virtual ~OutexClassificationEngine ()
 Clean up any reserved resources.

void setPrecalculation (bool precalculate)
 Set the precalculation flag.

bool getPrecalculation ()
 Get the current value of the precalculation flag.

void setRange (int startIndex=0, int endIndex=-1)
 Set the start and end indices for the classification problems to be run.

int getStartIndex () const
 Get the current start index.

int getEndIndex () const
 Get the current end index.

virtual util::List< T > getFeatureVector (const util::Matrix< int > &mat)
 Whenever the engine encounters a gray-scale image, this method is called.

virtual util::List< T > getFeatureVector (const util::Matrix< RGBColor<> > &mat)
 Whenever a color image is encountered, this method is consulted to extract the features.

virtual void classify (util::List< Sample< T, I, C > > &train, util::List< Sample< T, I, C > > &test, int classCount)=0
 Once the engine has constructed the necessary sample sets for classification, it calls this method.

util::List< ConfusionMatrixgetConfusionMatrices ()
 Once each iteration has been completed, the confusion matrices from each classification are collected in a list.

util::List< util::List< std::string > > getClasses ()
 Get the class names from each classification.

util::List< std::string > getClasses (int index) throw (InvalidArgumentException&)
 Get the class names at the specified classification round.

OutexResult evaluateSuite (std::string path) throw (OutexException&)
 The function evaluateSuite classifies all the problems in the test suite and returns the result in OutexResult format.


Protected Attributes

bool _bPrecalculate
 The pre-calculation flag.

int _iStartIndex
 Start and end indices for the problems to be evaluated.

int _iEndIndex
 Start and end indices for the problems to be evaluated.

util::List< ConfusionMatrix_lstConfusionMatrices
 A list stroring a confusion matrix for each classification round.

util::List< util::List< std::string > > _lstClasses
 Class names for each classification round.


Constructor & Destructor Documentation

template<class T, class I = std::string, class C = int>
prapi::extras::OutexClassificationEngine< T, I, C >::OutexClassificationEngine bool    precalculate = true [inline]
 

Construct a classification engine.

Parameters:
precalculate  a flag that controls the memory consumption versus speed trade-off. If set to true (the default), feature vectors for all images are calculated and stored in the main memory before classification. If there is not enough memory for this, the flag can be set to false, in which case a feature vector is calculated each time an image is accessed. Memory consumption is kept at minimum, but feature vectors must be calculated many times for each image.


Member Function Documentation

template<class T, class I = std::string, class C = int>
virtual void prapi::extras::OutexClassificationEngine< T, I, C >::classify util::List< Sample< T, I, C > > &    train,
util::List< Sample< T, I, C > > &    test,
int    classCount
[pure virtual]
 

Once the engine has constructed the necessary sample sets for classification, it calls this method.

The method can use whatever classification principle you feel suitable. As a result, the classification of each sample in the test set should be performed.

Parameters:
train  The train set which is used for training.
test  The test set which is used for testing.
classCount  the total number of classes

template<class T, class I, class C>
OutexResult prapi::extras::OutexClassificationEngine< T, I, C >::evaluateSuite std::string    path throw (OutexException&)
 

The function evaluateSuite classifies all the problems in the test suite and returns the result in OutexResult format.

Parameters:
path  A path to the root of the test suite.
Returns:
The result of the classification.

template<class T, class I = std::string, class C = int>
util::List<ConfusionMatrix> prapi::extras::OutexClassificationEngine< T, I, C >::getConfusionMatrices   [inline]
 

Once each iteration has been completed, the confusion matrices from each classification are collected in a list.

You can get the list by calling this method.

template<class T, class I = std::string, class C = int>
virtual util::List<T> prapi::extras::OutexClassificationEngine< T, I, C >::getFeatureVector const util::Matrix< RGBColor<> > &    mat [inline, virtual]
 

Whenever a color image is encountered, this method is consulted to extract the features.

The default implementation returns an empty list.

Parameters:
mat  a color image

template<class T, class I = std::string, class C = int>
virtual util::List<T> prapi::extras::OutexClassificationEngine< T, I, C >::getFeatureVector const util::Matrix< int > &    mat [inline, virtual]
 

Whenever the engine encounters a gray-scale image, this method is called.

The method should extract the needed features and return them as a feature vector. The default implementation returns an empty list.

Parameters:
mat  a gray-scale image matrix

template<class T, class I = std::string, class C = int>
void prapi::extras::OutexClassificationEngine< T, I, C >::setPrecalculation bool    precalculate [inline]
 

Set the precalculation flag.

See also:
OutexClassificationEngine(bool)

template<class T, class I = std::string, class C = int>
void prapi::extras::OutexClassificationEngine< T, I, C >::setRange int    startIndex = 0,
int    endIndex = -1
[inline]
 

Set the start and end indices for the classification problems to be run.

(By default, all problems are classified.)

Parameters:
startIndex  the first problem to be classified.
endIndex  the last problem to be classified. Negative value means 'as many as possible'.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.