SegmentInfo
Represents COCO-style per-segment metadata for one segment in a panoptic or instance segmentation. Fields include id, category_id, and optionally area, bbox, and iscrowd. This datatype is used as the schema for each element in the segments_info list of PanopticSegmentationAnnotation within the Telekinesis ecosystem.
Field
Required
| Field | Type | Description |
|---|---|---|
id | int | Segment identifier (int). |
category_id | int | Category id for this segment (int). |
Optional
| Field | Type | Description |
|---|---|---|
area | float | Segment area. Default 0.0. |
bbox | list[float] or np.ndarray | Bounding box [x, y, width, height]; length 4, dtype float. Default [0.0, 0.0, 0.0, 0.0]. |
iscrowd | int | Whether the segment is a crowd region. Default 0. |
Methods
| Method | Description |
|---|---|
to_dict() | Returns a dictionary with keys: id, category_id, area, bbox, iscrowd. |
Example
From the datatypes examples:
python
import numpy as np
from datatypes import datatypes
from loguru import logger
# ------------------------------------------------
# 1. Create SegmentInfo instance
# ------------------------------------------------
segment_info = datatypes.SegmentInfo(
id=1,
category_id=1,
area=100.0,
bbox=np.array([0.0, 0.0, 10.0, 10.0]),
iscrowd=0,
)
# ------------------------------------------------
# 2. Access data via to_dict
# ------------------------------------------------
segmentation_info = segment_info.to_dict()
logger.info("SegmentInfo id={}", segmentation_info["id"])
logger.info("SegmentInfo category_id={}", segmentation_info["category_id"])
logger.info("SegmentInfo area={}", segmentation_info["area"])
logger.info("SegmentInfo bbox={}", segmentation_info["bbox"])
logger.info("SegmentInfo iscrowd={}", segmentation_info["iscrowd"])
