Skip to content

train_dl_model_anomaly_datasetTrainDlModelAnomalyDatasetTrainDlModelAnomalyDatasettrain_dl_model_anomaly_datasetT_train_dl_model_anomaly_dataset🔗

Short description🔗

train_dl_model_anomaly_datasetTrainDlModelAnomalyDatasetTrainDlModelAnomalyDatasettrain_dl_model_anomaly_datasetT_train_dl_model_anomaly_dataset — Train a deep learning model for anomaly detection.

Signature🔗

train_dl_model_anomaly_dataset( dl_model DLModelHandle, dict DLSamples, dict DLTrainParam, out dict DLTrainResult )void TrainDlModelAnomalyDataset( const HTuple& DLModelHandle, const HTuple& DLSamples, const HTuple& DLTrainParam, HTuple* DLTrainResult )static void HOperatorSet.TrainDlModelAnomalyDataset( HTuple DLModelHandle, HTuple DLSamples, HTuple DLTrainParam, out HTuple DLTrainResult )def train_dl_model_anomaly_dataset( dlmodel_handle: HHandle, dlsamples: Sequence[HHandle], dltrain_param: HHandle ) -> HHandle

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

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

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

Description🔗

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

This operator processes the full training dataset at once. This is in contrast to the operator train_dl_model_batchTrainDlModelBatch. 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 DLSamplesDLSamplesdlsamples. 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 DLTrainParamDLTrainParamdltrain_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 >=11.

    Default: max_num_epochs = 3030.

  • 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.00.0 <= error_threshold <= 1.01.0.

    Default: error_threshold = 0.0010.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.00.0 < domain_ratio <= 1.01.0.

    Default: domain_ratio = 0.10.1.

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

    Restriction: regularization_noise >=0.00.0.

    Default: regularization_noise = 0.00.0.

The output dictionary DLTrainResultDLTrainResultdltrain_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_datasetTrainDlModelAnomalyDataset internally calls functions that might not be deterministic. Therefore, results from multiple calls of train_dl_model_anomaly_datasetTrainDlModelAnomalyDataset can slightly differ, although the same input values have been used.

System requirements: To run this operator on GPU by setting 'runtime'"runtime" to 'gpu'"gpu" (see get_dl_model_paramGetDlModelParam), 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" to 'cpu'"cpu".

Execution information🔗

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🔗

DLModelHandleDLModelHandledlmodel_handle (input_control) dl_model → (handle)HTuple (HHandle)HDlModel, HTuple (IntPtr)HHandleHtuple (handle)

Deep learning model handle.

DLSamplesDLSamplesdlsamples (input_control) dict-array → (handle)HTuple (HHandle)HDict, HTuple (IntPtr)Sequence[HHandle]Htuple (handle)

Tuple of Dictionaries with input images and corresponding information.

DLTrainParamDLTrainParamdltrain_param (input_control) dict → (handle)HTuple (HHandle)HDict, HTuple (IntPtr)HHandleHtuple (handle)

Parameter for training the anomaly detection model.

Default: [][]

DLTrainResultDLTrainResultdltrain_result (output_control) dict → (handle)HTuple (HHandle)HDict, HTuple (IntPtr)HHandleHtuple (handle)

Dictionary with the train result data.

Result🔗

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

Combinations with other operators🔗

Combinations

Possible predecessors

read_dl_modelReadDlModel, set_dl_model_paramSetDlModelParam, get_dl_model_paramGetDlModelParam

Possible successors

apply_dl_modelApplyDlModel

See also

apply_dl_modelApplyDlModel

Module🔗

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