How hustvl/maptr works
This repository’s primary product is MapTR: a framework that constructs vectorized HD maps from driving-scene sensor data. Its main workflow is to load a configured dataset, train or run a map-prediction model, and produce vectorized map elements; documented variants include camera–LiDAR fusion and alternative BEV encoders. The graph also shows data preparation and prediction visualization as supporting workflows. The source index confirms the training entry point’s dataset/model imports and identifies the MapTR dataset and head; internal links not evidenced by the excerpts or README are omitted.
Main entry points: nuscenes_map_dataset.py Map dataset · maptr_head.py MapTR head · spatial_cross_attention.py BEVFormer encoder · train.py Training entry
Components 17
Data handling
- Map dataset
projects/mmdet3d_plugin/datasets/nuscenes_map_dataset.py - 3D input pipelines
mmdetection3d/mmdet3d/datasets/pipelines/loading.py
Map prediction
- Image backbone
projects/mmdet3d_plugin/models/backbones/swin.py - BEVFormer encoder
projects/mmdet3d_plugin/bevformer/modules/spatial_cross_attention.py - Position embedding
projects/mmdet3d_plugin/models/utils/position_embedding.py - MapTR head
projects/mmdet3d_plugin/maptr/dense_heads/maptr_head.py - Map losses
projects/mmdet3d_plugin/maptr/losses/map_loss.py - BEVFormer config
projects/configs/bevformer/bevformer_small.py - Fusion config
projects/configs/maptr/maptr_tiny_fusion_24e.py
Execution and results
- Training entry
tools/train.py - Inference API
mmdetection3d/mmdet3d/apis/inference.py - Prediction visualization
tools/maptr/vis_pred.py
Supporting workflows
- Dataset preparation
tools/create_data.py - Dataset converters
tools/data_converter/nuscenes_converter.py
Other components
- Engineer
- Driving data
- Vector map
Connections 20
- Engineer → Dataset preparation: prepares data
tools/create_data.py - Driving data → Dataset preparation: converts
tools/create_data.py - Dataset preparation → Dataset converters: dispatches to
tools/create_data.py - Driving data → Map dataset: provides samples
README.md - Map dataset → 3D input pipelines: loads inputs
- Engineer → Training entry: starts training
tools/train.py - Training entry → Map dataset: builds dataset
tools/train.py - Training entry → MapTR head: builds model
tools/train.py - Map dataset → Image backbone: supplies sensor input
- Image backbone → BEVFormer encoder: encodes views
- Position embedding → BEVFormer encoder: embeds positions
- BEVFormer encoder → MapTR head: provides BEV features
- MapTR head → Map losses: optimizes with
- MapTR head → Vector map: predicts elements
README.md - Engineer → Inference API: requests prediction
mmdetection3d/mmdet3d/apis/inference.py - Inference API → Vector map: returns predictions
README.md - Engineer → Prediction visualization: views predictions
tools/maptr/vis_pred.py - Prediction visualization → Inference API: runs model
- BEVFormer config → BEVFormer encoder: configures encoder
- Fusion config → Map dataset: configures fusion data