Overview
Lane detection is a latency problem before it is an accuracy problem: a model that is right but late is no use to a vehicle. I built this implementation to meet both targets and to report them against a named baseline on a public dataset, so the numbers can be checked.
Architecture
- Encoder: a pretrained EfficientNet-B0 or MobileNetV2 backbone, picked per deployment target to set the accuracy and latency trade.
- Decoder: four progressive upsampling blocks with skip connections.
- Two heads: a segmentation head predicts the binary lane mask, and an embedding head produces 4-dimensional instance embeddings so individual lanes can be clustered apart.
- Post-processing: instance clustering, a perspective transform and spline fitting turn the mask into lane geometry.
Training and deployment
- Mixed-precision training with AMP, about 40% faster than full-precision training.
- TorchScript export, so the model ships as an optimized
.ptartifact instead of a Python dependency graph. - Mock-data mode generates a synthetic dataset, so the model and tests run in CI without shipping TuSimple.
- Unit tests run the model on random tensors to catch shape and dtype regressions without the real dataset.
Results
- 99% accuracy on the TuSimple dataset, 7 percentage points above the baseline.
- 150 FPS on an NVIDIA RTX 3080, roughly 6.7ms per frame.
- 80% faster inference than the baseline implementation.
Limits
The CI tests run on synthetic data and random tensors, so they guard shapes and types, not the accuracy figure; that comes from TuSimple. The frame rate is measured on an RTX 3080 and will differ on other hardware.