Maskomaly: Zero-Shot Mask Anomaly Segmentation

Jan Ackermann, Christos Sakaridis, Fisher Yu

Introduction

In the context of autonomous driving, the ability of a perception system to identify "unknown" objects is a critical safety requirement. Standard semantic segmentation models are typically trained on a closed set of categories, such as roads, vehicles, and pedestrians. However, real-world environments frequently present out-of-distribution (OOD) objects—ranging from stray animals to fallen cargo—that the model has never encountered. When faced with these anomalies, traditional models often erroneously assign them to a known class with high confidence, potentially leading to catastrophic navigation failures.

Maskomaly introduces a simple yet effective zero-shot framework for anomaly segmentation. By repurposing the intermediate outputs of standard mask-based semantic segmentation networks, such as Mask2Former, Maskomaly detects anomalies without requiring any additional training or exposure to auxiliary outlier data.

The Problem: Complexity in Anomaly Detection

Existing anomaly segmentation methods often rely on complex pipelines. Many require specialized training procedures or the use of synthetic "outlier" datasets to teach the model what an anomaly looks like. These approaches can be computationally expensive and may not generalize well to the infinite variety of real-world anomalies.

The authors of Maskomaly argue that the information necessary to identify anomalies is already present within modern mask-based architectures. These networks naturally group pixels into cohesive masks even when they lack a specific label for the underlying object. Maskomaly seeks to extract this latent information to provide a "free" upgrade to existing segmentation systems.

Methodology

Maskomaly operates as a post-processing step on top of a pre-trained mask-based segmenter. The framework is built on the observation that transformer-based queries in these networks often attend to anomalous regions even if the final classification layer is uncertain. The system computes an anomaly score using two primary components:

1. Rejection-based Anomaly Detection ($o_{reject}$)

This component identifies pixels that the network fails to associate with any known "inlier" class. By treating each predicted mask as a binary classifier, the system determines if a pixel is excluded from all high-confidence inlier masks (e.g., road, sidewalk, or car). A specific "border rejection" logic is also implemented to mitigate false positives at the noisy boundaries between two known categories.

2. Acceptance-based Anomaly Detection ($o_{accept}$)

The authors discovered that certain "query" slots in architectures like Mask2Former naturally specialize in identifying "void" or anomalous regions. By using a small validation set to identify these specific queries, the framework can "accept" these masks as direct indicators of an anomaly.

The final anomaly heatmap is generated through a weighted interpolation of these two scores. Crucially, this process requires zero retraining of the backbone network and adds negligible computational overhead (less than 0.5ms).

Evaluation and Metrics

Maskomaly was evaluated across several prominent anomaly segmentation benchmarks:

  • SMIYC (SegmentMeIfYouCan): Real-world road anomalies.
  • RoadAnomaly: A collection of 60 images featuring unexpected street objects.
  • StreetHazards: A large-scale synthetic dataset generated via the CARLA simulator.
  • FishyScapes Static: A benchmark blending Pascal VOC objects into Cityscapes scenes.

In addition to standard metrics like Average Precision (AP), the paper introduces the Maximal Detection Margin (MDM). Unlike AP, which evaluates performance across all possible thresholds, MDM measures the range of thresholds where a model maintains a high F1-score. This metric prioritizes models that are robust and easy to deploy in real-world scenarios where a single, fixed threshold must be selected.

Key Results and Insights

Maskomaly achieves state-of-the-art results among methods that do not use auxiliary training data. On the SMIYC benchmark, it reached 93.4% AP. Remarkably, it also remains competitive with—and sometimes outperforms—supervised methods that are explicitly trained on anomalous data. For instance, on RoadAnomaly, it achieved 80.8% AP, surpassing several methods that utilize auxiliary outliers.

Qualitative analysis indicates that Maskomaly produces cleaner, object-shaped detections compared to traditional pixel-level methods (like Maximum Softmax Entropy), which often suffer from noisy heatmaps and background false positives. This suggests that treating masks as cohesive units is a more effective strategy for anomaly detection than analyzing individual pixels in isolation.

Limitations and Future Work

While highly effective, Maskomaly is inherently dependent on the quality of the underlying mask-based segmenter. If the backbone fails to propose a mask for a small or low-contrast object, the system will likely miss the anomaly. Additionally, while it requires no training, it does utilize a small validation set to calibrate the acceptance-based queries.

Future research may explore integrating mask-based anomaly logic directly into the training phase to further sharpen the distinction between inliers and outliers without the need for external data sources.

Summary updated

BibTeX
@inproceedings{ackermann2023maskomaly,
  author = {Jan Ackermann and Christos Sakaridis and Fisher Yu},
  title = {{Maskomaly: Zero-Shot Mask Anomaly Segmentation}},
  booktitle = {BMVC},
  year = {2023},
  url = {https://openreview.net/forum?id=YADGvC7IqR},
}
Figure