Source-linked AI summary

LACToS: Local Anomaly Detection via Conditional Typicality of Superpixels

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

arXiv:2610.31538v1cs.CVcs.LG

TL;DR

Local OOD methods can be unreliable beyond industrial defect detection, particularly with complex inlier distributions. LACToS uses conditional typicality with superpixels and a shared denoising posterior, and is reported to perform robustly across diverse tasks. Its accuracy depends in part on keeping target anomalies out of training data.

  • Problem

    Existing local anomaly methods can generalize unreliably beyond industrial defect detection, where inlier distributions are often more structured than in medical, face, and X-ray images.

    Source: §1 · p. 2, §3 · p. 3
  • Method

    LACToS scores image regions by conditional statistical typicality, using superpixels and a shared denoising posterior to make local typicality estimation practical.

    Source: §1 · p. 2
  • Results

    LACToS is reported to perform competitively and often more precisely across diverse local OOD tasks with complex inlier distributions.

    Source: §1 · p. 2
  • Takeaways & Limitations

    Because features resembling low-frequency inlier modes may be classified as inliers, practitioners should ensure training data excludes anomalies they want to detect.

    Source: §6 · p. 9

    LACToS inherits diffusion posterior sampling's substantially higher per-image computational cost than feedforward representation methods such as PatchCore.

    Source: §6 · p. 9

Abstract

from arXiv · show

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

Existing local anomaly methods can be brittle beyond industrial defect detection, while image-level typicality had not been applied to local detection. LACToS adapts conditional typicality using superpixels and a shared denoising posterior, with reported performance across diverse tasks.

1 INTRODUCTION

  • Prior local methods use feature distances or reconstruction discrepancies, but their scores can be heuristic and may generalize unreliably beyond industrial defect detection.Conformal and risk-control segmentation methods generally rely on large amounts of OOD calibration data.Source: §1 · pp. 1–2
  • LACToS uses statistical typicality of reconstruction distributions to score local OOD regions, rather than reducing reconstructions to a single sample or point estimate.The paper distinguishes this local use from prior typicality methods focused on image-level OOD detection.Source: §1 · p. 2
  • Pixel-conditional typicality faces challenges with contiguous anomalies, statistical validity, and the cost of sampling a separate inpainting posterior for every pixel.The paper identifies superpixel grouping and a shared denoising posterior as its responses to these challenges.Source: §1 · p. 2
  • Superpixel-level typicality can capture local features spanning multiple pixels and treat pixels within each superpixel as independent observations; a denoising posterior proxies the inpainting posteriors.The shared denoising posterior reduces the number of posterior samples needed to estimate typicality.Source: §1 · p. 2
  • LACToS is reported to perform competitively and often more precisely across diverse local OOD tasks with complex inlier distributions.The described applications include CT tumors, facial anomalies, and weapons in X-ray baggage scans.Source: Figure 1 · p. 1, §1 · p. 2

2 PRELIMINARIES

The preliminaries distinguish image-level from pixel-level OOD detection and describe how pixel scores form a dense anomaly heatmap. They also review reconstruction-based and typicality-based approaches to image-level detection.

2 PRELIMINARIES

  • Pixel-level OOD detection aims to localize anomalous regions within an image, unlike image-level detection, which assigns one anomaly score to the whole image.A local detector produces a dense heatmap whose pixel scores can be thresholded into an estimated anomaly mask.Source: §2 · pp. 2–3
  • Reconstruction-based local methods compare an input with an in-distribution reconstruction, but often reduce plausible reconstructions to a first-order statistic that may miss distributional information.The reviewed discrepancy measures include pixel-space and feature-space distances.Source: §2 · p. 3
  • Image-level typicality methods compare average sample negative log-likelihood with inlier-distribution entropy, and typicality has been reported as more effective than likelihood in high dimensions.The cited typicality-based methods include Nalisnick et al. (2019), Osada et al. (2023), and Barkley et al. (2026).Source: §2 · p. 3

3 MOTIVATION

The motivation is that methods successful on structured industrial data may not transfer to heterogeneous, context-dependent settings. A toy experiment illustrates how increasing inlier multimodality raises false positives for two baseline methods.

