The nearest neighbor classifier is invoked at the top level to evaluate detections. More...
#include <NNClassifier.h>
Public Member Functions | |
| void | addObject (const NNPatch &patch) |
| Initializes a new object class with the given patch. | |
| double | getConf (const NNPatch &patch, int objId=0, bool conservative=false) const |
| Returns the confidence of a given patch with respect to a certain class. | |
| double | getConf (NNPatch &patch, int objId, bool conservative, const ObjectBox &bbox, const unsigned char *rgb, int w, int h) const |
| Returns the confidence of a given patch while subsequently computing and saving the color histogram if needed. | |
| const std::vector< NNPatch > * | getNegPatches () const |
| Returns a pointer to negative patches (intended for drawing). | |
| const std::vector< std::vector < NNPatch > > * | getPosPatches () const |
| Returns a pointer to positive patches (intended for drawing). | |
| NNClassifier (int width, int height, int patchSize, bool useColor=true, bool allowFastChange=false) | |
| Constructor. | |
| NNClassifier (std::ifstream &inputStream) | |
| Constructor for loading from file. | |
| void | removeWarps () |
| Removes previously added warps (rotated patches) from positive list. | |
| void | saveToStream (std::ofstream &outputStream) const |
| Saves the classifier (i.e. the patches) to file. | |
| bool | trainNN (const NNPatch &patch, int objId=0, bool positive=true, bool tmp=false) |
| Trains a new patch to the classifier if it is considered "new" enough. | |
Private Member Functions | |
| double | cmpHistograms (const float *h1, const float *h2) const |
| double | crossCorr (const float *patchA, const float *patchB, float denom=1) const |
| double | getConf (const float *patch, float norm2=1.0f, int objId=0, bool conservative=false) const |
Private Attributes | |
| bool | ivAllowFastChange |
| int | ivHeight |
| std::vector< NNPatch > | ivNegPatches |
| int | ivPatchSize |
| std::vector< std::vector < NNPatch > > | ivPosPatches |
| bool | ivUseColor |
| std::vector< char > | ivWarpIndices |
| int | ivWidth |
Static Private Attributes | |
| static Histogram * | ivHistogram = Histogram::getInstance() |
The nearest neighbor classifier is invoked at the top level to evaluate detections.
Definition at line 65 of file NNClassifier.h.
| motld::NNClassifier::NNClassifier | ( | int | width, |
| int | height, | ||
| int | patchSize, | ||
| bool | useColor = true, |
||
| bool | allowFastChange = false |
||
| ) |
Constructor.
Definition at line 216 of file NNClassifier.h.
| motld::NNClassifier::NNClassifier | ( | std::ifstream & | inputStream | ) |
Constructor for loading from file.
Definition at line 220 of file NNClassifier.h.
| void motld::NNClassifier::addObject | ( | const NNPatch & | patch | ) |
Initializes a new object class with the given patch.
Definition at line 260 of file NNClassifier.h.
| double motld::NNClassifier::cmpHistograms | ( | const float * | h1, |
| const float * | h2 | ||
| ) | const [private] |
Definition at line 404 of file NNClassifier.h.
| double motld::NNClassifier::crossCorr | ( | const float * | patchA, |
| const float * | patchB, | ||
| float | denom = 1 |
||
| ) | const [private] |
Definition at line 393 of file NNClassifier.h.
| double motld::NNClassifier::getConf | ( | const NNPatch & | patch, |
| int | objId = 0, |
||
| bool | conservative = false |
||
| ) | const |
Returns the confidence of a given patch with respect to a certain class.
| patch | the patch that shall be evaluated |
| objId | Id of the class to compare or -1 for comparison to negative (background) patches |
| conservative | If true earlier positive patches are weighted more. |
Definition at line 308 of file NNClassifier.h.
| double motld::NNClassifier::getConf | ( | NNPatch & | patch, |
| int | objId, | ||
| bool | conservative, | ||
| const ObjectBox & | bbox, | ||
| const unsigned char * | rgb, | ||
| int | w, | ||
| int | h | ||
| ) | const |
Returns the confidence of a given patch while subsequently computing and saving the color histogram if needed.
Definition at line 326 of file NNClassifier.h.
| double motld::NNClassifier::getConf | ( | const float * | patch, |
| float | norm2 = 1.0f, |
||
| int | objId = 0, |
||
| bool | conservative = false |
||
| ) | const [private] |
Definition at line 352 of file NNClassifier.h.
| const std::vector< NNPatch > * motld::NNClassifier::getNegPatches | ( | ) | const |
Returns a pointer to negative patches (intended for drawing).
Definition at line 245 of file NNClassifier.h.
| const std::vector< std::vector< NNPatch > > * motld::NNClassifier::getPosPatches | ( | ) | const |
Returns a pointer to positive patches (intended for drawing).
Definition at line 241 of file NNClassifier.h.
| void motld::NNClassifier::removeWarps | ( | ) |
Removes previously added warps (rotated patches) from positive list.
Definition at line 250 of file NNClassifier.h.
| void motld::NNClassifier::saveToStream | ( | std::ofstream & | outputStream | ) | const |
Saves the classifier (i.e. the patches) to file.
Definition at line 418 of file NNClassifier.h.
| bool motld::NNClassifier::trainNN | ( | const NNPatch & | patch, |
| int | objId = 0, |
||
| bool | positive = true, |
||
| bool | tmp = false |
||
| ) |
Trains a new patch to the classifier if it is considered "new" enough.
| patch | the patch that shall be learned |
| objId | id of the object class to which the patch should be added |
| positive | true if element of this class, false if not (background patch) |
| tmp | true if this is a temporary (warped) patch |
Definition at line 284 of file NNClassifier.h.
bool motld::NNClassifier::ivAllowFastChange [private] |
Definition at line 98 of file NNClassifier.h.
int motld::NNClassifier::ivHeight [private] |
Definition at line 92 of file NNClassifier.h.
Histogram * motld::NNClassifier::ivHistogram = Histogram::getInstance() [static, private] |
Definition at line 94 of file NNClassifier.h.
std::vector<NNPatch> motld::NNClassifier::ivNegPatches [private] |
Definition at line 96 of file NNClassifier.h.
int motld::NNClassifier::ivPatchSize [private] |
Definition at line 93 of file NNClassifier.h.
std::vector<std::vector<NNPatch> > motld::NNClassifier::ivPosPatches [private] |
Definition at line 95 of file NNClassifier.h.
bool motld::NNClassifier::ivUseColor [private] |
Definition at line 98 of file NNClassifier.h.
std::vector<char> motld::NNClassifier::ivWarpIndices [private] |
Definition at line 97 of file NNClassifier.h.
int motld::NNClassifier::ivWidth [private] |
Definition at line 91 of file NNClassifier.h.