diff --git a/raillabel/format/bbox.py b/raillabel/format/bbox.py index b4ffe69..cd58b41 100644 --- a/raillabel/format/bbox.py +++ b/raillabel/format/bbox.py @@ -26,8 +26,8 @@ class Bbox: object_id: UUID "The unique identifyer of the real-life object, this annotation belongs to." - sensor: str - "The uid of the sensor, this annotation is labeled in." + sensor_id: str + "The unique identifyer of the sensor this annotation is labeled in." attributes: dict[str, float | bool | str | list] "Additional information associated with the annotation." @@ -39,7 +39,7 @@ def from_json(cls, json: JSONBbox, object_id: UUID) -> Bbox: pos=Point2d.from_json((json.val[0], json.val[1])), size=Size2d.from_json((json.val[2], json.val[3])), object_id=object_id, - sensor=json.coordinate_system, + sensor_id=json.coordinate_system, attributes=_attributes_from_json(json.attributes), ) @@ -48,11 +48,11 @@ def to_json(self, uid: UUID, object_type: str) -> JSONBbox: return JSONBbox( name=self.name(object_type), val=list(self.pos.to_json()) + list(self.size.to_json()), - coordinate_system=self.sensor, + coordinate_system=self.sensor_id, uid=uid, attributes=_attributes_to_json(self.attributes), ) def name(self, object_type: str) -> str: """Return the name of the annotation used for indexing in the object data pointers.""" - return f"{self.sensor}__bbox__{object_type}" + return f"{self.sensor_id}__bbox__{object_type}" diff --git a/raillabel/format/cuboid.py b/raillabel/format/cuboid.py index 3422c43..2ca34d9 100644 --- a/raillabel/format/cuboid.py +++ b/raillabel/format/cuboid.py @@ -31,8 +31,8 @@ class Cuboid: object_id: UUID "The unique identifyer of the real-life object, this annotation belongs to." - sensor: str - "The uid of the sensor, this annotation is labeled in." + sensor_id: str + "The unique identifyer of the sensor this annotation is labeled in." attributes: dict[str, float | bool | str | list] "Additional information associated with the annotation." @@ -45,10 +45,10 @@ def from_json(cls, json: JSONCuboid, object_id: UUID) -> Cuboid: quat=Quaternion.from_json((json.val[3], json.val[4], json.val[5], json.val[6])), size=Size3d.from_json((json.val[7], json.val[8], json.val[9])), object_id=object_id, - sensor=json.coordinate_system, + sensor_id=json.coordinate_system, attributes=_attributes_from_json(json.attributes), ) def name(self, object_type: str) -> str: """Return the name of the annotation used for indexing in the object data pointers.""" - return f"{self.sensor}__cuboid__{object_type}" + return f"{self.sensor_id}__cuboid__{object_type}" diff --git a/raillabel/format/num.py b/raillabel/format/num.py index d92aff6..21e7a23 100644 --- a/raillabel/format/num.py +++ b/raillabel/format/num.py @@ -18,7 +18,7 @@ class Num: val: float "This is the value of the number object." - sensor: str | None + sensor_id: str | None "A reference to the sensor, this value is represented in." @classmethod @@ -27,5 +27,5 @@ def from_json(cls, json: JSONNum) -> Num: return Num( name=json.name, val=json.val, - sensor=json.coordinate_system, + sensor_id=json.coordinate_system, ) diff --git a/raillabel/format/poly2d.py b/raillabel/format/poly2d.py index 8cfd9a6..c8030b4 100644 --- a/raillabel/format/poly2d.py +++ b/raillabel/format/poly2d.py @@ -25,8 +25,8 @@ class Poly2d: object_id: UUID "The unique identifyer of the real-life object, this annotation belongs to." - sensor: str - "The uid of the sensor, this annotation is labeled in." + sensor_id: str + "The unique identifyer of the sensor this annotation is labeled in." attributes: dict[str, float | bool | str | list] "Additional information associated with the annotation." @@ -41,10 +41,10 @@ def from_json(cls, json: JSONPoly2d, object_id: UUID) -> Poly2d: ], closed=json.closed, object_id=object_id, - sensor=json.coordinate_system, + sensor_id=json.coordinate_system, attributes=_attributes_from_json(json.attributes), ) def name(self, object_type: str) -> str: """Return the name of the annotation used for indexing in the object data pointers.""" - return f"{self.sensor}__poly2d__{object_type}" + return f"{self.sensor_id}__poly2d__{object_type}" diff --git a/raillabel/format/poly3d.py b/raillabel/format/poly3d.py index f7b54a4..6c4777a 100644 --- a/raillabel/format/poly3d.py +++ b/raillabel/format/poly3d.py @@ -25,8 +25,8 @@ class Poly3d: object_id: UUID "The unique identifyer of the real-life object, this annotation belongs to." - sensor: str - "The uid of the sensor, this annotation is labeled in." + sensor_id: str + "The unique identifyer of the sensor this annotation is labeled in." attributes: dict[str, float | bool | str | list] "Additional information associated with the annotation." @@ -41,10 +41,10 @@ def from_json(cls, json: JSONPoly3d, object_id: UUID) -> Poly3d: ], closed=json.closed, object_id=object_id, - sensor=json.coordinate_system, + sensor_id=json.coordinate_system, attributes=_attributes_from_json(json.attributes), ) def name(self, object_type: str) -> str: """Return the name of the annotation used for indexing in the object data pointers.""" - return f"{self.sensor}__poly3d__{object_type}" + return f"{self.sensor_id}__poly3d__{object_type}" diff --git a/raillabel/format/seg3d.py b/raillabel/format/seg3d.py index 8e8ff25..76ef176 100644 --- a/raillabel/format/seg3d.py +++ b/raillabel/format/seg3d.py @@ -21,8 +21,8 @@ class Seg3d: object_id: UUID "The unique identifyer of the real-life object, this annotation belongs to." - sensor: str - "The uid of the sensor, this annotation is labeled in." + sensor_id: str + "The unique identifyer of the sensor this annotation is labeled in." attributes: dict[str, float | bool | str | list] "Additional information associated with the annotation." @@ -33,10 +33,10 @@ def from_json(cls, json: JSONVec, object_id: UUID) -> Seg3d: return Seg3d( point_ids=[int(point_id) for point_id in json.val], object_id=object_id, - sensor=json.coordinate_system, + sensor_id=json.coordinate_system, attributes=_attributes_from_json(json.attributes), ) def name(self, object_type: str) -> str: """Return the name of the annotation used for indexing in the object data pointers.""" - return f"{self.sensor}__vec__{object_type}" + return f"{self.sensor_id}__vec__{object_type}" diff --git a/tests/test_raillabel/format/test_bbox.py b/tests/test_raillabel/format/test_bbox.py index cc534e0..7c061de 100644 --- a/tests/test_raillabel/format/test_bbox.py +++ b/tests/test_raillabel/format/test_bbox.py @@ -43,7 +43,7 @@ def bbox( return Bbox( pos=point2d, size=size2d, - sensor="rgb_middle", + sensor_id="rgb_middle", attributes=attributes_multiple_types, object_id=object_person_id, ) diff --git a/tests/test_raillabel/format/test_cuboid.py b/tests/test_raillabel/format/test_cuboid.py index ce7bfe8..9cfeeb6 100644 --- a/tests/test_raillabel/format/test_cuboid.py +++ b/tests/test_raillabel/format/test_cuboid.py @@ -46,7 +46,7 @@ def cuboid( pos=point3d, quat=quaternion, size=size3d, - sensor="lidar", + sensor_id="lidar", attributes=attributes_multiple_types, object_id=object_person_id, ) diff --git a/tests/test_raillabel/format/test_num.py b/tests/test_raillabel/format/test_num.py index dcde12d..2e0fae7 100644 --- a/tests/test_raillabel/format/test_num.py +++ b/tests/test_raillabel/format/test_num.py @@ -26,7 +26,7 @@ def num_json() -> JSONNum: @pytest.fixture def num() -> Num: return Num( - sensor="gps_imu", + sensor_id="gps_imu", name="velocity", val=49.21321, ) diff --git a/tests/test_raillabel/format/test_poly2d.py b/tests/test_raillabel/format/test_poly2d.py index b91a7aa..7773df9 100644 --- a/tests/test_raillabel/format/test_poly2d.py +++ b/tests/test_raillabel/format/test_poly2d.py @@ -45,7 +45,7 @@ def poly2d( return Poly2d( points=[point2d, another_point2d], closed=True, - sensor="rgb_middle", + sensor_id="rgb_middle", attributes=attributes_multiple_types, object_id=object_track_id, ) diff --git a/tests/test_raillabel/format/test_poly3d.py b/tests/test_raillabel/format/test_poly3d.py index b8752d0..6119d38 100644 --- a/tests/test_raillabel/format/test_poly3d.py +++ b/tests/test_raillabel/format/test_poly3d.py @@ -44,7 +44,7 @@ def poly3d( return Poly3d( points=[point3d, another_point3d], closed=True, - sensor="lidar", + sensor_id="lidar", attributes=attributes_multiple_types, object_id=object_track_id, ) diff --git a/tests/test_raillabel/format/test_seg3d.py b/tests/test_raillabel/format/test_seg3d.py index 8be83c6..0dd2716 100644 --- a/tests/test_raillabel/format/test_seg3d.py +++ b/tests/test_raillabel/format/test_seg3d.py @@ -38,7 +38,7 @@ def seg3d( ) -> Seg3d: return Seg3d( point_ids=[1234, 5678], - sensor="lidar", + sensor_id="lidar", attributes=attributes_multiple_types, object_id=object_person_id, )