BoundingBox class for a defect:
Data classes
| Type | Key fields | Example use |
|---|---|---|
SinglePoint | x, y, optional t, mention | Button taps, defect centroids, laser alignments. |
BoundingBox | top_left, bottom_right, optional metadata | Object detection overlays, cropping regions. |
Polygon | hull (list of SinglePoint), optional metadata | Segmentation masks, irregular outlines, exclusion zones. |
Collection | points, optional metadata | Grouped annotations such as multi-part equipment or layered regions. |
Clip | timestamp.at, optional timestamp.until, mention | Temporal moments or spans in video — sports highlights, event localization, action segmentation. |
x,y: integers on Perceptron’s normalized 0–1000 grid (see below).t: optional timestamp for frames or temporal reasoning.mention: optional model-provided label.top_left,bottom_right:SinglePointcorners that define aBoundingBox.hull: ordered list ofSinglePointvalues outlining a polygon.points: list of child annotations contained in aCollection.timestamp.at,timestamp.until: clip start (and optional end) in seconds. Whenuntil is None, the clip refers to a single moment rather than a range.
Canonical tags
The SDK’s serializer and parser share the same HTML-style format the models emit:- Attributes (
mention,t) live on the tag. - Whitespace around coordinates is ignored.
- Coordinates are integers on the 0–1000 grid.
- Collections can nest any mix of point, box, or polygon tags.
Video clips (Mk1 only)
Perceptron Mk1 additionally emits self-closing<clip /> tags for video temporal segments:
<clip />is self-closing — the timestamp is thetattribute, not body text. Values are whitespace-separated with the literal unitseconds. One number = a moment, two numbers = a range.- Collections can nest
<clip />tags alongside spatial primitives. - The SDK parses clips into
Clipobjects when you setexpects="clip"(see Video Clipping).
Collections in code
Metadata fields
mentioncarries the model’s textual label.tstores optional timestamps (handy for video frames).- Fields persist through serialization and are safe to log or display.
Normalized coordinates
All annotations live on a 0–1000 grid so they can be reprojected onto any render size. Convert them back to pixels withPerceiveResult.points_to_pixels(width, height) or the standalone helpers in perceptron.pointing.geometry. The Coordinate system concept page walks through the math and usage tips.