motional / nuplan-devkit

The devkit of the nuPlan dataset.
https://www.nuplan.org
Other
662 stars 126 forks source link

Cannot run sensor_data_tutorial #290

Closed QuanyiLi closed 1 year ago

QuanyiLi commented 1 year ago

Describe the bug

When running the sensor_data_tutorial, I can not execute the second cell:

sensors = scenario.get_sensors_at_iteration(0, [CameraChannel.CAM_F0, LidarChannel.MERGED_PC])
print(sensors)

The error message is

Remote store is not set and key was not found locally. Try setting NUPLAN_DATA_STORE to 's3'.

Could you help me with this?

Setup

Ubuntu 20.04, nuPlan 1.2.0

Steps To Reproduce

Just run the tutorial without any modification.

Stack Trace

RuntimeError                              Traceback (most recent call last)
Cell In[12], line 3
      1 import os
----> 3 sensors = scenario.get_sensors_at_iteration(0, [CameraChannel.CAM_F0, LidarChannel.MERGED_PC])
      4 print(sensors)

File /mnt/data/nuplan-devkit/nuplan/planning/scenario_builder/nuplan_db/nuplan_scenario.py:302, in NuPlanScenario.get_sensors_at_iteration(self, iteration, channels)
    295 channels = [LidarChannel.MERGED_PC] if channels is None else channels
    297 lidar_pc = next(
    298     get_sensor_data_from_sensor_data_tokens_from_db(
    299         self._log_file, get_lidarpc_sensor_data(), LidarPc, [self._lidarpc_tokens[iteration]]
    300     )
    301 )
--> 302 return self._get_sensor_data_from_lidar_pc(cast(LidarPc, lidar_pc), channels)

File /mnt/data/nuplan-devkit/nuplan/planning/scenario_builder/nuplan_db/nuplan_scenario.py:500, in NuPlanScenario._get_sensor_data_from_lidar_pc(self, lidar_pc, channels)
    494 local_store, remote_store = self._create_blob_store_if_needed()
    496 retrieved_images = get_images_from_lidar_tokens(
    497     self._log_file, [lidar_pc.token], [cast(str, channel.value) for channel in channels]
    498 )
    499 lidar_pcs = (
--> 500     {LidarChannel.MERGED_PC: load_point_cloud(cast(LidarPc, lidar_pc), local_store, remote_store)}
    501     if LidarChannel.MERGED_PC in channels
    502     else None
    503 )
    505 images = {
    506     CameraChannel[image.channel]: load_image(image, local_store, remote_store) for image in retrieved_images
    507 }
    509 return Sensors(pointcloud=lidar_pcs, images=images if images else None)

File /mnt/data/nuplan-devkit/nuplan/planning/scenario_builder/nuplan_db/nuplan_scenario_utils.py:471, in load_point_cloud(lidar_pc, local_store, remote_store)
    463 """
    464 Loads a point cloud given a database LidarPC object.
    465 :param lidar_pc: The lidar_pc for which to grab the point cloud.
   (...)
    468 :return: The corresponding point cloud.
    469 """
    470 file_type = lidar_pc.filename.split('.')[-1]
--> 471 blob = download_and_cache(lidar_pc.filename, local_store, remote_store)
    472 return LidarPointCloud.from_buffer(blob, file_type) if blob is not None else None

File /mnt/data/nuplan-devkit/nuplan/planning/scenario_builder/nuplan_db/nuplan_scenario_utils.py:448, in download_and_cache(key, local_store, remote_store)
    445     return cast(BinaryIO, local_store.get(key))
    447 if remote_store is None:
--> 448     raise RuntimeError(
    449         "Remote store is not set and key was not found locally. Try setting NUPLAN_DATA_STORE to 's3'."
    450     )
    452 # Download and store data locally
    453 try:

RuntimeError: Remote store is not set and key was not found locally. Try setting NUPLAN_DATA_STORE to 's3'.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

patk-motional commented 1 year ago

Hi @QuanyiLi,

The code should never get to that point if you have the local file structure set correctly.

The code will check first if the files exist locally. If not then it will attempt to download from AWS S3 if you have the setup on your end.

muety commented 1 year ago

Got the same issue. But also only downloaded the mini batch of data. Is the full dataset required in this tutorial?

Btw.: Thanks a lot for this awesome tooling! :raised_hands: Must have taken such a lot of work...

EDIT: Never mind, I realized I didn't have the sensor data downloaded :man_facepalming:.