utils.plotter.Plotter

utils.plotter.Plotter#

class Plotter(threshold=0.8, labels: List[str] | None = None, interval: int = 200, columns: int = 4)[source]#

Bases: object

Tool for displaying images, predictions and boxes

OpenCV is used for displaying.

Parameters:
  • threshold (float, optional) – Threshold value for displaying box. Defaults to 0.8.

  • labels (Optional[List[str]], optional) – List of class names. Defaults to None.

  • interval (int, optional) – Time interval between frames in milliseconds. Defaults to 200.

  • columns (int, optional) – Images are displayed in a grid. This parameter determines its width. Defaults to 4.

Methods

display

Plays video from tensor

display(images: Tensor, predictions: Tensor | None, target: List[Tensor] | Tensor | None)[source]#

Plays video from tensor

Parameters:
  • images (torch.Tensor) – Shape [ts, batch, channel, h, w]. Expects 2 channels.

  • predictions (Optional[torch.Tensor]) –

    Shape [ts, batch, anchor, 6].

    One label contains (class, iou, xlu, ylu, xrd, yrd).

  • target (Optional[Union[List[torch.Tensor], torch.Tensor]]) –

    Ground Truth. The length of the list is equal to the number of batch.

    Expects format:

    Tensor shape [count_box, 6]

    One label contains (ts, class id, xlu, ylu, xrd, yrd)

    or

    Tensor shape [count_box, 5]

    One label contains (class id, xlu, ylu, xrd, yrd)