Skip to content

Workflow for advanced object detection🔗

The preprocessing and data augmentation are defined using a transform pipeline. The pipeline specifies a sequence of transformations that are applied to the input images before they are processed by the model.

We assume that your dataset is already labeled; see also About data.

Have a look at the HDevelop example dl_advanced_detection_workflow.hdev for a complete workflow. The example series detect_pills_deep_learning_*.hdev illustrates the individual workflow steps using the advanced object detection approach.

For details on defining and configuring transform pipelines, including data augmentation, see the dedicated HDevelop example dl_transform_pipeline.hdev.

  1. Load the model and configure the transform pipeline.

    1. Read the dataset containing the images and annotations into a dictionary DLDataset.
    2. Split the dataset represented by the dictionary DLDataset. This can be done using the procedure

      • split_dl_dataset.
    3. Create individual transform methods defining the desired preprocessing and augmentation steps. Typical transformations include random perspective transformations, flipping, normalization, and resizing and are created using operators such as:

    4. Combine the individual transforms into a transform pipeline using the operator

    5. Store the resulting pipeline in the dictionary DLDataset. Separate pipelines can be defined for training, validation, and test data. Typically, data augmentation is applied only during training, while for validation and test data only deterministic preprocessing steps are used.

  2. Read the model.

    1. Load a pretrained detection model using the operator

    2. Suggestions for the parameters max_overlap and max_overlap_class_agnostic can be determined from the Dataset using the procedure

      • determine_dl_model_detection_param.

      These suggestions are based on the ground truth annotations of the dataset and can be used as a starting point for finetuning the parameters.

    3. Configure the NMS parameters using the operator

      The NMS parameters include:

    • Maximum overlap for suppression (max_overlap)
    • Maximum overlap for suppression across classes (max_overlap_class_agnostic)
  3. Train the model.

    1. Set the training parameters and store them in the dictionary TrainParam.
    2. Train the model using the procedure

      • train_dl_model.

      During training, the transform pipeline is applied to the input data. This allows performing data augmentation and other preprocessing steps before the images are processed by the network.

  4. Evaluate the trained model.

    1. Evaluate the model using the procedure

      • evaluate_dl_model.
    2. Visualize the evaluation results using the procedure

      • dev_display_detection_detailed_evaluation.
  5. Run inference on new images.
    Apply the trained detection model:

    1. Generate a data dictionary DLSample for each input image using the procedure

      • gen_dl_samples_from_images.
    2. Apply the transform pipeline defined for test data to the generated samples using the operator

      The applied pipeline depends on the dataset configuration.

    3. Apply the model using the operator

    4. Retrieve the detection results from the dictionary DLResultBatch.