Visualization — mmengine 0.10.7 documentation (original) (raw)

1 Overall Design

Visualization provides an intuitive explanation of the training and testing process of the deep learning model. In OpenMMLab, we expect the visualization module to meet the following requirements:

Based on the above requirements, we proposed the Visualizer and various VisBackend such as LocalVisBackend, WandbVisBackend, and TensorboardVisBackend in OpenMMLab 2.0. The visualizer could not only visualize the image data, but also things like configurations, scalars, and model structure.

The UML diagram of the two is as follows.

2 Visualizer

The external interface of Visualizer can be divided into three categories.

  1. Drawing APIs

The above APIs can be called in a chain except for draw_featmap because the image size may change after this method is called. To avoid confusion, draw_featmap is a static method.

  1. Storage APIs

Interfaces beginning with the add prefix represent storage APIs. [datasample] (./data_element.md)is the unified interface of each downstream repository in the OpenMMLab 2.0, and add_datasample can process the data sample directly .

  1. Other APIs

For more details, you can refer to Visualizer Tutorial.

3 VisBackend

After drawing, the drawn data can be stored in multiple visualization storage backends. To unify the interfaces, MMEngine provides an abstract class, BaseVisBackend, and some commonly used backends such as LocalVisBackend, WandbVisBackend, and TensorboardVisBackend. The main interfaces and properties of BaseVisBackend are as follows:

BaseVisBackend defines five common data writing interfaces. Some writing backends are very powerful, such as WandB, which could write tables and videos. Users can directly obtain the experiment object for such needs and then call native APIs of the corresponding backend. LocalVisBackend, WandbVisBackend, and TensorboardVisBackend are all inherited from BaseVisBackend and implement corresponding storage functions according to their features. Users can also customize BaseVisBackend to extend the storage backends and implement custom storage requirements.

For more details, you can refer to Storage Backend Tutorial.