Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 1.13 KB

File metadata and controls

41 lines (34 loc) · 1.13 KB
title Labels
summary Resolve class, confidence, and custom text next to detections.

Labels

The label annotation renderer derives display text from semantic detections. BaseLabelStyle can use a class name, caller metadata, or a custom resolver and can include confidence without storing presentation strings in model output.

<iframe data-supervision-playground-src="demo/?embed=annotation-renderer&renderer=labels" loading="lazy" title="Interactive label visualization playground" ></iframe>

Add the label renderer

session.setPresentation({
  renderers: [
    annotationRenderers.label({
      style: new BaseLabelStyle({
        background: { alpha: 0.9 },
        includeConfidence: true,
        textStyle: { fontSize: 14 },
      }),
    }),
  ],
});

Labels need a resolvable detection rectangle for placement, but the box layer does not need to be visible. Use placement and offset options to move text without changing the geometry.

See Interactive Picking for hover-only labels and selection-aware presentation.