Skip to content

Schema Tables

Attribute

Bases: SchemaBase

A dataclass to represent schema table of attribute.json.

Attributes:

Name Type Description
token str

Unique record identifier.

name str

Attribute name.

description str

Attribute description.

Source code in t4_devkit/schema/tables/attribute.py
@define(slots=False)
@SCHEMAS.register(SchemaName.ATTRIBUTE)
class Attribute(SchemaBase):
    """A dataclass to represent schema table of `attribute.json`.

    Attributes:
        token (str): Unique record identifier.
        name (str): Attribute name.
        description (str): Attribute description.
    """

    name: str = field(validator=validators.instance_of(str))
    description: str = field(validator=validators.instance_of(str))

CalibratedSensor

Bases: SchemaBase

A dataclass to represent schema table of calibrated_sensor.json.

Attributes:

Name Type Description
token str

Unique record identifier.

sensor_token str

Foreign key pointing to the sensor type.

translation Vector3

Coordinates system origin given as [x, y, z] in [m].

rotation Quaternion

Coordinates system orientation given as quaternion [w, x, y, z].

camera_intrinsic CameraIntrinsic

3x3 camera intrinsic matrix. Empty for sensors that are not cameras.

camera_distortion CameraDistortion

Camera distortion array. Empty for sensors that are not cameras.

Source code in t4_devkit/schema/tables/calibrated_sensor.py
@define(slots=False)
@SCHEMAS.register(SchemaName.CALIBRATED_SENSOR)
class CalibratedSensor(SchemaBase):
    """A dataclass to represent schema table of `calibrated_sensor.json`.

    Attributes:
        token (str): Unique record identifier.
        sensor_token (str): Foreign key pointing to the sensor type.
        translation (Vector3): Coordinates system origin given as [x, y, z] in [m].
        rotation (Quaternion): Coordinates system orientation given as quaternion [w, x, y, z].
        camera_intrinsic (CameraIntrinsic): 3x3 camera intrinsic matrix. Empty for sensors that are not cameras.
        camera_distortion (CameraDistortion): Camera distortion array. Empty for sensors that are not cameras.
    """

    sensor_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    translation: Vector3 = field(converter=Vector3)
    rotation: Quaternion = field(converter=to_quaternion)
    camera_intrinsic: CameraIntrinsic = field(converter=CameraIntrinsic)
    camera_distortion: CameraDistortion = field(converter=CameraDistortion)

Category

Bases: SchemaBase

A dataclass to represent schema table of category.json.

Attributes:

Name Type Description
token str

Unique record identifier.

name str

Category name.

description str

Category description.

index int | None

Category index for lidar segmentation.

has_orientation bool | None

Indicates whether annotations for this category may include an orientation field (e.g., traffic light arrows). If omitted, it is treated as false.

has_number bool | None

Indicates whether annotations for this category may include a number field (e.g., numeric traffic lights). If omitted, it is treated as false.

Source code in t4_devkit/schema/tables/category.py
@define(slots=False)
@SCHEMAS.register(SchemaName.CATEGORY)
class Category(SchemaBase):
    """A dataclass to represent schema table of `category.json`.

    Attributes:
        token (str): Unique record identifier.
        name (str): Category name.
        description (str): Category description.
        index (int | None, optional): Category index for lidar segmentation.
        has_orientation (bool | None, optional): Indicates whether annotations for this category may include an `orientation` field (e.g., traffic light arrows). If omitted, it is treated as `false`.
        has_number (bool | None, optional): Indicates whether annotations for this category may include a `number` field (e.g., numeric traffic lights). If omitted, it is treated as `false`.
    """

    name: str = field(validator=validators.instance_of(str))
    description: str = field(validator=validators.instance_of(str))
    index: int | None = field(
        default=None, validator=validators.optional(validators.instance_of(int))
    )
    has_orientation: bool = field(default=False, validator=validators.instance_of(bool))
    has_number: bool = field(default=False, validator=validators.instance_of(bool))

EgoPose

Bases: SchemaBase

A dataclass to represent schema table of ego_pose.json.

Attributes:

Name Type Description
token str

Unique record identifier.

translation Vector3

Coordinate system origin given as [x, y, z] in [m].

rotation Quaternion

Coordinate system orientation given as quaternion [w, x, y, z].

timestamp int

Unix time stamp.

twist Vector6 | None

