raillabel.scene_builder package

Submodules

raillabel.scene_builder.scene_builder module

class raillabel.scene_builder.scene_builder.SceneBuilder(result: Scene)

Bases: object

Use this class for easily creating scenes for tests.

add_annotation(annotation: Bbox | Cuboid | Poly2d | Poly3d | Seg3d, uid: str | UUID | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'rgb_middle') SceneBuilder

Add an annotation to the scene.

add_bbox(uid: str | UUID | None = None, pos: Point2d | None = None, size: Size2d | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'rgb_middle', attributes: dict | None = None) SceneBuilder

Add a bbox to the scene.

add_cuboid(uid: str | UUID | None = None, pos: Point3d | None = None, quat: Quaternion | None = None, size: Size3d | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'lidar', attributes: dict | None = None) SceneBuilder

Add a cuboid to the scene.

add_frame(frame_id: int | None = None, timestamp: float | None = None) SceneBuilder

Add a frame to the scene.

If no frame_id is provided, the frame_id is the lowest number not currently occupied by another frame_id.

Example: `python scene = SceneBuilder.empty().add_frame(frame_id=1).add_frame(frame_id=3).add_frame().result assert sorted(list(scene.frames.keys())) == [1, 2, 3] `

add_object(object_id: str | UUID | None = None, object_type: str | None = None, object_name: str | None = None) SceneBuilder

Add an object to the scene.

add_poly2d(uid: str | UUID | None = None, points: list[Point2d] | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'rgb_middle', attributes: dict | None = None) SceneBuilder

Add a poly2d to the scene.

add_poly3d(uid: str | UUID | None = None, points: list[Point3d] | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'lidar', attributes: dict | None = None) SceneBuilder

Add a poly3d to the scene.

add_seg3d(uid: str | UUID | None = None, point_ids: list[int] | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'lidar', attributes: dict | None = None) SceneBuilder

Add a poly3d to the scene.

add_sensor(sensor_id: str) SceneBuilder

Add a sensor to the scene.

The sensor type is implicitly determined by the sensor_id. Id’s, that start with ‘rgb_’ or ‘ir_’ are added as a camera. If the id is ‘lidar’, it is a lidar. ‘radar’ creates a Radar. ‘gps_imu’ creates a GpsImu. If the id does not match any of these, a OtherSensor is added.

classmethod empty() SceneBuilder

Construct the SceneBuilder with an empty scene.

result: Scene

Module contents

Package for the scene building functionality.

class raillabel.scene_builder.SceneBuilder(result: Scene)

Bases: object

Use this class for easily creating scenes for tests.

add_annotation(annotation: Bbox | Cuboid | Poly2d | Poly3d | Seg3d, uid: str | UUID | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'rgb_middle') SceneBuilder

Add an annotation to the scene.

add_bbox(uid: str | UUID | None = None, pos: Point2d | None = None, size: Size2d | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'rgb_middle', attributes: dict | None = None) SceneBuilder

Add a bbox to the scene.

add_cuboid(uid: str | UUID | None = None, pos: Point3d | None = None, quat: Quaternion | None = None, size: Size3d | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'lidar', attributes: dict | None = None) SceneBuilder

Add a cuboid to the scene.

add_frame(frame_id: int | None = None, timestamp: float | None = None) SceneBuilder

Add a frame to the scene.

If no frame_id is provided, the frame_id is the lowest number not currently occupied by another frame_id.

Example: `python scene = SceneBuilder.empty().add_frame(frame_id=1).add_frame(frame_id=3).add_frame().result assert sorted(list(scene.frames.keys())) == [1, 2, 3] `

add_object(object_id: str | UUID | None = None, object_type: str | None = None, object_name: str | None = None) SceneBuilder

Add an object to the scene.

add_poly2d(uid: str | UUID | None = None, points: list[Point2d] | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'rgb_middle', attributes: dict | None = None) SceneBuilder

Add a poly2d to the scene.

add_poly3d(uid: str | UUID | None = None, points: list[Point3d] | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'lidar', attributes: dict | None = None) SceneBuilder

Add a poly3d to the scene.

add_seg3d(uid: str | UUID | None = None, point_ids: list[int] | None = None, frame_id: int = 1, object_name: str = 'person_0001', sensor_id: str = 'lidar', attributes: dict | None = None) SceneBuilder

Add a poly3d to the scene.

add_sensor(sensor_id: str) SceneBuilder

Add a sensor to the scene.

The sensor type is implicitly determined by the sensor_id. Id’s, that start with ‘rgb_’ or ‘ir_’ are added as a camera. If the id is ‘lidar’, it is a lidar. ‘radar’ creates a Radar. ‘gps_imu’ creates a GpsImu. If the id does not match any of these, a OtherSensor is added.

classmethod empty() SceneBuilder

Construct the SceneBuilder with an empty scene.

result: Scene