Hook that collects detectron2 standard metrics.

Module Contents#





Hook that collects detectron2 standard metrics.


class tlc.integration.detectron2.detectron_metrics_collection_hook.DetectronMetricsCollectionHook(run_url: str, cfg: detectron2.config.CfgNode | None = None, collection_start_iteration: int = 0, collection_frequency: int = -1, collect_metrics_before_train: bool = False)#

Bases: detectron2.engine.hooks.HookBase

Hook that collects detectron2 standard metrics.

Collect any metrics that are available in the detectron2 event storage and write them as a single table to the run.

  • run_url – The URL of the run.

  • cfg – The detectron2 config. If None, the config will be read 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.

before_train() None#

Checks that the detectron config includes the values required to collect metrics, collects metrics if required.

after_train() None#

Writes the metrics table to the run.

after_step() None#

Collects metrics if required.