#include <ClassMappings.h>
Static Public Member Functions | |
static int | addClassName (const string &className) |
Add a class name to the registered list. | |
static void | loadClassMapFile (const string &classMapFileName) |
Load a class file. | |
static string | getClassNameFromIdx (const int idx) |
Get the class name using the index. | |
static int | getIdxFromClassName (const string &className) |
Get the index using the class name Example:. | |
static int | getNumClasses () |
Returns the number of classes. | |
Static Private Attributes | |
static vector< string > | _mapIdxToClass |
Maps the internal index to the class: internal_index->class. | |
static map< string, int > | _mapClassToIdx |
Maps the class to the internal index: class->internal_index. | |
static int | _numRegClasses = 0 |
The number of the classes registered. |
Each class (or label) is mapped into an index for efficiency reasons.
Definition at line 46 of file ClassMappings.h.
|
Add a class name to the registered list.
Definition at line 41 of file ClassMappings.cpp. References ClassMappings::_mapClassToIdx, ClassMappings::_mapIdxToClass, and ClassMappings::_numRegClasses. |
|
Get the class name using the index. Example: getClassNameFromIdx(0); // -> "rock"
Definition at line 76 of file ClassMappings.cpp. Referenced by Classifier::run(), and Serialization::vectorTag(). |
|
Get the index using the class name Example:.
getIdxFromClassName("rock"); // -> 0
Definition at line 92 of file ClassMappings.cpp. References ClassMappings::_mapClassToIdx. Referenced by UnSerialization::seekAndParseVectorTag(). |
|
Load a class file. The class file contains the list of the classes that will be used during learning or classification. The format of the file is just a list of names separated by white spaces. Example: country metal rock blues classical pop disco blues hiphop reggae
Definition at line 56 of file ClassMappings.cpp. |
|
Maps the class to the internal index: class->internal_index.
Definition at line 105 of file ClassMappings.h. Referenced by ClassMappings::addClassName(), and ClassMappings::getIdxFromClassName(). |
|
Maps the internal index to the class: internal_index->class.
Definition at line 98 of file ClassMappings.h. Referenced by ClassMappings::addClassName(). |