ClassesClassesClassesClasses | | | | Operators

add_sample_class_gmmT_add_sample_class_gmmAddSampleClassGmmadd_sample_class_gmmAddSampleClassGmmAddSampleClassGmm (Operator)


add_sample_class_gmmT_add_sample_class_gmmAddSampleClassGmmadd_sample_class_gmmAddSampleClassGmmAddSampleClassGmm — Add a training sample to the training data of a Gaussian Mixture Model.


add_sample_class_gmm( : : GMMHandle, Features, ClassID, Randomize : )

Herror T_add_sample_class_gmm(const Htuple GMMHandle, const Htuple Features, const Htuple ClassID, const Htuple Randomize)

Herror add_sample_class_gmm(const HTuple& GMMHandle, const HTuple& Features, const HTuple& ClassID, const HTuple& Randomize)

void HClassGmm::AddSampleClassGmm(const HTuple& Features, const HTuple& ClassID, const HTuple& Randomize) const

void AddSampleClassGmm(const HTuple& GMMHandle, const HTuple& Features, const HTuple& ClassID, const HTuple& Randomize)

void HClassGmm::AddSampleClassGmm(const HTuple& Features, Hlong ClassID, double Randomize) const

void HOperatorSetX.AddSampleClassGmm(
[in] VARIANT GMMHandle, [in] VARIANT Features, [in] VARIANT ClassID, [in] VARIANT Randomize)

void HClassGmmX.AddSampleClassGmm(
[in] VARIANT Features, [in] Hlong ClassID, [in] double Randomize)

static void HOperatorSet.AddSampleClassGmm(HTuple GMMHandle, HTuple features, HTuple classID, HTuple randomize)

void HClassGmm.AddSampleClassGmm(HTuple features, int classID, double randomize)


add_sample_class_gmmadd_sample_class_gmmAddSampleClassGmmadd_sample_class_gmmAddSampleClassGmmAddSampleClassGmm adds a training sample to the Gaussian Mixture Model (GMM) given by GMMHandleGMMHandleGMMHandleGMMHandleGMMHandleGMMHandle. The training sample is given by FeaturesFeaturesFeaturesFeaturesFeaturesfeatures and ClassIDClassIDClassIDClassIDClassIDclassID. FeaturesFeaturesFeaturesFeaturesFeaturesfeatures is the feature vector of the sample, and consequently must be a real vector of length NumDimNumDimNumDimNumDimNumDimnumDim, as specified in create_class_gmmcreate_class_gmmCreateClassGmmcreate_class_gmmCreateClassGmmCreateClassGmm. ClassIDClassIDClassIDClassIDClassIDclassID is the class of the sample, an integer between 0 and NumClassesNumClassesNumClassesNumClassesNumClassesnumClasses-1 (set in create_class_gmmcreate_class_gmmCreateClassGmmcreate_class_gmmCreateClassGmmCreateClassGmm).

In the special case where the feature vectors are of integer type, they are lying in the feature space in a grid with step width 1.0. For example, the RGB feature vectors typically used for color classification are triples having integer values between 0 and 255 for each of their components. In fact, there might be even several feature vectors representing the same point. When training a GMM with such data, the training algorithm may tend to align the modelled Gaussians along linearly dependent lines or planes of data that are parallel to the grid dimensions. If the number of CentersCentersCentersCentersCenterscenters returned by train_class_gmmtrain_class_gmmTrainClassGmmtrain_class_gmmTrainClassGmmTrainClassGmm is unusually high, this indicates such a behavior of the algorithm. The parameter RandomizeRandomizeRandomizeRandomizeRandomizerandomize can be used to handle such undesired effects. If RandomizeRandomizeRandomizeRandomizeRandomizerandomize > 0.0, random Gaussian noise with mean 0 and standard deviation RandomizeRandomizeRandomizeRandomizeRandomizerandomize is added to each component of the training data vectors, and the transformed training data is stored in the GMM. For values of RandomizeRandomizeRandomizeRandomizeRandomizerandomize 1.0, the randomized data will look like small clouds around the grid points, which does not improve the properties of the data cloud. For values of RandomizeRandomizeRandomizeRandomizeRandomizerandomize >> 2.0, the randomization might have a too strong influence on the resulting GMM. For integer feature vectors, a value of RandomizeRandomizeRandomizeRandomizeRandomizerandomize between 1.5 and 2.0 is recommended, which transforms the integer data into homogeneous clouds, without modifying its general form in the feature space. If the data has been created from integer data by scaling, the same problem may occur. Here, RandomizeRandomizeRandomizeRandomizeRandomizerandomize must be scaled with the same scale factor that was used to scale the original data.

