ClassesClasses | | Operators

set_dl_classifier_paramset_dl_classifier_paramSetDlClassifierParamSetDlClassifierParam (Operator)

Name

set_dl_classifier_paramset_dl_classifier_paramSetDlClassifierParamSetDlClassifierParam — Set the parameters of the deep-learning-based classifier.

Signature

set_dl_classifier_param( : : DLClassifierHandle, GenParamName, GenParamValue : )

Herror set_dl_classifier_param(const Hlong DLClassifierHandle, const char* GenParamName, const char* GenParamValue)

Herror T_set_dl_classifier_param(const Htuple DLClassifierHandle, const Htuple GenParamName, const Htuple GenParamValue)

void SetDlClassifierParam(const HTuple& DLClassifierHandle, const HTuple& GenParamName, const HTuple& GenParamValue)

void HDlClassifier::SetDlClassifierParam(const HTuple& GenParamName, const HTuple& GenParamValue) const

void HDlClassifier::SetDlClassifierParam(const HString& GenParamName, const HString& GenParamValue) const

void HDlClassifier::SetDlClassifierParam(const char* GenParamName, const char* GenParamValue) const

static void HOperatorSet.SetDlClassifierParam(HTuple DLClassifierHandle, HTuple genParamName, HTuple genParamValue)

void HDlClassifier.SetDlClassifierParam(HTuple genParamName, HTuple genParamValue)

void HDlClassifier.SetDlClassifierParam(string genParamName, string genParamValue)

Description

set_dl_classifier_paramset_dl_classifier_paramSetDlClassifierParamSetDlClassifierParamSetDlClassifierParam sets the parameters and hyperparameters GenParamNameGenParamNameGenParamNameGenParamNamegenParamName of the neural network DLClassifierHandleDLClassifierHandleDLClassifierHandleDLClassifierHandleDLClassifierHandle to the values GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue.

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName can attain the following values:

'batch_size'"batch_size""batch_size""batch_size""batch_size":

Number of images (and corresponding labels) in a batch and thus the number of images that are processed simultaneously in a single iteration of the training. Please refer to train_dl_classifier_batchtrain_dl_classifier_batchTrainDlClassifierBatchTrainDlClassifierBatchTrainDlClassifierBatch for further details. This parameter is stored in the pretrained classifier. Per default, the 'batch_size'"batch_size""batch_size""batch_size""batch_size" is set such that a training of the pretrained classifier with up to 100 classes can be easily performed on a device with 8 gigabyte of memory. For the pretrained classifiers, the default values are hence given as follows:

pretrained classifier default value of 'batch_size'"batch_size""batch_size""batch_size""batch_size"
'pretrained_dl_classifier_compact.hdl'"pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl" 160
'pretrained_dl_classifier_enhanced.hdl'"pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl" 96

'classes'"classes""classes""classes""classes":

Tuple of labels corresponding to the classes of objects which are to be recognized. The order of the class names remains unchanged after the setting.

'gpu'"gpu""gpu""gpu""gpu":

