tlc.integration.super_gradients.callbacks.detection_callback

Callback for collecting predictions from SuperGradients detection models.

Module Contents

Classes

API

class DetectionMetricsCollectionCallback(
project_name: str | None = None,
run_name: str | None = None,
run_description: str | None = None,
image_column_name: str = 'image',
label_column_name: str | None = None,
metrics_collection_epochs: list[int] = [],
collect_metrics_on_train_end: bool = True,
collect_val_only: bool = False,
batch_size: int | None = 32,
pipeline_params: PipelineParams = PipelineParams(),
)

Bases: tlc.integration.super_gradients.callbacks.base_callback.MetricsCollectionCallback

Callback that collects per-sample metrics and logs SuperGradients aggregate metrics to a 3LC run.

To collect per-sample metrics, subclasses must implement the methods compute_metrics and metrics_column_schemas, and the property label_column_name.

Parameters:
  • project_name – The name of the 3LC project to use if no active run exists.

  • run_name – The name of the 3LC run to use if no active run exists.

  • run_description – The description of the 3LC run to use if no active run exists.

  • image_column_name – The name of the column in the table that contains the images.

  • label_column_name – The name of the column in the table that contains the labels. If not provided, a task-specific default will be used.

  • metrics_collection_epochs – The zero-indexed epochs after which to collect metrics.

  • collect_metrics_on_train_end – Whether to collect metrics after training finishes.

  • collect_val_only – Whether to collect metrics only on the validation set.

  • metrics_collection_dataloader_args – Additional arguments to pass to the dataloaders used for metrics collection.

  • batch_size – The batch size to use for metrics collection.

  • pipeline_params – The pipeline parameters to use for metrics collection.

property label_column_name: str
compute_metrics(
images: list[str],
predictions: super_gradients.training.utils.predict.prediction_results.ImagesDetectionPrediction | super_gradients.training.utils.predict.prediction_results.ImageDetectionPrediction,
table: Table,
) dict[str, Any]

Compute metrics from a batch of data and corresponding predictions.

metrics_column_schemas(
table: Table,
) dict[str, Schema]

Return the column schemas for the metrics of this callback.