train_dl_classifier_batch — Perform a training step of a deep-learning-based classifier on a batch of images.
train_dl_classifier_batch performs a training step of the deep-learning-based classifier contained in DLClassifierHandle. The classifier handle DLClassifierHandle has to be read previously using read_dl_classifier. In order to apply training steps, classes have to be specified using set_dl_classifier_param. Other hyperparameters such as the learning rate and the momentum are also important for a successful training. They are set using set_dl_classifier_param. The training step is done on basis of a single batch of images from the training data set, thus the images BatchImages with labels BatchLabels. Thereby, the number of images within the batch must be consistent with the batch size that can be set with set_dl_classifier_param. Note that the images in BatchImages must fulfill certain conditions regarding, for example, the image size and gray value range, depending on the chosen network. Please have a look at read_dl_classifier and set_dl_classifier_param for more information. The labels in BatchLabels can be handed over as an array of strings, or as an array of indices corresponding to the position of the label within the array of classes (counting from Valref(0)) set before via 'classes' with set_dl_classifier_param. Information about the results of the training step as the value of the loss are stored in DLClassifierTrainResultHandle and can be accessed using get_dl_classifier_train_result.
Note that an epoch generally consists of a large number of batches and that a successful training involves many epochs. Therefore train_dl_classifier_batch has to be applied several times with different batches. For a more detailed explanation, we refer to Deep Learning / Classification.
During training, a nonlinear optimization algorithm minimizes the value of the loss function. The later one is determined based on the prediction of the neural network on the current batch of images. The algorithm used for optimization is stochastic gradient descent (SGD). It updates the layers' weights of the previous iteration to the new values at iteration as follows:
Here, stands for the learning rate, for the momentum, and for the classification result of the deep learning-based classifier which depends on the network weights and the input batch . The variable is used to involve the influence of the momentum . The loss function used here is the Multinomial Logistic Loss in combination with a quadratic regularization term ,
Here, is a one-hot encoded target vector that encodes the label of the -th image of the batch containing -many images, and shall be understood to be a vector such that is applied on each component of . The regularization term is a weighted -norm involving all weights except for biases. Its influence can be controlled through . In the above formula, stands for the hyperparameter 'weight_prior' that can be set with set_dl_classifier_param.
For an explanation of the concept of deep-learning-based classification see the introduction of chapter Deep Learning / Classification.
The operator train_dl_classifier_batch internally calls functions that might not be deterministic. Therefore, results from multiple calls of train_dl_classifier_batch can slightly differ, although the same input values have been used.
To run this operator, cuDNN and cuBLAS are required. For further details, please refer to the Installation Guide, paragraph Requirements for Deep Learning.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
Images comprising the batch.
Handle of the deep-learning-based classifier.
Corresponding labels for each of the images.
Default value: 
List of values: 
Handle of the training results from the deep-learning-based classifier.
If the parameters are valid, the operator train_dl_classifier_batch returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
read_dl_classifier, set_dl_classifier_param, get_dl_classifier_param
get_dl_classifier_train_result, apply_dl_classifier, clear_dl_classifier_train_result, clear_dl_classifier
Deep Learning Training