arXiv:2610.31538cs.CVOct 2026

Manuscript Offprint

arXiv:2610.31538

LACToS: Local Anomaly Detection via Conditional Typicality of Superpixels

Jihoon Hong, Alireza Kheirandish, Rohan Sanda, Sara Fridovich-Keil

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Local anomaly detection is the task of identifying spatially confined anomalous or out-of-distribution (OOD) regions within an otherwise in-distribution (ID) image. Most existing methods are designed for a specific context, with a strong focus on industrial defect detection, where they achieve excellent performance on well-established benchmarks. However, we observe that these methods can exhibit significant performance drops in other contexts, especially when the inlier distribution is multimodal. To account for this inlier complexity, we propose LACToS, a principled local OOD detection method based on statistical typicality and made tractable through two innovations: (i) grouping pixels into superpixels and (ii) using a computationally efficient proxy to estimate typicality. We evaluate LACToS across three diverse applications spanning medical imaging, human faces, and X-ray security screening. LACToS performs more robustly than prior methods across these benchmarks. The code is released here: https://github.com/voilalab/LACToS.

1 INTRODUCTION

Local anomaly detection is the task of identifying out-of-distribution (OOD) regions that are spatially confined within an otherwise in-distribution (ID) image. It is central to applications such as industrial defect inspection, medical image analysis, and security screening, where an anomalous region may occupy only a small fraction of the image yet indicate a defect, tumor, or weapon. Unlike image-level OOD detection, which assigns a single anomaly score to an entire image, localized pixel-level anomaly detection involves generating a dense heatmap that indicates which pixels or regions of each outlier image are inconsistent with the inlier distribution. This makes the problem espe-

Image

LACToS

Heatmap

Figure

Figure 1: Using a diffusion model pretrained on ID images only, LACToS is able to identify locally OOD regions in images across various tasks, including tumors in CT scans, anomalies such as scars on faces, and harmful objects such as scissors in X-ray baggage scans.

cially challenging: a local OOD detector must be sensitive to subtle local deviations while remaining robust to natural variation in normal image content.

Prior work on localized anomaly detection has largely followed representation-based and reconstruction-based approaches. Representation-based methods extract local features from normal (inlier) training images, and score test patches using their distance from the learned distribution or their

∗^{*}Equal contribution.

likelihood under it (Cohen and Hoshen, 2020; Defard et al., 2021; Roth et al., 2022). Reconstruction-based methods instead reconstruct, inpaint, or denoise the target image under a prior for inlier images, and use the discrepancy between the input and its reconstruction as an anomaly signal (Mousakhan et al., 2024; Wu et al., 2024). Although both approaches have achieved strong empirical performance, especially for industrial defect detection (Bergmann et al., 2019), their anomaly scores are often heuristic: representation-based methods depend on the choice of feature and distance metric, while reconstruction-based methods typically collapse the distribution of inlier completions into a point estimate. Conformal and risk-control methods can provide statistical guarantees for calibrated segmentation outputs (Shen and Liu, 2025), but they generally rely on a large amount of OOD calibration data. Moreover, we empirically observe that these methods do not always generalize reliably beyond industrial defect detection.

We present LACToS, a statistical method for local OOD detection that is designed to address these limitations of existing methods. Our approach is fundamentally reconstruction-based, but uses the key insight that the distribution of the reconstructions contains valuable information that is lost when reconstruction error is computed using a single sample or an aggregated point estimate. To leverage this richer distributional information towards improved local anomaly detection, we propose an anomaly metric based on statistical typicality, a measure of how representative a sequence of observations is for a given distribution. Our use of typicality is inspired by previous typicality-based OOD detection methods (Nalisnick et al., 2019; Osada et al., 2023; Barkley et al., 2026). However, these works are focused on image-level OOD detection where an entire image is classified as OOD, and to the best of our knowledge, using typicality for local anomaly detection has not yet been explored.

We begin with the typicality score of Nalisnick et al. (2019), and adapt it to identify local rather than whole-image anomalies (Section 4.1). Instead of asking whether an entire image is typical with respect to the unconditional prior distribution, we ask whether each pixel is typical with respect to the inpainting posterior conditioned on all other pixels in the image. However, this substitution induces three major challenges: (i) failure to detect larger local anomalies that span multiple contiguous pixels, (ii) loss of statistical validity, because typicality testing requires sampling a sequence of i.i.d. observations, and (iii) prohibitive computational cost of performing posterior sampling separately for each pixel.

LACToS tackles these challenges through two innovations: we partition images into superpixels and replace pixel-level typicality with superpixel-level typicality (Section 4.2), and we use a single denoising posterior as a common proxy for all inpainting posteriors. Our use of superpixels addresses challenges (i) and (ii), because a local OOD feature is more likely to be captured by a superpixel than a single pixel, and the individual pixels in each superpixel can be treated as independent observations to evaluate superpixel-level typicality. Our use of denoising rather than inpainting addresses challenge (iii), by dramatically reducing the number of posterior samples needed to estimate typicality. Through these innovations, we show that LACToS achieves strong quantitative and qualitative performance across a wide range of local OOD detection tasks including detecting tumors in CT scans, detecting unusual facial accessories in photographs, and detecting weapons in X-ray baggage scans.

To summarize, we propose LACToS, a statistical approach to local OOD detection in images using an inlier diffusion model and typicality testing. Our method (1) is grounded in statistical typicality, and (2) is competitive with, and often more precise than, existing methods across diverse local OOD detection tasks with complex inlier distributions.

References (72)