Skip to main content
emobility.academy
PhDCamera perceptionResearch About 16 weeksADAS & AUTOSAR

Uncertainty-Aware Object Detection for Safety-Critical ADAS

Compare Monte Carlo dropout, deep ensembles and probabilistic box regression for object detectors on driving data, measuring calibration and whether uncertainty flags errors and unfamiliar objects. A downstream warning test shows if uncertainty improves safety decisions.

Tools: Python · PyTorch

Uncertainty-Aware Object Detection for Safety-Critical ADAS: Students working on simulation software in the DIYguru computer lab
Representative photo from DIYguru's EV lab, not of this specific project.

The problem

Standard detectors output confidence scores that are often over-confident and are not calibrated probabilities, so a downstream function cannot tell when perception is unreliable. For safety-critical ADAS, uncertainty estimates could trigger fallbacks or warnings, but only if they are calibrated and actually correlate with errors, including on objects never seen in training.

Objectives

  • Implement detectors with classification and box-regression uncertainty.
  • Compare MC dropout, deep ensembles and a probabilistic regression head.
  • Measure calibration with expected calibration error and probabilistic scores.
  • Evaluate uncertainty as an error and out-of-distribution detector.
  • Show the effect of uncertainty-aware thresholds on a downstream warning.

What you need

Tools and toolboxes

  • Python — Experiments, metrics and statistics.
  • PyTorch — Detector implementation, dropout sampling, ensembles and custom loss heads.
  • OpenCV — Visualising boxes with uncertainty ellipses and video demos.
  • CARLA — Optional generation of controlled out-of-distribution objects with ground truth.

Software

  • Python 3 with PyTorch and torchvision
  • nuScenes or BDD100K for in-distribution training
  • IDD as a shifted test set with unfamiliar classes
  • NumPy, SciPy, pandas, Matplotlib

Extra parts and data

  • A GPU cluster or multi-GPU machine — Ensembles and sampling-based methods multiply training and inference cost.

Key concepts

Aleatoric and epistemic uncertainty
Aleatoric uncertainty comes from noise in the data, such as occlusion; epistemic uncertainty comes from the model's lack of knowledge and should rise for unfamiliar inputs.
Expected calibration error
The average gap between predicted confidence and actual accuracy across confidence bins. A calibrated model that says 80 per cent is right about 80 per cent of the time.
Deep ensemble
Several independently trained models whose disagreement serves as an uncertainty estimate. Simple and strong, but costly.
Probabilistic box regression
Predicting a variance for each box coordinate with a negative log-likelihood loss, so the network says how sure it is about box position.

