Scene API¶
- class py123d.api.SceneAPI[source]¶
Base class for all scene APIs. The scene API provides access to all data modalities at in a scene.
Public Data Attributes:
log_metadataThe
LogMetadataof the scene.scene_metadataThe
SceneMetadataof the scene.datasetThe dataset name from the log metadata.
splitThe data split name from the log metadata.
locationThe location from the log metadata.
log_nameThe log name from the log metadata.
scene_uuidThe UUID of the scene.
number_of_iterationsThe number of iterations in the scene (includes current frame + future).
number_of_history_iterationsThe number of history iterations in the scene.
available_camera_idsList of available camera IDs.
available_camera_namesList of available camera names.
available_lidar_idsList of available
LidarID.available_lidar_namesList of available Lidar names.
Public Methods:
get_scene_metadata()Returns the
SceneMetadataof the scene.get_log_metadata()Returns the
LogMetadataof the scene.get_timestamp_at_iteration(iteration)Returns the
Timestampat a given iteration.get_all_iteration_timestamps([include_history])Returns all sync timestamps for the current scene.
get_scene_timestamp_boundaries([include_history])Returns the first and last sync timestamps of the scene.
get_map_metadata()Returns the
MapMetadataof the scene, if available.get_map_api()Returns the
MapAPIof the scene, if available.get_all_modality_metadatas()Returns all modality metadatas found in the log directory.
get_modality_metadata(modality_type[, ...])Returns the metadata for a specific modality.
get_all_modality_timestamps(modality_type[, ...])Returns all timestamps for a specific modality within the scene range.
get_modality_at_iteration(iteration, ...[, ...])Returns the modality data at a given iteration, if available.
get_modality_at_timestamp(timestamp, ...[, ...])Returns the modality data at a given timestamp, if available.
get_ego_state_se3_metadata()Returns the
EgoStateSE3Metadataof the ego vehicle, if available.get_all_ego_state_se3_timestamps([...])Returns all ego state timestamps within the current scene.
get_ego_state_se3_at_iteration(iteration)Returns the
EgoStateSE3at a given iteration, if available.get_ego_state_se3_at_timestamp(timestamp[, ...])Returns the
EgoStateSE3at a given timestamp, if available.get_box_detections_se3_metadata()Returns the
BoxDetectionsSE3Metadataof the scene, if available.get_all_box_detections_se3_timestamps([...])Returns all box detection timestamps within the current scene.
get_box_detections_se3_at_iteration(iteration)Returns the
BoxDetectionsSE3at a given iteration, if available.get_box_detections_se3_at_timestamp(timestamp)Returns the
BoxDetectionsSE3at a given timestamp, if available.get_traffic_light_detections_metadata()Returns the
TrafficLightDetectionsMetadataof the scene, if available.get_all_traffic_light_detections_timestamps([...])Returns all traffic light detection timestamps within the current scene.
get_traffic_light_detections_at_iteration(...)Returns the
TrafficLightDetectionsat a given iteration,get_traffic_light_detections_at_timestamp(...)get_camera_metadatas()Returns per-camera metadata for all cameras in the scene.
get_all_camera_timestamps(camera_id[, ...])Returns all camera timestamps within the current scene.
get_camera_at_iteration(iteration, camera_id)Returns a
Cameraat a given iteration, if available.get_camera_at_timestamp(timestamp, camera_id)Returns a
Cameraat a given timestamp, if available.get_lidar_metadatas()Returns per-lidar metadata, if available.
get_all_lidar_timestamps(lidar_id[, ...])Returns all lidar start timestamps within the current scene.
get_lidar_at_iteration(iteration, lidar_id)Returns the
Lidarof a givenLidarIDat a given iteration, if available.get_lidar_at_timestamp(timestamp, lidar_id)Returns the
Lidarof a givenLidarIDat a given timestamp, if available.get_all_custom_modality_metadatas()Returns the metadata for all custom modalities in the scene, keyed by modality ID.
get_all_custom_modality_timestamps(modality_id)Returns all custom modality timestamps within the current scene.
get_custom_modality_at_iteration(iteration, ...)Returns the
CustomModalitywith the given ID at a given iteration,get_custom_modality_at_timestamp(timestamp, ...)Returns the
CustomModalitywith the given ID at a given timestamp,
- abstractmethod get_scene_metadata()[source]¶
Returns the
SceneMetadataof the scene.- Return type:
- Returns:
The scene metadata.
- abstractmethod get_log_metadata()[source]¶
Returns the
LogMetadataof the scene.- Return type:
- Returns:
The log metadata.
- abstractmethod get_timestamp_at_iteration(iteration)[source]¶
Returns the
Timestampat a given iteration.
- abstractmethod get_all_iteration_timestamps(include_history=False)[source]¶
Returns all sync timestamps for the current scene.
- abstractmethod get_scene_timestamp_boundaries(include_history=False)[source]¶
Returns the first and last sync timestamps of the scene.
- abstractmethod get_map_metadata()[source]¶
Returns the
MapMetadataof the scene, if available.- Return type:
- Returns:
The map metadata, or None if not available.
- abstractmethod get_all_modality_metadatas()[source]¶
Returns all modality metadatas found in the log directory.
- abstractmethod get_modality_metadata(modality_type, modality_id=None)[source]¶
Returns the metadata for a specific modality.
- abstractmethod get_all_modality_timestamps(modality_type, modality_id=None, include_history=False)[source]¶
Returns all timestamps for a specific modality within the scene range.
- Parameters:
- Return type:
- Returns:
List of timestamps, empty if the modality is not present.
- abstractmethod get_modality_at_iteration(iteration, modality_type, modality_id=None, **kwargs)[source]¶
Returns the modality data at a given iteration, if available.
- Parameters:
- Return type:
Optional[BaseModality]- Returns:
The modality data at the given iteration, or None if not available.
- abstractmethod get_modality_at_timestamp(timestamp, modality_type, modality_id=None, criteria='exact', **kwargs)[source]¶
Returns the modality data at a given timestamp, if available.
- Parameters:
timestamp (
Union[Timestamp,int]) – The timestamp to get the modality data for, as a Timestamp object or integer microseconds.modality_type (
Union[str,ModalityType]) – The modality type as a string orModalityType.modality_id (
Union[str,SerialIntEnum,None]) – Optional modality id (e.g. sensor id).criteria (
Literal['exact','nearest','forward','backward']) – Criteria for matching the timestamp if an exact match is not found. One of: - “exact”: Only return data if an exact timestamp match is found. - “nearest”: Return data from the nearest timestamp. - “forward”: Return data from the nearest timestamp that is greater than or equal to the requested timestamp. - “backward”: Return data from the nearest timestamp that is less than or equal to the requested timestamp.
- Return type:
Optional[BaseModality]- Returns:
The modality data at the given timestamp, or None if not available.
- get_ego_state_se3_metadata()[source]¶
Returns the
EgoStateSE3Metadataof the ego vehicle, if available.- Return type:
- Returns:
The ego metadata, or None if not available.
- get_all_ego_state_se3_timestamps(include_history=False)[source]¶
Returns all ego state timestamps within the current scene.
- get_ego_state_se3_at_iteration(iteration)[source]¶
Returns the
EgoStateSE3at a given iteration, if available.- Parameters:
iteration (
int) – The iteration to get the ego state for.- Return type:
- Returns:
The ego state at the given iteration, or None if not available.
- get_ego_state_se3_at_timestamp(timestamp, criteria='exact')[source]¶
Returns the
EgoStateSE3at a given timestamp, if available.- Parameters:
timestamp (
Union[Timestamp,int]) – The timestamp to get the ego state for, as a Timestamp object or integer microseconds.criteria (
Literal['exact','nearest','forward','backward']) – Criteria for matching the timestamp if an exact match is not found. One of: - “exact”: Only return data if an exact timestamp match is found. - “nearest”: Return data from the nearest timestamp. - “forward”: Return data from the nearest timestamp that is greater than or equal to the requested timestamp. - “backward”: Return data from the nearest timestamp that is less than or equal to the requested timestamp.
- Return type:
- Returns:
The ego state at the given timestamp, or None if not available.
- get_box_detections_se3_metadata()[source]¶
Returns the
BoxDetectionsSE3Metadataof the scene, if available.- Return type:
Optional[BoxDetectionsSE3Metadata]- Returns:
The box detection metadata, or None if not available.
- get_all_box_detections_se3_timestamps(include_history=False)[source]¶
Returns all box detection timestamps within the current scene.
- get_box_detections_se3_at_iteration(iteration)[source]¶
Returns the
BoxDetectionsSE3at a given iteration, if available.- Parameters:
iteration (
int) – The iteration to get the box detections for.- Return type:
- Returns:
The box detections at the given iteration, or None if not available.
- get_box_detections_se3_at_timestamp(timestamp, criteria='exact')[source]¶
Returns the
BoxDetectionsSE3at a given timestamp, if available.- Parameters:
timestamp (
Union[Timestamp,int]) – The timestamp to get the box detections for, as a Timestamp object or integer microseconds.criteria (
Literal['exact','nearest','forward','backward']) – Criteria for matching the timestamp if an exact match is not found. One of: - “exact”: Only return data if an exact timestamp match is found. - “nearest”: Return data from the nearest timestamp. - “forward”: Return data from the nearest timestamp that is greater than or equal to the requested timestamp. - “backward”: Return data from the nearest timestamp that is less than or equal to the requested timestamp.
- Return type:
- Returns:
The box detections at the given timestamp, or None if not available.
- get_traffic_light_detections_metadata()[source]¶
Returns the
TrafficLightDetectionsMetadataof the scene, if available.- Return type:
Optional[TrafficLightDetectionsMetadata]- Returns:
The traffic light detection metadata, or None if not available.
- get_all_traffic_light_detections_timestamps(include_history=False)[source]¶
Returns all traffic light detection timestamps within the current scene.
- get_traffic_light_detections_at_iteration(iteration)[source]¶
- Returns the
TrafficLightDetectionsat a given iteration, if available.
- Parameters:
iteration (
int) – The iteration to get the traffic light detections for.- Return type:
- Returns:
The traffic light detections at the given iteration, or None if not available.
- Returns the
- get_traffic_light_detections_at_timestamp(timestamp, criteria='exact')[source]¶
- Return type:
- Parameters:
- get_camera_metadatas()[source]¶
Returns per-camera metadata for all cameras in the scene.
- Return type:
- Returns:
A dictionary mapping camera IDs to their metadata.
- get_all_camera_timestamps(camera_id, include_history=False)[source]¶
Returns all camera timestamps within the current scene.
- get_camera_at_iteration(iteration, camera_id, scale=None)[source]¶
Returns a
Cameraat a given iteration, if available.
- get_camera_at_timestamp(timestamp, camera_id, criteria='exact', scale=None)[source]¶
Returns a
Cameraat a given timestamp, if available.- Parameters:
timestamp (
Union[Timestamp,int]) – The timestamp to get the camera for, as a Timestamp object or integer microseconds.camera_id (
CameraID) – The camera ID.criteria (
Literal['exact','nearest','forward','backward']) – Criteria for matching the timestamp if an exact match is not found. One of: - “exact”: Only return data if an exact timestamp match is found. - “nearest”: Return data from the nearest timestamp. - “forward”: Return data from the nearest timestamp that is greater than or equal to the requested timestamp. - “backward”: Return data from the nearest timestamp that is less than or equal to the requested timestamp.scale (
Optional[int]) – Optional downscale denominator, e.g. 2 for half size, 4 for quarter size.
- Return type:
- Returns:
The camera, or None if not available.
- get_lidar_metadatas()[source]¶
Returns per-lidar metadata, if available.
- Return type:
- Returns:
The lidar metadatas, or None if not available.
- get_all_lidar_timestamps(lidar_id, include_history=False)[source]¶
Returns all lidar start timestamps within the current scene.
- get_lidar_at_iteration(iteration, lidar_id)[source]¶
Returns the
Lidarof a givenLidarIDat a given iteration, if available.
- get_lidar_at_timestamp(timestamp, lidar_id, criteria='exact')[source]¶
Returns the
Lidarof a givenLidarIDat a given timestamp, if available.- Parameters:
timestamp (
Union[Timestamp,int]) – The timestamp to get the Lidar for, as a Timestamp object or integer microseconds.lidar_id (
LidarID) – TheLidarIDof the Lidar.criteria (
Literal['exact','nearest','forward','backward']) – Criteria for matching the timestamp if an exact match is not found. One of: - “exact”: Only return data if an exact timestamp match is found. - “nearest”: Return data from the nearest timestamp. - “forward”: Return data from the nearest timestamp that is greater than or equal to the requested timestamp. - “backward”: Return data from the nearest timestamp that is less than or equal to the requested timestamp.
- Return type:
- Returns:
The Lidar, or None if not available.
- get_all_custom_modality_metadatas()[source]¶
Returns the metadata for all custom modalities in the scene, keyed by modality ID.
- get_all_custom_modality_timestamps(modality_id, include_history=False)[source]¶
Returns all custom modality timestamps within the current scene.
- get_custom_modality_at_iteration(iteration, modality_id)[source]¶
- Returns the
CustomModalitywith the given ID at a given iteration, if available.
- Returns the
- get_custom_modality_at_timestamp(timestamp, modality_id, criteria='exact')[source]¶
- Returns the
CustomModalitywith the given ID at a given timestamp, if available.
- Parameters:
timestamp (
Union[Timestamp,int]) – The timestamp to get the custom modality for, as a Timestamp object or integer microseconds.modality_id (
str) – The ID of the custom modality (e.g."route","predictions").criteria (
Literal['exact','nearest','forward','backward']) – Criteria for matching the timestamp if an exact match is not found. One of: - “exact”: Only return data if an exact timestamp match is found. - “nearest”: Return data from the nearest timestamp. - “forward”: Return data from the nearest timestamp that is greater than or equal to the requested timestamp. - “backward”: Return data from the nearest timestamp that is less than or equal to the requested timestamp.
- Return type:
Optional[CustomModality]- Returns:
The custom modality, or None if not available.
- Returns the
- property log_metadata: LogMetadata¶
The
LogMetadataof the scene.
- property scene_metadata: SceneMetadata¶
The
SceneMetadataof the scene.