Skip to content

Commit

Permalink
feat: allow even if original is not specified
Browse files Browse the repository at this point in the history
Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 committed Oct 18, 2024
1 parent b422d02 commit 7e317de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions t4_devkit/dataclass/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Box3D(BaseBox):
>>> box3d = Box3D(
... unix_time=100,
... frame_id="base_link",
... semantic_label=SemanticLabel(label=LabelID.CAR, original="car"),
... semantic_label=SemanticLabel(LabelID.CAR),
... position=(1.0, 1.0, 1.0),
... rotation=Quaternion([0.0, 0.0, 0.0, 1.0]),
... shape=Shape(shape_type=ShapeType.BOUNDING_BOX, size=(1.0, 1.0, 1.0)),
Expand Down Expand Up @@ -181,7 +181,7 @@ class Box2D(BaseBox):
>>> box2d = Box2D(
... unix_time=100,
... frame_id="camera",
... semantic_label=SemanticLabel(label=LabelID.CAR, original="car"),
... semantic_label=SemanticLabel(LabelID.CAR),
... roi=(100, 100, 50, 50),
... confidence=1.0,
... uuid="car2d_0",
Expand Down
6 changes: 3 additions & 3 deletions t4_devkit/dataclass/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ class SemanticLabel:
Attributes:
label (LabelID): Label ID.
original (str): Original name of the label.
attributes (list): List of attribute names.
original (str | None, optional): Original name of the label.
attributes (list[str], optional): List of attribute names.
"""

label: LabelID
original: str
original: str | None = field(default=None)
attributes: list[str] = field(default_factory=list)

def __eq__(self, other: SemanticLabel) -> bool:
Expand Down
16 changes: 8 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def dummy_box3d() -> Box3D:
return Box3D(
unix_time=100,
frame_id="base_link",
semantic_label=SemanticLabel(label=LabelID.CAR, original="car"),
semantic_label=SemanticLabel(LabelID.CAR),
position=(1.0, 1.0, 1.0),
rotation=Quaternion([0.0, 0.0, 0.0, 1.0]),
shape=Shape(shape_type=ShapeType.BOUNDING_BOX, size=(1.0, 1.0, 1.0)),
Expand All @@ -35,7 +35,7 @@ def dummy_box3ds() -> list[Box3D]:
Box3D(
unix_time=100,
frame_id="base_link",
semantic_label=SemanticLabel(label=LabelID.CAR, original="car"),
semantic_label=SemanticLabel(LabelID.CAR),
position=(1.0, 1.0, 1.0),
rotation=Quaternion([0.0, 0.0, 0.0, 1.0]),
shape=Shape(shape_type=ShapeType.BOUNDING_BOX, size=(1.0, 1.0, 1.0)),
Expand All @@ -46,7 +46,7 @@ def dummy_box3ds() -> list[Box3D]:
Box3D(
unix_time=100,
frame_id="base_link",
semantic_label=SemanticLabel(label=LabelID.BICYCLE, original="bicycle"),
semantic_label=SemanticLabel(LabelID.BICYCLE),
position=(-1.0, -1.0, 1.0),
rotation=Quaternion([0.0, 0.0, 0.0, 1.0]),
shape=Shape(shape_type=ShapeType.BOUNDING_BOX, size=(1.0, 1.0, 1.0)),
Expand All @@ -57,7 +57,7 @@ def dummy_box3ds() -> list[Box3D]:
Box3D(
unix_time=100,
frame_id="base_link",
semantic_label=SemanticLabel(label=LabelID.PEDESTRIAN, original="pedestrian"),
semantic_label=SemanticLabel(LabelID.PEDESTRIAN),
position=(-1.0, 1.0, 1.0),
rotation=Quaternion([0.0, 0.0, 0.0, 1.0]),
shape=Shape(shape_type=ShapeType.BOUNDING_BOX, size=(1.0, 1.0, 1.0)),
Expand All @@ -78,7 +78,7 @@ def dummy_box2d() -> Box2D:
return Box2D(
unix_time=100,
frame_id="camera",
semantic_label=SemanticLabel(label=LabelID.CAR, original="car"),
semantic_label=SemanticLabel(LabelID.CAR),
roi=(100, 100, 50, 50),
confidence=1.0,
uuid="car2d_0",
Expand All @@ -96,23 +96,23 @@ def dummy_box2ds() -> list[Box2D]:
Box2D(
unix_time=100,
frame_id="camera",
semantic_label=SemanticLabel(label=LabelID.CAR, original="car"),
semantic_label=SemanticLabel(LabelID.CAR),
roi=(100, 100, 50, 50),
confidence=1.0,
uuid="car2d_1",
),
Box2D(
unix_time=100,
frame_id="camera",
semantic_label=SemanticLabel(label=LabelID.BICYCLE, original="bicycle"),
semantic_label=SemanticLabel(LabelID.BICYCLE),
roi=(50, 50, 10, 10),
confidence=1.0,
uuid="bicycle2d_1",
),
Box2D(
unix_time=100,
frame_id="camera",
semantic_label=SemanticLabel(label=LabelID.PEDESTRIAN, original="pedestrian"),
semantic_label=SemanticLabel(LabelID.PEDESTRIAN),
roi=(150, 150, 20, 20),
confidence=1.0,
uuid="pedestrian2d_1",
Expand Down

0 comments on commit 7e317de

Please sign in to comment.