diff --git a/src/av2/datasets/sensor/sensor_dataloader.py b/src/av2/datasets/sensor/sensor_dataloader.py index aaa7ccbf..a6586d8b 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,8 @@ 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) # 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