KatInterview

Design a Real-Time Multi-Camera Perception System for a Self-Driving Car

System DesignModel answer
HardModel answerSystem Designautonomous-vehiclesreal-time-systemscomputer-vision

Last updated

Design an embedded onboard pipeline that ingests eight surround-view cameras and delivers tracked 3D obstacles, free space, and lane geometry to a motion planner within 40 ms.

Context

You are designing the onboard camera perception pipeline for a self-driving vehicle running on an embedded compute platform with dedicated hardware accelerators (an ISP, Deep Learning Accelerators, GPU cores, and unified LPDDR5 memory).

The pipeline sits between raw camera hardware and the motion planner. It owns everything from pixel capture to publishing structured scene understanding.

Sensor Rig

  • 8 surround-view cameras, each at 8 megapixels (3840 × 2160), streaming at 30 FPS over GMSL2
  • Aggregate raw uncompressed throughput: roughly 4.5–6.0 GB/s
  • All cameras must expose in the same tick, with sub-millisecond temporal alignment

What the Pipeline Must Produce

At 30 Hz, publish to the planner:

  • Tracked 3D objects — class, pose, size, velocity, covariance, track ID
  • Free space boundary — drivable region in BEV or polar format
  • Lane geometry — polylines or clothoid coefficients, type, confidence

Functional Requirements

  1. Synchronized capture — all eight cameras trigger together; temporal spread must be <1 ms
  2. Preprocessing — demosaicing, auto-exposure / white-balance corrections, lens undistortion, and rectification using stored intrinsic/extrinsic calibration
  3. Neural inference — a multi-task model covering 3D object detection, semantic segmentation, and lane extraction
  4. Cross-camera fusion and tracking — merge detections from overlapping views into a unified coordinate frame; maintain object tracks across frames with ego-motion compensation
  5. Graceful degradation — detect sensor and compute failures (lens blockage, camera desync, thermal throttling) and transition the vehicle into a safe fallback mode in bounded time

Non-Functional Requirements

RequirementTarget
End-to-end latency≤ 40 ms from photon exposure to planner delivery
Frame rate30 FPS continuous, no dropped frames under normal conditions
Memory allocationZero dynamic allocations at runtime; all buffers preallocated at init
Data movementZero-copy from camera serial interface → ISP → GPU → IPC
Safety standardFault isolation and watchdog design consistent with ISO 26262 ASIL-B/D principles

What a Strong Answer Covers

Walk through each of the following, with concrete decisions and trade-offs:

  1. Timing and bandwidth math — verify the 40 ms budget is feasible; build a per-stage latency breakdown
  2. Hardware synchronization — how all eight cameras are triggered to expose simultaneously
  3. Zero-copy memory architecture — how pixels move from deserializer to DNN without being copied
  4. Inference concurrency — how GPU, DLA, and other accelerators are partitioned and overlapped
  5. Fusion strategy — BEV feature-level fusion vs. late bounding-box fusion: when to use each
  6. Health monitoring and fault handling — what failures are detected, how, and what the mode transition looks like
  7. Output API contract — the data structure published to the planner, including validity signaling

Hints

Hint 1

Start with arithmetic: given 8 × 8 MP × 30 FPS, what is the raw bandwidth, what is the frame period, and how does that constrain the number of frames you can have in flight simultaneously?

Hint 2

The 40 ms deadline starts at photon exposure, not at frame arrival in software. Slot each pipeline stage — readout, ISP, warp, DNN, fusion, IPC — into a worst-case budget and check they sum to less than 40 ms.

Hint 3

Zero-copy means buffer descriptors (handles + fences) move between stages, not pixels. Think about what API and memory type makes a buffer simultaneously visible to the deserializer DMA, the ISP, CUDA, and the DLA without any intermediate copy.