# Msd Robust Seg Eval

> Evaluates the adversarial robustness and cross-task generalization of 3D medical image segmentation models across diverse organs and tumors using CT and MRI modalities. It measures how well models maintain segmentation accuracy under sophisticated adversarial attacks compared to clean inference. Use when the user wants to benchmark on MSD, or asks about evaluating this task. Reports Dice score.

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

---


# msd-robust-seg-eval

> Towards Robust General Medical Image Segmentation — Daza et al. (2021) (arXiv:2107.04263, 2021)

## What this evaluates

Evaluates the adversarial robustness and cross-task generalization of 3D medical image segmentation models across diverse organs and tumors using CT and MRI modalities. It measures how well models maintain segmentation accuracy under sophisticated adversarial attacks compared to clean inference.

## Datasets

- **MSD** — total 2633; splits: train (-1), val (-1), test (-1)

## Metrics

- `Dice score` **(primary)** — range: [0, 1]
  - Computes the overlap between predicted and ground-truth segmentation masks: 2 * |A ∩ B| / (|A| + |B|). Values range from 0 (no overlap) to 1 (perfect match).

## Input / output format

**Input**: 3D volumetric medical images (CT or MRI) with one or multiple channels. Inputs are preprocessed by resampling to homogeneous voxel spacing, clipping intensities to the [0.5, 99.5] percentiles of foreground values, and applying z-score normalization.

**Output**: 3D volumetric semantic segmentation masks. Predictions are generated by uniformly sampling cubic patches, combining voxel predictions via distance-weighted averaging, and applying post-processing (preserving the largest connected component for organs, fusing small tumor elements below a size threshold).

## Scoring recipe

```python
def compute_dice(pred_mask, gt_mask):
    intersection = np.sum(pred_mask & gt_mask)
    union = np.sum(pred_mask) + np.sum(gt_mask)
    if union == 0:
        return 1.0
    return 2.0 * intersection / union
```

## Common pitfalls

- Adversarial epsilon bounds must be carefully scaled to the normalized intensity range rather than raw pixel values, as standard natural-image attack parameters do not transfer directly to 3D medical volumes.
- Patch-based inference requires precise distance-weighted aggregation and specific post-processing (largest component extraction for organs, threshold-based fusion for tumors) to avoid boundary artifacts and match official evaluation protocols.
- Hyperparameter tuning and design choices are explicitly made based on only two tasks (pancreas and prostate), which may introduce selection bias when reporting robustness across all 10 MSD tasks.

## Evidence (verbatim from paper)

> We optimize a combination of the Dice loss and the Cross-Entropy loss. For data augmentation, we use random rotations, scaling, mirroring, and gamma correction. We sample cubic patches with a 50% probability of being centered at a foreground category to address data imbalance.

## Citation

```bibtex
@misc{daza2021robust,
  title={Towards Robust General Medical Image Segmentation},
  author={Daza et al. (2021)},
  year={2021},
  note={arXiv:2107.04263}
}
```

- arXiv: 2107.04263