Linear and angular velocities in the local coordinate system of the ego vehicle (in m/s for linear and rad/s for angular), in the order of (vx, vy, vz, yaw_rate, pitch_rate, roll_rate).

acceleration Vector3 | None

Acceleration in the local coordinate system of the ego vehicle (in m/s2), in the order of (ax, ay, az).

geocoordinate Vector3 | None

Coordinates in the WGS 84 reference ellipsoid (latitude, longitude, altitude) in degrees and meters.

Source code in t4_devkit/schema/tables/ego_pose.py
@define(slots=False)
@SCHEMAS.register(SchemaName.EGO_POSE)
class EgoPose(SchemaBase):
    """A dataclass to represent schema table of `ego_pose.json`.

    Attributes:
        token (str): Unique record identifier.
        translation (Vector3): Coordinate system origin given as [x, y, z] in [m].
        rotation (Quaternion): Coordinate system orientation given as quaternion [w, x, y, z].
        timestamp (int): Unix time stamp.
        twist (Vector6 | None): Linear and angular velocities in the local coordinate system of
            the ego vehicle (in m/s for linear and rad/s for angular), in the order of
            (vx, vy, vz, yaw_rate, pitch_rate, roll_rate).
        acceleration (Vector3 | None): Acceleration in the local coordinate system of
            the ego vehicle (in m/s2), in the order of (ax, ay, az).
        geocoordinate (Vector3 | None): Coordinates in the WGS 84 reference ellipsoid
            (latitude, longitude, altitude) in degrees and meters.
    """

    translation: Vector3 = field(converter=Vector3)
    rotation: Quaternion = field(converter=to_quaternion)
    timestamp: int = field(validator=validators.instance_of(int))
    twist: Vector6 | None = field(default=None, converter=converters.optional(Vector6))
    acceleration: Vector3 | None = field(default=None, converter=converters.optional(Vector3))
    geocoordinate: Vector3 | None = field(default=None, converter=converters.optional(Vector3))

Instance

Bases: SchemaBase

A dataclass to represent schema table of instance.json.

Attributes:

Name Type Description
token str

Unique record identifier.

category_token str

Foreign key pointing to the object category.

instance_name str

Dataset name and instance ID defined in annotation tool.

nbr_annotations int

Number of annotations of this instance.

first_annotation_token str

Foreign key pointing to the first annotation of this instance. Empty if the dataset only contains 2D annotations.

last_annotation_token str

Foreign key pointing to the last annotation of this instance. Empty if the dataset only contains 2D annotations.

Source code in t4_devkit/schema/tables/instance.py
@define(slots=False)
@SCHEMAS.register(SchemaName.INSTANCE)
class Instance(SchemaBase):
    """A dataclass to represent schema table of `instance.json`.

    Attributes:
        token (str): Unique record identifier.
        category_token (str): Foreign key pointing to the object category.
        instance_name (str): Dataset name and instance ID defined in annotation tool.
        nbr_annotations (int): Number of annotations of this instance.
        first_annotation_token (str): Foreign key pointing to the first annotation of this instance.
            Empty if the dataset only contains 2D annotations.
        last_annotation_token (str): Foreign key pointing to the last annotation of this instance.
            Empty if the dataset only contains 2D annotations.
    """

    category_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    instance_name: str = field(validator=validators.instance_of(str))
    nbr_annotations: int = field(validator=validators.instance_of(int))
    first_annotation_token: str = field(validator=validators.instance_of(str))
    last_annotation_token: str = field(validator=validators.instance_of(str))

Keypoint

Bases: SchemaBase

A dataclass to represent schema table of keypoint.json.

Attributes:

Name Type Description
token str

Unique record identifier.

sample_data_token str

Foreign key pointing to the sample data, which must be a keyframe image.

instance_token str

Foreign key pointing to the instance.

category_tokens list[str]

Foreign key pointing to keypoints categories.

keypoints KeypointLike

Annotated keypoints. Given as a list of [x, y].

num_keypoints int

The number of keypoints to be annotated.

