Shortcuts

DVCLiveVisBackend

class mmengine.visualization.DVCLiveVisBackend(save_dir, artifact_suffix=('.json', '.py', 'yaml'), init_kwargs=None)[源代码]

DVCLive visualization backend class.

示例

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

备注

New in version 0.9.0.

参数:
  • save_dir (str, optional) – The root directory to save the files produced by the visualizer.

  • artifact_suffix (Tuple[str] or str, optional) – The artifact suffix. Defaults to (‘.json’, ‘.py’, ‘yaml’).

  • init_kwargs (dict, optional) – DVCLive initialization parameters. See DVCLive for details. Defaults to None.

add_config(config, **kwargs)[源代码]

Record the config to dvclive.

参数:

config (Config) – The Config object

返回类型:

None

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

Record the image to dvclive.

参数:
  • name (str) – The image identifier.

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

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

返回类型:

None

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

Record the scalar data to dvclive.

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

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

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

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

返回类型:

None

close()[源代码]

Close an opened dvclive object.

返回类型:

None

property experiment

Return dvclive object.

The experiment attribute can get the dvclive backend, If you want to write other data, such as writing a table, you can directly get the dvclive backend through experiment.