l5kit.rasterization.semantic_rasterizer module¶
- class l5kit.rasterization.semantic_rasterizer.RasterEls(value)¶
Bases:
enum.IntEnum
An enumeration.
- CROSSWALK = 2¶
- LANE_NOTL = 0¶
- ROAD = 1¶
- class l5kit.rasterization.semantic_rasterizer.SemanticRasterizer(render_context: l5kit.rasterization.render_context.RenderContext, semantic_map_path: str, world_to_ecef: numpy.ndarray)¶
Bases:
l5kit.rasterization.rasterizer.Rasterizer
Rasteriser for the vectorised semantic map (generally loaded from json files).
- num_channels() int ¶
- rasterize(history_frames: numpy.ndarray, history_agents: List[numpy.ndarray], history_tl_faces: List[numpy.ndarray], agent: Optional[numpy.ndarray] = None) numpy.ndarray ¶
- render_semantic_map(center_in_world: numpy.ndarray, raster_from_world: numpy.ndarray, tl_faces: numpy.ndarray) numpy.ndarray ¶
Renders the semantic map at given x,y coordinates.
- Parameters
center_in_world (np.ndarray) – XY of the image center in world ref system
raster_from_world (np.ndarray) –
- Returns
RGB raster
- Return type
np.ndarray
- to_rgb(in_im: numpy.ndarray, **kwargs: dict) numpy.ndarray ¶
- l5kit.rasterization.semantic_rasterizer.cv2_subpixel(coords: numpy.ndarray) numpy.ndarray ¶
Cast coordinates to numpy.int but keep fractional part by previously multiplying by 2**CV2_SHIFT cv2 calls will use shift to restore original values with higher precision
- Parameters
coords (np.ndarray) – XY coords as float
- Returns
XY coords as int for cv2 shift draw
- Return type
np.ndarray
- l5kit.rasterization.semantic_rasterizer.indices_in_bounds(center: numpy.ndarray, bounds: numpy.ndarray, half_extent: float) numpy.ndarray ¶
Get indices of elements for which the bounding box described by bounds intersects the one defined around center (square with side 2*half_side)
- Parameters
center (float) – XY of the center
bounds (np.ndarray) – array of shape Nx2x2 [[x_min,y_min],[x_max, y_max]]
half_extent (float) – half the side of the bounding box centered around center
- Returns
indices of elements inside radius from center
- Return type
np.ndarray