| Customize Help
| Save Settings

MclassPredict



Function Map
Synopsis
Predict the class to which the target belongs.
Syntax
void MclassPredict(
MIL_ID ContextClassId, //in
MIL_ID TargetMilObjectId, //in
MIL_ID DatasetContextOrResultClassId, //in
MIL_INT64 ControlFlag //in
)
Description

This function uses a trained classifier context to predict the class to which the target belongs. For a trained CNN classifier context, you can specify an image or an images dataset context as the target. For a trained tree ensemble classifier context, you can specify an array of features or a features dataset context as the target.

This function is typically called with a target image (for image classification) or a target array of features (for feature classification).

You can also call this function with a target dataset. This can be done to predict the class that represents the dataset's entries (which you can inquire with M_CLASS_INDEX_PREDICTED and M_PREDICTED_CLASS_SCORES). You can then use these predictions to help manually define the ground truth of the entries.

Before calling this function, the classifier context must be in a preprocessed state and it must be trained. To inquire this information, use M_PREPROCESSED and M_CLASSIFIER_STATUS.

If your target is an image or an array of features, results are stored in a result buffer (DatasetContextOrResultClassId). To get these results, use MclassGetResult(). If your target is a dataset context, results are stored in a dataset context (DatasetContextOrResultClassId). To inquire about the dataset context, use MclassInquire().

If your target is a dataset context, you can hook functions to prediction events, using MclassHookFunction() (for example, with M_PREDICT_ENTRY). To get information about the events that caused the hook-handler function to execute, call MclassGetHookInfo().

Classification contexts and result buffers must have been previously allocated on the required system, using MclassAlloc() and MclassAllocResult().

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ContextClassId

Specifies the identifier of the trained classifier context to use for the prediction operation. You can specify a trained CNN classifier context (M_CLASSIFIER_CNN_PREDEFINED) or a trained tree ensemble classifier context (M_CLASSIFIER_TREE_ENSEMBLE).

TargetMilObjectId

Specifies the identifier of the target to classify. Set this parameter to one of the following values:

function map For specifying the target to classify
Click to summarizeValue Description
Click to summarize ArrayBufId

Specifies the identifier of a one-dimensional 32-bit float array that holds a list of features. In this case, the prediction operation will predict the best class to which the array of features belongs. The number of features in the array must be the same as the number of trained features in the dataset used to train the classifier context (DatasetContextOrResultClassId).

You must set the ContextClassId parameter to the identifier of a trained tree ensemble classifier context.

(summarize)
Click to summarize ContextDatasetId

Specifies the identifier of a features or images dataset context. In this case, the prediction operation will predict the best class to which each dataset entry (feature list or image) belongs.

You must set the ContextClassId parameter to the identifier of a trained CNN classifier context or a trained tree ensemble classifier context.

(summarize)
Click to summarize ImageBufId

Specifies the identifier of a 1- or 3-band target image. In this case, the prediction operation will predict the best class to which the target image belongs.

You must set the ContextClassId parameter to the identifier of a trained CNN classifier context.

By default, MIL considers the size of the target image to be the same as the source layer size; this means you are performing a typical image classification process. If the target image size is larger than the source layer size, you are performing coarse segmentation. To use a target image that is larger, you must call MclassControl() with M_TARGET_IMAGE_SIZE_X and M_TARGET_IMAGE_SIZE_Y.

(summarize)
DatasetContextOrResultClassId

Specifies the identifier of the result buffer or dataset in which to write the results of the prediction operation. Set this parameter to one of the following values:

function map For specifying the result buffer or dataset in which to write the results of the prediction
Click to summarizeValue Description
Click to summarize ContextDatasetId

Specifies the identifier of a features dataset context (M_DATASET_FEATURES) or images dataset context (M_DATASET_IMAGES). You must call MclassPredict() with a features or images dataset context as your target (TargetMilObjectId). The dataset context specified by the DatasetContextOrResultClassId parameter must either be empty, or be the same dataset as your target.

(summarize)
Click to summarize ResultBufPredictId

Specifies the identifier of a CNN prediction result buffer (M_PREDICT_CNN_RESULT) or a tree ensemble prediction result buffer (M_PREDICT_TREE_ENSEMBLE_RESULT). In this case, you must call MclassPredict() with an image or an array of features as your target (TargetMilObjectId).

(summarize)
ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; milclass.lib.
DLL Requires mil.dll; milclass.dll.