TensorboardVisBackend¶
- class mmengine.visualization.TensorboardVisBackend(save_dir)[源代码]¶
Tensorboard visualization backend class.
It can write images, config, scalars, etc. to a tensorboard file.
示例
>>> 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)
- 参数:
save_dir (str) – The root directory to save the files produced by the backend.
- add_config(config, **kwargs)[源代码]¶
Record the config to tensorboard.
- 参数:
config (Config) – The Config object
- 返回类型:
None
- add_scalar(name, value, step=0, **kwargs)[源代码]¶
Record the scalar data to tensorboard.
- 参数:
name (str) – The scalar identifier.
value (int, float, torch.Tensor, np.ndarray) – Value to save.
step (int) – Global step value to record. Defaults to 0.
- 返回类型:
None
- add_scalars(scalar_dict, step=0, file_path=None, **kwargs)[源代码]¶
Record the scalar’s data to tensorboard.
- property experiment¶
Return Tensorboard object.