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. |
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.
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.
- Collections can nest any mix of point, box, or polygon tags.
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.