# Med Anomaly Detection Eval

> This evaluation probes a model's ability to detect pathological anomalies in medical images using a one-class learning setting. It measures how well the model distinguishes between normal and abnormal samples across diverse imaging modalities and anatomical regions without seeing abnormal examples during training. Use when the user wants to benchmark on RSNA Pneumonia, VinDr-CXR, Brain Tumor, LAG, ISIC 2018, Camelyon16, BraTS2021, or asks about evaluating this task. Reports AUC-ROC.

- Skill: `qhjqhj00/med-anomaly-detection-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/med-anomaly-detection-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/med-anomaly-detection-eval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/med-anomaly-detection-eval

---


# med-anomaly-detection-eval

> Improved Anomaly Detection in Medical Images via Mean Shift Density Enhancement — Kar et al. (2026) (arXiv:2604.19191, 2026)

## What this evaluates

This evaluation probes a model's ability to detect pathological anomalies in medical images using a one-class learning setting. It measures how well the model distinguishes between normal and abnormal samples across diverse imaging modalities and anatomical regions without seeing abnormal examples during training.

## Datasets

- **RSNA Pneumonia** — total 5851; splits: train (3851), test (2000)
- **VinDr-CXR** — total 6000; splits: train (4000), test (2000)
- **Brain Tumor** — total 2200; splits: train (1000), test (1200)
- **LAG** — total 3122; splits: train (1500), test (1622)
- **ISIC 2018** — total 8217; splits: train (6705), test (1512)
- **Camelyon16** — total 7321; splits: train (5088), test (2233)
- **BraTS2021** — total 6987; splits: train (4211), test (2776)

## Metrics

- `AUC-ROC` **(primary)** — range: [0, 1]
  - Area under the Receiver Operating Characteristic curve, measuring the trade-off between true positive rate and false positive rate across all classification thresholds.
- `Average Precision (AP)` — range: [0, 1]
  - Area under the Precision-Recall curve, summarizing the model's precision across varying recall thresholds. Commonly used in imbalanced anomaly detection settings.

## Input / output format

**Input**: 512-dimensional feature vectors extracted offline from pre-trained backbones (AnatPaste for chest X-rays, ResNet18 for all other modalities). Input images are resized to a fixed resolution, normalized, and converted to 3-channel RGB format.

**Output**: A single normalized anomaly score per sample in the range [0, 1], computed by standardizing Mahalanobis distances and applying a sigmoid function.

## Scoring recipe

```python
def compute_metrics(scores, labels):
    # scores: array of normalized anomaly scores in [0,1]
    # labels: binary array (0=normal, 1=abnormal)
    auc_roc = roc_auc_score(labels, scores)
    ap = average_precision_score(labels, scores)
    return {'AUC-ROC': auc_roc, 'AP': ap}
```

## Common pitfalls

- Training exclusively on normal samples (one-class setting), so the model never sees anomalies during optimization or hyperparameter tuning.
- Features are pre-extracted offline rather than trained end-to-end, meaning performance is heavily dependent on the chosen backbone and cannot be improved via fine-tuning.
- PCA dimensionality reduction and covariance estimation are fitted only on training data, which can cause distribution shift issues if test normal data differs significantly from training.

## Evidence (verbatim from paper)

> Performance is evaluated using AUC-ROC and Average Precision (AP), following standard anomaly detection benchmarks(Cai et al. (2025)). All experiments are conducted under a one-class training setting using only normal samples.

## Citation

```bibtex
@misc{kar2026improved,
  title={Improved Anomaly Detection in Medical Images via Mean Shift Density Enhancement},
  author={Kar et al. (2026)},
  year={2026},
  note={arXiv:2604.19191}
}
```

- arXiv: 2604.19191

