Hook that collects 3LC metrics on a detectron dataset.

Module Contents#





Hook that collects 3LC metrics on a detectron dataset.


class tlc.integration.detectron2.metrics_collection_hook.MetricsCollectionHook(dataset_name: str, metrics_collectors: list[tlc.client.torch.metrics.MetricsCollector], cfg: detectron2.config.CfgNode | None = None, collection_start_iteration: int = 0, collection_frequency: int = -1, collect_metrics_before_train: bool = False, collect_metrics_after_train: bool = False, metric_collection_batch_size: int = 8)#

Bases: detectron2.engine.hooks.HookBase

Hook that collects 3LC metrics on a detectron dataset.

  • dataset_name – The name of the dataset to collect metrics on. This name should be registered in the MetadataCatalog.

  • metrics_collectors – The metrics collectors to use.

  • cfg – The detectron config. If None, the config will be loaded from the trainer.

  • collection_start_iteration – The iteration to start collecting metrics on.

  • collection_frequency – The frequency with which to collect metrics.

  • collect_metrics_before_train – Whether to collect metrics at the beginning of training.

  • collect_metrics_after_train – Whether to collect metrics at the end of training.

  • metric_collection_batch_size – The batch size to use for collecting metrics.

before_train() None#

Creates a test-dataloader from the trainer and collects metrics if required.

after_train() None#

Collects metrics if required.

before_step() None#
after_step() None#

Collects 3LC metrics at regular intervals.