datumaro.components.visualizer#
Classes
|
Visualizer for Datumaro annotations |
- class datumaro.components.visualizer.Visualizer(dataset: IDataset, ignored_types: Iterable[AnnotationType] | None = None, figsize: Tuple[float, float] = (8, 6), color_cycles: List[str] | None = None, bbox_linewidth: float = 1.0, text_y_offset: float = 1.5, alpha: float = 1.0, show_plot_title: bool = True)[source]#
Bases:
object
Visualizer for Datumaro annotations
- Parameters:
dataset – Datumaro dataset to visualize its items.
ignored_types – Categories of labels. It is used to extract label name by label id.
figsize – Pyplot Figure instance used to draw annotation.
color_cycles – Color cycle corresponding to each label ID. If the length of the color cycle is less than the label ID, then the label ID exceeding the color cycle length is assgined by the following rule. color = color_cycles[label_id % len(color_cycles)]
bbox_linewidth – Line width for Bbox, Polygon and PolyLine annotation
text_y_offset – Offset of y axis for texts. The higher value puts the text in the upper place of the annotation.
alpha – Transparency value when drawing annotations. It should be in [0, 1]. If alpha=0, we do not draw any annotations.
show_plot_title – If True, show the plot title formatted as “ID: {item_id}, Subset: {subset}”. Otherwise, hide the plot title.
- property draw_only_image#
If self.alpha = 0, we do not overdraw any annotation over the image.
- get_random_items(n_samples: int) List[DatasetItem] [source]#
Get random samples from the dataset
- vis_gallery(ids: List[str], ann_ids: List[int], subsets: str | List[str], *, grid_size: Tuple[int | None, int | None] = (None, None))[source]#
- vis_gallery(ids: List[str], subsets: str | List[str], *, grid_size: Tuple[int | None, int | None] = (None, None))
- vis_gallery(items: List[DatasetItem], *, grid_size: Tuple[int | None, int | None] = (None, None))
Visualize several
DatasetItem
as a gallery