Skip to the dice vs clinical error demo

Medical AI lab · Dice vs clinical error ·

Dice score vs clinical error: interactive demo

A high Dice score can hide a missed lesion, because Dice is dominated by the largest structure in the image. In this demo the prediction follows a lesion about 68 mm across and misses an 8 mm lesion entirely: Dice is 0.98, lesions detected reads 1 of 2, and the HD95 boundary distance is 38.5 mm. Per-lesion detection and a boundary metric show what Dice does not.

In one line: Dice 0.98 with 1 of 2 lesions found: the missed 8 mm lesion is 1.4% of the true lesion area, so it barely moves the score.

SYNTHETIC DATA

These demos are illustrative. Every signal, image, patient and note is synthetic and fictional, generated and scored in your browser, and every number shown is computed from that synthetic data. They show general principles, not the performance of any real model, product or project, and none of them is a medical device.

Nothing is uploaded. No patient data is used.

05

Medical imaging AI / evaluation metrics

A high Dice. A missed lesion.

What this shows: Dice is dominated by the largest structure, so missing a small lesion barely moves it. A boundary distance and a simple count of lesions found tell a different story.

Change the prediction

Two true lesions: one about 68 mm across and one small. Shrink the small lesion below about 5 mm and even the 95th-percentile distance stops noticing that it was missed.

Ground truth and prediction

160 × 160 mm · 1 mm pixels

Blue: predicted and trueAmber: missedRed: predicted, not true

Dice—
HD95 boundary distance—
Max boundary distance—
Lesions detected—

Synthetic data · illustrative · not a medical device

Where this matters

Segmentation and detection where small findings change the clinical decision: metastases, small nodules, early lesions. Report per-lesion detection and a boundary metric next to Dice, and choose metrics for the clinical question.

What this experiment models

Binary masks on a 160 × 160 grid with 1 mm pixels. The large true lesion is a slightly irregular disc; the prediction follows its boundary with a fixed wobble scaled by the roughness slider. Dice is 2|A∩B| / (|A| + |B|) over all pixels. Boundary distances are measured between the boundary pixels of the two masks in both directions; HD95 is the larger of the two directed 95th percentiles, and the maximum is the Hausdorff distance. A lesion counts as detected if any predicted pixel overlaps it.

The principle

How it works

The ground truth has one lesion about 68 mm across and one small lesion whose diameter you set. The prediction follows the large lesion with an adjustable boundary wobble, and either finds the small lesion or misses it. With an 8 mm lesion missed, Dice stays near 0.98, because the missing pixels are about 1% of the total.

Boundary metrics measure distance instead of overlap. For each boundary pixel of one mask, the demo finds the nearest boundary pixel of the other, in both directions. The Hausdorff distance is the largest of these distances, and HD95 is the larger of the two 95th percentiles, which ignores a few outlying pixels. A missed lesion far from the prediction produces large distances, but if its boundary is less than 5% of the total, HD95 ignores it too, while the maximum distance does not.

The clinical question is often simpler: was each lesion found? Counting detected lesions, and reporting per-lesion results next to Dice and a boundary metric, catches what a single overlap score hides. See medical imaging AI.

Worked example

A Dice of 0.98 with one lesion missing

Picture a team reporting results for a lesion segmentation model. The headline metric is Dice, and many of their images contain one large lesion and one or more small ones. A reviewer reads 0.98 and moves on.

The demo’s default settings show what can sit behind that number. The image is 160 × 160 mm, with a large lesion about 68 mm across and a small one 8 mm in diameter. The prediction follows the large lesion with 1.0 mm of boundary roughness and misses the small lesion entirely. Dice is 0.98. Per lesion it is 0.99 for the large one and 0.00 for the small one, but the small lesion is 1.4% of the true lesion area, so missing it costs almost nothing in the overall score.

The other readouts tell a different story. Lesions detected reads 1 of 2. The HD95 boundary distance is 38.5 mm and the maximum boundary distance is 42.9 mm, because the nearest predicted boundary to the small lesion is on the large one. HD95 notices here because the small lesion makes up 9% of the true boundary, more than the 5% that HD95 is designed to ignore.

Untick the box so the model finds the small lesion. Dice becomes 0.99, HD95 1.0 mm, the maximum distance 1.4 mm and lesions detected 2 of 2. The whole difference between missing and finding a lesion is 0.98 against 0.99 in Dice, which in a comparison of two models would pass as noise.

Tick the box again and shrink the small lesion to 4 mm. Dice is 0.99 and HD95 is 1.4 mm, so both now look fine. Only the maximum distance, 40.7 mm, and the count, 1 of 2, still show the miss.

The correct practice is to choose metrics from the clinical question. If each lesion matters, report lesion-level detection, meaning sensitivity and false positives per image, broken down by lesion size. Report Dice and a boundary metric next to it, not instead of it.