3 MOTIVATION

  • Industrial defect datasets often have visually homogeneous inliers, whereas CT, face, and X-ray images are more heterogeneous and can make anomaly status context-dependent.For example, a dark CT region can be normal anatomy in one location but indicate a tumor in another.Source: §3 · p. 3
  • When a local conditional distribution is multimodal, first-order-statistic methods may mistake a sample from another inlier mode for an anomaly.The toy experiment increases the number of inlier modes while placing a square anomaly where inlier images contain a circle.Source: §3 · pp. 3–4
  • At a per-image true positive rate (TPR) of 95%, false positive rates for DDAD and PatchCore increase as toy inlier multimodality grows.The paper reports that the trend also holds across the TPR values shown in Figure 7.Source: §3 · p. 4

4 METHOD

LACToS adapts conditional typicality to local image anomalies, then makes it tractable with superpixels and a shared denoising proxy. It augments pixel values with compressed pretrained features to provide richer statistical context.

4.1 TYPICALITY-BASED ANOMALY SCORE

  • Conditional typicality flags a pixel when it is not typical under its distribution conditioned on all other observed pixels, but single-pixel tests can miss contiguous anomalies and be computationally costly.A length-one observation is also insufficient for typical-set guarantees, and RGB alone may lack semantic information.Source: §4.1 · pp. 4–5

4.2 SUPERPIXEL-LEVEL TYPICALITY

  • Superpixels group contiguous, similarly colored pixels so anomalies spanning multiple pixels form a sequence for typicality testing, under a within-superpixel conditional i.i.d. assumption.Scoring superpixels rather than pixels reduces the number of scores from |J| to |K|.Source: §4.2 · p. 5

4.3 DENOISING POSTERIOR

  • A shared denoising posterior approximates the superpixel-specific inpainting posteriors, allowing one small sample set to estimate distributions across superpixels.The paper states that, under appropriate assumptions, the error from this replacement can be bounded.Source: §4.3 · p. 6

4.4 FEATURE AUGMENTATION

  • LACToS augments pixel values with compressed activations from a pretrained ResNet, then builds per-superpixel histograms and computes typicality scores for the anomaly map.The autoencoder compresses the high-dimensional activations to reduce histogram estimation error when samples are few.Source: §4.4 · p. 7

5 EVALUATION

LACToS is evaluated on local anomalies in medical images, faces, and X-ray scans, against six industrial-defect-detection baselines. Across the tasks, it is competitive, with heatmaps suggesting a precision–coverage trade-off; results vary by metric, and performance is mostly stable across tested hyperparameter settings.

Datasets

  • The evaluation covers CHAOS abdominal CT scans, FFHQ face images, and DVXray baggage scans, with each test set containing ID and local-OOD images.CHAOS anomalies are synthetic tumors; FFHQ anomalies are curated facial features; DVXray anomalies are scissors.Source: §5 · p. 7

Baselines & Models

  • The six baselines span representation-based and reconstruction-based methods developed for industrial defect detection.They include PatchCore, SimpleNet, SuperSimpleNet, EfficientAD, GLASS, and DDAD.Source: §5 · pp. 7–8

Results

  • AUROC and AP pool pixel scores across each dataset, whereas AUPRO averages per-region overlap up to false-positive rate 0.3.AUPRO weights anomalies equally when their sizes differ.Source: §5 · p. 9
  • LACToS is competitive with baselines across all tasks, though the best method differs across metrics.The evaluation reports AUROC, AP, and AUPRO; example heatmaps suggest LACToS more often avoids flagging inlier pixels, while sometimes missing part or all of an anomalous region.Source: §5 · p. 9

Ablation Studies

  • Performance is mostly stable across tested posterior-sample counts and superpixel sizes, while autoencoder features can improve over RGB-only typicality in a dataset-dependent way.These are the reported ablation findings.Source: §5 · p. 9

6 DISCUSSION

LACToS uses a pretrained diffusion model and conditional typicality to score local regions, with strong performance across medical-imaging-to-security tasks. Its discussion notes limits in specialized settings, sampling cost, and assumptions; the appendices describe diffusion sampling and posterior conditioning.