Source code in t4_devkit/schema/tables/keypoint.py
@define(slots=False)
@SCHEMAS.register(SchemaName.KEYPOINT)
class Keypoint(SchemaBase):
    """A dataclass to represent schema table of `keypoint.json`.

    Attributes:
        token (str): Unique record identifier.
        sample_data_token (str): Foreign key pointing to the sample data, which must be a keyframe image.
        instance_token (str): Foreign key pointing to the instance.
        category_tokens (list[str]): Foreign key pointing to keypoints categories.
        keypoints (KeypointLike): Annotated keypoints. Given as a list of [x, y].
        num_keypoints (int): The number of keypoints to be annotated.
    """

    sample_data_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    instance_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    category_tokens: list[str] = field(
        validator=validators.deep_iterable((validators.instance_of(str), impossible_empty))
    )
    keypoints: KeypointLike = field(converter=np.array)
    num_keypoints: int = field(validator=validators.instance_of(int))

LidarSeg

Bases: SchemaBase

A dataclass to represent lidar point cloud segmentation data.

Attributes:

Name Type Description
token str

Unique record identifier.

filename str

The filename of the lidar point cloud segmentation data.

sample_data_token str

The token of the sample data.

Source code in t4_devkit/schema/tables/lidarseg.py
@define(slots=False)
@SCHEMAS.register(SchemaName.LIDARSEG)
class LidarSeg(SchemaBase):
    """A dataclass to represent lidar point cloud segmentation data.

    Attributes:
        token (str): Unique record identifier.
        filename (str): The filename of the lidar point cloud segmentation data.
        sample_data_token (str): The token of the sample data.
    """

    filename: str = field(validator=validators.instance_of(str))
    sample_data_token: str = field(validator=(validators.instance_of(str), impossible_empty))

Log

Bases: SchemaBase

A dataclass to represent schema table of log.json.

Attributes:

Name Type Description
token str

Unique record identifier.

logfile str

Log file name.

vehicle str

Vehicle name.

data_captured str

Date of the data was captured (YYYY-MM-DD-HH-mm-ss).

location str

Area where log was captured.

Shortcuts:

map_token (str): Foreign key pointing to the map record.
    This should be set after instantiated.
Source code in t4_devkit/schema/tables/log.py
@define(slots=False)
@SCHEMAS.register(SchemaName.LOG)
class Log(SchemaBase):
    """A dataclass to represent schema table of `log.json`.

    Attributes:
        token (str): Unique record identifier.
        logfile (str): Log file name.
        vehicle (str): Vehicle name.
        data_captured (str): Date of the data was captured (YYYY-MM-DD-HH-mm-ss).
        location (str): Area where log was captured.

    Shortcuts:
    ---------
        map_token (str): Foreign key pointing to the map record.
            This should be set after instantiated.
    """

    logfile: str = field(validator=validators.instance_of(str))
    vehicle: str = field(validator=validators.instance_of(str))
    data_captured: str = field(validator=validators.instance_of(str))
    location: str = field(validator=validators.instance_of(str))

    # shortcuts
    map_token: str = field(init=False, factory=str)

Map

Bases: SchemaBase

A dataclass to represent schema table of map.json.

Attributes:

Name Type Description
token str

Unique record identifier.

log_tokens str

Foreign keys pointing the log tokens.

category str

Map category.

filename str

Relative path to the file with the map mask.

Source code in t4_devkit/schema/tables/map.py
@define(slots=False)
@SCHEMAS.register(SchemaName.MAP)
class Map(SchemaBase):
    """A dataclass to represent schema table of `map.json`.

    Attributes:
        token (str): Unique record identifier.
        log_tokens (str): Foreign keys pointing the log tokens.
        category (str): Map category.
        filename (str): Relative path to the file with the map mask.
    """

    log_tokens: list[str] = field(
        validator=validators.deep_iterable((validators.instance_of(str), impossible_empty))
    )
    category: str = field(validator=validators.instance_of(str))
    filename: str = field(validator=validators.instance_of(str))

ObjectAnn

Bases: SchemaBase, AutolabelMixin

A dataclass to represent schema table of object_ann.json.

Attributes:

Name Type Description
token str

Unique record identifier.

sample_data_token str

Foreign key pointing to the sample data, which must be a keyframe image.

instance_token str

Foreign key pointing to the instance.

category_token str

Foreign key pointing to the object category.

attribute_tokens list[str]

Foreign keys. List of attributes for this annotation.

bbox Roi

Annotated bounding box. Given as [xmin, ymin, xmax, ymax].

mask RLEMask

Instance mask using the COCO format compressed by RLE.

orientation float | None

