Workflow for Continual Learning🔗
In contrast to standard classification, the general workflow for a Continual Learning for Classification task is not split into multiple parts.
Tip
Take a look at the HDevelop example continual_learning_for_classification.hdev for an application.
-
Initialize the model for Continual Learning.
-
Start from a pretrained network or a model that was already trained in the standard workflow and read it with
-
Initialize the model for Continual Learning using
Note
At this step, it is possible to provide a
DLDatasetthat has been created withread_dl_dataset_classification, split withsplit_dl_dataset, and preprocessed withpreprocess_dl_dataset. -
If a dataset has been passed to
init_dl_continual_learning, the model can be evaluated withevaluate_dl_model.
Visualization can be done with
dev_display_classification_evaluation.
-
-
Extend the model with new data.
-
Provide a preprocessed
DLDatasetwith the new images (either of new classes or extensions of existing ones).Important
This dataset must not contain the training images that were used during initialization or in one of the earlier extend steps.
For this, use
-
read_dl_dataset_classification, -
split_dl_dataset, and -
preprocess_dl_dataset.
-
-
Extend the model using
This operator can be called multiple times on the same model, each time with new data.
During extension, the operator automatically checks class names and IDs for consistency. Existing class names are kept, new class names are added, and IDs are adapted accordingly. Additionally, the dataset is modified internally so that its class IDs are consistent with those of the model. Hence, you do not need to adapt the class IDs manually.For example,
read_dl_dataset_classificationalways assigns class IDs starting from 0. If the model already contains two classes, and the new dataset introduces a third class with ID 0, the operator remaps this new class to ID 2 internally. This ensures that the dataset and the model remain consistent without any manual adjustments.
-
-
Evaluate the model.
-
The evaluation can be done using the procedure
evaluate_dl_model.
-
In Continual Learning for classification, multiple datasets can be passed, for example, one for the initial classes and another for the newly added ones.
-
The dictionary
EvaluationResultholds the evaluation measures. Visualization is possible withdev_display_classification_evaluation.
-
-
Run inference on new images.
-
Generate a data dictionary
DLSamplefor each image withgen_dl_samples_from_images.
-
Preprocess the images as done before, using
preprocess_dl_samples.
-
Apply the model using the operator
-
Retrieve the results from the dictionary
'DLResultBatch'.
-