6 DISCUSSION

  • LACToS combines a pretrained diffusion model with regional typicality under a conditional distribution induced by surrounding context.The discussion characterizes the framework as general-purpose local anomaly detection and reports strong performance from medical imaging to security screening.Source: §6 · p. 9
  • LACToS may be outperformed by specialized methods on highly structured datasets, incurs diffusion-posterior-sampling costs, and relies on an assumption that can fail for large or heterogeneous superpixels.It also requires several hyperparameters, although reported ablations indicate fairly robust performance to their settings.Source: §6 · p. 9

A.1 DIFFUSION MODELS

  • Diffusion models define a forward noising process and, under regularity conditions, a corresponding backward SDE with the same time-indexed marginals.The forward process transforms clean data toward pure noise; the backward process enables sampling back toward data.Source: §A.1 · p. 13
  • Diffusion models are trained to predict either the score of the noisy-data distribution or the backward-SDE drift, then sample by discretizing the backward SDE.The passage identifies score-matching and flow-matching objectives.Source: §A.1 · p. 13

A.2 POSTERIOR SAMPLING USING DIFFUSION MODELS

  • Posterior sampling modifies reverse diffusion to combine the pretrained prior with inference-time measurements, approximating the likelihood score for tractability.The described applications include inpainting, denoising, deblurring, superresolution, and tomography.Source: §A.2 · p. 13

B TOY EXPERIMENT 1

The toy experiment varies local multimodality in the inlier distribution while testing detection of an anomalous square. At 20 samples, LACToS keeps false-positive rates negligible relative to baselines as multimodality rises.

B TOY EXPERIMENT 1

  • The experiment trains a dedicated diffusion model at each complexity level, keeping a circle in the upper-right corner while varying shapes in the other three corners.More shapes become equally probable as the inlier multimodality level rises.Source: B TOY EXPERIMENT 1 · p. 14
  • Test images place an anomalous square in the upper-right corner, with other inlier shapes elsewhere; square pixels are labeled positive and all others negative.The study compares DDAD, a 20-sample DDAD variant, PatchCore, and LACToS with sample counts varied from 1 to 20.Source: B TOY EXPERIMENT 1 · p. 15
  • With 20 samples, LACToS’s false-positive rate stays negligible relative to DDAD and PatchCore as inlier multimodality increases.The reported measure is per-image average FPR at fixed TPR levels of 80%, 90%, 95%, and 99%; LACToS’s FPR decreases rapidly with sample size.Source: B TOY EXPERIMENT 1 · p. 15

C TOY EXPERIMENT 2

Toy Experiment 2 tests whether LACToS distinguishes under-represented inlier features from dominant inlier and strictly OOD features. It finds LACToS less likely than DDAD to separate inlier squares from circles, and more likely to distinguish uncommon inlier squares from OOD squares, with both trends strengthening as reconstructions increase.

C TOY EXPERIMENT 2

  • Five diffusion models are trained on specified distributions to test whether typicality treats uncommon inlier features more like dominant inliers than strict OOD features.The hypothesis is that first-order-statistic baselines may instead treat uncommon inlier features as closer to OOD.Source: C TOY EXPERIMENT 2 · p. 16, Table 3 · p. 16
  • The experiment keeps the upper-right square strictly OOD while lowering the inlier probability of squares in the other three corners from 0.5 to 0.1.The square and circle positions are jittered around fixed anchors; the upper-right corner always contains a circle under the inlier distribution.Source: C TOY EXPERIMENT 2 · p. 16, Figure 8 · p. 17
  • LACToS is less likely than DDAD to distinguish inlier squares from circles and more likely to distinguish under-represented inlier squares from truly OOD squares; both trends grow with more sampled reconstructions.The figure defines the two AUROC comparisons: inlier squares versus circles, and OOD squares versus under-represented inlier squares.Source: C TOY EXPERIMENT 2 · p. 16, Figure 9 · p. 18

D THEORY

The theory formalizes denoising as a proxy for inpainting scores under regularity and tradeoff assumptions, then considers how dependence between pixels affects typicality concentration and detection bounds.

