BaseVisBackend — mmengine 0.10.7 documentation (original) (raw)
class mmengine.visualization.BaseVisBackend(save_dir)[source]¶
Base class for visualization backend.
All backends must inherit BaseVisBackend
and implement the required functions.
Parameters:
save_dir (str, optional) – The root directory to save the files produced by the backend.
add_config(config, **kwargs)[source]¶
Record the config.
Parameters:
config (Config) – The Config object
Return type:
None
add_graph(model, data_batch, **kwargs)[source]¶
Record the model graph.
Parameters:
- model (torch.nn.Module) – Model to draw.
- data_batch (Sequence _[_dict]) – Batch of data from dataloader.
Return type:
None
add_image(name, image, step=0, **kwargs)[source]¶
Record the image.
Parameters:
- 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.
Return type:
None
add_scalar(name, value, step=0, **kwargs)[source]¶
Record the scalar.
Parameters:
- name (str) – The scalar identifier.
- value (int, float) – Value to save.
- step (int) – Global step value to record. Defaults to 0.
Return type:
None
add_scalars(scalar_dict, step=0, file_path=None, **kwargs)[source]¶
Record the scalars’ data.
Parameters:
- 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.
Return type:
None
Close an opened object.
Return type:
None
abstract property experiment_: Any_¶
Return the experiment object associated with this visualization backend.
The experiment attribute can get the visualization backend, such as wandb, tensorboard. If you want to write other data, such as writing a table, you can directly get the visualization backend through experiment.