Self-Driving Cars
Topic 29 · Part 6: Modern perception (advanced) · ⏱ about 3 h

The Frontier: End-to-End, World Models and Vision-Language

Where self-driving research is heading: whole stacks trained end to end, world models that imagine the future, vision-language models that explain a scene in words, and the problem underneath them all, knowing when the network does not know. Measure uncertainty yourself and question a vision-language model about a road scene.

Softmaxima Simulator StudioWrite your car in Python, with as many files and trained networks as it needs, and watch it drive. In your browser, nothing to install.Open
Show:
In this topic
Beginner

In plain words

This topic is a tour of where research is going: one big network that does the whole job, networks that imagine the future like a dream, models that describe the road in words, and the question underneath all of them: does the car know when it is out of its depth?

By the end of this topic you will be able to describe the main research directions in self-driving today, and measure when a network is unsure.

Start with: the demo Try it: an unusual object in the road.

Beginner

From modules to one network

The stack you built is modular: perception, prediction and planning are separate parts, each trained and tested on its own. Each part is easier to understand and test, but errors pass between them, and each part is trained for its own score, not for driving well.

End-to-end stacks connect the parts inside one network trained jointly for the final goal. UniAD (Hu et al., 2023, best paper at CVPR 2023) chains tracking, mapping, motion prediction, occupancy prediction and planning as learned modules with shared queries, trained together, while still producing each intermediate output so engineers can inspect them. Several companies now drive with large end-to-end networks trained on fleet data. The open questions are the ones from Part 5: how do you test and explain such a system?

Beginner

World models

A world model learns to predict what happens next: given the last few camera frames and an action, generate the next frames. GAIA-1 (Hu et al., 2023) generates realistic driving video, including rare situations, from text and action prompts. Uses:

  • Simulation from data: instead of hand-built simulators like ours, a learned one that looks like real roads.
  • Rare-case generation: create the near-misses that are too rare to record.
  • Planning by imagination: try actions in the model before doing them for real.

The catch: a world model can generate physically impossible futures, so its results need checking too.

Beginner

Going deeper

The sections marked Intermediate · Maths, Code or Advanced go deeper: the equations, the code and the finer details. They are worth it when you are ready, but you can follow the whole idea without them. To hide them, press those buttons next to Show at the top of the page; the Beginner explanations and Try it demos stay.

Code

Vision-language models in driving

Vision-language models (VLMs) take an image and a question and answer in words. Trained on the internet, they know about ambulances, school zones and hand signals from police officers without any driving-specific training. Research such as DriveLM (2023) asks them to describe scenes, reason about what will happen and suggest actions. Their strengths are common sense about rare situations and explanations people can read; their weaknesses are speed, and confident answers that are wrong. Today they are mostly used for labelling data, finding rare cases in fleet recordings, and as a slower "second opinion" beside a fast driving network.

Python (Colab)
# In Google Colab with a GPU (Runtime > Change runtime type > T4 GPU). A vision-language model answers questions
# about a driving picture, in words. Upload any picture from the road: a frame from your recording, or your own photo.
!pip install -q -U transformers accelerate
from google.colab import files
from PIL import Image
from transformers import pipeline

vlm = pipeline("image-text-to-text", model="Qwen/Qwen2.5-VL-3B-Instruct", device_map="auto", torch_dtype="auto")
img = Image.open(list(files.upload())[0]).convert("RGB")
for q in ["Describe this driving scene in two sentences.",
          "Is there anything the driver must react to in the next few seconds? Answer briefly.",
          "What colour is the traffic light, if there is one?"]:
    msg = [{"role": "user", "content": [{"type": "image", "image": img}, {"type": "text", "text": q}]}]
    out = vlm(text=msg, max_new_tokens=80)
    print("Q:", q, "\nA:", out[0]["generated_text"][-1]["content"], "\n")
# Try a frame recorded at night, or in rain, and compare the answers with the labels in your recording.
# Notice what it gets right without any driving-specific training, and where it is vague or wrong.
This code needs Google Colab (it uploads the dataset file you recorded), which cannot run inside a web page. To run it, press Copy, then paste it into a new notebook in Google Colab ↗ (free; Runtime → Change runtime type → GPU for deep learning).
Beginner

