HDMapBEVAdapter

class standard_e2e.caching.adapters.HDMapBEVAdapter(min_x=-32.0, max_x=32.0, min_y=-32.0, max_y=32.0, pixels_per_meter=4.0, channels=None, polyline_thickness=1)[source]

Bases: AbstractAdapter

Rasterizes StandardFrameData.hd_map to a multi-channel BEV image.

One channel per element type listed in channels (default: every member of MapElementType in declaration order). Polygons are drawn filled; polylines are drawn with polyline_thickness; points (single-row MapElement.points) are drawn as filled circles of radius polyline_thickness. Output is np.float32 in [0, 1].

Axis convention matches LidarBEVAdapter: rows correspond to the vehicle x axis (forward), columns to the y axis (left). Output shape is (C, H, W) with C = len(channels), H = (max_x - min_x) * pixels_per_meter, W = (max_y - min_y) * pixels_per_meter.

Parameters:
  • min_x (float) – BEV x extent in meters (vehicle x is forward).

  • max_x (float) – BEV x extent in meters (vehicle x is forward).

  • min_y (float) – BEV y extent in meters (vehicle y is left).

  • max_y (float) – BEV y extent in meters (vehicle y is left).

  • pixels_per_meter (float) – grid resolution; cast to int internally.

  • channels (Optional[Sequence[Union[MapElementType, str]]]) – ordered list of MapElementType (or their string value for YAML configs) determining channel composition and order. Defaults to all enum members in declaration order. The resolved list is exposed via metadata so downstream consumers can interpret the BEV without re-deriving the channel order.

  • polyline_thickness (int) – line thickness in pixels for polyline elements; also the radius of point-element circles.

property channels: list[MapElementType]

Resolved ordered channel list (read-only view).

property consumes_attrs: set[StandardFrameDataField]

StandardFrameData fields this adapter reads.

Used by source-dataset processors to skip building modalities that no adapter consumes (lazy-load). For example, an HDMapBEVAdapter returns {StandardFrameDataField.HD_MAP}; a processor whose adapter chain registers no HD-map adapter can then skip the (often expensive) _build_hd_map step entirely.

Returning an empty set means “this adapter does not gate any modality build” — appropriate for adapters that read optional aux_data keys (e.g. preference trajectories) which the processor populates unconditionally and cheaply.

property metadata: dict[str, Any]

Expose the BEV channel order so the .npz remains self-describing.

property name: str

Name of the adapter. Must be implemented by subclasses.

property output_shape: tuple[int, int, int]
transform(standard_frame_data)

Validate input frame and dispatch to subclass implementation.

Return type:

dict[Modality, Any]

Parameters:

standard_frame_data (StandardFrameData)