D THEORY

  • The formal discussion uses a finite, quantized single-pixel state space; features are treated as an empirical extension and excluded from the theory.The state space is based on 8-bit values for one color channel.Source: D THEORY · p. 19
  • A probability floor δk keeps the log-likelihood and entropy score stable; histogram-based estimates can enforce it through smoothing or clipping.The lower bound rules out probabilities near zero, which can make the score functional unstable.Source: D THEORY · p. 19
  • The formal denoising-score approximation is stated under Assumptions D.1 and D.2, with an absorbed-constant form also given.The approximation concerns denoising and inpainting scores over a specified noise interval.Source: D THEORY · p. 20
  • The bound-optimal noise level balances context gap, which worsens as noise increases, against self-leakage, which worsens as noise decreases.The corollary selects a bound-optimal noise level, not necessarily the empirically optimal denoising noise.Source: D THEORY · p. 21
  • Under the inlier model the signed statistic remains centered, while positive within-superpixel covariance reduces effective sample size and weakens concentration and detection bounds.When cross-covariances vanish under Assumption 4.1, effective sample size equals the number of pixels in the superpixel.Source: D THEORY · pp. 21–22

E.1 DATASET SUMMARY

The appendix documents dataset composition and resolutions, reconstruction models, LACToS and baseline tuning, and feature preparation for the evaluations.

E.1 DATASET SUMMARY

  • Training images contain only inlier examples, while test images include local anomalies with pixel-level masks; the datasets use resolutions from 256×256 to native 600×800.MVTec AD and CHAOS use 256×256, FFHQ uses 256×256, and DVXray is evaluated at native 600×800 with per-pixel mean metrics.Source: §E.1 · p. 22, Table 4 · p. 23

E.2 DIFFUSION MODELS AND RECONSTRUCTION

  • MVTec AD uses DDAD checkpoints, while the other benchmarks use guided-diffusion UNets trained from scratch and DPS reconstructions.The MVTec checkpoints are epsilon-prediction UNets trained separately for each category.Source: §E.2 · p. 23

E.3 LACTOS HYPERPARAMETERS

  • LACToS forms RGB and feature histograms per superpixel, smooths them, sums their typicality scores with a feature weight, and smooths the resulting anomaly map.Parameters are selected by grid search on a subset of 20 test images.Source: §E.3 · p. 23, Table 5 · p. 23

E.4 BASELINES

  • Baselines use official implementations; tuning uses the same 20 test images, but SimpleNet, SuperSimpleNet, and GLASS retain their default parameters.The latter methods are not tuned because doing so would require retraining.Source: §E.4 · pp. 23–24, Table 6 · p. 24

E.5 FEATURE EXTRACTOR AND AUTOENCODER

  • The feature extractor is a frozen ImageNet-pretrained ResNet-101; activations from its last three residual stages are upsampled, concatenated, and compressed to three dimensions by an inlier-trained autoencoder.Source: §E.5 · p. 24

F ADDITIONAL RESULTS

This section provides additional benchmark visualizations and reports category-level MVTec AD metrics, with the table defining the metrics and their aggregation.

F ADDITIONAL RESULTS

  • Figure 10 shows 10 randomly selected CHAOS test images and each method’s heatmaps.Source: Figure 10 · p. 25
  • Figure 11 shows 10 randomly selected FFHQ test images and each method’s heatmaps.Source: Figure 11 · p. 26
  • Figure 12 shows 10 randomly selected DVXray test images and each method’s heatmaps.Source: Figure 12 · p. 27
  • Table 7 reports pixel-level AUROC, AP, and AUPRO for each MVTec AD object or texture category.AUROC and AP pool test-image pixels; AUPRO is region-based per-region overlap integrated up to an FPR of 0.3.Source: Table 7 · p. 28, F ADDITIONAL RESULTS · p. 28

G ABLATION STUDIES

The ablations examine denoising sample count, superpixel size, and feature weighting; they report sample-count improvements on CHAOS and DVXray, mostly stable performance across superpixel sizes, and gains from feature typicality in most datasets.

Sample efficiency

  • LACToS improves with more denoising samples on CHAOS and DVXray compared with DDAD, which relies on point estimates of reconstruction errors.The ablation varies M from 1 to 20 and reports AUROC, AP, and AUPRO.Source: G ABLATION STUDIES · p. 29, Table 8 · p. 29

Superpixel size

  • Performance is mostly stable across average superpixel sizes, although trends differ across benchmarks.The ablation reports AUROC, AP, and AUPRO on CHAOS, FFHQ, and DVXray.Source: G ABLATION STUDIES · p. 29, Table 9 · p. 29

AutoEncoder features

Loading 2610.31538v1…