Orientation of the arrow shape within the bounding box, in radians. Present only for categories where has_orientation is true (e.g., traffic light arrows).

number int | None

The digit displayed within the bounding box. Present only for categories where has_number is true (e.g., numeric traffic lights).

Inherited from AutolabelMixin

automatic_annotation (bool, optional): Indicates if the annotation is fully generated by an ML model. If any part is manually modified or annotated by human this value is False. autolabel_metadata (list[AutolabelModel] | None, optional): List of models used for autolabeling. Required if automatic_annotation is true.

Shortcuts:

category_name (str): Category name. This should be set after instantiated.
Source code in t4_devkit/schema/tables/object_ann.py
@define(slots=False)
@SCHEMAS.register(SchemaName.OBJECT_ANN)
class ObjectAnn(SchemaBase, AutolabelMixin):
    """A dataclass to represent schema table of `object_ann.json`.

    Attributes:
        token (str): Unique record identifier.
        sample_data_token (str): Foreign key pointing to the sample data, which must be a keyframe image.
        instance_token (str): Foreign key pointing to the instance.
        category_token (str): Foreign key pointing to the object category.
        attribute_tokens (list[str]): Foreign keys. List of attributes for this annotation.
        bbox (Roi): Annotated bounding box. Given as [xmin, ymin, xmax, ymax].
        mask (RLEMask): Instance mask using the COCO format compressed by RLE.
        orientation (float | None, optional): Orientation of the arrow shape within the bounding box, in radians. Present only for categories where `has_orientation` is true (e.g., traffic light arrows).
        number (int | None, optional): The digit displayed within the bounding box. Present only for categories where `has_number` is true (e.g., numeric traffic lights).

    Inherited from AutolabelMixin:
        automatic_annotation (bool, optional): Indicates if the annotation is fully generated by an ML model.
            If any part is manually modified or annotated by human this value is False.
        autolabel_metadata (list[AutolabelModel] | None, optional): List of models used for autolabeling. Required if `automatic_annotation` is `true`.

    Shortcuts:
    ---------
        category_name (str): Category name. This should be set after instantiated.
    """

    sample_data_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    instance_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    category_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    attribute_tokens: list[str] = field(
        validator=validators.deep_iterable((validators.instance_of(str), impossible_empty))
    )
    bbox: Roi = field(converter=Roi)
    mask: RLEMask | None = field(
        default=None,
        converter=lambda x: RLEMask(**x) if isinstance(x, dict) else x,
        validator=validators.optional(validators.instance_of(RLEMask)),
    )
    orientation: float | None = field(
        default=None, validator=validators.optional(validators.instance_of(float))
    )
    number: int | None = field(
        default=None, validator=validators.optional(validators.instance_of(int))
    )

    # shortcuts
    category_name: str = field(init=False, factory=str)

Sample

Bases: SchemaBase

A dataclass to represent schema table of sample.json.

Attributes:

Name Type Description
token str

Unique record identifier.

timestamp int

Unix time stamp.

scene_token str

Foreign key pointing to the scene.

next str

Foreign key pointing the sample that follows this in time. Empty if end of scene.

prev str

Foreign key pointing the sample that precedes this in time. Empty if start of scene.

Shortcuts:

data (dict[str, str]): Sensor channel and its token.
    This should be set after instantiated.
ann_3ds (list[str]): List of foreign keys pointing the sample annotations.
    This should be set after instantiated.
ann_2ds (list[str]): List of foreign keys pointing the object annotations.
    This should be set after instantiated.
surface_anns (list[str]): List of foreign keys pointing the surface annotations.
    This should be set after instantiated.
Source code in t4_devkit/schema/tables/sample.py
@define(slots=False)
@SCHEMAS.register(SchemaName.SAMPLE)
class Sample(SchemaBase):
    """A dataclass to represent schema table of `sample.json`.

    Attributes:
        token (str): Unique record identifier.
        timestamp (int): Unix time stamp.
        scene_token (str): Foreign key pointing to the scene.
        next (str): Foreign key pointing the sample that follows this in time. Empty if end of scene.
        prev (str): Foreign key pointing the sample that precedes this in time. Empty if start of scene.

    Shortcuts:
    ---------
        data (dict[str, str]): Sensor channel and its token.
            This should be set after instantiated.
        ann_3ds (list[str]): List of foreign keys pointing the sample annotations.
            This should be set after instantiated.
        ann_2ds (list[str]): List of foreign keys pointing the object annotations.
            This should be set after instantiated.
        surface_anns (list[str]): List of foreign keys pointing the surface annotations.
            This should be set after instantiated.
    """

    timestamp: int = field(validator=validators.instance_of(int))
    scene_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    next: str = field(validator=validators.instance_of(str))
    prev: str = field(validator=validators.instance_of(str))

    # shortcuts
    data: dict[str, str] = field(factory=dict, init=False)
    ann_3ds: list[str] = field(factory=list, init=False)
    ann_2ds: list[str] = field(factory=list, init=False)
    surface_anns: list[str] = field(factory=list, init=False)

