TL;DR
Autonomous vehicles often fail when encountering "semantic anomalies"—familiar objects arranged in unusual or invalid contexts, such as a stop sign printed on a billboard or a truck carrying traffic lights. This paper introduces an efficient, vision foundation model embedding-based detector that compares local DINOv2 image embeddings against a cached database of safe, nominal driving scenes. An instance-segmented variant paired with simple connected-component filtering matches or exceeds GPT-4o’s detection performance while providing real-time-capable spatial anomaly localization.
What Problem Does This Paper Address?
Standard out-of-distribution (OOD) perception focuses on novel visual inputs (e.g., unfamiliar animals, rare weather conditions, or unseen debris). However, semantic anomalies stem from high-level reasoning failures: every individual visual component is familiar and "in-distribution," but their spatial or contextual relationship is anomalous. Real-world incidents include Tesla vehicles phantom-braking for billboards featuring stop signs or tracking traffic lights mounted on the flatbed of a transport truck.
While vision-language foundation models (like GPT-4o) possess broad world knowledge, deploying them at the edge is impractical due to high latency (several seconds per frame), hallucinations, and a lack of pixel-level localization. Conversely, prior embedding-based methods can run quickly but usually output a single, coarse whole-image anomaly score without spatial grounding.
Methods
The authors build an anomaly detection and localization pipeline that operates directly on image embeddings without requiring training on anomaly data:
- Nominal Embedding Cache: Embeddings from safe, nominal trajectories are precomputed offline and cached using a frozen DINOv2 vision transformer ($14 \times 14$ patches, $d=384$).
- Two Representation Variants:
- Grid/Patch-based: Uses raw patch-level DINOv2 embeddings (256 per image).
- Instance-based: Prompts SAM2 using bounding boxes from OWLv2 open-vocabulary detector, then pools DINOv2 patch embeddings across each instance mask into an object-centric embedding.
- Dissimilarity Scoring & Thresholding: Runtime patch or instance embeddings are scored against the nearest patch in the nominal database using negated maximum cosine similarity. An adaptive threshold $\tau$ is established via the $\alpha$-quantile of nominal validation scores using a leave-one-out strategy across driving runs.
- False-Positive Filtering: Removes small connected pixel components from the thresholded binary anomaly map to eliminate noise caused by patch artifacts and oversegmentation.
Datasets
- CARLA Benchmark: The evaluation uses the CARLA (v0.9.15) autonomous driving dataset introduced by Elhafsi et al. and Sinha et al., featuring nominal runs across multiple maps alongside anomalies:
- Semantic anomalies: Stop signs on billboards, trucks carrying traffic lights.
- OOD objects: Novel obstacles such as robots.
- Pixel-Level Ground Truth: The authors extend the CARLA dataset by annotating binary ground-truth segmentation masks for all anomalies to evaluate spatial localization (requiring $\text{IoU} \ge 0.3$ for a True Positive).
Key Insights and Ideas
- Zero-shot VLMs rationalize anomalies: GPT-4o frequently overlooks subtle semantic errors because it lacks domain-specific autonomous driving constraints. For instance, it labeled a billboard stop sign as "nominal" because it viewed it as a helpful general safety reminder, and classified a truck carrying traffic lights as anomalous solely because the truck was poorly aligned in its lane.
- Visual novelty vs. semantic anomaly: Patch-level embeddings alone primarily flag low-level visual novelties (unusual foliage, atypical building facades, or an unobserved truck model) rather than semantic inconsistencies.
- Object-centric aggregation resolves context: Grouping patch embeddings by object instance (OWLv2 + SAM2) smooths out high-frequency patch noise and models entire objects, boosting the stop-sign and traffic-light detection rates significantly.
Key Results
Evaluated on frame-level binary classification (TPR / FPR / F1):
- Full Dataset: The filtered instance-based method achieves an F1 of 0.51 (TPR 0.44, FPR 0.17), outperforming zero-shot GPT-4o (F1 of 0.47, TPR 0.33, FPR 0.03) and unfiltered patch embeddings (F1 of 0.32).
- Traffic Light Scenarios: The filtered instance method markedly outperforms GPT-4o, reaching an F1 of 0.62 compared to GPT-4o’s 0.44.
- Stop Sign Scenarios: Subtle contextual anomalies remain challenging for all models. Filtered instance-based achieves F1 of 0.23 (TPR 0.17), whereas GPT-4o achieves F1 of 0.19 (TPR 0.12), and patch embeddings fail entirely (F1 of 0.04).
- OOD Objects: GPT-4o leads on pure novelty (robots, animals) with an F1 of 0.71, followed by filtered patch embeddings at 0.56.
- Connected Component Filtering: Consistently reduced FPR across scenarios (e.g., cutting full-dataset instance FPR from 0.27 to 0.17).
Limitations and Future Work
- Detector Brittleness: OWLv2 occasionally generates spurious or overlapping bounding boxes on synthetic CARLA graphics, causing SAM2 to over-segment structures (like streetlights) into fragments that mimic anomalies.
- Score Distribution Discrepancy: Different anomaly classes map to wildly different distance scales—OOD objects produce high anomaly scores, whereas stop signs remain close to nominal scores. A single global threshold remains suboptimal.
- Lack of Relational Graphs: Embeddings are evaluated independently without explicit relationship modeling. The authors suggest future architectures explore graph-based representations or energy-based scoring to capture relational constraints between objects directly.
Summary updated