# Tongue Segmentation Eval

> Evaluates zero-shot and cross-dataset generalization of a tongue segmentation model adapted from SAM. It probes the model's ability to segment tongue regions in medical images without task-specific fine-tuning on the target datasets. Use when the user wants to benchmark on TongueSet1, BioHit (TongueSet2), Webset (TongueSet3), or asks about evaluating this task. Reports mIoU.

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

---


# tongue-segmentation-eval

> TongueSAM: An Universal Tongue Segmentation Model Based on SAM with Zero-Shot — Cao et al. (2023) (arXiv:2308.06444, 2023)

## What this evaluates

Evaluates zero-shot and cross-dataset generalization of a tongue segmentation model adapted from SAM. It probes the model's ability to segment tongue regions in medical images without task-specific fine-tuning on the target datasets.

## Datasets

- **TongueSet1** — total 3192; splits: train (-1), test (-1)
- **BioHit (TongueSet2)** — total 300; splits: test (300)
- **Webset (TongueSet3)** — total 1000; splits: test (1000)

## Metrics

- `mIoU` **(primary)** — range: [0, 1]
  - Mean Intersection over Union across all pixels or classes. IoU = TP / (TP + FP + FN). Averaged over the dataset.
- `mPA` — range: [0, 1]
  - Mean Pixel Accuracy across classes. PA = TP / (TP + FP). Averaged over the dataset.
- `Acc` — range: [0, 1]
  - Overall pixel accuracy. Acc = (TP + TN) / Total pixels.

## Input / output format

**Input**: RGB tongue images of varying resolutions (e.g., 400×400, 768×576, or arbitrary sizes).

**Output**: Binary segmentation mask indicating the tongue region.

## Scoring recipe

```python
def compute_metrics(pred_mask, gt_mask):
    intersection = np.logical_and(pred_mask, gt_mask).sum()
    union = np.logical_or(pred_mask, gt_mask).sum()
    mIoU = intersection / union if union > 0 else 0.0
    mPA = (intersection / np.sum(gt_mask)) if np.sum(gt_mask) > 0 else 0.0
    Acc = np.mean(pred_mask == gt_mask)
    return mIoU, mPA, Acc
```

## Common pitfalls

- Zero-shot evaluation trains exclusively on TongueSet1 and tests on TongueSet2/3 without fine-tuning, which may overstate generalization if domain shift is large.
- The evaluation pipeline relies on an object detector (YOLOX) to generate bounding box prompts; performance is thus conflated with detection quality rather than pure segmentation capability.
- Image sizes vary significantly across datasets and are not explicitly normalized before metric computation, which can bias pixel-based metrics like mPA and Acc.

## Evidence (verbatim from paper)

> In this study, we utilized three evaluation metrics to assess the performance of the model: mean Intersection over Union (mIoU), mean Pixel Accuracy (mPA), and Accuracy (Acc). TongueSet1 is used as the training set, while TongueSet2 and TongueSet3 are used as the test sets.

## Citation

```bibtex
@misc{cao2023tonguesam,
  title={TongueSAM: An Universal Tongue Segmentation Model Based on SAM with Zero-Shot},
  author={Cao et al. (2023)},
  year={2023},
  note={arXiv:2308.06444}
}
```

- arXiv: 2308.06444

