Shortcuts

NeptuneVisBackend

class mmengine.visualization.NeptuneVisBackend(save_dir=None, init_kwargs=None)[源代码]

Neptune visualization backend class.

示例

>>> from mmengine.visualization import NeptuneVisBackend
>>> from mmengine import Config
>>> import numpy as np
>>> init_kwargs = {'project': 'your_project_name'}
>>> neptune_vis_backend = NeptuneVisBackend(init_kwargs=init_kwargs)
>>> img = np.random.randint(0, 256, size=(10, 10, 3))
>>> neptune_vis_backend.add_image('img', img)
>>> neptune_vis_backend.add_scalar('mAP', 0.6)
>>> neptune_vis_backend.add_scalars({'loss': 0.1, 'acc': 0.8})
>>> cfg = Config(dict(a=1, b=dict(b1=[0, 1])))
>>> neptune_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. NeptuneVisBackend does not require this argument. Defaults to None.

  • init_kwargs (dict, optional) –

    Neptune initialization parameters. Defaults to None.

    • project (str): Name of a project in a form of namespace/project_name. If project is not specified, the value of NEPTUNE_PROJECT environment variable will be taken.

    • api_token (str): User’s API token. If api_token is not api_token, the value of NEPTUNE_API_TOKEN environment variable will be taken. Note: It is strongly recommended to use NEPTUNE_API_TOKEN environment variable rather than placing your API token here.

    If ‘project’ and ‘api_token are not specified in init_kwargs, the ‘mode’ will be set to ‘offline’. See neptune.init_run for details.

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

Record the config to neptune.

参数:

config (Config) – The Config object

返回类型:

None

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

Record the image.

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

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

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

返回类型:

None

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

Record the scalar.

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

  • value (int, float) – 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 scalars’ data.

参数:
  • 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) – The scalar’s data will be saved to the file_path file at the same time if the file_path parameter is specified. Defaults to None.

返回类型:

None

close()[源代码]

Close an opened object.

返回类型:

None

property experiment

Return Neptune object.