Argoverse2数据集数据结构介绍和API简要介绍

数据结构

轨迹预测常用的有场景数据ArgoverseScenario和地图ArgoverseStaticMap

轨迹序列读取的API为scenario_serialization

可视化的API为visualize_scenario

argoverse2和argoverse1不一样的地方是,每一段轨迹序列(Scenario)内有自己的json地图文件(虽然说都是同一幅HD map,但是对应HD map中的不同的位置),而argoverse1是所有轨迹序列共享一个地图文件

# 存放轨迹序列的类
from av2.datasets.motion_forecasting.data_schema import ArgoverseScenario
# 用于读取轨迹序列的API
from av2.datasets.motion_forecasting import scenario_serialization
# 用于可视化的API
from av2.datasets.motion_forecasting.viz.scenario_visualization import visualize_scenario
# 用于读取地图的API
from av2.map.map_api import ArgoverseStaticMap

自己写的一个简单的读取例子,具体的可以参考av2-api文件夹中的generate_forecasting_scenario_visualizations.py文件

def generate_scenarios(argoverse_scenario_dir: Path, num_scenarios: int = 100) -> list:
    scenario_map_list = []
    all_scenario_files = sorted(argoverse_scenario_dir.rglob("*.parquet"))
    for scenario in all_scenario_files[:num_scenarios]:
        scenario, static_map = generate_scenario(Path(scenario))
        scenario_map_list.append([scenario, static_map])
    return scenario_map_list


# Build inner function to generate visualization for a single scenario.
def generate_scenario(scenario_path: Path) -> (ArgoverseScenario, ArgoverseStaticMap):
    """Generate and save dynamic visualization for a single Argoverse scenario.

    NOTE: This function assumes that the static map is stored in the same directory as the scenario file.

    Args:
        scenario_path: Path to the parquet file corresponding to the Argoverse scenario to visualize.
    """
    scenario_id = scenario_path.stem.split("_")[-1]
    static_map_path = scenario_path.parents[0] / f"log_map_archive_{scenario_id}.json"

    scenario = scenario_serialization.load_argoverse_scenario_parquet(scenario_path)
    static_map = ArgoverseStaticMap.from_json(static_map_path)
    return scenario, static_map


if __name__ == "__main__":
    argoverse2_dataset_path = Path("/media/gah/New/Datasets/Argoverse2/val")
    num_scenarios = 10
    scenario_map_list = generate_scenarios(argoverse2_dataset_path, num_scenarios)
    print("debug")

ArgoverseScenario

每个scenario有11s长的序列,包含actor的历史轨迹集合,就是这里面的tracks,对于每一个scenario,提供了以下的顶层属性:

  • scenario_id: 该scenario的特有ID
  • timestamps_ns: 该scenario的所有时间戳
  • tracks: 该scenario的所有轨迹序列
  • focal_track_id: 该scenario的焦点agent(focal agent)的track ID
  • city_name: 该scenario对应的城市名

请添加图片描述

每个track包含以下属性:

  • track_id: 该track的特有ID
  • object_states: 该轨迹序列对应的object在这11s内的有效观测的状态,以timestep表示时间步,一般来说最多有110步,因为采样频率为10Hz,一步对应0.1s
  • object_type: 该轨迹序列对应的object的类型,如vehicle等
  • category: 给轨迹序列分配种类,用于给轨迹预测的数据质量提供参考,一般来说,有四种:SCORED_TRACK,UNSCORED_TRACK,FOCAL_TRACK,TRACK_FRAGMENT。其中FOCAL_TRACK和SCORED_TRACK数据质量较好,UNSCORED_TRACK用于当作上下文输入,数据质量一般,而TRACK_FRAGMENT的时间长度不定,数据质量较差
    • TRACK_FRAGMENT: Lower quality track that may only contain a few timestamps of observations. 在数据中以整数0表示
    • UNSCORED_TRACK: Unscored track used for contextual input. 在数据中以整数1表示
    • SCORED_TRACK: High-quality tracks relevant to the AV - scored in the multi-agent prediction challenge. 在数据中以整数2表示
    • FOCAL_TRACK: The primary track of interest in a given scenario - scored in the single-agent prediction challenge. 在数据中以整数3表示
      在这里插入图片描述

每个object_states包含以下属性,对应某一actor在某一时间点的所有信息:

  • observed: Boolean 指示这个object state是否在该scenario的观测区间内(observed segment)

  • timestep: 时间步,范围是[0, num_scenario_timesteps) Time step corresponding to this object state [0, num_scenario_timesteps).

  • position: (x, y) Coordinates of center of object bounding box. object bounding box的xy坐标

  • heading: Heading associated with object bounding box (in radians, defined w.r.t the map coordinate frame). object bounding box的航向角,单位是弧度,是在地图坐标系下

  • velocity: (x, y) Instantaneous velocity associated with the object (in m/s). object的xy方向的速度
    在这里插入图片描述
    每个track有以下10种label:

  • Dynamic

    • VEHICLE
    • PEDESTRIAN
    • MOTORCYCLIST
    • CYCLIST
    • BUS
  • Static

    • STATIC
    • BACKGROUND
    • CONSTRUCTION
    • RIDERLESS_BICYCLE
  • UNKNOWN