Identifier of the GPU where the training and inference operators (train_dl_classifier_batchtrain_dl_classifier_batchTrainDlClassifierBatchTrainDlClassifierBatchTrainDlClassifierBatch and apply_dl_classifierapply_dl_classifierApplyDlClassifierApplyDlClassifierApplyDlClassifier are executed. Per default, the first available GPU is used. get_systemget_systemGetSystemGetSystemGetSystem with 'cuda_devices'"cuda_devices""cuda_devices""cuda_devices""cuda_devices" can be used to retrieve a list of available GPUs. Pass the index in this list to 'gpu'"gpu""gpu""gpu""gpu".

'learning_rate'"learning_rate""learning_rate""learning_rate""learning_rate":

Initial value of the factor determining the gradient influence during training. Please refer to train_dl_classifier_batchtrain_dl_classifier_batchTrainDlClassifierBatchTrainDlClassifierBatchTrainDlClassifierBatch for further details. Per default, the 'learning_rate'"learning_rate""learning_rate""learning_rate""learning_rate" is set to 0.001.

'momentum'"momentum""momentum""momentum""momentum":

When updating the arguments of the loss function, the hyperparameter 'momentum'"momentum""momentum""momentum""momentum" specifies to which extent previous updating vectors will be added to the current updating vector. Please refer to train_dl_classifier_batchtrain_dl_classifier_batchTrainDlClassifierBatchTrainDlClassifierBatchTrainDlClassifierBatch for further details. Per default, the 'momentum'"momentum""momentum""momentum""momentum" is set to 0.9.

'runtime_init'"runtime_init""runtime_init""runtime_init""runtime_init":

If called with 'immediately'"immediately""immediately""immediately""immediately", the GPU memory is initialized and the corresponding handle created. Otherwise this is done on demand, which may result in significantly larger execution times for the first call of apply_dl_classifierapply_dl_classifierApplyDlClassifierApplyDlClassifierApplyDlClassifier or train_dl_classifier_batchtrain_dl_classifier_batchTrainDlClassifierBatchTrainDlClassifierBatchTrainDlClassifierBatch. If 'gpu'"gpu""gpu""gpu""gpu" or 'batch_size'"batch_size""batch_size""batch_size""batch_size" is changed with subsequent calls of set_dl_classifier_paramset_dl_classifier_paramSetDlClassifierParamSetDlClassifierParamSetDlClassifierParam, the GPU memory is reinitialized.

'weight_prior'"weight_prior""weight_prior""weight_prior""weight_prior":

Regularization parameter used for regularization of the loss function. Regularization is helpful in the presence of overfitting during the classifier training. If the hyperparameter 'weight_prior'"weight_prior""weight_prior""weight_prior""weight_prior" is non-zero, the regularization term given below is added to the loss function (see also train_dl_classifier_batchtrain_dl_classifier_batchTrainDlClassifierBatchTrainDlClassifierBatchTrainDlClassifierBatch)

Here the index k runs over all weights of the network, except for the biases which are not regularized. The regularization term generally penalizes large weights, thus pushing the weights towards zero, which effectively reduces the complexity of the model. Simply put: Regularization favors simpler models that are less likely to learn noise in the data and generalize better. Per default no regularization is used, i.e. 'weight_prior'"weight_prior""weight_prior""weight_prior""weight_prior" is set to 0.0. In case the classifier overfits the data, it is strongly recommended to try different values for the parameter 'weight_prior'"weight_prior""weight_prior""weight_prior""weight_prior" to improve the generalization properties of the neural network. Choosing its value is a trade-off between the models ability to generalize, overfitting, and underfitting. If is too small, the model might overfit, if its too large the model might loose its ability to fit the data, because all weights are effectively zero. For finding an ideal value for , we recommend a cross-validation, i.e. to perform the training for a range of values and choose the value that results in the best validation error. For typical applications, we recommend testing the values for 'weight_prior'"weight_prior""weight_prior""weight_prior""weight_prior" on a logarithmic scale between . If the training takes a very long time, one might consider performing the hyperparameter optimization on a reduced amount of data.

For an explanation of the concept of deep-learning-based classification see the introduction of chapter Deep Learning / Classification.

Attention

To run this operator, cuDNN is required when setting 'gpu'"gpu""gpu""gpu""gpu" or 'runtime_init'"runtime_init""runtime_init""runtime_init""runtime_init". For further details, please refer to the Installation Guide, paragraph Requirements for Deep Learning.

Execution Information

Parameters

DLClassifierHandleDLClassifierHandleDLClassifierHandleDLClassifierHandleDLClassifierHandle (input_control)  dl_classifier HDlClassifier, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Handle of the deep-learning-based classifier.

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  attribute.name(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Name of the generic parameter.

Default value: 'classes' "classes" "classes" "classes" "classes"

List of values: 'batch_size'"batch_size""batch_size""batch_size""batch_size", 'classes'"classes""classes""classes""classes", 'gpu'"gpu""gpu""gpu""gpu", 'learning_rate'"learning_rate""learning_rate""learning_rate""learning_rate", 'momentum'"momentum""momentum""momentum""momentum", 'runtime_init'"runtime_init""runtime_init""runtime_init""runtime_init", 'weight_prior'"weight_prior""weight_prior""weight_prior""weight_prior"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  attribute.value(-array) HTupleHTupleHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong)

Value of the generic parameter.

Default value: ['class_1','class_2','class_3'] ["class_1","class_2","class_3"] ["class_1","class_2","class_3"] ["class_1","class_2","class_3"] ["class_1","class_2","class_3"]

Suggested values: 1, 2, 3, 50, 0.001, 'immediately'"immediately""immediately""immediately""immediately"

Result

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

Possible Predecessors

read_dl_classifierread_dl_classifierReadDlClassifierReadDlClassifierReadDlClassifier

Possible Successors

get_dl_classifier_paramget_dl_classifier_paramGetDlClassifierParamGetDlClassifierParamGetDlClassifierParam, apply_dl_classifierapply_dl_classifierApplyDlClassifierApplyDlClassifierApplyDlClassifier, train_dl_classifier_batchtrain_dl_classifier_batchTrainDlClassifierBatchTrainDlClassifierBatchTrainDlClassifierBatch

See also

get_dl_classifier_paramget_dl_classifier_paramGetDlClassifierParamGetDlClassifierParamGetDlClassifierParam

Module

Deep Learning Inference


ClassesClasses | | Operators