GeometryDetectionAnnotation
Represents a single COCO-style geometry-detection annotation for one object. Required fields include id, and optionally image_id, category_id, geometry (shape-specific dict), and geometry_shape (e.g. "circle", "ellipse", "line", "contour"). Optional fields include segmentation, bbox, area, iscrowd, and score. This datatype is used as the schema for each element in GeometryDetectionAnnotations within the Telekinesis ecosystem.
Field
Required
| Field | Type | Description |
|---|---|---|
id | int | Annotation identifier (int). |
Optional
| Field | Type | Description |
|---|---|---|
image_id | int or None | Image identifier. Default None. |
category_id | int or None | Category identifier. Default None. |
geometry | dict or None | Shape-specific geometry (e.g. circle: center, radius; ellipse: center, axes, angle; line: rho, theta; contour: points). Default None. |
geometry_shape | str or None | One of "circle", "ellipse", "line", "contour" (case-insensitive). Default None. |
segmentation | list, dict, or None | Polygons or RLE. Default None. |
bbox | list[float] or np.ndarray or None | Bounding box; length 4. Default [0, 0, 0, 0]. |
area | float or None | Area. Default 0. |
iscrowd | int | Crowd flag. Default 0. |
score | float or None | Confidence score. Default None. |
Methods
| Method | Description |
|---|---|
to_dict() | Returns a dictionary with keys: id, image_id, category_id, geometry, geometry_shape, segmentation, bbox, area, iscrowd, score. |
Example
From the datatypes examples:
python
from datatypes import datatypes
from loguru import logger
# ------------------------------------------------
# 1. Create GeometryDetectionAnnotation instance
# ------------------------------------------------
ann = datatypes.GeometryDetectionAnnotation(
id=1,
image_id=0,
category_id=1,
geometry={"center": [100.0, 100.0], "radius": 50.0},
geometry_shape="circle",
)
# ------------------------------------------------
# 2. Access data via to_dict
# ------------------------------------------------
d = ann.to_dict()
logger.info("GeometryDetectionAnnotation id={}", d["id"])
logger.info("GeometryDetectionAnnotation geometry_shape={}", d["geometry_shape"])
logger.info("GeometryDetectionAnnotation geometry={}", d["geometry"])
