utils.plotter.Plotter#
- class Plotter(threshold: float = 0.8, show_video: bool = True, save_video: bool = False, file_path: str = 'log', file_name: str = 'out')[source]#
Bases:
objectTool for displaying event videos, predictions and boxes
- Parameters:
threshold (float, optional) – Threshold value for displaying box. Defaults to 0.8.
show_video (bool, optional) – If true, shows video in window. Defaults to True.
save_video (bool, optional) – If true, saves the video to a file. Defaults to False.
file_path (str, optional) – Folder for saved video. Defaults to “log”.
file_name (str, optional) – Save file name. Defaults to “out”.
Methods
Prepares a frame from an event camera for display and overlays prediction and target boxes on it
- __call__(video: List[ndarray], interval: int = 50) None[source]#
Displays frames obtained by the apply method and saves them
- Parameters:
video (List[np.ndarray]) – List of frames
interval (int) – Time between frames in milliseconds
- apply(image: ndarray, predictions: Tensor | None = None, target: Tensor | None = None) ndarray[source]#
Prepares a frame from an event camera for display and overlays prediction and target boxes on it
- Parameters:
image (np.ndarray) – Background image
predictions (Optional[torch.Tensor]) – Tensor shape [anchor, 6], one label contains (class, iou, xlu, ylu, xrd, yrd).
target (Optional[torch.Tensor]) – Ground Truth. Tensor shape [count_box, 5], one label contains (class id, xlu, ylu, xrd, yrd)
- Returns:
Returns an image that can be processed by opencv
- Return type:
np.ndarray