Skip to main content

BoundingBoxCoordinates Objects

@dataclass(frozen=True)
class BoundingBoxCoordinates()
Represents bounding box coordinates, where all values are percentages relative to the total image size. Attributes:
  • height float - The height of the bounding box.
  • width float - The width of the bounding box.
  • top_left_x float - The x-coordinate of the top-left corner.
  • top_left_y float - The y-coordinate of the top-left corner.

from_dict

@staticmethod
def from_dict(d: Dict) -> BoundingBoxCoordinates
Create a BoundingBoxCoordinates instance from a dictionary. Arguments:
  • d dict - A dictionary containing bounding box information.
Returns:
  • BoundingBoxCoordinates - An instance of BoundingBoxCoordinates.

to_dict

def to_dict() -> Dict
Convert the BoundingBoxCoordinates instance to a dictionary. Returns:
  • dict - A dictionary representation of the bounding box coordinates.

RotatableBoundingBoxCoordinates Objects

@dataclass(frozen=True)
class RotatableBoundingBoxCoordinates()
Represents rotatable bounding box coordinates, where all values are percentages relative to the total image size. Attributes:
  • height float - The height of the bounding box.
  • width float - The width of the bounding box.
  • top_left_x float - The x-coordinate of the top-left corner.
  • top_left_y float - The y-coordinate of the top-left corner.
  • theta float - The angle of rotation originating at the center of the box.

theta

angle of rotation originating at center of box

from_dict

@staticmethod
def from_dict(d: Dict) -> RotatableBoundingBoxCoordinates
Create a RotatableBoundingBoxCoordinates instance from a dictionary. Arguments:
  • d dict - A dictionary containing rotatable bounding box information.
Returns:
  • RotatableBoundingBoxCoordinates - An instance of RotatableBoundingBoxCoordinates.

to_dict

def to_dict() -> Dict
Convert the RotatableBoundingBoxCoordinates instance to a dictionary. Returns:
  • dict - A dictionary representation of the rotatable bounding box coordinates.

CuboidCoordinates Objects

@dataclass(frozen=True)
class CuboidCoordinates()
Represents a cuboid. Attributes:
  • position tuple[float, float, float] - The (x, y, z) coordinates of the center of the cuboid in the 3D space.
  • orientation tuple[float, float, float] - The (alpha, beta, gamma) Euler angles of the cuboid, in radians.
  • size tuple[float, float, float] - The size of the cuboid along its (x, y, z) axes.

PointCoordinate Objects

@dataclass(frozen=True)
class PointCoordinate()
Represents a point coordinate, where all coordinates are a percentage relative to the total image size. Attributes:
  • x float - The x-coordinate of the point.
  • y float - The y-coordinate of the point.

from_dict

@staticmethod
def from_dict(d: Dict) -> PointCoordinate
Create a PointCoordinate instance from a dictionary. Arguments:
  • d dict - A dictionary containing point coordinate information.
Returns:
  • PointCoordinate - An instance of PointCoordinate.

to_dict

def to_dict() -> Dict
Convert the PointCoordinate instance to a dictionary. Returns:
  • dict - A dictionary representation of the point coordinate.

PointCoordinate3D Objects

@dataclass(frozen=True)
class PointCoordinate3D()
Represents a 3D point coordinate, where all coordinates are a percentage relative to the total image size. Attributes:
  • x float - The x-coordinate of the point.
  • y float - The y-coordinate of the point.
  • z float - The z-coordinate of the point.

from_dict

@staticmethod
def from_dict(d: Dict) -> PointCoordinate3D
Create a PointCoordinate3D instance from a dictionary. Arguments:
  • d dict - A dictionary containing point coordinate information.
Returns:
  • PointCoordinate3D - An instance of PointCoordinate3D.

to_dict

def to_dict() -> Dict
Convert the PointCoordinate instance to a dictionary. Returns:
  • dict - A dictionary representation of the point coordinate.

PolygonCoordinates Objects

class PolygonCoordinates()
Represents polygon coordinates

__init__

def __init__(values: Optional[List[PointCoordinate]] = None,
             polygons: Optional[List[List[List[PointCoordinate]]]] = None)
