| Customize Help
| Save Settings

MclassTrain



Function Map
Synopsis
Train a classifier context.
Syntax
void MclassTrain(
MIL_ID TrainContextClassId, //in
MIL_ID ClassifierContextClassId, //in
MIL_ID TrainDatasetContextClassId, //in
MIL_ID DevDatasetContextClassId, //in
MIL_ID TrainResultClassId, //in
MIL_INT64 ControlFlag //in
)
Description

This function trains a classifier context. Results are stored in a classification result buffer. To get the results, use MclassGetResult(). A classifier context is trained according to a training context and dataset contexts.

To modify training related settings, call MclassControl() and MclassControlEntry(). To hook functions to training events, call MclassHookFunction().

A training context must be preprocessed before it is trained. To inquire a context's preprocessing state, call MclassInquire() with M_PREPROCESSED.

You can train a predefined CNN classifier context or a tree ensemble classifier context (ClassifierContextClassId). All other training contexts (TrainContextClassId, TrainDatasetContextClassId, and DevDatasetContextClassId) must be for the same type of classifier. Contexts must have been previously allocated on the required system using MclassAlloc().

A classifer context is not trained when you allocate it. You must call MclassTrain() to train it. You can also call this function to retrain a trained classifier context. To do so, you must copy the trained classifier context result, that MclassTrain() produces, into a classifier context, using MclassCopyResult(). You can then train that classifier context with MclassTrain(). Before training a trained context, you should modify your training settings. This process (train, copy result, modify settings, train) can be repeated as many times as required.

When your classifier context is properly trained, you can copy the result that MclassTrain() produces into a classifier context (MclassCopyResult()) and use that trained classifier context with MclassPredict().

Training time can vary considerably, depending on the complexity of the application, the available hardware, and the accuracy required. To produce a properly trained classifier, MclassTrain() might have to run for an extended period, and you might have to call it several times after modifying your training setup (for example, your training settings or your datasets).

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
TrainContextClassId

Specifies the identifier of the training context with which to train the classifier context. Training settings (MclassControl() and MclassControlEntry()) are held in the training context.

ClassifierContextClassId

Specifies the identifier of the classifier context to train. For CNN classification, you can set this parameter to the identifier of an original (untrained) classifier context that was predefined by Matrox. For tree ensemble classification, you can set this parameter to M_NULL to start a new training process. For both CNN and tree ensemble classification, you can set this parameter to the identifier of a trained classifier context, to continue the training process.

When you call MclassTrain(), the class definitions in the classifier context are discarded and replaced by the class definitions in the training dataset context (TrainDatasetContextClassId).

TrainDatasetContextClassId

Specifies the identifier of the training dataset context with which to train the classifier context. This parameter cannot be null.

DevDatasetContextClassId

Specifies the identifier of the development dataset with which to evaluate the performance of the classifier context's training. This helps determine the extent to which the classifier context is trained. The development dataset must not contain data (image or feature entries) that is in the training dataset context. The development dataset context must not contain augmented data.

Set this parameter to one of the following values:

function map For specifying the development dataset context identifier
Click to summarizeValue Description
Click to summarize M_NULL

Specifies to ignore the development dataset context, when you are training a tree ensemble classifier context. Results related to the development dataset (such as M_DEV_DATASET_ACCURACY) are unavailable.

You cannot specify M_NULL if you are training a predefined CNN classifier context, nor can you specify an empty development dataset context.

(summarize)
Click to summarize ContextDatasetId

Specifies the identifier of a features (M_DATASET_FEATURES) or images (M_DATASET_IMAGES) dataset context to use as the development dataset.

TrainResultClassId

Specifies the identifier of the classification result buffer in which to write the results of the training operation. This result buffer must have been previously allocated on the required system using MclassAllocResult() with M_TRAIN_CNN_RESULT or M_TRAIN_TREE_ENSEMBLE_RESULT.

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.
NULL