SampleAnnotation

Bases: SchemaBase, AutolabelMixin

A dataclass to represent schema table of sample_annotation.json.

Attributes:

Name Type Description
token str

Unique record identifier.

sample_token str

Foreign key pointing the sample.

instance_token str

Foreign key pointing the object instance.

attribute_tokens list[str]

Foreign keys. List of attributes for this annotation.

visibility_token str

Foreign key pointing the object visibility.

translation Vector3

Bounding box location given as [x, y, z] in [m].

size Vector3

Bounding box size given as [width, length, height] in [m].

rotation Quaternion

Bounding box orientation given as quaternion [w, x, y, z].

num_lidar_pts int

Number of lidar points in this box.

num_radar_pts int

Number of radar points in this box.

next str

Foreign key pointing the annotation that follows this in time. Empty if this is the last annotation for this object.

prev str

Foreign key pointing the annotation that precedes this in time. Empty if this the first annotation for this object.

velocity Vector3 | None

Bounding box velocity given as [vx, vy, vz] in [m/s].

acceleration Vector3 | None

Bonding box acceleration given as [ax, ay, av] in [m/s^2].

Inherited from AutolabelMixin

automatic_annotation (bool, optional): Indicates if the annotation is fully generated by an ML model. If any part is manually modified or annotated by human this value is False. autolabel_metadata (list[AutolabelModel] | None, optional): List of models used for autolabeling. Required if automatic_annotation is true.

Shortcuts:

category_name (str): Category name. This should be set after instantiated.
Source code in t4_devkit/schema/tables/sample_annotation.py
@define(slots=False)
@SCHEMAS.register(SchemaName.SAMPLE_ANNOTATION)
class SampleAnnotation(SchemaBase, AutolabelMixin):
    """A dataclass to represent schema table of `sample_annotation.json`.

    Attributes:
        token (str): Unique record identifier.
        sample_token (str): Foreign key pointing the sample.
        instance_token (str): Foreign key pointing the object instance.
        attribute_tokens (list[str]): Foreign keys. List of attributes for this annotation.
        visibility_token (str): Foreign key pointing the object visibility.
        translation (Vector3): Bounding box location given as [x, y, z] in [m].
        size (Vector3): Bounding box size given as [width, length, height] in [m].
        rotation (Quaternion): Bounding box orientation given as quaternion [w, x, y, z].
        num_lidar_pts (int): Number of lidar points in this box.
        num_radar_pts (int): Number of radar points in this box.
        next (str): Foreign key pointing the annotation that follows this in time.
            Empty if this is the last annotation for this object.
        prev (str): Foreign key pointing the annotation that precedes this in time.
            Empty if this the first annotation for this object.
        velocity (Vector3 | None, optional): Bounding box velocity given as
            [vx, vy, vz] in [m/s].
        acceleration (Vector3 | None, optional): Bonding box acceleration
            given as [ax, ay, av] in [m/s^2].

    Inherited from AutolabelMixin:
        automatic_annotation (bool, optional): Indicates if the annotation is fully generated by an ML model.
            If any part is manually modified or annotated by human this value is False.
        autolabel_metadata (list[AutolabelModel] | None, optional): List of models used for autolabeling. Required if `automatic_annotation` is `true`.

    Shortcuts:
    ---------
        category_name (str): Category name. This should be set after instantiated.
    """

    sample_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    instance_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    attribute_tokens: list[str] = field(
        validator=validators.deep_iterable((validators.instance_of(str), impossible_empty))
    )
    visibility_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    translation: Vector3 = field(converter=Vector3)
    size: Vector3 = field(converter=Vector3)
    rotation: Quaternion = field(converter=to_quaternion)
    num_lidar_pts: int = field(validator=validators.instance_of(int))
    num_radar_pts: int = field(validator=validators.instance_of(int))
    next: str = field(validator=validators.instance_of(str))
    prev: str = field(validator=validators.instance_of(str))
    velocity: Vector3 | None = field(default=None, converter=converters.optional(Vector3))
    acceleration: Vector3 | None = field(default=None, converter=converters.optional(Vector3))

    # shortcuts
    category_name: str = field(init=False, factory=str)

