Skip to content

Commit

Permalink
Merge pull request #59 from DSD-DBS/scene_builder_fixes
Browse files Browse the repository at this point in the history
Scene builder fixes
  • Loading branch information
unexcellent authored Dec 9, 2024
2 parents c7ad8d7 + c0ac631 commit 892060b
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 118 deletions.
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

0 comments on commit 892060b

Please sign in to comment.