Skip to content
EvalSuite
Documentation menu

Segmentation

Hausdorff distance

Implementedsegmentation.hausdorff

Definition

Largest distance from a point on one boundary to the nearest point on the other.

Formula

H(A, B) = max(supₐ inf_b d(a, b), sup_b infₐ d(a, b))

Range: [0, ∞)

Inputs and outputs

  • y_true: ground-truth mask (H×W or N×H×W)
  • y_pred: predicted mask with the same shape
  • voxel spacing

Returns: float (physical units)

Assumptions

No assumptions beyond valid, aligned inputs of the documented types.

Limitations

  • Sensitive to single outlier pixels; a percentile variant (HD95) is planned.

Python API

PythonSince v0.3.0
import evalsuite as es

es.hausdorff_distance(y_true, y_pred)                   # HD
es.hausdorff_distance(y_true, y_pred, percentile=95, spacing=(0.8, 0.8))  # HD95 in mm
es.average_surface_distance(y_true, y_pred)

References

  1. Huttenlocher, D. P., Klanderman, G. A., & Rucklidge, W. J. (1993). Comparing images using the Hausdorff distance. IEEE Transactions on Pattern Analysis and Machine Intelligence, 15(9), 850–863.

Implementation status