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. 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: None

  • commit (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.

  • 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. Default 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. Default 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. Default to 0.

  • file_path (str, optional) – Useless parameter. Just for interface unification. Default 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.4.0
Versions
latest
stable
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.