@Namespace(value="cv::ml") public static class opencv_ml.EM extends opencv_ml.StatModel
\sa \ref ml_intro_em
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator| Modifier and Type | Field and Description |
|---|---|
static int |
COV_MAT_DEFAULT
enum cv::ml::EM::Types
|
static int |
COV_MAT_DIAGONAL
enum cv::ml::EM::Types
|
static int |
COV_MAT_GENERIC
enum cv::ml::EM::Types
|
static int |
COV_MAT_SPHERICAL
enum cv::ml::EM::Types
|
static int |
DEFAULT_MAX_ITERS
enum cv::ml::EM::
|
static int |
DEFAULT_NCLUSTERS
enum cv::ml::EM::
|
static int |
START_AUTO_STEP
enum cv::ml::EM::
|
static int |
START_E_STEP
enum cv::ml::EM::
|
static int |
START_M_STEP
enum cv::ml::EM::
|
COMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL| Constructor and Description |
|---|
EM(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static opencv_ml.EM |
create()
Creates empty %EM model.
|
int |
getClustersNumber() |
int |
getCovarianceMatrixType() |
void |
getCovs(opencv_core.MatVector covs)
\brief Returns covariation matrices
|
opencv_core.Mat |
getMeans()
\brief Returns the cluster centers (means of the Gaussian mixture)
|
opencv_core.TermCriteria |
getTermCriteria() |
opencv_core.Mat |
getWeights()
\brief Returns weights of the mixtures
|
opencv_core.Point2d |
predict2(opencv_core.Mat sample,
opencv_core.Mat probs)
\brief Returns a likelihood logarithm value and an index of the most probable mixture component
for the given sample.
|
opencv_core.Point2d |
predict2(opencv_core.UMat sample,
opencv_core.UMat probs) |
void |
setClustersNumber(int val)
\copybrief getClustersNumber @see getClustersNumber
|
void |
setCovarianceMatrixType(int val)
\copybrief getCovarianceMatrixType @see getCovarianceMatrixType
|
void |
setTermCriteria(opencv_core.TermCriteria val)
\copybrief getTermCriteria @see getTermCriteria
|
boolean |
trainE(opencv_core.Mat samples,
opencv_core.Mat means0) |
boolean |
trainE(opencv_core.Mat samples,
opencv_core.Mat means0,
opencv_core.Mat covs0,
opencv_core.Mat weights0,
opencv_core.Mat logLikelihoods,
opencv_core.Mat labels,
opencv_core.Mat probs)
\brief Estimate the Gaussian mixture parameters from a samples set.
|
boolean |
trainE(opencv_core.UMat samples,
opencv_core.UMat means0) |
boolean |
trainE(opencv_core.UMat samples,
opencv_core.UMat means0,
opencv_core.UMat covs0,
opencv_core.UMat weights0,
opencv_core.UMat logLikelihoods,
opencv_core.UMat labels,
opencv_core.UMat probs) |
boolean |
trainEM(opencv_core.Mat samples) |
boolean |
trainEM(opencv_core.Mat samples,
opencv_core.Mat logLikelihoods,
opencv_core.Mat labels,
opencv_core.Mat probs)
\brief Estimate the Gaussian mixture parameters from a samples set.
|
boolean |
trainEM(opencv_core.UMat samples) |
boolean |
trainEM(opencv_core.UMat samples,
opencv_core.UMat logLikelihoods,
opencv_core.UMat labels,
opencv_core.UMat probs) |
boolean |
trainM(opencv_core.Mat samples,
opencv_core.Mat probs0) |
boolean |
trainM(opencv_core.Mat samples,
opencv_core.Mat probs0,
opencv_core.Mat logLikelihoods,
opencv_core.Mat labels,
opencv_core.Mat probs)
\brief Estimate the Gaussian mixture parameters from a samples set.
|
boolean |
trainM(opencv_core.UMat samples,
opencv_core.UMat probs0) |
boolean |
trainM(opencv_core.UMat samples,
opencv_core.UMat probs0,
opencv_core.UMat logLikelihoods,
opencv_core.UMat labels,
opencv_core.UMat probs) |
calcError, calcError, empty, getVarCount, isClassifier, isTrained, predict, predict, predict, predict, train, train, train, trainloadANN_MLP, loadANN_MLP, loadBoost, loadBoost, loadDTrees, loadDTrees, loadEM, loadEM, loadKNearest, loadKNearest, loadLogisticRegression, loadLogisticRegression, loadNormalBayesClassifier, loadNormalBayesClassifier, loadRTrees, loadRTrees, loadSVM, loadSVMclear, getDefaultName, position, read, save, save, writeaddress, asBuffer, asByteBuffer, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, free, hashCode, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, physicalBytes, position, put, realloc, setNull, sizeof, toString, totalBytes, withDeallocator, zeropublic static final int COV_MAT_SPHERICAL
public static final int COV_MAT_DIAGONAL
public static final int COV_MAT_GENERIC
public static final int COV_MAT_DEFAULT
public static final int DEFAULT_NCLUSTERS
public static final int DEFAULT_MAX_ITERS
public static final int START_E_STEP
public static final int START_M_STEP
public static final int START_AUTO_STEP
public EM(Pointer p)
Pointer.Pointer(Pointer).public int getClustersNumber()
setClustersNumberpublic void setClustersNumber(int val)
public int getCovarianceMatrixType()
setCovarianceMatrixTypepublic void setCovarianceMatrixType(int val)
@ByVal public opencv_core.TermCriteria getTermCriteria()
setTermCriteriapublic void setTermCriteria(@Const @ByRef opencv_core.TermCriteria val)
@ByVal public opencv_core.Mat getWeights()
Returns vector with the number of elements equal to the number of mixtures.
@ByVal public opencv_core.Mat getMeans()
Returns matrix with the number of rows equal to the number of mixtures and number of columns equal to the space dimensionality.
public void getCovs(@ByRef opencv_core.MatVector covs)
Returns vector of covariation matrices. Number of matrices is the number of gaussian mixtures, each matrix is a square floating-point matrix NxN, where N is the space dimensionality.
@ByVal public opencv_core.Point2d predict2(@ByVal opencv_core.Mat sample, @ByVal opencv_core.Mat probs)
sample - A sample for classification. It should be a one-channel matrix of
\f$1 \times dims\f$ or \f$dims \times 1\f$ size.probs - Optional output matrix that contains posterior probabilities of each component
given the sample. It has \f$1 \times nclusters\f$ size and CV_64FC1 type.
The method returns a two-element double vector. Zero element is a likelihood logarithm value for the sample. First element is an index of the most probable mixture component for the given sample.
@ByVal public opencv_core.Point2d predict2(@ByVal opencv_core.UMat sample, @ByVal opencv_core.UMat probs)
@Cast(value="bool") public boolean trainEM(@ByVal opencv_core.Mat samples, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat logLikelihoods, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat labels, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat probs)
This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm.
Unlike many of the ML models, %EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the *Maximum Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \f$p_{i,k}\f$ in probs, \f$a_k\f$ in means , \f$S_k\f$ in covs[k], \f$\pi_k\f$ in weights , and optionally computes the output "class label" for each sample: \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable mixture component for each sample).
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
samples - Samples from which the Gaussian mixture model will be estimated. It should be a
one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
it will be converted to the inner matrix of such type for the further computing.logLikelihoods - The optional output matrix that contains a likelihood logarithm value for
each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.labels - The optional output "class label" for each sample:
\f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.probs - The optional output matrix that contains posterior probabilities of each Gaussian
mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
CV_64FC1 type.@Cast(value="bool") public boolean trainEM(@ByVal opencv_core.Mat samples)
@Cast(value="bool") public boolean trainEM(@ByVal opencv_core.UMat samples, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat logLikelihoods, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat labels, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat probs)
@Cast(value="bool") public boolean trainEM(@ByVal opencv_core.UMat samples)
@Cast(value="bool") public boolean trainE(@ByVal opencv_core.Mat samples, @ByVal opencv_core.Mat means0, @ByVal(nullValue="cv::InputArray(cv::noArray())") opencv_core.Mat covs0, @ByVal(nullValue="cv::InputArray(cv::noArray())") opencv_core.Mat weights0, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat logLikelihoods, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat labels, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat probs)
This variation starts with Expectation step. You need to provide initial means \f$a_k\f$ of mixture components. Optionally you can pass initial weights \f$\pi_k\f$ and covariance matrices \f$S_k\f$ of mixture components.
samples - Samples from which the Gaussian mixture model will be estimated. It should be a
one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
it will be converted to the inner matrix of such type for the further computing.means0 - Initial means \f$a_k\f$ of mixture components. It is a one-channel matrix of
\f$nclusters \times dims\f$ size. If the matrix does not have CV_64F type it will be
converted to the inner matrix of such type for the further computing.covs0 - The vector of initial covariance matrices \f$S_k\f$ of mixture components. Each of
covariance matrices is a one-channel matrix of \f$dims \times dims\f$ size. If the matrices
do not have CV_64F type they will be converted to the inner matrices of such type for the
further computing.weights0 - Initial weights \f$\pi_k\f$ of mixture components. It should be a one-channel
floating-point matrix with \f$1 \times nclusters\f$ or \f$nclusters \times 1\f$ size.logLikelihoods - The optional output matrix that contains a likelihood logarithm value for
each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.labels - The optional output "class label" for each sample:
\f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.probs - The optional output matrix that contains posterior probabilities of each Gaussian
mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
CV_64FC1 type.@Cast(value="bool") public boolean trainE(@ByVal opencv_core.Mat samples, @ByVal opencv_core.Mat means0)
@Cast(value="bool") public boolean trainE(@ByVal opencv_core.UMat samples, @ByVal opencv_core.UMat means0, @ByVal(nullValue="cv::InputArray(cv::noArray())") opencv_core.UMat covs0, @ByVal(nullValue="cv::InputArray(cv::noArray())") opencv_core.UMat weights0, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat logLikelihoods, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat labels, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat probs)
@Cast(value="bool") public boolean trainE(@ByVal opencv_core.UMat samples, @ByVal opencv_core.UMat means0)
@Cast(value="bool") public boolean trainM(@ByVal opencv_core.Mat samples, @ByVal opencv_core.Mat probs0, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat logLikelihoods, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat labels, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.Mat probs)
This variation starts with Maximization step. You need to provide initial probabilities \f$p_{i,k}\f$ to use this option.
samples - Samples from which the Gaussian mixture model will be estimated. It should be a
one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
it will be converted to the inner matrix of such type for the further computing.probs0 - logLikelihoods - The optional output matrix that contains a likelihood logarithm value for
each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.labels - The optional output "class label" for each sample:
\f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.probs - The optional output matrix that contains posterior probabilities of each Gaussian
mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
CV_64FC1 type.@Cast(value="bool") public boolean trainM(@ByVal opencv_core.Mat samples, @ByVal opencv_core.Mat probs0)
@Cast(value="bool") public boolean trainM(@ByVal opencv_core.UMat samples, @ByVal opencv_core.UMat probs0, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat logLikelihoods, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat labels, @ByVal(nullValue="cv::OutputArray(cv::noArray())") opencv_core.UMat probs)
@Cast(value="bool") public boolean trainM(@ByVal opencv_core.UMat samples, @ByVal opencv_core.UMat probs0)
@opencv_core.Ptr public static opencv_ml.EM create()
Copyright © 2017. All rights reserved.