Checklist

What to check in your own project

  • Does the clinical decision depend on finding every lesion, on total volume or on the exact boundary, and do the reported metrics match that?
  • Are lesion-level sensitivity and false positives per scan reported next to Dice?
  • Are results broken down by lesion size, so small lesions are not averaged away?
  • Is a boundary metric such as HD95 reported in millimetres, with the voxel spacing taken into account?
  • Is it stated whether Dice is averaged per case or pooled over all pixels, and how cases with no lesion are scored?
  • Has someone looked at the worst cases, not only at the mean?

Related: our medical imaging AI service, the wiki page on medical AI validation, and the demos on scanner shift and heart rate from a noisy ECG.

FAQ

Common questions

What metrics should I report for lesion segmentation besides Dice?

Report lesion-level detection, meaning sensitivity and false positives per image broken down by lesion size, and a boundary metric such as HD95 or the maximum boundary distance. In the demo Dice reads 0.98 while lesions detected reads 1 of 2 and HD95 is 38.5 mm, so the extra metrics show the missed lesion that Dice hides.

Can a Dice score of 0.98 still mean a lesion was missed?

Yes. Dice is dominated by the largest structure, so an 8 mm lesion that is 1.4% of the true lesion area barely moves it. In the demo the prediction scores Dice 0.98 while missing that lesion completely, and finding it only raises Dice to 0.99.

How do I evaluate a segmentation model for small findings?

Count each finding separately: for every true lesion, whether it was detected, and how many false lesions were predicted, broken down by size. Choose the size bands from the clinical question. The demo shows that even HD95 stops noticing a missed lesion once it shrinks below about 5 mm, leaving only the maximum distance and the lesion count to show it.

What is the Dice score in image segmentation?

The Dice score measures the overlap between a predicted mask and the ground truth: twice the number of pixels the two share, divided by the total number of pixels in both. It runs from 0, no overlap, to 1, identical masks.

What is a good Dice score?

There is no universal cut-off. Large, well-defined structures routinely reach high values, while small or irregular lesions score lower even when the segmentation is clinically acceptable. In this demo a prediction with a Dice of 0.98 misses one of two lesions. Judge Dice against the agreement between human annotators on the same task, and next to lesion-level results.

What is the difference between Dice and Hausdorff distance?

Dice measures overlap in area or volume. Hausdorff distance measures how far apart the boundaries of the two masks are at their worst point, in millimetres. HD95 uses the 95th percentile of the boundary distances instead of the maximum, so a few outlying pixels do not dominate. Dice is insensitive to small missed regions; boundary distances are sensitive to them when they are far from the prediction.

Why does a high Dice score miss small lesions?

Because Dice counts pixels, and a small lesion has few. In this demo the 8 mm lesion is 1.4% of the true lesion area, so missing it completely lowers Dice only from 0.99 to 0.98. Counting detected lesions, or computing Dice per lesion, shows the miss at once.

Medical AI lab

More demos

01 / Heart rate from ECGHeart rate from a noisy ECG – interactive demoMissed and false beats behind a correct average02 / Patient leakagePatient-level data leakage – interactive demoRecord-level vs patient-level train/test splits03 / Calibration & thresholdsCalibration and decision thresholds – interactive demoCalibration plot, decision curve and net benefit04 / Scanner shiftScanner shift in medical imaging – interactive demoSegmentation tuned on one scanner, tested on another06 / Note de-identificationDe-identifying a clinical note – interactive demoEnglish, Hebrew and mixed notes vs a rule-based detector07 / Nodule volume 3DNodule volume and CT slice thickness – 3D interactive demoThe same nodule, measured on thin and thick slices08 / Sample sizeSample size for validating a clinical AI model – interactive demoHow wide the interval is around a measured sensitivity09 / SubgroupsHidden subgroup failure in clinical AI – interactive demoA good overall score next to a weak subgroup10 / Slice-by-slice 3DSlice-by-slice segmentation of a 3D lesion – 3D interactive demoA high per-slice Dice and a lesion reported in pieces11 / Predictive value 3DPositive predictive value and prevalence – 3D interactive demoWhat a positive result means when the condition is rare12 / Shortcut learningShortcut learning in medical imaging AI – interactive demoA model that reads the hospital tag, not the disease13 / DriftModel drift and performance monitoring – interactive demoHow late a monitoring rule notices a slow decline14 / Alert burdenAlert burden of a clinical early-warning model – interactive demoA threshold counted in alerts per nurse per shift

MLAIA DATA SCIENCE

Tell us what
you’re working on.

Share the problem, the data you have and what success would look like. We’ll discuss a practical next step.

Please don’t include confidential datasets, credentials or patient information.

yochai@mlaia.com
WhatsApp: +972 52 484 6282

Your inquiry is handled under our Privacy Policy.