Shortcuts

TensorboardVisBackend

class mmengine.visualization.TensorboardVisBackend(save_dir)[source]

Tensorboard visualization backend class.

It can write images, config, scalars, etc. to a tensorboard file.

Examples

>>> from mmengine.visualization import TensorboardVisBackend
>>> import numpy as np
>>> vis_backend = TensorboardVisBackend(save_dir='temp_dir')
>>> img = np.random.randint(0, 256, size=(10, 10, 3))
>>> vis_backend.add_image('img', img)
>>> vis_backend.add_scaler('mAP', 0.6)
>>> vis_backend.add_scalars({'loss': 0.1,'acc':0.8})
>>> cfg = Config(dict(a=1, b=dict(b1=[0, 1])))
>>> vis_backend.add_config(cfg)
Parameters

save_dir (str) – The root directory to save the files produced by the backend.

add_config(config, **kwargs)[source]

Record the config to tensorboard.

Parameters

config (Config) – The Config object

Return type

None

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

Record the image to tensorboard.

Parameters
  • name (str) – The image identifier.

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

  • step (int) – Global step value to record. Default to 0.

Return type

None

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

Record the scalar data to tensorboard.

Parameters
  • name (str) – The scalar identifier.

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

  • step (int) – Global step value to record. Default to 0.

Return type

None

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

Record the scalar’s data to tensorboard.

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

  • step (int) – Global step value to record. Default to 0.

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

Return type

None

close()[source]

close an opened tensorboard object.

property experiment

Return Tensorboard object.

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.