MLflowVisBackend¶
- class mmengine.visualization.MLflowVisBackend(save_dir, exp_name=None, run_name=None, tags=None, params=None, tracking_uri=None, artifact_suffix=('.json', '.log', '.py', 'yaml'), tracked_config_keys=None, artifact_location=None)[source]¶
MLflow visualization backend class.
It can write images, config, scalars, etc. to a mlflow file.
Examples
>>> from mmengine.visualization import MLflowVisBackend >>> from mmengine import Config >>> import numpy as np >>> vis_backend = MLflowVisBackend(save_dir='temp_dir') >>> img = np.random.randint(0, 256, size=(10, 10, 3)) >>> vis_backend.add_image('img.png', img) >>> vis_backend.add_scalar('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.
exp_name (str, optional) – The experiment name. Defaults to None.
run_name (str, optional) – The run name. Defaults to None.
tags (dict, optional) – The tags to be added to the experiment. Defaults to None.
params (dict, optional) – The params to be added to the experiment. Defaults to None.
tracking_uri (str, optional) – The tracking uri. Defaults to None.
artifact_suffix (Tuple[str] or str, optional) – The artifact suffix. Defaults to (‘.json’, ‘.log’, ‘.py’, ‘yaml’).
tracked_config_keys (dict, optional) – The top level keys of config that will be added to the experiment. If it is None, which means all the config will be added. Defaults to None. New in version 0.7.4.
artifact_location (str, optional) – The location to store run artifacts. If None, the server picks an appropriate default. Defaults to None. New in version 0.10.4.
- add_config(config, **kwargs)[source]¶
Record the config to mlflow.
- Parameters:
config (Config) – The Config object
- Return type:
None
- add_scalar(name, value, step=0, **kwargs)[source]¶
Record the scalar data to mlflow.
- 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 mlflow.
- property experiment¶
Return MLflow object.