File size: 1,657 Bytes
0122a25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""Visualizer base class."""

from mapdet3d.common.typing import ArgsType


class Visualizer:
    """Base visualizer class."""

    def __init__(self, vis_freq: int = 50, image_mode: str = "RGB") -> None:
        """Initialize the visualizer.

        Args:
            vis_freq (int): Visualization frequency. Defaults to 0.
            image_mode (str): Image channel mode (RGB or BGR).
        """
        self.vis_freq = vis_freq
        self.image_mode = image_mode
        assert image_mode in {"RGB", "BGR"}

    def _run_on_batch(self, cur_iter: int) -> bool:
        """Return whether to run on current iteration.

        Args:
            cur_iter (int): Current iteration.
        """
        return cur_iter % self.vis_freq == 0

    def reset(self) -> None:
        """Reset visualizer for new round of evaluation."""
        raise NotImplementedError()

    def process(self, cur_iter: int, *args: ArgsType) -> None:
        """Process data of single sample."""
        raise NotImplementedError()

    def show(self, cur_iter: int, blocking: bool = True) -> None:
        """Shows the visualization.

        Args:
            cur_iter (int): Current iteration.
            blocking (bool): If the visualization should be blocking and wait
                for human input. Defaults to True.
        """
        raise NotImplementedError()

    def save_to_disk(self, cur_iter: int, output_folder: str) -> None:
        """Saves the visualization to disk.

        Args:
            cur_iter (int): Current iteration.
            output_folder (str): Folder where the output should be written.
        """
        raise NotImplementedError()