WandbVisBackend¶
- class mmengine.visualization.WandbVisBackend(save_dir, init_kwargs=None, define_metric_cfg=None, commit=True, log_code_name=None)[source]¶
Wandb visualization backend class.
Examples
>>> from mmengine.visualization import WandbVisBackend >>> import numpy as np >>> wandb_vis_backend = WandbVisBackend() >>> img=np.random.randint(0, 256, size=(10, 10, 3)) >>> wandb_vis_backend.add_image('img', img) >>> wandb_vis_backend.add_scaler('mAP', 0.6) >>> wandb_vis_backend.add_scalars({'loss': [1, 2, 3],'acc': 0.8}) >>> cfg = Config(dict(a=1, b=dict(b1=[0, 1]))) >>> wandb_vis_backend.add_config(cfg)
- Parameters
save_dir (str, optional) – The root directory to save the files produced by the visualizer.
init_kwargs (dict, optional) – wandb initialization 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 for details. Default: Nonecommit (Optional[bool]) – (bool, optional) Save the metrics dict to the wandb server and increment the step. If false wandb.log just updates the current metrics dict with the row argument and metrics won’t be saved until wandb.log is called with commit=True. Default to True.
log_code_name (Optional[str]) –
(str, optional) The name of code artifact. By default, the artifact will be named source-$PROJECT_ID-$ENTRYPOINT_RELPATH. See wandb docs for details. Defaults to None. New in version 0.3.0.
- add_scalars(scalar_dict, step=0, file_path=None, **kwargs)[source]¶
Record the scalar’s data to wandb.
- property experiment¶
Return wandb object.
The experiment attribute can get the wandb backend, If you want to write other data, such as writing a table, you can directly get the wandb backend through experiment.