scenario = {
# ===== Meta data about the scenario =====
# string. The name of the scenario
"id": "Waymo-001",
# string. The version of data format.
"version": "MetaDrive v0.3.0.1",
# int. The length of all trajectory and state arrays (T).
"length": 200,
# ===== Meta data ===
"metadata": {
# np.ndarray in (T, ). The time stamp of each time step.
"ts": np.array([0.0, 0.1, 0.2, ...], dtype=np.float32),
# bool. Whether the scenario is processed and exported by MetaDrive.
# Some operations may be done, such as interpolating the lane to
# make way points uniformly scattered in given interval.
"metadrive_processed": True,
# string. Coordinate system.
"coordinate": "metadrive",
# optional keys
"source_file": "training_20s.tfrecord-00014-of-01000",
"dataset": "waymo",
"scenario_id": "dd0c8c27fdd6ef59", # Used in Waymo dataset
"seed": 512,
"history_metadata": {},
"sdc_id": "172", # A key exists in tracks
},
# ===== Trajectories of active participants, e.g. vehicles, pedestrians =====
# a dict mapping object ID to it's state dict.
"tracks": {
"vehicle1": {
# The type string in metadrive.type.MetaDriveType
"type": "VEHICLE",
# The state dict. All values must have T elements.
"state": {
"position": np.ones([200, 3], dtype=np.float32),
...
},
# The meta data dict. Store useful information about the object. type in metadata could be those from
# different dataset
"metadata": {
"type": "VEHICLE",
"track_length": 200,
"object_id": "vehicle1",
# Optional keys
"agent_name": "default_agent",
"policy_spawn_info": { # Information needed to re-instantiate the policy
"policy_class": ("metadrive.policy.idm_policy", "IDMPolicy"),
"args": ...,
"kwargs": ...,
}
}
},
"pedestrian1": ...
},
# ===== States sequence of dynamics objects, e.g. traffic light =====
# a dict mapping object ID to it's state dict.
"dynamic_map_states": {
"trafficlight1": {
# The type string in metadrive.type.MetaDriveType
"type": "TRAFFIC_LIGHT",
# The state dict. All values must have T elements.
"state": {
"object_state": np.ones([200, ], dtype=int),
...
},
# The meta data dict. Store useful information about the object
"metadata": {
"type": "TRAFFIC_LIGHT",
"track_length": 200,
}
}
# ===== Map features =====
# A dict mapping from map feature ID to a line segment
"map_features": {
"219": {
"type": "LANE_SURFACE_STREET",
"polyline": np.array in [21, 2], # A set of 2D points describing a line segment
# optional, only works for lane
"polygon": np.array in [N, 2] # A set of 2D points representing convexhull
},
"182": ...
...
}
}
# Note: Example is from the docstring of metadrive/scenario/scenario_description.py
-
元数据 (
Meta data about the scenario
)- id: 场景的唯一标识符,这里是"Waymo-001"。
- version: 数据格式的版本,这里是"MetaDrive v0.3.0.1"。
- length: 所有轨迹和状态数组的长度,这里是200,表示时间步数为200。
-
元数据 (
metadata
)- ts: 一个长度为T(在这里是200)的numpy数组,存储每个时间步的时间戳。
- metadrive_processed: 一个布尔值,表示该场景是否由MetaDrive处理并导出。
- coordinate: 坐标系统,这里是"metadrive"。
- 其他可选键,如
source_file
、dataset
、scenario_id
、seed
、history_metadata
和sdc_id
,提供了关于场景来源、数据集、唯一标识符、随机种子、历史元数据和自动驾驶车辆ID的信息。
-
参与者轨迹 (
tracks
)- 这是一个字典,键是参与者的唯一标识符(如"vehicle1"),值是另一个字典,包含参与者的类型、状态和元数据。
- 类型 (
type
): 参与者的类型,这里是"VEHICLE"。 - 状态 (
state
): 一个字典,包含参与者在每个时间步的状态。例如,"position"键是一个形状为(200, 3)的numpy数组,表示每个时间步的三维位置。 - 元数据 (
metadata
): 一个字典,包含关于参与者的有用信息。例如,"type"键再次表示参与者的类型,"track_length"表示轨迹的长度,"object_id"是参与者的唯一标识符。其他可选键,如"agent_name"和"policy_spawn_info",提供了关于代理名称和重新实例化策略所需的信息。