Step-by-step guide

  1. 1

    Define questions, metrics and the safety use

    State the questions: which uncertainty method gives the best calibrated and most error-predictive detections within a compute budget, and does uncertainty help a downstream safety decision? Define the use case: a monitor that flags unreliable detections to a forward collision function. Choose metrics: ECE, negative log-likelihood, probability-based detection quality, AUROC for error and OOD detection, and a downstream measure such as missed critical objects.

    Checkpoint: Questions, metrics and a written description of the downstream safety use.

  2. 2

    Prepare in-distribution and shifted data

    Train on nuScenes or BDD100K camera images with a fixed class list. Build test sets: in-distribution test, a shifted set from IDD with the same classes, and an out-of-distribution set of objects absent from training, such as animals, carts and debris, cropped from IDD or generated in CARLA. Document each set and verify labels on a sample. Make sure the OOD objects are genuinely absent from the training labels and images, otherwise the test does not measure what it claims.

    Checkpoint: Three test sets with counts and a documented class mapping.

  3. 3

    Build the baseline detector

    Train a Faster R-CNN or a single-stage detector with a ResNet-50 backbone and record mAP and the calibration of its raw confidence scores on all three test sets. Plot reliability diagrams. This shows the starting point: confidence that is usually over-confident and does not rise in uncertainty for unfamiliar objects. Also record how often the baseline assigns high confidence to OOD objects, mislabelling them as a known class, since this is the behaviour the uncertainty methods are meant to correct. Keep this baseline checkpoint fixed for all comparisons.

    Checkpoint: Baseline mAP, ECE and reliability diagrams on each test set.

  4. 4

    Implement MC dropout and ensembles

    Add dropout to the detection head and at inference run 10 to 30 stochastic passes, clustering boxes across passes and computing mean class probabilities, entropy and box variance. Train an ensemble of five detectors with different seeds and merge their outputs the same way. Record the inference cost of each relative to the baseline. Use the same box-merging rule and IoU threshold for both methods, so differences in results come from the uncertainty method rather than the clustering. Check how results change with the number of passes.

    Checkpoint: Working MC dropout and ensemble detectors with measured inference cost.

  5. 5

    Implement probabilistic box regression

    Replace the box regression loss with a Gaussian negative log-likelihood that predicts mean and log-variance for each coordinate, with a warm-up phase on the standard loss for stable training. Combine with temperature scaling for classification confidence, fitted on a validation split. This gives a single-pass method to compare against the sampling methods. Check that predicted variances are larger for occluded and truncated objects than for clear ones, which is a quick sign that the head has learnt something meaningful. Compare its mAP with the baseline.

    Checkpoint: A single-pass detector producing box variances, with stable training curves.

  6. 6

    Measure calibration and accuracy

    For every method compute mAP, ECE for classification, box NLL and calibration of box variances (the fraction of true boxes inside predicted confidence intervals) on all test sets. Use three seeds where feasible and bootstrap intervals. Check that uncertainty methods do not reduce mAP noticeably, because a calibrated but inaccurate detector is not useful. Plot reliability diagrams for each method on the shifted set, where calibration usually degrades most, and comment on the pattern.

    Checkpoint: A table of accuracy and calibration metrics per method and test set.

  7. 7

    Evaluate error and OOD detection

    Treat uncertainty as a score for detecting false positives, poorly localised boxes and OOD objects. Compute AUROC and the false-positive rate at 95 per cent true-positive rate for each uncertainty measure (entropy, mutual information, box variance). Compare methods on the shifted and OOD sets, where epistemic uncertainty should rise if the method works. Report results separately for objects near the ego path and elsewhere, because errors close to the vehicle are the ones a safety monitor most needs to catch. Note which uncertainty measure works best for each method.

    Checkpoint: AUROC tables for error and OOD detection by method and measure.

  8. 8

    Test a downstream safety decision

    Simulate a forward collision function that uses detections in the ego path. Compare a fixed confidence threshold with an uncertainty-aware policy that lowers the threshold or raises a caution flag when uncertainty is high near the ego path. Measure missed critical objects and false warnings on recorded sequences or in CARLA scenarios. This shows whether uncertainty improves a safety-relevant outcome, not only a metric.

    Checkpoint: Missed-object and false-warning counts for both policies.

  9. 9

    Analyse cost and failure cases

    Plot each method's benefit against its compute cost and discuss which is practical on an in-vehicle computer. Inspect cases where uncertainty was low but the detection was wrong, which are the most dangerous, and describe their characteristics. Consider whether distillation of an ensemble into a single model could keep most of the benefit. Estimate whether the most useful method would fit a realistic in-vehicle latency budget, and what accuracy or uncertainty quality would be lost if it were simplified to fit.

    Checkpoint: A cost–benefit plot and a categorised list of confident errors.

  10. 10

    Write the thesis chapter

    Present the methods, data, calibration, error and OOD detection results, the downstream study and the cost analysis. Relate the findings to SOTIF, where unknown unsafe scenarios and performance limits must be identified, and to what a runtime monitor would require. State the limitations of the OOD set and the simulated downstream function. Release code and evaluation scripts. Give a short practical recommendation stating which method you would choose for a production monitor and why.

    Checkpoint: A chapter with reproducible experiments and a clear recommendation.

Testing & validation

  • mAP, ECE and box NLL per method on in-distribution, shifted and OOD sets.
  • AUROC for error and OOD detection by uncertainty measure.
  • Missed critical objects and false warnings for fixed versus uncertainty-aware policies.
  • Inference cost relative to the baseline.

Expected results

A comparison of uncertainty methods for driving detectors covering calibration, error and OOD detection, compute cost and a measured effect on a downstream warning decision.

Research angle for your PhD

Research questions: which uncertainty method gives calibrated, error-predictive detections at an acceptable cost, and does using it change safety-relevant outcomes? Metrics: ECE, box NLL, AUROC for error and OOD detection, missed critical objects, inference cost. Baselines: raw detector confidence and temperature scaling. Showing a measurable downstream safety benefit, not only better calibration, on in-distribution, shifted and OOD data with released code makes the work strong for a journal or major venue.

Take it further

  • Distil an ensemble into a single network and compare.
  • Propagate detection uncertainty into a tracker's measurement noise.
  • Extend to lidar detection on nuScenes.
  • Use conformal prediction to give coverage guarantees on boxes.

Viva and review questions

What is the difference between aleatoric and epistemic uncertainty?

Aleatoric is noise inherent in the data, such as occlusion, and does not shrink with more data; epistemic reflects what the model has not learnt and should rise on unfamiliar inputs.

Why are raw detector scores not good uncertainty estimates?

They are trained to rank detections, not to be calibrated probabilities, and they are often high even for objects unlike anything in training.

Why test a downstream decision?

Better calibration only matters if it changes outcomes; the downstream test shows whether uncertainty reduces missed critical objects or false warnings.

What is the main cost of deep ensembles?

Training and running several models multiplies compute and memory, which is hard to afford on an in-vehicle computer.

Learn it at DIYguru

These DIYguru courses and programmes teach what this project needs.

Related EV projects

All 100 ADAS & AUTOSAR projects