"""Visualizer base class."""fromvis4d.common.typingimportArgsType
[docs]classVisualizer:"""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_freqself.image_mode=image_modeassertimage_modein{"RGB","BGR"}def_run_on_batch(self,cur_iter:int)->bool:"""Return whether to run on current iteration. Args: cur_iter (int): Current iteration. """returncur_iter%self.vis_freq==0
[docs]defreset(self)->None:"""Reset visualizer for new round of evaluation."""raiseNotImplementedError()
[docs]defprocess(self,cur_iter:int,*args:ArgsType)->None:"""Process data of single sample."""raiseNotImplementedError()
[docs]defshow(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. """raiseNotImplementedError()
[docs]defsave_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. """raiseNotImplementedError()