Knowing when you do not know

Every learned part of the car will one day meet something it never saw in training: a mattress on the motorway, a horse and cart, a new kind of road sign. Two kinds of uncertainty matter:

  • Aleatoric: noise in the world itself (a distant, blurry object). More data does not remove it.
  • Epistemic: the model's own ignorance, because it has seen too little like this. More data does remove it, and it is the one that warns of the unfamiliar.

Practical tools: the spread of a softmax (entropy, cheap but often overconfident), ensembles of networks trained from different random starts (they agree on familiar inputs and disagree on strange ones; Lakshminarayanan et al., 2017), and separate out-of-distribution detectors. A car that knows it is unsure can slow down, give more room, or hand over control.

Try it

Try it: an unusual object in the road

The U-Net never saw a mattress or a barrel. Compare its uncertainty map with and without them, and at night. Notice that it is unsure at object edges anyway, and that it may call the mattress something it knows with high confidence. That is why entropy alone is not enough.

Interactive: this part runs in your browser.

Code

Code: an ensemble knows what it does not know

Five small networks trained on stopping distances for speeds up to 20 m/s. Inside that range they agree; beyond it they disagree, and their disagreement warns you that every one of them is guessing.

Python · NumPy
import numpy as np

rng = np.random.default_rng(0)
# Training data only covers speeds from 0 to 20 m/s: stopping distance = reaction + braking.
x = rng.uniform(0, 20, 200)
y = x * 0.5 + x ** 2 / (2 * 7) + rng.normal(0, 0.5, 200)

def train(seed):
    """A small neural network (1 -> 32 -> 1), trained from its own random start."""
    r = np.random.default_rng(seed)
    W1, b1, W2, b2 = r.normal(0, 1, (1, 32)), r.normal(0, 1, 32), r.normal(0, 0.1, (32, 1)), np.zeros(1)
    for _ in range(4000):
        h = np.maximum(0, x[:, None] / 10 @ W1 + b1)
        p = (h @ W2 + b2)[:, 0]
        g = 2 * (p - y / 30)[:, None] / len(x)
        gh = (g @ W2.T) * (h > 0)
        W2 -= 0.05 * h.T @ g; b2 -= 0.05 * g.sum(0); W1 -= 0.05 * (x[:, None] / 10).T @ gh; b1 -= 0.05 * gh.sum(0)
    return lambda q: 30 * (np.maximum(0, np.array(q)[:, None] / 10 @ W1 + b1) @ W2 + b2)[:, 0]

models = [train(s) for s in range(5)]          # an ensemble: five networks, same data, different random starts
for speed in (5, 10, 15, 25, 35):
    preds = np.array([m([speed])[0] for m in models])
    true = speed * 0.5 + speed ** 2 / 14
    print(f"{speed:3} m/s (true {true:5.1f} m): the five say {np.round(preds, 0)}, spread ±{preds.std():4.1f} m"
          + ("   (outside the training data)" if speed > 20 else ""))
Open in playground ↗
Beginner

Where to go next

  • Read papers: the references below are the core ones for each topic in this part. Papers with Code and the leaderboards of nuScenes, Waymo Open and Argoverse show the current best methods.
  • Use the big libraries on real data: OpenPCDet and MMDetection3D for 3D detection, the nuScenes and Waymo development kits for evaluation.
  • Build a portfolio project: for example, fine-tune a detector on BDD100K and test on night images; or train Lift-Splat-Shoot on nuScenes-mini; or compare a constant-velocity predictor with a learned one on Argoverse 2.
  • Join a challenge: CVPR's autonomous driving workshops run open challenges every year.
Check yourself

Quiz

1. What is the main idea of an end-to-end stack like UniAD?

2. Which uncertainty can more training data reduce?

3. An ensemble of five networks disagrees strongly on an input. What does that suggest?

4. What is a world model?

Go deeper

📚 Further reading

Trusted, mostly free sources: official documentation, well-known textbooks and courses. When you want to confirm or go deeper on anything here, start with these.

Ready