From 51f86284122c1289c8a4e8139986c77c6bd5e9c6 Mon Sep 17 00:00:00 2001 From: "zhe.du" Date: Sat, 27 Aug 2022 12:41:52 +0800 Subject: [PATCH 1/3] fix bug of loading testset label --- src/av2/datasets/sensor/sensor_dataloader.py | 7 ++++++- tutorials/generate_sensor_dataset_visualizations.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/av2/datasets/sensor/sensor_dataloader.py b/src/av2/datasets/sensor/sensor_dataloader.py index aaa7ccbf..6d259bb2 100644 --- a/src/av2/datasets/sensor/sensor_dataloader.py +++ b/src/av2/datasets/sensor/sensor_dataloader.py @@ -212,6 +212,8 @@ def _build_sensor_cache(self) -> pd.DataFrame: if self.with_cache and sensor_cache_path.exists(): logger.info("Cache found. Loading from disk ...") sensor_cache = read_feather(sensor_cache_path) + if self.with_annotations: + sensor_cache = sensor_cache[sensor_cache.split != 'test'] else: lidar_records = self.populate_lidar_records() # Load camera records if enabled. @@ -338,7 +340,10 @@ def __getitem__(self, idx: int) -> SynchronizedSensorData: # Load annotations if enabled. if self.with_annotations: - datum.annotations = self._load_annotations(split, log_id, timestamp_ns) + if split != 'test': + datum.annotations = self._load_annotations(split, log_id, timestamp_ns) + else: + datum.annotations = None # Load camera imagery if enabled. if self.cam_names: diff --git a/tutorials/generate_sensor_dataset_visualizations.py b/tutorials/generate_sensor_dataset_visualizations.py index e1a3d7a3..f07c9597 100644 --- a/tutorials/generate_sensor_dataset_visualizations.py +++ b/tutorials/generate_sensor_dataset_visualizations.py @@ -51,6 +51,8 @@ def generate_sensor_dataset_visualizations( for _, datum in enumerate(track(dataset, "Creating sensor tutorial videos ...")): sweep = datum.sweep annotations = datum.annotations + if annotations is None: + continue timestamp_city_SE3_ego_dict = datum.timestamp_city_SE3_ego_dict synchronized_imagery = datum.synchronized_imagery From e119cabda52b4d340cb01ac29a6c3a03959f4237 Mon Sep 17 00:00:00 2001 From: Benjamin Wilson Date: Tue, 21 Mar 2023 18:29:59 -0700 Subject: [PATCH 2/3] Update src/av2/datasets/sensor/sensor_dataloader.py --- src/av2/datasets/sensor/sensor_dataloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/av2/datasets/sensor/sensor_dataloader.py b/src/av2/datasets/sensor/sensor_dataloader.py index 6d259bb2..9db1a760 100644 --- a/src/av2/datasets/sensor/sensor_dataloader.py +++ b/src/av2/datasets/sensor/sensor_dataloader.py @@ -213,7 +213,7 @@ def _build_sensor_cache(self) -> pd.DataFrame: logger.info("Cache found. Loading from disk ...") sensor_cache = read_feather(sensor_cache_path) if self.with_annotations: - sensor_cache = sensor_cache[sensor_cache.split != 'test'] + sensor_cache = sensor_cache[sensor_cache.split != "test"] else: lidar_records = self.populate_lidar_records() # Load camera records if enabled. From 3c91e226ecb2205f4bae9454ed22fc702a52dce6 Mon Sep 17 00:00:00 2001 From: Benjamin Wilson Date: Tue, 21 Mar 2023 18:30:05 -0700 Subject: [PATCH 3/3] Update src/av2/datasets/sensor/sensor_dataloader.py --- src/av2/datasets/sensor/sensor_dataloader.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/av2/datasets/sensor/sensor_dataloader.py b/src/av2/datasets/sensor/sensor_dataloader.py index 9db1a760..a6586d8b 100644 --- a/src/av2/datasets/sensor/sensor_dataloader.py +++ b/src/av2/datasets/sensor/sensor_dataloader.py @@ -340,10 +340,8 @@ def __getitem__(self, idx: int) -> SynchronizedSensorData: # Load annotations if enabled. if self.with_annotations: - if split != 'test': + if split != "test": datum.annotations = self._load_annotations(split, log_id, timestamp_ns) - else: - datum.annotations = None # Load camera imagery if enabled. if self.cam_names: