diff --git a/CHANGELOG.md b/CHANGELOG.md index 11dbde9b50..1e8eb30135 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Enhancements - Change _Shape to Shape and add comments for subclasses of Shape () +- Fix `kitti_raw` importer and exporter for dimensions (height, width, length) in meters + () ### Bug fixes diff --git a/src/datumaro/plugins/data_formats/kitti_raw/base.py b/src/datumaro/plugins/data_formats/kitti_raw/base.py index 92e04cc88e..836ad28574 100644 --- a/src/datumaro/plugins/data_formats/kitti_raw/base.py +++ b/src/datumaro/plugins/data_formats/kitti_raw/base.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021-2023 Intel Corporation +# Copyright (C) 2021-2024 Intel Corporation # # SPDX-License-Identifier: MIT @@ -182,7 +182,7 @@ def _parse_attr(cls, value): @classmethod def _parse_track(cls, track_id, track, categories): common_attrs = {k: cls._parse_attr(v) for k, v in track["attributes"].items()} - scale = [track["scale"][k] for k in ["w", "h", "l"]] + scale = [track["scale"][k] for k in ["h", "w", "l"]] label = categories[AnnotationType.label].find(track["label"])[0] kf_occluded = False diff --git a/src/datumaro/plugins/data_formats/kitti_raw/exporter.py b/src/datumaro/plugins/data_formats/kitti_raw/exporter.py index 8e2f250d29..3d01b1d822 100644 --- a/src/datumaro/plugins/data_formats/kitti_raw/exporter.py +++ b/src/datumaro/plugins/data_formats/kitti_raw/exporter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Intel Corporation +# Copyright (C) 2021-2024 Intel Corporation # # SPDX-License-Identifier: MIT @@ -339,8 +339,8 @@ def _create_tracklets(self, subset): if not track: track = { "objectType": label, - "h": ann.scale[1], - "w": ann.scale[0], + "h": ann.scale[0], + "w": ann.scale[1], "l": ann.scale[2], "first_frame": frame_id, "poses": [], @@ -348,7 +348,7 @@ def _create_tracklets(self, subset): } tracks[track_id] = track else: - if [track["w"], track["h"], track["l"]] != ann.scale: + if [track["h"], track["w"], track["l"]] != ann.scale: # Tracks have fixed scale in the format raise DatasetExportError( "Item %s: mismatching track shapes, " diff --git a/tests/integration/cli/test_kitti_raw_format.py b/tests/integration/cli/test_kitti_raw_format.py index 884cc02708..f7810bc981 100644 --- a/tests/integration/cli/test_kitti_raw_format.py +++ b/tests/integration/cli/test_kitti_raw_format.py @@ -33,13 +33,13 @@ def test_can_convert_to_kitti_raw(self): annotations=[ Cuboid3d( position=[1, 2, 3], - scale=[7.95, -3.62, -1.03], + scale=[-3.62, 7.95, -1.03], label=1, attributes={"occluded": False, "track_id": 1}, ), Cuboid3d( position=[1, 1, 0], - scale=[8.34, 23.01, -0.76], + scale=[23.01, 8.34, -0.76], label=0, attributes={"occluded": False, "track_id": 2}, ), @@ -65,7 +65,7 @@ def test_can_convert_to_kitti_raw(self): annotations=[ Cuboid3d( position=[0, 1, 0], - scale=[8.34, 23.01, -0.76], + scale=[23.01, 8.34, -0.76], rotation=[1, 1, 3], label=0, attributes={"occluded": True, "track_id": 2}, @@ -92,7 +92,7 @@ def test_can_convert_to_kitti_raw(self): annotations=[ Cuboid3d( position=[1, 2, 3], - scale=[-9.41, 13.54, 0.24], + scale=[13.54, -9.41, 0.24], label=1, attributes={"occluded": False, "track_id": 3}, ) diff --git a/tests/unit/test_kitti_raw_format.py b/tests/unit/test_kitti_raw_format.py index e8ab776b75..498e99b20f 100644 --- a/tests/unit/test_kitti_raw_format.py +++ b/tests/unit/test_kitti_raw_format.py @@ -52,13 +52,13 @@ def test_can_load(self): annotations=[ Cuboid3d( position=[1, 2, 3], - scale=[7.95, -3.62, -1.03], + scale=[-3.62, 7.95, -1.03], label=1, attributes={"occluded": False, "track_id": 1}, ), Cuboid3d( position=[1, 1, 0], - scale=[8.34, 23.01, -0.76], + scale=[23.01, 8.34, -0.76], label=0, attributes={"occluded": False, "track_id": 2}, ), @@ -71,7 +71,7 @@ def test_can_load(self): annotations=[ Cuboid3d( position=[0, 1, 0], - scale=[8.34, 23.01, -0.76], + scale=[23.01, 8.34, -0.76], rotation=[1, 1, 3], label=0, attributes={"occluded": True, "track_id": 2}, @@ -85,7 +85,7 @@ def test_can_load(self): annotations=[ Cuboid3d( position=[1, 2, 3], - scale=[-9.41, 13.54, 0.24], + scale=[13.54, -9.41, 0.24], label=1, attributes={"occluded": False, "track_id": 3}, ) @@ -161,7 +161,7 @@ def test_can_save_and_load(self): Cuboid3d(position=[1.4, 2.1, 1.4], label=1, attributes={"track_id": 2}), Cuboid3d( position=[11.4, -0.1, 4.2], - scale=[2, 1, 2], + scale=[1, 2, 2], label=0, attributes={"track_id": 3}, ), @@ -172,7 +172,7 @@ def test_can_save_and_load(self): annotations=[ Cuboid3d( position=[0.4, -1, 2.24], - scale=[2, 1, 2], + scale=[1, 2, 2], label=0, attributes={"track_id": 3}, ), @@ -185,7 +185,7 @@ def test_can_save_and_load(self): annotations=[ Cuboid3d( position=[0.4, -1, 3.24], - scale=[2, 1, 2], + scale=[1, 2, 2], label=0, attributes={"track_id": 3}, ), @@ -244,7 +244,7 @@ def test_can_save_and_load(self): ), Cuboid3d( position=[11.4, -0.1, 4.2], - scale=[2, 1, 2], + scale=[1, 2, 2], label=0, attributes={"occluded": False, "track_id": 3}, ), @@ -256,7 +256,7 @@ def test_can_save_and_load(self): annotations=[ Cuboid3d( position=[0.4, -1, 2.24], - scale=[2, 1, 2], + scale=[1, 2, 2], label=0, attributes={"occluded": False, "track_id": 3}, ), @@ -271,7 +271,7 @@ def test_can_save_and_load(self): annotations=[ Cuboid3d( position=[0.4, -1, 3.24], - scale=[2, 1, 2], + scale=[1, 2, 2], label=0, attributes={"occluded": False, "track_id": 3}, ),