nutonomy / nuscenes-devkit

The devkit of the nuScenes dataset.
https://www.nuScenes.org
Other
2.24k stars 617 forks source link

Lane connector polygon is in wrong shape #915

Closed QuanyiLi closed 1 year ago

QuanyiLi commented 1 year ago

Hi,

Thanks for the great work!

I am loading the data to my own program and run into a problem when extracting the polygon of lane connectors. As you can see from the image below, the polygon of lane connectors is more like a bounding box. But what I want is the shape of the lane, like the polygon extracted from the lane layer. NQOcPQLXaV

I am not sure if this is as expected, or if there is something wrong when extracting the polygon. My code is as follows:

 for id in map_objs["lane_connector"]:
        lane_info = map_api.get("lane_connector", id)
        assert lane_info["token"] == id
        boundary = map_api.extract_polygon(lane_info["polygon_token"]).boundary.xy
        boundary_polygon = [[boundary[0][i], boundary[1][i], 0.1] for i in range(len(boundary[0]))]
        boundary_polygon += [[boundary[0][i], boundary[1][i], 0.] for i in range(len(boundary[0]))]
        ret[id] = {SD.TYPE: MetaDriveType.LANE_SURFACE_STREET,
                   SD.POLYLINE: discretize_lane(map_api.arcline_path_3[id], resolution_meters=points_distance),
                   SD.POLYGON: boundary_polygon}

Thanks!

whyekit-motional commented 1 year ago

@QuanyiLi in nuScenes, lane connectors are not polygons - they are parametrized lines that connect valid combinations of lanes at an intersection

If you refer to the map expansion tutorial, you can use nusc_map.render_centerlines(resolution_meters=0.5, figsize=1, bitmap=bitmap) to render both the lanes (center line) and lane connectors