ArgoverseStaticMap

在这里插入图片描述

Vector Map: Lane Graph and Lane Segments

The core feature of the HD map is the lane graph, consisting of a graph G = (V, E), where V are individual lane segments.

Argoverse2 提供了3D的道路边界线,而不是仅仅有centerlines,也提供了快速获取特定采样分辨率的centerlines的API,在release中多边形的分辨率被设置为1cm

地图以json文件的形式提供

可以通过以下方式读取:

from av2.map.map_api import ArgoverseStaticMap
log_map_dirpath = Path("av2") / "00a6ffc1-6ce9-3bc3-a060-6006e9893a1a" / "map"
avm = ArgoverseStaticMap.from_map_dir(log_map_dirpath=log_map_dirpath, build_raster=False)

LaneSegment

LaneSegment中包含以下属性:

  • id: unique identifier for this lane segment (guaranteed to be unique only within this local map). 该lane segment的特有ID(仅在局部地图中保证是特有的ID)
  • is_intersection: boolean value representing whether or not this lane segment lies within an intersection. boolean value,用来表示该lane segment是否位于一个路口内
  • lane_type: designation of which vehicle types may legally utilize this lane for travel. 表示车道线类型
  • right_lane_boundary: 3d polyline representing the right lane boundary. 3D线条,表示右车道边界线
  • left_lane_boundary: 3d polyline representing the left lane boundary. 3D线条,表示左车道边界线
  • right_mark_type: type of painted marking found along the right lane boundary . 右车道边界线的线型
  • left_mark_type: type of painted marking found along the left lane boundary. 左车道边界线的线型
  • predecessors: unique identifiers of lane segments that are predecessors of this object. 该lane segment的前继lane segment的unique ID
  • successors: unique identifiers of lane segments that represent successor of this object. Note: this list will be empty if no successors exist. 该lane segment的后继lane segment的unique ID
  • right_neighbor_id: unique identifier of the lane segment representing this object’s right neighbor. 该lane segment的右邻lane segment的unique ID
  • left_neighbor_id: unique identifier of the lane segment representing this object’s left neighbor. 该lane segment的左邻lane segment的unique ID

Vector Map: Drivable Area

多边形向量的分辨率也是1cm

包含以下属性:

  • id: unique identifier. 特有ID
  • area_boundary: 3d vertices of polygon, representing the drivable area’s boundary. 3D多边形,用来表示可行驶区域的边界

Vector Map: Pedestrian Crossings

代表人行道,由两条沿同一主轴的edge构成

  • id: unique identifier of pedestrian crossing. 人行道的特有ID
  • edge1: 3d polyline representing one edge of the crosswalk, with 2 waypoints. 3D多边形,代表人行道的其中一边,由2个waypoints组成
  • edge2: 3d polyline representing the other edge of the crosswalk, with 2 waypoints. 3D多边形,代表人行道的其中一边,由2个waypoints组成

Area of Local Maps

Each scenario’s local map includes all entities found within a 100 m dilation in l2-norm from the ego-vehicle trajectory.

每个scenario的局部地图包含距离ego-vehicle的轨迹100m l2距离内的所有实体

常用API

import pandas as pd
from av2.datasets.motion_forecasting.data_schema import ArgoverseScenario
from av2.datasets.motion_forecasting import scenario_serialization
from av2.datasets.motion_forecasting.viz.scenario_visualization import visualize_scenario
from av2.map.map_api import ArgoverseStaticMap
from av2.map.map_primitives import Polyline
from av2.utils.io import read_json_file

# 利用pandas读取轨迹序列parquet文件
df = pd.read_parquet文件(os.path.join(self.raw_dir, raw_file_name, f'scenario_{raw_file_name}.parquet'))
# 加载地图json文件
map_data = read_json_file(map_path)
# 从地图的json文件读取车道中心线
centerlines = {lane_segment['id']: Polyline.from_json_data(lane_segment['centerline'])
                           for lane_segment in map_data['lane_segments'].values()}
# 加载地图API
map_api = ArgoverseStaticMap.from_json(map_path)
# 以某个query中心搜索附近一定半径的的lane_segments
query_center = scenario_df.loc[0, ['position_x', 'position_y']].values
search_radius_m = 30
nearby_lane_segments = map_api.get_nearby_lane_segments(query_center, search_radius_m)
# 通过map_api获取lane_segments的车道中心线
nearby_lane_centerlines = get_lane_centerlines(map_api, nearby_lane_segments)
# 获取地图内的所有pedestrian crossings(目前av2 API没有提供获取附近pedestrian crossings的API)
crosswalks = map_api.get_scenario_ped_crossings()
  • 6
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值