pipert.utils.visualizer.video_visualizer¶
Module Contents¶
Classes¶
Enum of different color modes to use for instance visualizations. |
|
Used to store data about detected objects in video frame, |
|
Functions¶
|
Args: |
-
class
pipert.utils.visualizer.video_visualizer.ColorMode[source]¶ Bases:
enum.EnumEnum of different color modes to use for instance visualizations.
- Attributes:
IMAGE: Picks a random color for every instance and overlay segmentations with low opacity. SEGMENTATION: Let instances of the same category have similar colors, and overlay them with
high opacity. This provides more attention on the quality of segmentation.
- IMAGE_BW: same as IMAGE, but convert all areas without masks to gray-scale.
Only available for drawing per-instance mask predictions.
-
class
pipert.utils.visualizer.video_visualizer._DetectedInstance(label, bbox, mask_rle, color, ttl)[source]¶ Used to store data about detected objects in video frame, in order to transfer color to objects in the future frames.
- Attributes:
label (int): bbox (tuple[float]): mask_rle (dict): color (tuple[float]): RGB colors in range (0, 1) ttl (int): time-to-live for the instance. For example, if ttl=2,
the instance color can be transferred to objects in the next two frames.
-
pipert.utils.visualizer.video_visualizer._create_text_labels(classes, scores, class_names, ids)[source]¶ - Args:
classes (list[int] or None): scores (list[float] or None): class_names (list[str] or None): ids (list[int] or None):
- Returns:
list[str] or None
-
class
pipert.utils.visualizer.video_visualizer.VideoVisualizer(metadata, instance_mode=ColorMode.IMAGE)[source]¶ -
draw_instance_predictions(self, frame, predictions, names)[source]¶ Draw instance-level prediction results on an image.
- Args:
frame (ndarray): an RGB image of shape (H, W, C), in the range [0, 255]. predictions (Instances): the output of an instance detection/segmentation
model. Following fields will be used to draw: “pred_boxes”, “pred_classes”, “scores”, “pred_masks” (or “pred_masks_rle”).
- Returns:
output (VisImage): image object with visualizations.
-