This is the tutorial for the nuScenes map expansion. In particular, the NuScenesMap
data class.
This tutorial will go through the description of each layers, how we retrieve and query a certain record within the map layers, render methods, and advanced data exploration
In database terms, layers are basically tables of the map database in which we assign arbitrary parts of the maps with informative labels such as traffic_light
, stop_line
, walkway
, etc. Refer to the discussion on layers for more details.
To install the map expansion, please download the files from https://www.nuscenes.org/download and copy the files into your nuScenes map folder, e.g. /data/sets/nuscenes/maps
.
We will be working with the singapore-onenorth
map. The NuScenesMap
can be initialized as follows:
import matplotlib.pyplot as plt
import tqdm
import numpy as np
from nuscenes.map_expansion.map_api import NuScenesMap
from nuscenes.map_expansion import arcline_path_utils
from nuscenes.map_expansion.bitmap import BitMap
nusc_map = NuScenesMap(dataroot='/data/sets/nuscenes', map_name='singapore-onenorth')
Before we go into the details, let's visualize the map.
The NuScenesMap
class makes it possible to render multiple map layers on a matplotlib figure.
fig, ax = nusc_map.render_layers(nusc_map.non_geometric_layers, figsize=1)
New: We can render the HD lidar basemap used for localization. The basemap is a bitmap image that can be underlaid for most functions (render_centerlines
, render_egoposes_on_fancy_map
, render_layers
, render_map_patch
, render_next_roads
, render_record
). The same BitMap
class can also be used to render the semantic prior (drivable surface + sidewalk) from the original nuScenes release. Note that in this visualization we only show the lane
annotations for better visibility.
bitmap = BitMap(nusc_map.dataroot, nusc_map.map_name, 'basemap')
fig, ax = nusc_map.render_layers(['lane'], figsize=1, bitmap=bitmap)