raillabel.json_format package¶
Submodules¶
- raillabel.json_format._json_format_base module
- raillabel.json_format.attributes module
- raillabel.json_format.bbox module
- raillabel.json_format.boolean_attribute module
- raillabel.json_format.coordinate_system module
- raillabel.json_format.cuboid module
- raillabel.json_format.element_data_pointer module
- raillabel.json_format.frame module
- raillabel.json_format.frame_interval module
- raillabel.json_format.metadata module
- raillabel.json_format.num module
- raillabel.json_format.num_attribute module
- raillabel.json_format.object module
- raillabel.json_format.object_data module
- raillabel.json_format.poly2d module
- raillabel.json_format.poly3d module
- raillabel.json_format.scene module
- raillabel.json_format.stream_camera module
- raillabel.json_format.stream_other module
- raillabel.json_format.stream_radar module
- raillabel.json_format.stream_sync module
- raillabel.json_format.text_attribute module
- raillabel.json_format.transform_data module
- raillabel.json_format.vec module
- raillabel.json_format.vec_attribute module
Module contents¶
Package for classes representing the direct RailLabel JSON objects.
- class raillabel.json_format.JSONAnnotations(*, bbox: list[JSONBbox] | None = None, cuboid: list[JSONCuboid] | None = None, poly2d: list[JSONPoly2d] | None = None, poly3d: list[JSONPoly3d] | None = None, vec: list[JSONVec] | None = None)¶
Bases:
_JSONFormatBase
Container of the annotations by type.
- _abc_impl = <_abc._abc_data object>¶
- cuboid: list[JSONCuboid] | None¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- poly2d: list[JSONPoly2d] | None¶
- poly3d: list[JSONPoly3d] | None¶
- class raillabel.json_format.JSONAttributes(*, boolean: list[JSONBooleanAttribute] | None = None, num: list[JSONNumAttribute] | None = None, text: list[JSONTextAttribute] | None = None, vec: list[JSONVecAttribute] | None = None)¶
Bases:
_JSONFormatBase
Attributes is the alias of element data that can be nested inside geometric object data.
For example, a certain bounding box can have attributes related to its score, visibility, etc. These values can be nested inside the bounding box as attributes.
- _abc_impl = <_abc._abc_data object>¶
- boolean: list[JSONBooleanAttribute] | None¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- num: list[JSONNumAttribute] | None¶
- text: list[JSONTextAttribute] | None¶
- vec: list[JSONVecAttribute] | None¶
- class raillabel.json_format.JSONBbox(*, name: str, val: tuple[float, float, float, float], coordinate_system: str, uid: UUID | None = None, attributes: JSONAttributes | None = None)¶
Bases:
_JSONFormatBase
A 2D bounding box is defined as a 4-dimensional vector [x, y, w, h].
[x, y] is the center of the bounding box and [w, h] represent the width (horizontal, x-coordinate dimension) and height (vertical, y-coordinate dimension), respectively.
- _abc_impl = <_abc._abc_data object>¶
- attributes: JSONAttributes | None¶
- coordinate_system: str¶
Name of the coordinate system in respect of which this object data is expressed.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONBooleanAttribute(*, name: str, val: bool)¶
Bases:
_JSONFormatBase
A boolean attribute.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONCoordinateSystem(*, parent: Literal['base', ''], type: Literal['sensor', 'local'], pose_wrt_parent: JSONTransformData | None = None, children: list[str] | None = None)¶
Bases:
_JSONFormatBase
A 3D reference frame.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- parent: Literal['base', '']¶
This is the string UID of the parent coordinate system this coordinate system is referring to.
- pose_wrt_parent: JSONTransformData | None¶
The transformation with regards to the parent coordinate system.
- type: Literal['sensor', 'local']¶
This is a string that describes the type of the coordinate system, for example, ‘local’, ‘geo’).
- class raillabel.json_format.JSONCuboid(*, name: str, val: tuple[float, float, float, float, float, float, float, float, float, float], coordinate_system: str, uid: UUID | None = None, attributes: JSONAttributes | None = None)¶
Bases:
_JSONFormatBase
A cuboid or 3D bounding box.
It is defined by the position of its center, the rotation in 3D, and its dimensions.
- _abc_impl = <_abc._abc_data object>¶
- attributes: JSONAttributes | None¶
- coordinate_system: str¶
Name of the coordinate system in respect of which this object data is expressed.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
This is a string encoding the name of this object data. It is used as index inside the corresponding object data pointers.
- val: tuple[float, float, float, float, float, float, float, float, float, float]¶
List of values encoding the position, rotation and dimensions. It is (x, y, z, qx, qy, qz, qw, sx, sy, sz) where (x, y, z) encodes the position, (qx, qy, qz, qw) encodes the quaternion that encode the rotation, and (sx, sy, sz) are the dimensions of the cuboid in its object coordinate system
- class raillabel.json_format.JSONElementDataPointer(*, attribute_pointers: dict[str, Literal['num', 'text', 'boolean', 'vec']], frame_intervals: list[JSONFrameInterval], type: Literal['bbox', 'num', 'poly2d', 'poly3d', 'cuboid', 'vec'])¶
Bases:
_JSONFormatBase
A pointer to element data of elements.
It is indexed by ‘name’, and containing information about the element data type, for example, bounding box, cuboid, and the frame intervals in which this element_data exists within an element. That means, these pointers can be used to explore element data dynamic information within the JSON content.
- _abc_impl = <_abc._abc_data object>¶
- attribute_pointers: dict[str, Literal['num', 'text', 'boolean', 'vec']]¶
This is a JSON object which contains pointers to the attributes of the element data pointed by this pointer. The attributes pointer keys shall be the ‘name’ of the attribute of the element data this pointer points to.
- frame_intervals: list[JSONFrameInterval]¶
List of frame intervals of the element data pointed by this pointer.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['bbox', 'num', 'poly2d', 'poly3d', 'cuboid', 'vec']¶
Type of the element data pointed by this pointer.
- class raillabel.json_format.JSONFrame¶
Bases:
_JSONFormatBase
A frame is a container of dynamic, timewise, information.
- _abc_impl = <_abc._abc_data object>¶
- frame_properties: JSONFrameProperties | None¶
Container of frame information other than annotations.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- objects: dict[UUID, JSONObjectData] | None¶
This is a JSON object that contains dynamic information on RailLabel objects. Object keys are strings containing 32 bytes UUIDs. Object values contain an ‘object_data’ JSON object.
- class raillabel.json_format.JSONFrameData(*, num: list[JSONNum] | None = None)¶
Bases:
_JSONFormatBase
Additional data to describe attributes of the frame (like GPS position).
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONFrameInterval(*, frame_start: int, frame_end: int)¶
Bases:
_JSONFormatBase
A frame interval defines a starting and ending frame number as a closed interval.
That means the interval includes the limit frame numbers.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONFrameProperties¶
Bases:
_JSONFormatBase
Container of frame information other than annotations.
- _abc_impl = <_abc._abc_data object>¶
- frame_data: JSONFrameData | None¶
Additional data to describe attributes of the frame (like GPS position).
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- streams: dict[str, JSONStreamSync] | None¶
Stream timestamps for synchronization.
- class raillabel.json_format.JSONIntrinsicsPinhole(*, camera_matrix: tuple[float, float, float, float, float, float, float, float, float, float, float, float], distortion_coeffs: tuple[float, float, float, float, float], height_px: int, width_px: int)¶
Bases:
_JSONFormatBase
JSON object defining an instance of the intrinsic parameters of a pinhole camera.
- _abc_impl = <_abc._abc_data object>¶
- camera_matrix: tuple[float, float, float, float, float, float, float, float, float, float, float, float]¶
This is a 3x4 camera matrix which projects 3D homogeneous points (4x1) from a camera coordinate system into the image plane (3x1). This is the usual K matrix for camera projection as in OpenCV. It is extended from 3x3 to 3x4 to enable its direct utilisation to project 4x1 homogeneous 3D points. The matrix is defined to follow the camera model: x-to-right, y-down, z-forward. The following equation applies: x_img = camera_matrix * X_ccs.
- distortion_coeffs: tuple[float, float, float, float, float]¶
This is the array 1x5 radial and tangential distortion coefficients.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONIntrinsicsRadar(*, resolution_px_per_m: float, height_px: int, width_px: int)¶
Bases:
_JSONFormatBase
JSON object defining an instance of the intrinsic parameters of a radar.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONMetadata(*, schema_version: Literal['1.0.0'], name: str | None = None, subschema_version: str | None = None, exporter_version: str | None = None, file_version: str | None = None, tagged_file: str | None = None, annotator: str | None = None, comment: str | None = None, **extra_data: Any)¶
Bases:
BaseModel
Metadata about the annotation file itself.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- schema_version: Literal['1.0.0']¶
Version number of the OpenLABEL schema this annotation file follows.
- class raillabel.json_format.JSONNum(*, name: str, val: float, coordinate_system: str | None = None, uid: UUID | None = None)¶
Bases:
_JSONFormatBase
A number.
- _abc_impl = <_abc._abc_data object>¶
- coordinate_system: str | None¶
Name of the coordinate system in respect of which this object data is expressed.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONNumAttribute(*, name: str, val: float)¶
Bases:
_JSONFormatBase
A number attribute.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONObject(*, name: str, type: str, frame_intervals: list[JSONFrameInterval] | None = None, object_data_pointers: dict[str, JSONElementDataPointer] | None = None)¶
Bases:
_JSONFormatBase
An object is the main type of annotation element.
Object is designed to represent spatiotemporal entities, such as physical objects in the real world. Objects shall have a name and type. Objects may have static and dynamic data. Objects are the only type of elements that may have geometric data, such as bounding boxes, cuboids, polylines, images, etc.
- _abc_impl = <_abc._abc_data object>¶
- frame_intervals: list[JSONFrameInterval] | None¶
The array of frame intervals where this object exists or is defined.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- object_data_pointers: dict[str, JSONElementDataPointer] | None¶
- class raillabel.json_format.JSONObjectData¶
Bases:
_JSONFormatBase
Container of annotations of an object in a frame.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- object_data: JSONAnnotations¶
- class raillabel.json_format.JSONPoly2d(*, name: str, val: list[float | str], closed: bool, mode: Literal['MODE_POLY2D_ABSOLUTE'], coordinate_system: str, uid: UUID | None = None, attributes: JSONAttributes | None = None)¶
Bases:
_JSONFormatBase
A 2D polyline defined as a sequence of 2D points.
- _abc_impl = <_abc._abc_data object>¶
- attributes: JSONAttributes | None¶
- closed: bool¶
A boolean that defines whether the polyline is closed or not. In case it is closed, it is assumed that the last point of the sequence is connected with the first one.
- coordinate_system: str¶
Name of the coordinate system in respect of which this object data is expressed.
- mode: Literal['MODE_POLY2D_ABSOLUTE']¶
Mode of the polyline describes how the points should be arranged in the images. MODE_POLY2D_ABSOLUTE means that any point defined by an x-value followed by a y-value is the absolute position.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONPoly3d(*, name: str, val: list[float], closed: bool, coordinate_system: str, uid: UUID | None = None, attributes: JSONAttributes | None = None)¶
Bases:
_JSONFormatBase
A 3D polyline defined as a sequence of 3D points.
- _abc_impl = <_abc._abc_data object>¶
- attributes: JSONAttributes | None¶
- closed: bool¶
A boolean that defines whether the polyline is closed or not. In case it is closed, it is assumed that the last point of the sequence is connected with the first one.
- coordinate_system: str¶
Name of the coordinate system in respect of which this object data is expressed.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONScene¶
Bases:
_JSONFormatBase
Root RailLabel object.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- openlabel: JSONSceneContent¶
- class raillabel.json_format.JSONSceneContent(*, metadata: JSONMetadata, coordinate_systems: dict[str, JSONCoordinateSystem] | None = None, streams: dict[str, JSONStreamCamera | JSONStreamOther | JSONStreamRadar] | None = None, objects: dict[UUID, JSONObject] | None = None, frames: dict[int, JSONFrame] | None = None, frame_intervals: list[JSONFrameInterval] | None = None)¶
Bases:
_JSONFormatBase
Container of all scene content.
- _abc_impl = <_abc._abc_data object>¶
- coordinate_systems: dict[str, JSONCoordinateSystem] | None¶
- frame_intervals: list[JSONFrameInterval] | None¶
- metadata: JSONMetadata¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- objects: dict[UUID, JSONObject] | None¶
- streams: dict[str, JSONStreamCamera | JSONStreamOther | JSONStreamRadar] | None¶
- class raillabel.json_format.JSONStreamCamera¶
Bases:
_JSONFormatBase
A stream describes the source of a data sequence, usually a sensor.
This specific object contains the intrinsics of a camera sensor.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- stream_properties: JSONStreamCameraProperties¶
Intrinsic calibration of the stream.
- type: Literal['camera']¶
A string encoding the type of the stream.
- class raillabel.json_format.JSONStreamCameraProperties¶
Bases:
_JSONFormatBase
Intrinsic calibration of the stream.
- _abc_impl = <_abc._abc_data object>¶
- intrinsics_pinhole: JSONIntrinsicsPinhole¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONStreamOther(*, type: Literal['lidar', 'gps_imu', 'other'], uri: str | None = None, description: str | None = None)¶
Bases:
_JSONFormatBase
A stream describes the source of a data sequence, usually a sensor.
This specific object describes a sensor without intrinsic calibration.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['lidar', 'gps_imu', 'other']¶
A string encoding the type of the stream.
- class raillabel.json_format.JSONStreamRadar¶
Bases:
_JSONFormatBase
A stream describes the source of a data sequence, usually a sensor.
This specific object contains the intrinsics of a radar sensor.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- stream_properties: JSONStreamRadarProperties¶
Intrinsic calibration of the stream.
- type: Literal['radar']¶
A string encoding the type of the stream.
- class raillabel.json_format.JSONStreamRadarProperties¶
Bases:
_JSONFormatBase
Intrinsic calibration of the stream.
- _abc_impl = <_abc._abc_data object>¶
- intrinsics_radar: JSONIntrinsicsRadar¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONStreamSync¶
Bases:
_JSONFormatBase
Syncronization information of a stream in a frame.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- stream_properties: JSONStreamSyncProperties¶
- class raillabel.json_format.JSONStreamSyncProperties¶
Bases:
_JSONFormatBase
The sync information.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- sync: JSONStreamSyncTimestamp¶
- class raillabel.json_format.JSONStreamSyncTimestamp(*, timestamp: Decimal | str)¶
Bases:
_JSONFormatBase
The timestamp of a stream sync.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONTextAttribute(*, name: str, val: str)¶
Bases:
_JSONFormatBase
A text attribute.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONTransformData(*, translation: tuple[float, float, float], quaternion: tuple[float, float, float, float])¶
Bases:
_JSONFormatBase
The translation and rotation of one coordinate system to another.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class raillabel.json_format.JSONVec(*, name: str, val: list[float], coordinate_system: str, uid: UUID | None = None, type: Literal['values', 'range'] | None = None, attributes: JSONAttributes | None = None)¶
Bases:
_JSONFormatBase
A vector (list) of numbers.
- _abc_impl = <_abc._abc_data object>¶
- attributes: JSONAttributes | None¶
- coordinate_system: str¶
Name of the coordinate system in respect of which this object data is expressed.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
This is a string encoding the name of this object data. It is used as index inside the corresponding object data pointers.
- class raillabel.json_format.JSONVecAttribute(*, name: str, val: list[float | str])¶
Bases:
_JSONFormatBase
A vec attribute.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].