Skip to content

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.

  1. Initialize the model for Continual Learning.

    1. Start from a pretrained network or a model that was already trained in the standard workflow and read it with

    2. Initialize the model for Continual Learning using

      Note

      At this step, it is possible to provide a DLDataset that has been created with read_dl_dataset_classification, split with split_dl_dataset, and preprocessed with preprocess_dl_dataset.

    3. If a dataset has been passed to init_dl_continual_learning, the model can be evaluated with

      • evaluate_dl_model.

      Visualization can be done with

      • dev_display_classification_evaluation.
  2. Extend the model with new data.

    1. Provide a preprocessed DLDataset with 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.

    2. 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_classification always 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.

  3. Evaluate the model.

    1. The evaluation can be done using the procedure

      • evaluate_dl_model.
    2. In Continual Learning for classification, multiple datasets can be passed, for example, one for the initial classes and another for the newly added ones.

    3. The dictionary EvaluationResult holds the evaluation measures. Visualization is possible with

      • dev_display_classification_evaluation.
  4. Run inference on new images.

    1. Generate a data dictionary DLSample for each image with

      • gen_dl_samples_from_images.
    2. Preprocess the images as done before, using

      • preprocess_dl_samples.
    3. Apply the model using the operator

    4. Retrieve the results from the dictionary 'DLResultBatch'.