Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene builder fixes #59

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ ignore = [

"N802", # does not allow constant abstractproperties

"PLR0913",# constructors sometimes need many arguments

"TCH001", # adds hard to understand compexity without providing a benefit for smaller projects
"TCH002", # same as TCH001
"TCH003", # same as TCH001
Expand Down
2 changes: 1 addition & 1 deletion raillabel/json_format/stream_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class JSONStreamCamera(_JSONFormatBase):
stream_properties: JSONStreamCameraProperties
"Intrinsic calibration of the stream."

uri: str
uri: str | None = None
"A string encoding the subdirectory containing the sensor files."

description: str | None = None
Expand Down
2 changes: 1 addition & 1 deletion raillabel/json_format/stream_radar.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class JSONStreamRadar(_JSONFormatBase):
stream_properties: JSONStreamRadarProperties
"Intrinsic calibration of the stream."

uri: str
uri: str | None = None
"A string encoding the subdirectory containing the sensor files."

description: str | None = None
Expand Down
24 changes: 16 additions & 8 deletions raillabel/scene_builder/scene_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def add_annotation(
def add_bbox(
self,
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",
Expand All @@ -162,8 +164,8 @@ def add_bbox(
bbox = Bbox(
object_id=UUID("ffffffff-ffff-4fff-ffff-ffffffffffff"),
sensor_id=sensor_id,
pos=Point2d(0, 0),
size=Size2d(0, 0),
pos=pos if pos is not None else Point2d(0, 0),
size=size if size is not None else Size2d(0, 0),
attributes=attributes if attributes is not None else {},
)
return self.add_annotation(
Expand All @@ -177,6 +179,9 @@ def add_bbox(
def add_cuboid(
self,
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",
Expand All @@ -186,9 +191,9 @@ def add_cuboid(
cuboid = Cuboid(
object_id=UUID("ffffffff-ffff-4fff-ffff-ffffffffffff"),
sensor_id=sensor_id,
pos=Point3d(0, 0, 0),
size=Size3d(0, 0, 0),
quat=Quaternion(0, 0, 0, 0),
pos=pos if pos is not None else Point3d(0, 0, 0),
size=size if size is not None else Size3d(0, 0, 0),
quat=quat if quat is not None else Quaternion(0, 0, 0, 0),
attributes=attributes if attributes is not None else {},
)
return self.add_annotation(
Expand All @@ -202,6 +207,7 @@ def add_cuboid(
def add_poly2d(
self,
uid: str | UUID | None = None,
points: list[Point2d] | None = None,
frame_id: int = 1,
object_name: str = "person_0001",
sensor_id: str = "rgb_middle",
Expand All @@ -211,7 +217,7 @@ def add_poly2d(
poly2d = Poly2d(
object_id=UUID("ffffffff-ffff-4fff-ffff-ffffffffffff"),
sensor_id=sensor_id,
points=[],
points=points if points is not None else [],
closed=False,
attributes=attributes if attributes is not None else {},
)
Expand All @@ -226,6 +232,7 @@ def add_poly2d(
def add_poly3d(
self,
uid: str | UUID | None = None,
points: list[Point3d] | None = None,
frame_id: int = 1,
object_name: str = "person_0001",
sensor_id: str = "lidar",
Expand All @@ -235,7 +242,7 @@ def add_poly3d(
poly3d = Poly3d(
object_id=UUID("ffffffff-ffff-4fff-ffff-ffffffffffff"),
sensor_id=sensor_id,
points=[],
points=points if points is not None else [],
closed=False,
attributes=attributes if attributes is not None else {},
)
Expand All @@ -250,6 +257,7 @@ def add_poly3d(
def add_seg3d(
self,
uid: str | UUID | None = None,
point_ids: list[int] | None = None,
frame_id: int = 1,
object_name: str = "person_0001",
sensor_id: str = "lidar",
Expand All @@ -259,7 +267,7 @@ def add_seg3d(
seg3d = Seg3d(
object_id=UUID("ffffffff-ffff-4fff-ffff-ffffffffffff"),
sensor_id=sensor_id,
point_ids=[],
point_ids=point_ids if point_ids is not None else [],
attributes=attributes if attributes is not None else {},
)
return self.add_annotation(
Expand Down
Loading
Loading