# 豪斯多夫距离

豪斯多夫距离是度量空间上非空紧致子集族上的一种度量，定义为从一个集合的某一点出发到达另一集合所需经过的最大距离。形式化地，对于以 \( d \) 为度量的度量空间中的集合 \( A \) 和 \( B \)，

\[ d_H(A,B) = \max\left\{ \sup_{a \in A} \inf_{b \in B} d(a,b),\; \sup_{b \in B} \inf_{a \in A} d(a,b) \right\}. \]

其中两个内层项各为一个有向豪斯多夫距离：即对一个集合的所有点，到另一集合最近点距离的最大值。无向距离是两个有向值的最大值，因此可以通过两次计算有向距离来求得。<sup>[1](https://link.springer.com/article/10.1007/s00454-023-00562-5)</sup> 费利克斯·豪斯多夫（Felix Hausdorff）于1914年引入该度量，并证明了紧致集的闭子集空间本身是紧致的；苏联拓扑学家 P. S. 乌雷松（P. S. Urysohn）于1921–1922年间独立得到了同一定理。<sup>[2](https://encyclopediaofmath.org/wiki/Hausdorff_metric)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | \( d_H(A,B) = \max\{\sup_{a \in A} \inf_{b \in B} d(a,b), \sup_{b \in B} \inf_{a \in A} d(a,b)\} \)，即两个方向上最近邻距离的最大值<sup>[2](https://encyclopediaofmath.org/wiki/Hausdorff_metric)</sup> |
| 起源 | 由费利克斯·豪斯多夫于1914年引入；紧致集的闭子集超空间的紧致性由豪斯多夫证明，并由 P. S. 乌雷松于1921–1922年独立证明<sup>[2](https://encyclopediaofmath.org/wiki/Hausdorff_metric)</sup> |
| 适用范围 | 度量空间非空紧致子集族上的真正度量<sup>[2](https://encyclopediaofmath.org/wiki/Hausdorff_metric)</sup> |
| 解释 | 当一个集合的每一点都接近另一集合的某一点，且反之亦然时，两集合的豪斯多夫距离很小<sup>[1](https://link.springer.com/article/10.1007/s00454-023-00562-5)</sup> |
| 离群值行为 | 度量最大表面偏差，因此单个错误标注的像素或标注错误即可主导该值；95百分位变体（HD95）用于排除此类离群值<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC4533825/)</sup> |
| 主要应用 | 医学图像分割评估、点云与网格比较、用多面体逼近凸集<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC4533825/)</sup><sup> • </sup><sup>[4](https://tropp.caltech.edu/notes/Tro18-Lectures-Convex-LN.pdf)</sup> |

## 定义与基本性质

该定义可以通过 ε-邻域来理解：\( A \) 与 \( B \) 之间的豪斯多夫距离是使得每个集合都包含在另一集合的闭 ε-邻域内的最小 \( \varepsilon \)。度量空间 \( X \) 的子集 \( S \) 称为在 \( X \) 中 \( r \)-稠密的，当 \( S \) 与 \( X \) 之间的豪斯多夫距离至多为 \( r \)，这将该度量与网理论和逼近理论联系起来。<sup>[5](https://www.math.ucdavis.edu/~kapovich/EPR/ggt.pdf)</sup>

**紧致性为何重要。** 豪斯多夫度量只在适当的集合族上才是真正的度量，主要是非空紧致子集族。在任意的闭集或有界集上，两个上确界可能为无穷大，或者分离公理可能失效，这就是标准定义将注意力限制在度量空间的紧致子集上的原因。<sup>[2](https://encyclopediaofmath.org/wiki/Hausdorff_metric)</sup> 在这一集合族上，该度量表现良好：紧致集的闭子集空间在豪斯多夫度量下是紧致的，这正是豪斯多夫证明且乌雷松独立发现的定理。<sup>[2](https://encyclopediaofmath.org/wiki/Hausdorff_metric)</sup> 超空间的紧致性是收敛性论证的基础：该度量定义了紧致集序列的豪斯多夫收敛拓扑。<sup>[5](https://www.math.ucdavis.edu/~kapovich/EPR/ggt.pdf)</sup>

这一构造还可以提升为抽象度量空间之间的距离，而非共同空间的子集之间的距离：格罗莫夫-豪斯多夫距离（Gromov-Hausdorff distance）通过在嵌入上优化来度量两个紧致度量空间之间的差异，它将豪斯多夫构造限制到等距类上，并在这些类上构成一个度量。<sup>[6](https://arxiv.org/abs/1612.00728)</sup>

## 计算

对于有限点集，有向距离是一个最大-最小计算：对一个集合的每个点，找到另一集合中最近的点，然后取最大值。暴力实现的代价为 \( O(m \cdot o) \)，其中两个集合分别有 \( m \) 和 \( o \) 个点。实用算法可以减少这一工作量。SciPy 的 `directed_hausdorff` 使用提前终止技术，一旦当前最小值超过当前最佳有向距离就放弃内层最近邻搜索，并结合输入顺序的随机采样；最坏情况仍为 \( O(m \cdot o) \)，但由于输入点被打乱，实际中不太可能出现。<sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.directed_hausdorff.html)</sup> 一种较新的算法将点排除法与系统随机采样相结合，已在三维点云模型和脑肿瘤体积上进行了测试。<sup>[8](https://www.sciencedirect.com/science/article/pii/S0031320321000443)</sup>

**复杂度与变体。** 在标准位计算模型下确定豪斯多夫距离的计算复杂度是离散与计算几何领域当前的研究课题。<sup>[1](https://link.springer.com/article/10.1007/s00454-023-00562-5)</sup> 当输入本身不确定时，问题变得更加困难：对于平面中点集之间的有向豪斯多夫距离，其中一个或两个集合由不精确的点组成时，所研究的每种情况要么是 NP 难的，要么存在多项式时间算法，分类逐例给出。<sup>[9](https://www.sciencedirect.com/science/article/pii/S0304397511001058)</sup>

## 在医学图像分割中的应用

豪斯多夫距离是验证三维医学图像分割的标准空间距离度量之一，与 Dice 相似系数和 Jaccard 指数等重叠度量并列。<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC4533825/)</sup> 它在定义两个分割的体素集合上计算，同样也可以在轮廓和表面上而非体素集合上计算。<sup>[10](https://aapm.onlinelibrary.wiley.com/doi/10.1002/mp.12124)</sup> 由于它报告边界之间的最大偏差，它能捕捉重叠度量遗漏的错误：Dice 系数可能对小而具有临床重要性的边界误差不敏感，特别是对于薄结构。<sup>[11](https://xplorestaging.ieee.org/document/11203990)</sup> AAPM 第211任务组关于 PET 自动分割的报告指出，该度量善于反映两个分割之间的平移以及形状差异。<sup>[10](https://aapm.onlinelibrary.wiley.com/doi/10.1002/mp.12124)</sup>

**离群值问题与 HD95。** 同样的取最大值特性使普通豪斯多夫距离对离群值高度敏感：单个错误标注的像素、标注噪声或参考边界中的不规则性即可主导该值，即使边界其余部分紧密对齐，也会给人以大误差的误导印象。<sup>[11](https://xplorestaging.ieee.org/document/11203990)</sup> 标准的补救方法是豪斯多夫分位数法，其中该度量报告有向距离的 \( q \) 分位数而非最大值，\( q \) 根据应用选择；95百分位变体 HD95 是最常见的选择，度量的是一个距离阈值，95%的边界点到另一边界的距离低于该阈值。<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC4533825/)</sup><sup> • </sup><sup>[11](https://xplorestaging.ieee.org/document/11203990)</sup> HD95 广泛用于危及器官，而平均表面距离和归一化表面距离报告平均边界误差。<sup>[12](https://pmc.ncbi.nlm.nih.gov/articles/PMC13405723/)</sup>

**平均值与排名。** 平均豪斯多夫距离用最近邻距离的均值替代最大值，对一个集合中每一点到另一集合的最小距离取平均，并合并两个有向平均值；它已被应用于脑肿瘤、脑血管、颞骨、前列腺病灶及其他分割任务，并被推荐用于边界复杂且含有血管等细小薄结构的任务。<sup>[19](https://pmc.ncbi.nlm.nih.gov/articles/PMC7817746/)</sup> 然而，在用于比较分割方法时，它带有隐藏的排名误差，已有人提出一种改进的度量——平衡平均豪斯多夫距离——来缓解这一问题。<sup>[13](https://springerlink.fh-diploma.de/article/10.1186/s41747-020-00200-2)</sup>

## 相关度量

倒角距离（Chamfer distance）是最接近的平均化对应物。从 \( A \) 到 \( B \) 的有向倒角距离为 \( c(A,B) = \frac{1}{|A|} \sum_{a \in A} \min_{b \in B} d(a,b) \)，对称版本将两个方向求和。与使用最大最近邻距离的豪斯多夫距离不同，倒角距离对最近邻距离取平均，因此对孤立离群值不太敏感；对称形式一般不是度量，因为它可能违反三角不等式。<sup>[14](https://mathworld.wolfram.com/ChamferDistance.html)</sup> 在表面重建评估中，倒角距离因此被描述为形状差异的平均情况度量，而豪斯多夫距离提供最坏情况的视角。<sup>[15](https://summergeometry.org/sgi2024/a-study-on-surface-reconstruction-from-signed-distance-data-part-2-error-methods/)</sup>

**针对该度量的训练。** 由于现代医学图像分割的损失函数在训练中通常只考虑 Dice 系数或类似的基于区域的度量，豪斯多夫距离等基于边界的量并未被直接优化；已有人提出一种广义表面损失来降低所学分割的豪斯多夫距离。<sup>[16](https://arxiv.org/abs/2302.03868)</sup> 实现质量同样重要：常见的基于距离的度量的开源实现之间，在同一对分割上的豪斯多夫距离差异可超过100毫米，这促使了精确规定的参考实现的出现。<sup>[17](https://arxiv.org/abs/2509.05670)</sup>

## 几何与逼近

在凸几何中，该度量度量紧致凸集之间的距离，并允许用一列在豪斯多夫距离下收敛的多面体来逼近任意凸集。<sup>[4](https://tropp.caltech.edu/notes/Tro18-Lectures-Convex-LN.pdf)</sup> 完备度量空间中该距离的性质也被用于非紧致性测度的理论，其中非空相对紧子集族携带该度量。<sup>[18](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/A4281BFF5A3F50D78CC81888A9739A98/S0004972700028677a.pdf/some_properties_of_the_hausdorff_distance_in_metric_spaces.pdf)</sup>

## References

1. [The Complexity of the Hausdorff Distance, Discrete & Computational Geometry (Springer)](https://link.springer.com/article/10.1007/s00454-023-00562-5)
2. [Hausdorff metric, Encyclopedia of Mathematics](https://encyclopediaofmath.org/wiki/Hausdorff_metric)
3. [A. A. Taha, A. Hanbury (2015). Metrics for evaluating 3D medical image segmentation: analysis, selection, and tool. BMC Medical Imaging.](https://pmc.ncbi.nlm.nih.gov/articles/PMC4533825/)
4. [J. Tropp. Lecture 7: Hausdorff Distance, Caltech lecture notes](https://tropp.caltech.edu/notes/Tro18-Lectures-Convex-LN.pdf)
5. [M. Kapovich. Notes on geometric group theory: the Hausdorff distance on compact subsets, UC Davis](https://www.math.ucdavis.edu/~kapovich/EPR/ggt.pdf)
6. [Who Invented the Gromov-Hausdorff Distance? arXiv](https://arxiv.org/abs/1612.00728)
7. [scipy.spatial.distance.directed_hausdorff, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.directed_hausdorff.html)
8. [An efficient computational algorithm for Hausdorff distance based on points-ruling-out and systematic random sampling, Pattern Recognition](https://www.sciencedirect.com/science/article/pii/S0031320321000443)
9. [The directed Hausdorff distance between imprecise point sets, Theoretical Computer Science](https://www.sciencedirect.com/science/article/pii/S0304397511001058)
10. [M. Hatt et al. (2017). Classification and evaluation strategies of auto-segmentation approaches for PET: Report of AAPM Task Group No. 211. Medical Physics.](https://aapm.onlinelibrary.wiley.com/doi/10.1002/mp.12124)
11. [DIR-YOLO: Segmentation of Alveolar Bone and Mandibular Canal in CBCT Images, IEEE Xplore](https://xplorestaging.ieee.org/document/11203990)
12. [Language-Guided Segmentation of Medical Images: A Review of Foundation Models, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC13405723/)
13. [On the usage of average Hausdorff distance for segmentation performance assessment: hidden error when used for ranking, European Radiology Experimental](https://springerlink.fh-diploma.de/article/10.1186/s41747-020-00200-2)
14. [Chamfer Distance, Wolfram MathWorld](https://mathworld.wolfram.com/ChamferDistance.html)
15. [A Study on Surface Reconstruction from Signed Distance Data Part 2: Error Methods, SGI 2024](https://summergeometry.org/sgi2024/a-study-on-surface-reconstruction-from-signed-distance-data-part-2-error-methods/)
16. [A Generalized Surface Loss for Reducing the Hausdorff Distance in Medical Imaging Segmentation, arXiv](https://arxiv.org/abs/2302.03868)
17. [MeshMetrics: A Precise Implementation of Distance-Based Image Segmentation Metrics, arXiv](https://arxiv.org/abs/2509.05670)
18. [Some properties of the Hausdorff distance in metric spaces, Bulletin of the Australian Mathematical Society](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/A4281BFF5A3F50D78CC81888A9739A98/S0004972700028677a.pdf/some_properties_of_the_hausdorff_distance_in_metric_spaces.pdf)
19. [pmc.ncbi.nlm.nih.gov](https://pmc.ncbi.nlm.nih.gov/articles/PMC7817746/)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 几何学与拓扑学 › Metric, convex, and discrete geometry

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/hausdorff-distance

English original: https://www.edgepedia.org/hausdorff-distance