SampleData

Bases: SchemaBase

A class to represent schema table of sample_data.json.

Attributes:

Name Type Description
token str

Unique record identifier.

sample_token str

Foreign key pointing the sample. Empty if this is not a key frame.

ego_pose_token str

Foreign key pointing the ego_pose.

calibrated_sensor_token str

Foreign key pointing the calibrated_sensor.

filename str

Relative path to data-blob on disk.

fileformat FileFormat

Data file format.

width int

If the sample data is an image, this is the image width in [px].

height int

If the sample data is an image, this is the image height in [px].

timestamp int

Unix time stamp.

is_key_frame bool

True if sample_data is part of key frame else, False.

next str

Foreign key pointing the sample_data that follows this in time. Empty if end of scene.

prev str

Foreign key pointing the sample_data that precedes this in time. Empty if start of scene.

is_valid bool

True if this data is valid, else False. Invalid data should be ignored.

info_filename str

Relative path to metainfo data-blob on disk.

autolabel_metadata list[AutolabelModel] | None

List of models used for autolabeling applied to this entire sample_data item (e.g., image or scan).

Shortcuts:

modality (SensorModality): Sensor modality. This should be set after instantiated.
channel (str): Sensor channel. This should be set after instantiated.
Source code in t4_devkit/schema/tables/sample_data.py
@define(slots=False)
@SCHEMAS.register(SchemaName.SAMPLE_DATA)
class SampleData(SchemaBase):
    """A class to represent schema table of `sample_data.json`.

    Attributes:
        token (str): Unique record identifier.
        sample_token (str): Foreign key pointing the sample. Empty if this is not a key frame.
        ego_pose_token (str): Foreign key pointing the ego_pose.
        calibrated_sensor_token (str): Foreign key pointing the calibrated_sensor.
        filename (str): Relative path to data-blob on disk.
        fileformat (FileFormat): Data file format.
        width (int): If the sample data is an image, this is the image width in [px].
        height (int): If the sample data is an image, this is the image height in [px].
        timestamp (int): Unix time stamp.
        is_key_frame (bool): True if sample_data is part of key frame else, False.
        next (str): Foreign key pointing the sample_data that follows this in time.
            Empty if end of scene.
        prev (str): Foreign key pointing the sample_data that precedes this in time.
            Empty if start of scene.
        is_valid (bool): True if this data is valid, else False. Invalid data should be ignored.
        info_filename (str): Relative path to metainfo data-blob on disk.
        autolabel_metadata (list[AutolabelModel] | None, optional): List of models used for autolabeling applied to this entire sample_data item (e.g., image or scan).

    Shortcuts:
    ---------
        modality (SensorModality): Sensor modality. This should be set after instantiated.
        channel (str): Sensor channel. This should be set after instantiated.
    """

    sample_token: str = field(validator=validators.instance_of(str))
    ego_pose_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    calibrated_sensor_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    filename: str = field(validator=validators.instance_of(str))
    fileformat: FileFormat = field(converter=FileFormat)
    width: int = field(validator=validators.instance_of(int))
    height: int = field(validator=validators.instance_of(int))
    timestamp: int = field(validator=validators.instance_of(int))
    is_key_frame: bool = field(validator=validators.instance_of(bool))
    next: str = field(validator=validators.instance_of(str))  # noqa: A003
    prev: str = field(validator=validators.instance_of(str))
    is_valid: bool = field(default=True, validator=validators.instance_of(bool))
    info_filename: str | None = field(
        default=None, validator=validators.optional(validators.instance_of(str))
    )
    autolabel_metadata: list[AutolabelModel] | None = field(
        default=None,
        converter=AutolabelModel.to_autolabel_model,
        validator=validators.optional(
            validators.deep_iterable(validators.instance_of(AutolabelModel))
        ),
    )

    # shortcuts
    modality: SensorModality | None = field(init=False, default=None)
    channel: str = field(init=False, factory=str)

