Shortcuts

WandbVisBackend

class mmengine.visualization.WandbVisBackend(save_dir, init_kwargs=None, define_metric_cfg=None, commit=True, log_code_name=None, watch_kwargs=None)[源代码]

Wandb visualization backend class.

实际案例

>>> 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)
参数
  • 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)[源代码]

Record the config to wandb.

参数

config (Config) – The Config object

返回类型

None

add_graph(model, data_batch, **kwargs)[源代码]

Record the model graph.

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

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

返回类型

None

add_image(name, image, step=0, **kwargs)[源代码]

Record the image to wandb.

参数
  • 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.

返回类型

None

add_scalar(name, value, step=0, **kwargs)[源代码]

Record the scalar data to wandb.

参数
  • 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.

返回类型

None

add_scalars(scalar_dict, step=0, file_path=None, **kwargs)[源代码]

Record the scalar’s data to wandb.

参数
  • 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.

返回类型

None

close()[源代码]

close an opened wandb object.

返回类型

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.0
Versions
latest
stable
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.