Skip to content
Snippets Groups Projects
Unverified Commit cfb884c1 authored by takuoko's avatar takuoko Committed by GitHub
Browse files

[Enhancement] update docstring of wandb define_metric (#509)

* wandb define_metric

* fix docs

* add wandb docs link
parent ac5e79c6
No related branches found
No related tags found
No related merge requests found
...@@ -340,6 +340,15 @@ class WandbVisBackend(BaseVisBackend): ...@@ -340,6 +340,15 @@ class WandbVisBackend(BaseVisBackend):
produced by the visualizer. produced by the visualizer.
init_kwargs (dict, optional): wandb initialization init_kwargs (dict, optional): wandb initialization
input parameters. Default to None. input parameters. Default to None.
define_metric_cfg (dict, optional):
A dict of metrics and summary for wandb.define_metric.
The key is metric and the value is summary.
When ``define_metric_cfg={'coco/bbox_mAP': 'max'}``,
The maximum value of``coco/bbox_mAP`` is logged on wandb UI.
See
`wandb docs <https://docs.wandb.ai/ref/python/run#define_metric>`_
for details.
Default: None
commit: (bool, optional) Save the metrics dict to the wandb server commit: (bool, optional) Save the metrics dict to the wandb server
and increment the step. If false `wandb.log` just and increment the step. If false `wandb.log` just
updates the current metrics dict with the row argument updates the current metrics dict with the row argument
...@@ -350,9 +359,11 @@ class WandbVisBackend(BaseVisBackend): ...@@ -350,9 +359,11 @@ class WandbVisBackend(BaseVisBackend):
def __init__(self, def __init__(self,
save_dir: str, save_dir: str,
init_kwargs: Optional[dict] = None, init_kwargs: Optional[dict] = None,
define_metric_cfg: Optional[dict] = None,
commit: Optional[bool] = True): commit: Optional[bool] = True):
super().__init__(save_dir) super().__init__(save_dir)
self._init_kwargs = init_kwargs self._init_kwargs = init_kwargs
self._define_metric_cfg = define_metric_cfg
self._commit = commit self._commit = commit
def _init_env(self): def _init_env(self):
...@@ -370,6 +381,9 @@ class WandbVisBackend(BaseVisBackend): ...@@ -370,6 +381,9 @@ class WandbVisBackend(BaseVisBackend):
'Please run "pip install wandb" to install wandb') 'Please run "pip install wandb" to install wandb')
wandb.init(**self._init_kwargs) wandb.init(**self._init_kwargs)
if self._define_metric_cfg is not None:
for metric, summary in self._define_metric_cfg.items():
wandb.define_metric(metric, summary=summary)
self._wandb = wandb self._wandb = wandb
@property # type: ignore @property # type: ignore
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment