Shortcuts

WandbVisBackend

class mmengine.visualization.WandbVisBackend(save_dir, init_kwargs=None, define_metric_cfg=None, commit=True, log_code_name=None, watch_kwargs=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. See wandb.init for details. Defaults to None.

  • define_metric_cfg (dict or list[dict], optional) – When a dict is set, it is a dict of metrics and summary for wandb.define_metric. The key is metric and the value is summary. When a list is set, each dict should be a valid argument of the define_metric. For example, define_metric_cfg={'coco/bbox_mAP': 'max'}, means the maximum value of coco/bbox_mAP is logged on wandb UI. When define_metric_cfg=[dict(name='loss', step_metric='epoch')], the “loss” will be plotted against the epoch. See wandb define_metric for details. Defaults to None.

  • commit (bool, optional) – 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. Defaults to True.

  • log_code_name (str, optional) – By default, the artifact will be named source-$PROJECT_ID-$ENTRYPOINT_RELPATH. See wandb log_code for details. Defaults to None. New in version 0.3.0.

  • watch_kwargs (optional, dict) – Agurments for wandb.watch. New in version 0.4.0.

add_config(config, **kwargs)[source]

Record the config to wandb.

Parameters

config (Config) – The Config object

Return type

None

add_graph(model, data_batch, **kwargs)[source]

Record the model graph.

Parameters
  • model (torch.nn.Module) – Model to draw.

  • data_batch (Sequence[dict]) – Batch of data from dataloader.

Return type

None

add_image(name, image, step=0, **kwargs)[source]

Record the image to wandb.

Parameters
  • name (str) – The image identifier.

  • image (np.ndarray) – The image to be saved. The format should be RGB.

  • step (int) – Useless parameter. Wandb does not need this parameter. Defaults to 0.

Return type

None

add_scalar(name, value, step=0, **kwargs)[source]

Record the scalar data to wandb.

Parameters
  • name (str) – The scalar identifier.

  • value (int, float, torch.Tensor, np.ndarray) – Value to save.

  • step (int) – Useless parameter. Wandb does not need this parameter. Defaults to 0.

Return type

None

add_scalars(scalar_dict, step=0, file_path=None, **kwargs)[source]

Record the scalar’s data to wandb.

Parameters
  • scalar_dict (dict) – Key-value pair storing the tag and corresponding values.

  • step (int) – Useless parameter. Wandb does not need this parameter. Defaults to 0.

  • file_path (str, optional) – Useless parameter. Just for interface unification. Defaults to None.

Return type

None

close()[source]

close an opened wandb object.

Return type

None

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.

Read the Docs v: v0.8.3
Versions
latest
stable
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.