Scene

Bases: SchemaBase

A dataclass to represent schema table of scene.json.

Attributes:

Name Type Description
token str

Unique record identifier.

name str

Short string identifier.

description str

Longer description for the scene.

log_token str

Foreign key pointing to log from where the data was extracted.

nbr_samples int

Number of samples in the scene.

first_sample_token str

Foreign key pointing to the first sample in scene.

last_sample_token str

Foreign key pointing to the last sample in scene.

Source code in t4_devkit/schema/tables/scene.py
@define(slots=False)
@SCHEMAS.register(SchemaName.SCENE)
class Scene(SchemaBase):
    """A dataclass to represent schema table of `scene.json`.

    Attributes:
        token (str): Unique record identifier.
        name (str): Short string identifier.
        description (str): Longer description for the scene.
        log_token (str): Foreign key pointing to log from where the data was extracted.
        nbr_samples (int): Number of samples in the scene.
        first_sample_token (str): Foreign key pointing to the first sample in scene.
        last_sample_token (str): Foreign key pointing to the last sample in scene.
    """

    name: str = field(validator=validators.instance_of(str))
    description: str = field(validator=validators.instance_of(str))
    log_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    nbr_samples: int = field(validator=validators.instance_of(int))
    first_sample_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    last_sample_token: str = field(validator=(validators.instance_of(str), impossible_empty))

Sensor

Bases: SchemaBase

A dataclass to represent schema table of sensor.json.

Attributes:

Name Type Description
token str

Unique record identifier.

channel str

Sensor channel name.

modality SensorModality

Sensor modality.

Shortcuts:

first_sd_token (str): The first sample data token corresponding to its sensor channel.
Source code in t4_devkit/schema/tables/sensor.py
@define(slots=False)
@SCHEMAS.register(SchemaName.SENSOR)
class Sensor(SchemaBase):
    """A dataclass to represent schema table of `sensor.json`.

    Attributes:
        token (str): Unique record identifier.
        channel (str): Sensor channel name.
        modality (SensorModality): Sensor modality.

    Shortcuts:
    ---------
        first_sd_token (str): The first sample data token corresponding to its sensor channel.
    """

    channel: str = field(validator=validators.instance_of(str))
    modality: SensorModality = field(converter=SensorModality)

    # shortcuts
    first_sd_token: str = field(init=False, factory=str)

SurfaceAnn

Bases: SchemaBase, AutolabelMixin

A dataclass to represent schema table of surface_ann.json.

Attributes:

Name Type Description
token str

Unique record identifier.

sample_data_token str

Foreign key pointing to the sample data, which must be a keyframe image.

category_token str

Foreign key pointing to the surface category.

mask RLEMask

Segmentation mask using the COCO format compressed by RLE.

Inherited from AutolabelMixin

automatic_annotation (bool, optional): Indicates if the annotation is fully generated by an ML model. If any part is manually modified or annotated by human this value is False. autolabel_metadata (list[AutolabelModel] | None, optional): List of models used for autolabeling. Required if automatic_annotation is true.

Shortcuts:

category_name (str): Category name. This should be set after instantiated.
Source code in t4_devkit/schema/tables/surface_ann.py
@define(slots=False)
@SCHEMAS.register(SchemaName.SURFACE_ANN)
class SurfaceAnn(SchemaBase, AutolabelMixin):
    """A dataclass to represent schema table of `surface_ann.json`.

    Attributes:
        token (str): Unique record identifier.
        sample_data_token (str): Foreign key pointing to the sample data, which must be a keyframe image.
        category_token (str): Foreign key pointing to the surface category.
        mask (RLEMask): Segmentation mask using the COCO format compressed by RLE.

    Inherited from AutolabelMixin:
        automatic_annotation (bool, optional): Indicates if the annotation is fully generated by an ML model.
            If any part is manually modified or annotated by human this value is False.
        autolabel_metadata (list[AutolabelModel] | None, optional): List of models used for autolabeling. Required if `automatic_annotation` is `true`.

    Shortcuts:
    ---------
        category_name (str): Category name. This should be set after instantiated.
    """

    sample_data_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    category_token: str = field(validator=(validators.instance_of(str), impossible_empty))
    mask: RLEMask | None = field(
        default=None,
        converter=lambda x: RLEMask(**x) if isinstance(x, dict) else x,
        validator=validators.optional(validators.instance_of(RLEMask)),
    )

    # shortcuts
    category_name: str = field(init=False, factory=str)

    @property
    def bbox(self) -> Roi | None:
        """Return a bounding box corners calculated from polygon vertices.

        Returns:
            Roi instance given as [xmin, ymin, xmax, ymax].
        """
        if self.mask is None:
            return None

        mask = self.mask.decode()
        indices = np.where(mask == 1)
        xmin, ymin = np.min(indices, axis=1)
        xmax, ymax = np.max(indices, axis=1)
        return Roi(xmin, ymin, xmax, ymax)