Before the GMM can be trained with train_class_gmmtrain_class_gmmTrainClassGmmtrain_class_gmmTrainClassGmmTrainClassGmm, all training samples must be added to the GMM with add_sample_class_gmmadd_sample_class_gmmAddSampleClassGmmadd_sample_class_gmmAddSampleClassGmmAddSampleClassGmm.

The number of currently stored training samples can be queried with get_sample_num_class_gmmget_sample_num_class_gmmGetSampleNumClassGmmget_sample_num_class_gmmGetSampleNumClassGmmGetSampleNumClassGmm. Stored training samples can be read out again with get_sample_class_gmmget_sample_class_gmmGetSampleClassGmmget_sample_class_gmmGetSampleClassGmmGetSampleClassGmm.

Normally, it is useful to save the training samples in a file with write_samples_class_gmmwrite_samples_class_gmmWriteSamplesClassGmmwrite_samples_class_gmmWriteSamplesClassGmmWriteSamplesClassGmm to facilitate reusing the samples, and to facilitate that, if necessary, new training samples can be added to the data set, and hence to facilitate that a newly created GMM can be trained anew with the extended data set.


This operator modifies the state of the following input parameter:

The value of this parameter may not be shared across multiple threads without external synchronization.


GMMHandleGMMHandleGMMHandleGMMHandleGMMHandleGMMHandle (input_control, state is modified)  class_gmm HClassGmm, HTupleHTupleHClassGmm, HTupleHClassGmmX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

GMM handle.

FeaturesFeaturesFeaturesFeaturesFeaturesfeatures (input_control)  real-array HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Feature vector of the training sample to be stored.

ClassIDClassIDClassIDClassIDClassIDclassID (input_control)  number HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Class of the training sample to be stored.

RandomizeRandomizeRandomizeRandomizeRandomizerandomize (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Standard deviation of the Gaussian noise added to the training data.

Default value: 0.0

Suggested values: 0.0, 1.5, 2.0

Restriction: Randomize >= 0.0


If the parameters are valid, the operator add_sample_class_gmmadd_sample_class_gmmAddSampleClassGmmadd_sample_class_gmmAddSampleClassGmmAddSampleClassGmm returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Possible Predecessors


Possible Successors

train_class_gmmtrain_class_gmmTrainClassGmmtrain_class_gmmTrainClassGmmTrainClassGmm, write_samples_class_gmmwrite_samples_class_gmmWriteSamplesClassGmmwrite_samples_class_gmmWriteSamplesClassGmmWriteSamplesClassGmm


read_samples_class_gmmread_samples_class_gmmReadSamplesClassGmmread_samples_class_gmmReadSamplesClassGmmReadSamplesClassGmm, add_samples_image_class_gmmadd_samples_image_class_gmmAddSamplesImageClassGmmadd_samples_image_class_gmmAddSamplesImageClassGmmAddSamplesImageClassGmm

See also

clear_samples_class_gmmclear_samples_class_gmmClearSamplesClassGmmclear_samples_class_gmmClearSamplesClassGmmClearSamplesClassGmm, get_sample_num_class_gmmget_sample_num_class_gmmGetSampleNumClassGmmget_sample_num_class_gmmGetSampleNumClassGmmGetSampleNumClassGmm, get_sample_class_gmmget_sample_class_gmmGetSampleClassGmmget_sample_class_gmmGetSampleClassGmmGetSampleClassGmm



ClassesClassesClassesClasses | | | | Operators