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.
-
Load the model and configure the transform pipeline.
- Read the dataset containing the images and annotations into a dictionary
DLDataset. -
Split the dataset represented by the dictionary
DLDataset. This can be done using the proceduresplit_dl_dataset.
-
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:
-
Combine the individual transforms into a transform pipeline using the operator
-
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.
- Read the dataset containing the images and annotations into a dictionary
-
Read the model.
-
Load a pretrained detection model using the operator
-
Suggestions for the parameters
max_overlapandmax_overlap_class_agnosticcan be determined from the Dataset using the proceduredetermine_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.
-
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)
-
-
Train the model.
- Set the training parameters and store them in the dictionary
TrainParam. -
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.
- Set the training parameters and store them in the dictionary
-
Evaluate the trained model.
-
Evaluate the model using the procedure
evaluate_dl_model.
-
Visualize the evaluation results using the procedure
dev_display_detection_detailed_evaluation.
-
-
Run inference on new images.
Apply the trained detection model:-
Generate a data dictionary
DLSamplefor each input image using the proceduregen_dl_samples_from_images.
-
Apply the transform pipeline defined for test data to the generated samples using the operator
The applied pipeline depends on the dataset configuration.
-
Apply the model using the operator
-
Retrieve the detection results from the dictionary
DLResultBatch.
-