py123d_detection.torch.models.bevformer.detector

BEVFormer: 3D detection through an explicit bird’s-eye-view feature map.

Where PETR leaves the features in the images and teaches the queries where to look, BEVFormer builds a top-down grid first. Each cell of the grid attends back into whichever cameras can see the ground it covers, and the detection decoder then works entirely in that grid.

Both produce the same predictions in the same format, so the data, the loss, the metric and the training loop are shared and only the head differs. That is why this file is short.

Classes

BEVFormer([bev_h, bev_w, ...])

BEVFormer's head on the shared backbone and training loop.

class py123d_detection.torch.models.bevformer.detector.BEVFormer(bev_h=50, bev_w=50, num_encoder_layers=3, num_heights=4, num_points=4, feedforward_channels_encoder=512, feedforward_channels_decoder=2048, with_box_refine=True, camera_embedding='none', num_cameras=6, **kwargs)[source]

Bases: MultiViewDetector

BEVFormer’s head on the shared backbone and training loop.

Parameters:
  • bev_h (int) – Rows of the bird’s-eye grid. The grid spans pc_range, so 50 rows over 102.4 m is about two metres a cell.

  • bev_w (int) – Columns of the grid.

  • num_encoder_layers (int) – Rounds of BEV self-attention and camera cross-attention.

  • camera_embedding (str) – "bevformer" adds the paper’s learned per-camera token, which ties the model to one rig. "none" is what allows training across datasets whose camera counts differ, which is the reason this package exists.

build_head(num_classes, in_channels, num_query, num_decoder_layers, pc_range, with_cp, **unused)[source]

BEVFormer’s head.

The patch-geometry arguments describe PETR’s positional embedding, which a bird’s-eye grid does not have. They are accepted and dropped so both detectors share one constructor.

Return type:

BEVFormerHead