# Explainseg Segmentation Eval

> Evaluates the ability of an XAI-driven classification model to generate clinically meaningful segmentation masks without pixel-level annotations. It probes spatial coherence, boundary precision, and generalization across diverse medical imaging modalities (mammography, histopathology, endoscopy). Use when the user wants to benchmark on CBIS-DDSM, NuInsSeg, Kvasir-SEG, or asks about evaluating this task. Reports Dice.

- Skill: `qhjqhj00/explainseg-segmentation-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/explainseg-segmentation-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/explainseg-segmentation-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/explainseg-segmentation-eval

---


# explainseg-segmentation-eval

> No Masks Needed: Explainable AI for Deriving Segmentation from Classification — Ma et al. (2025) (arXiv:2508.04534, 2025)

## What this evaluates

Evaluates the ability of an XAI-driven classification model to generate clinically meaningful segmentation masks without pixel-level annotations. It probes spatial coherence, boundary precision, and generalization across diverse medical imaging modalities (mammography, histopathology, endoscopy).

## Datasets

- **CBIS-DDSM** — total ?; splits: train (1276), val (234)
- **NuInsSeg** — total 665; splits: train (600), val (65)
- **Kvasir-SEG** — total 1000; splits: train (1852), val (254)

## Metrics

- `mIoU` — range: percent
  - Mean Intersection over Union across all classes: average of (intersection / union) per class.
- `Dice` **(primary)** — range: percent
  - Dice coefficient: 2 * |A ∩ B| / (|A| + |B|), measuring overlap between predicted and ground truth masks.

## Input / output format

**Input**: Normalized medical images (mammography, histopathology tiles, or colonoscopy patches) passed through a fine-tuned Vision Transformer (ViT) classification backbone.

**Output**: Binary segmentation masks derived from Integrated Gradients relevance heatmaps, optionally fused with ViT features, and refined via Normalized Cut (NCut) or morphological operations.

## Scoring recipe

```python
def compute_dice(pred, gt):
    intersection = np.logical_and(pred, gt).sum()
    return 2.0 * intersection / (pred.sum() + gt.sum())

def compute_miou(pred, gt, classes=2):
    ious = []
    for c in range(classes):
        p = (pred == c)
        g = (gt == c)
        inter = np.logical_and(p, g).sum()
        union = np.logical_or(p, g).sum()
        ious.append(inter / union if union > 0 else 0.0)
    return np.mean(ious) * 100
```

## Common pitfalls

- Using ground truth segmentation masks during the classification network fine-tuning stage, which violates the paper's annotation-free premise.
- Directly comparing with fully supervised segmentation baselines without acknowledging the lack of pixel-level labels during training.
- Computing normalization statistics on the full dataset instead of solely the training subset, causing data leakage.

## Evidence (verbatim from paper)

> ExplainSeg (XAI \& NCut) consistently achieves the best or near-best segmentation performance across all three datasets. It yields the highest mIoU (31.2%) and Dice score (43.7%) on CBIS-DDSM, the mammography dataset that poses substantial challenges due to low contrast and subtle boundaries.

## Citation

```bibtex
@misc{ma2025nomasks,
  title={No Masks Needed: Explainable AI for Deriving Segmentation from Classification},
  author={Ma et al. (2025)},
  year={2025},
  note={arXiv:2508.04534}
}
```

- arXiv: 2508.04534

