Formalizing and Evaluating Requirements of Perception Systems for Automated Vehicles using Spatio-Temporal Perception Logic

Mohammad Hekmatnejad, Bardh Hoxha, Jyotirmoy V. Deshmukh, Yezhou Yang, Georgios Fainekos

TL;DR

This paper introduces Spatio-Temporal Perception Logic (STPL), a formal specification language designed to define and verify the safety and correctness requirements of automated vehicle (AV) perception systems. By combining spatial and temporal reasoning, STPL allows engineers to move beyond traditional frame-by-frame evaluation metrics and perform automated sanity checks on tracking and classification consistency over time, even without ground-truth data.

What Problem Does This Paper Address?

Traditional computer vision metrics evaluate perception systems on a frame-by-frame basis (e.g., calculating mean Average Precision (mAP) or per-image precision/recall). However, when deployed on an autonomous vehicle, a perception system operates on a continuous data stream where cross-frame relations are critical.

A classic failure mode is "class flickering," where an object is classified as a Car in frame 1, a Pedestrian in frame 2, and a Cyclist in frame 3. Frame-by-frame metrics might score these highly if the bounding boxes are accurate, but the downstream planning system will be severely disrupted. The authors point to real-world incidents, such as the 2018 Uber autonomous vehicle crash in Tempe, Arizona, where the perception system repeatedly toggled the classification of a pedestrian, preventing the vehicle from accurately predicting her path.

Currently, there is a lack of formal tools to mathematically specify and automatically monitor these complex spatio-temporal requirements (e.g., "an object cannot change its class within 1 second of being detected" or "bounding boxes of consecutive frames must overlap by at least 10%").

Methods

The authors propose Spatio-Temporal Perception Logic (STPL), which merges two distinct logical frameworks:

  1. Timed Quality Temporal Logic (TQTL): Handles time variables, freeze-time quantifiers, and reasoning over object attributes (like classification probability).
  2. Spatial Logic ($S4_u$): Provides a topological foundation to reason about spatial relations like intersection, containment, closure, and interior regions in 2D or 3D spaces.

By combining these, STPL can express complex rules involving object quantification, temporal durations, and geometric constraints simultaneously.

To make this logic practical, the authors developed an offline monitoring algorithm based on dynamic programming. Because the full logic is computationally expensive (PSPACE-hard), they identified a specific polynomial-time monitorable fragment called Almost Arbitrarily Nested (AAN) formulas, which restricts how freeze-time operators can be nested.

Datasets

The framework was evaluated using three prominent autonomous driving datasets:

  • KITTI Tracking Benchmark: Used to demonstrate real-world requirement violations and label inconsistencies.
  • nuScenes (LidarSeg): Used to validate 3D spatial reasoning and occlusion scenarios.
  • Berkeley DeepDrive (BDD): Used to benchmark the execution time and scalability of the monitoring algorithm.

Key Insights and Ideas

  • Sanity Checks Without Ground Truth: One of STPL's biggest advantages is that it can evaluate a perception system's performance purely based on internal consistency. For instance, laws of physics dictate that a vehicle cannot instantaneously "teleport" across the screen or change its volume tenfold between two frames. STPL can flag these anomalies without needing human-annotated ground truth.
  • Finding "Bugs" in Human Labels: When applying an STPL occlusion requirement to the public KITTI dataset, the monitor successfully flagged human labeling errors. It identified frames where cars were incorrectly annotated as "largely occluded" when they were actually fully visible or inconsistent with adjacent frames.
  • Balancing Expressivity and Geometry: The computational complexity of spatial operations depends heavily on data structures. The authors show that using geometry-sensitive structures like Quadtrees (for 2D) and Octrees (for 3D) keeps the spatial evaluation polynomial rather than exponential.

Key Results

The authors formalized 18 distinct perception requirements into STPL formulas and evaluated them using their open-source toolbox.

Fig. 1: A series of image frames taken from KITTI (Geiger et al. (2013a)) augmented with the data about classified data- objects using SqueezeDet (Wu et al. (2017)). Here, τ is a function that maps each frame f to its captured time.
  • Error Detection Speed: The STPL monitor detected the aforementioned labeling inconsistencies in the KITTI dataset in less than 2 seconds.
  • Scalability: Testing on the BDD dataset showed that for formulas within the AAN fragment, the monitor scales efficiently. Processing 200 frames containing dozens of objects took anywhere from a fraction of a second to roughly one minute, depending on the number of spatial operators involved.

Limitations and Future Work

While the AAN fragment runs in polynomial time, formulas with deeply nested object quantifiers (e.g., checking combinations of three or more objects simultaneously across frames) still suffer from combinatorial explosion.

To address this, the authors suggest:

  1. Parallelization: Optimizing the algorithm to evaluate quantified subformulas concurrently.
  2. Pre-filtering: Using lighter-weight query languages (like Spatial Regular Expressions) to isolate interesting segments of massive datasets before running full STPL verification.
  3. LLM Integration: Developing front-ends (like their domain-specific language PyFoReL) that leverage Large Language Models to translate natural language safety requirements directly into mathematically rigorous STPL formulas.

Summary updated

Abstract

Automated vehicles (AV) heavily depend on robust perception systems. Current methods for evaluating vision systems focus mainly on frame-by-frame performance. Such evaluation methods appear to be inadequate in assessing the performance of a perception subsystem when used within an AV. In this paper, we present a logic -- referred to as Spatio-Temporal Perception Logic (STPL) -- which utilizes both spatial and temporal modalities. STPL enables reasoning over perception data using spatial and temporal operators. One major advantage of STPL is that it facilitates basic sanity checks on the functional performance of the perception system, even without ground-truth data in some cases. We identify a fragment of STPL which is efficiently monitorable offline in polynomial time. Finally, we present a range of specifications for AV perception systems to highlight the types of requirements that can be expressed and analyzed through offline monitoring with STPL.
BibTeX
@article{hekmatnejad2024formalizing,
  author = {Mohammad Hekmatnejad and Bardh Hoxha and Jyotirmoy V. Deshmukh and Yezhou Yang and Georgios Fainekos},
  title = {{Formalizing and Evaluating Requirements of Perception Systems for Automated Vehicles using Spatio-Temporal Perception Logic}},
  journal = {Int. J. Robotics Res.},
  year = {2024},
  doi = {10.1177/02783649231223546},
}
Figure