Operator Reference

train_dl_model_anomaly_datasetT_train_dl_model_anomaly_datasetTrainDlModelAnomalyDatasetTrainDlModelAnomalyDatasettrain_dl_model_anomaly_dataset (Operator)

train_dl_model_anomaly_datasetT_train_dl_model_anomaly_datasetTrainDlModelAnomalyDatasetTrainDlModelAnomalyDatasettrain_dl_model_anomaly_dataset — Train a deep learning model for anomaly detection.

Signature

train_dl_model_anomaly_dataset( : : DLModelHandle, DLSamples, DLTrainParam : DLTrainResult)

Herror T_train_dl_model_anomaly_dataset(const Htuple DLModelHandle, const Htuple DLSamples, const Htuple DLTrainParam, Htuple* DLTrainResult)

void TrainDlModelAnomalyDataset(const HTuple& DLModelHandle, const HTuple& DLSamples, const HTuple& DLTrainParam, HTuple* DLTrainResult)

HDict HDlModel::TrainDlModelAnomalyDataset(const HDictArray& DLSamples, const HDict& DLTrainParam) const

static void HOperatorSet.TrainDlModelAnomalyDataset(HTuple DLModelHandle, HTuple DLSamples, HTuple DLTrainParam, out HTuple DLTrainResult)

HDict HDlModel.TrainDlModelAnomalyDataset(HDict[] DLSamples, HDict DLTrainParam)

def train_dl_model_anomaly_dataset(dlmodel_handle: HHandle, dlsamples: Sequence[HHandle], dltrain_param: HHandle) -> HHandle

Description

The operator train_dl_model_anomaly_datasettrain_dl_model_anomaly_datasetTrainDlModelAnomalyDatasetTrainDlModelAnomalyDatasettrain_dl_model_anomaly_dataset performs the training of a deep learning model with 'type'"type""type""type""type"='anomaly_detection'"anomaly_detection""anomaly_detection""anomaly_detection""anomaly_detection" contained in DLModelHandleDLModelHandleDLModelHandleDLModelHandledlmodel_handle (for deep learning models with 'type'"type""type""type""type"='gc_anomaly_detection'"gc_anomaly_detection""gc_anomaly_detection""gc_anomaly_detection""gc_anomaly_detection" see train_dl_model_batchtrain_dl_model_batchTrainDlModelBatchTrainDlModelBatchtrain_dl_model_batch).

This operator processes the full training dataset at once. This is in contrast to the operator train_dl_model_batchtrain_dl_model_batchTrainDlModelBatchTrainDlModelBatchtrain_dl_model_batch. The iterations over the dataset are performed internally by the operator. Consequently, you only need to call this operator once with the full training dataset to train your anomaly detection model.

The training dataset is handed over in the tuple of dictionaries DLSamplesDLSamplesDLSamplesDLSamplesdlsamples. See the chapter Deep Learning / Model for further information to the used dictionaries and their keys. The operator expects within the training dataset only images without anomaly to train the anomaly detection model.

The dictionary DLTrainParamDLTrainParamDLTrainParamDLTrainParamdltrain_param can be used to change the hyperparameters. The following values are supported:

  • max_num_epochs: This parameter specifies the maximum number of epochs performed during training. In case the criterion specified by error_threshold is reached in an earlier epoch, the training will terminate regardless.

    Restriction: max_num_epochs >=1.

    Default: max_num_epochs = 30.

  • error_threshold: This parameter is a termination criterion for the training. If the training error is less than the specified error_threshold, the training terminates successfully.

    Restriction: 0.0 <= error_threshold <= 1.0.

    Default: error_threshold = 0.001.

  • domain_ratio: This parameter determines the percentage of information of each image used for training. Since images tend to contain an abundance of information, it is advisable to reduce its amount. Additionally, reducing domain_ratio can decrease the time needed for training. Please note, however, sufficient information needs to remain and therefore this value should not be set too small either. Otherwise the training result might not be satisfactory or the training itself might even fail.

    Restriction: 0.0 < domain_ratio <= 1.0.

    Default: domain_ratio = 0.1.

  • regularization_noise: This parameter can be set to regularize the training in order to improve robustness.

    Restriction: regularization_noise >=0.0.

    Default: regularization_noise = 0.0.

The output dictionary DLTrainResultDLTrainResultDLTrainResultDLTrainResultdltrain_result contains the following values:

  • final_error: The best error received during training.

  • final_epoch The epoch in which the error final_error was achieved.

Attention

The operator train_dl_model_anomaly_datasettrain_dl_model_anomaly_datasetTrainDlModelAnomalyDatasetTrainDlModelAnomalyDatasettrain_dl_model_anomaly_dataset internally calls functions that might not be deterministic. Therefore, results from multiple calls of train_dl_model_anomaly_datasettrain_dl_model_anomaly_datasetTrainDlModelAnomalyDatasetTrainDlModelAnomalyDatasettrain_dl_model_anomaly_dataset can slightly differ, although the same input values have been used.

System requirements: To run this operator on GPU by setting 'runtime'"runtime""runtime""runtime""runtime" to 'gpu'"gpu""gpu""gpu""gpu" (see get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamget_dl_model_param), cuDNN and cuBLAS are required. For further details, please refer to the “Installation Guide”, paragraph “Requirements for Deep Learning and Deep-Learning-Based Methods”. Alternatively, this operator can also be run on CPU by setting 'runtime'"runtime""runtime""runtime""runtime" to 'cpu'"cpu""cpu""cpu""cpu".

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Automatically parallelized on internal data level.

Parameters

DLModelHandleDLModelHandleDLModelHandleDLModelHandledlmodel_handle (input_control)  dl_model HDlModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Deep learning model handle.

DLSamplesDLSamplesDLSamplesDLSamplesdlsamples (input_control)  dict-array HDict, HTupleSequence[HHandle]HTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Tuple of Dictionaries with input images and corresponding information.

DLTrainParamDLTrainParamDLTrainParamDLTrainParamdltrain_param (input_control)  dict HDict, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Parameter for training the anomaly detection model.

Default: []

DLTrainResultDLTrainResultDLTrainResultDLTrainResultdltrain_result (output_control)  dict HDict, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Dictionary with the train result data.

Result

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

Possible Predecessors

read_dl_modelread_dl_modelReadDlModelReadDlModelread_dl_model, set_dl_model_paramset_dl_model_paramSetDlModelParamSetDlModelParamset_dl_model_param, get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamget_dl_model_param

Possible Successors

apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelapply_dl_model

See also

apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelapply_dl_model

Module

Foundation. This operator uses dynamic licensing (see the 'Installation Guide'). Which of the following modules is required depends on the specific usage of the operator:
Deep Learning Professional