bbox property

Return a bounding box corners calculated from polygon vertices.

Returns:

Type Description
Roi | None

Roi instance given as [xmin, ymin, xmax, ymax].

VehicleState

Bases: SchemaBase

A dataclass to represent schema table of vehicle_state.json.

Attributes:

Name Type Description
token str

Unique record identifier.

timestamp int

Unix time stamp.

accel_pedal float | None

Accel pedal position [%].

brake_pedal float | None

Brake pedal position [%].

steer_pedal float | None

Steering wheel position [%].

steering_tire_angle float | None

Steering tire angle [rad].

steering_wheel_angle float | None

Steering wheel angle [rad].

shift_state ShiftState | None

Gear shift state.

indicators Indicators | None

State of each indicator.

additional_info AdditionalInfo | None

Additional state information.

Source code in t4_devkit/schema/tables/vehicle_state.py
@define(slots=False)
@SCHEMAS.register(SchemaName.VEHICLE_STATE)
class VehicleState(SchemaBase):
    """A dataclass to represent schema table of `vehicle_state.json`.

    Attributes:
        token (str): Unique record identifier.
        timestamp (int): Unix time stamp.
        accel_pedal (float | None): Accel pedal position [%].
        brake_pedal (float | None): Brake pedal position [%].
        steer_pedal (float | None): Steering wheel position [%].
        steering_tire_angle (float | None): Steering tire angle [rad].
        steering_wheel_angle (float | None): Steering wheel angle [rad].
        shift_state (ShiftState | None): Gear shift state.
        indicators (Indicators | None): State of each indicator.
        additional_info (AdditionalInfo | None): Additional state information.
    """

    timestamp: int = field(validator=validators.instance_of(int))
    accel_pedal: float | None = field(
        default=None,
        validator=validators.optional(validators.instance_of(float)),
    )
    brake_pedal: float | None = field(
        default=None,
        validator=validators.optional(validators.instance_of(float)),
    )
    steer_pedal: float | None = field(
        default=None,
        validator=validators.optional(validators.instance_of(float)),
    )
    steering_tire_angle: float | None = field(
        default=None,
        validator=validators.optional(validators.instance_of(float)),
    )
    steering_wheel_angle: float | None = field(
        default=None,
        validator=validators.optional(validators.instance_of(float)),
    )
    shift_state: ShiftState | None = field(
        default=None,
        converter=converters.optional(ShiftState),
        validator=validators.optional(validators.instance_of(ShiftState)),
    )
    indicators: Indicators | None = field(
        default=None,
        converter=lambda x: Indicators(**x) if isinstance(x, dict) else x,
        validator=validators.optional(validators.instance_of(Indicators)),
    )
    additional_info: AdditionalInfo | None = field(
        default=None,
        converter=lambda x: AdditionalInfo(**x) if isinstance(x, dict) else x,
        validator=validators.optional(validators.instance_of(AdditionalInfo)),
    )

Visibility

Bases: SchemaBase

A dataclass to represent schema table of visibility.json.

Attributes:

Name Type Description
token str

Unique record identifier.

level VisibilityLevel

Visibility level.

description str

Description of visibility level.

Source code in t4_devkit/schema/tables/visibility.py
@define(slots=False)
@SCHEMAS.register(SchemaName.VISIBILITY)
class Visibility(SchemaBase):
    """A dataclass to represent schema table of `visibility.json`.

    Attributes:
        token (str): Unique record identifier.
        level (VisibilityLevel): Visibility level.
        description (str): Description of visibility level.
    """

    level: VisibilityLevel = field(
        converter=lambda x: VisibilityLevel.from_value(x)
        if not isinstance(x, VisibilityLevel)
        else VisibilityLevel(x)
    )
    description: str = field(validator=validators.instance_of(str))