Test set size calculator
Work out how many test cases a segmentation study needs, how precise a mean Dice score will be, and how many cases it takes to show that one method beats another.
Nothing is uploaded: every number stays in your browser. The results are planning estimates, not a substitute for a statistician on a study that matters.
Most segmentation papers report a mean Dice score on a test set, but few say how many cases that test set needs. This calculator answers three questions before you collect data: how precise your mean will be, how many cases you need for a given precision, and how many you need to show that your method beats another one.
How precise will the mean score be?
The confidence interval around a mean shrinks with the square root of the number of cases.
How many test cases do I need?
Pick how close the reported mean should be to the true mean, and get the smallest test set that achieves it.
How many cases to show one method beats another?
When both methods run on the same cases, what matters is the spread of the per-case difference, which is usually much smaller than the spread of either score. This uses a two-sided paired t-test.
Estimate the standard deviation from your own scores
Paste per-case scores from a validation set or a pilot run, one case per line. With two columns (your method, then the baseline) you also get the spread of the difference. Commas, tabs and spaces all work.
Paste at least three cases.
How it works, and when to be careful
Precision. The interval is the mean ± t × SD / √n, where t is the Student t quantile with n − 1 degrees of freedom. Test set size is the smallest n whose interval is no wider than the margin you ask for. Comparing methods uses the standard approximation for a paired t-test, n ≥ ((t1−α/2 + tpower) × SDdiff / δ)², solved with the t quantiles at n − 1 degrees of freedom.
Count patients, not images. Scans or slices from the same patient are not independent, so n is the number of patients. Failures skew the mean. Dice is bounded at 1, and a few failed cases near 0 make the distribution lopsided. If your pilot scores include failures, also report the median and the number of failures, and check the interval with a bootstrap. The SD is an estimate. With a small pilot set, the SD itself is uncertain; rounding it up gives a safer test set size. Several comparisons (many baselines or many structures) need a stricter significance level, for example Bonferroni.