Arguments:
  • values List[PointCoordinate] - A list of PointCoordinate objects defining the polygon.
  • polygons List[List[List[PointCoordinate]]] - A list of polygons, where each polygon is a list of contours, where each contour is a list of points.

from_dict

@staticmethod
def from_dict(d: Dict) -> "PolygonCoordinates"
Create a PolygonCoordinates instance from a dictionary. Supports both legacy format (single polygon with one contour) and the new complex format (multiple polygons and contours). Arguments:
  • d dict - Dictionary containing polygon coordinates information.
Returns:
  • PolygonCoordinates - A PolygonCoordinates instance.
Examples: Legacy format (mapping of index -> point):
{
  "polygon": {
    "0": {"x": 12.3, "y": 45.6},
    "1": {"x": 78.9, "y": 12.3}
  }
}
Legacy format (list of points):
{
  "polygon": [
    {"x": 12.3, "y": 45.6},
    {"x": 78.9, "y": 12.3}
  ]
}
New format (polygons -> contours -> points):
{
  "polygons": [
    [
      [
        {"x": 12.3, "y": 45.6},
        {"x": 78.9, "y": 12.3}
      ]
    ]
  ]
}

to_dict

def to_dict(
    kind: Union[PolygonCoordsToDict, str] = PolygonCoordsToDict.single_polygon
) -> Union[Dict, List[List[List[float]]]]
Convert the PolygonCoordinates instance to a dictionary. Returns:
  • dict - A dictionary representation of the polygon coordinates.

PolylineCoordinates Objects

@dataclass(frozen=True)
class PolylineCoordinates()
Represents polyline coordinates as a list of point coordinates. Attributes:
  • values Union[List[PointCoordinate], List[PointCoordinate3D]] - A list of (3D) PointCoordinate objects defining the polyline.

from_dict

@staticmethod
def from_dict(d: Dict) -> PolylineCoordinates
Create a PolylineCoordinates instance from a dictionary. Arguments:
  • d dict - A dictionary containing polyline coordinates information.
Returns:
  • PolylineCoordinates - An instance of PolylineCoordinates.

to_dict

def to_dict() -> Dict
Convert the PolylineCoordinates instance to a dictionary. Returns:
  • dict - A dictionary representation of the polyline coordinates.

Visibility Objects

class Visibility(CamelStrEnum)
An enumeration to represent the visibility state of an item. Attributes:
  • VISIBLE - The item is visible within the frame.
  • INVISIBLE - The item is outside the frame and thus invisible.
  • OCCLUDED - The item is within the frame but occluded by something else.
  • SELF_OCCLUDED - The item is occluded by itself.

SkeletonCoordinate Objects

class SkeletonCoordinate(BaseDTO)
Represents a coordinate for a skeleton structure in an image. Attributes:
  • x float - The x-coordinate of the skeleton point.
  • y float - The y-coordinate of the skeleton point.
  • name str - The name of the skeleton point.
  • color Optional[str] - The color associated with the skeleton point.
  • feature_hash Optional[str] - A unique hash for the feature.
  • value Optional[str] - An optional value associated with the skeleton point.
  • visibility Optional[Visibility] - The visibility state of the skeleton point.

SkeletonCoordinates Objects

class SkeletonCoordinates(BaseDTO)
Represents a collection of skeleton coordinates. Attributes:
  • values List[SkeletonCoordinate] - A list of SkeletonCoordinate objects.
  • name str - The name of the skeleton structure.

to_dict

def to_dict(by_alias=True, exclude_none=True) -> Dict[str, Any]
Convert the SkeletonCoordinates instance to a dictionary. Arguments:
  • by_alias bool - Whether to use alias for the field names.
  • exclude_none bool - Whether to exclude fields with None values.
Returns: Dict[str, Any]: A dictionary representation of the skeleton coordinates.

AudioCoordinates Objects

class AudioCoordinates(BaseDTO)
Represents coordinates for an audio file Attributes:
  • range Ranges - Ranges in milliseconds for audio files

TextCoordinates Objects

class TextCoordinates(BaseDTO)
Represents coordinates for a text file Attributes:
  • range Ranges - Ranges of chars for simple text files

HtmlCoordinates Objects

class HtmlCoordinates(BaseDTO)
Represents coordinates for a html file Attributes:
  • range List[HtmlRange] - A list of HtmlRange objects