10 class CSamplesAccumulator;
56 DllExport
CTrainNodeKNN(byte nStates, word nFeatures,
size_t maxSamples);
59 DllExport
void reset(
void);
60 DllExport
void save(
const std::string &path,
const std::string &name = std::string(),
short idx = -1)
const;
61 DllExport
void load(
const std::string &path,
const std::string &name = std::string(),
short idx = -1);
63 DllExport
void addFeatureVec(
const Mat &featureVector, byte gt);
64 DllExport
void train(
bool doClean =
false);
void load(const std::string &path, const std::string &name=std::string(), short idx=-1)
Loads the training data.
TrainNodeKNNParams(float _bias, size_t _maxNeighbors, size_t _maxSamples)
void save(const std::string &path, const std::string &name=std::string(), short idx=-1) const
Saves the training data.
size_t maxNeighbors
Max number of neighbors to be used for calculating potentials.
Nearest Neighbor training class.
CKDTree * m_pTree
k-D Tree
void addFeatureVec(const Mat &featureVector, byte gt)
Adds new feature vector.
TrainNodeKNNParams m_params
size_t maxSamples
Maximum number of samples to be used in training. 0 means using all the samples.
Class implementing k-D Tree data structure.
k-Nearest Neighbors parameters
void train(bool doClean=false)
Random model training.
void calculateNodePotentials(const Mat &featureVector, Mat &potential, Mat &mask) const
Calculates the node potential, based on the feature vector.
void loadFile(FILE *pFile)
Loads the random model from the file.
Samples accumulator abstract class.
struct DirectGraphicalModels::TrainNodeKNNParams TrainNodeKNNParams
k-Nearest Neighbors parameters
float bias
Regularization CRF parameter: bias is added to all potential values.
void saveFile(FILE *pFile) const
Saves the random model into the file.
Base abstract class for node potentials training.
CTrainNodeKNN(byte nStates, word nFeatures, TrainNodeKNNParams params=TRAIN_NODE_KNN_PARAMS_DEFAULT)
Constructor.
void reset(void)
Resets class variables.
CSamplesAccumulator * m_pSamplesAcc
Samples Accumulator.
const TrainNodeKNNParams TRAIN_NODE_KNN_PARAMS_DEFAULT
void init(TrainNodeKNNParams params)