EMD Earth Movers Distance

EMD距离即Earth Mover's Distance,是由2000年IJCV期刊文章《The Earth Mover's Distance as a Metric for Image Retrieval》提出的一种图像相似度度量方法,从文章标题也可以得知,最初EMD的概念是用于图像检索的。后来因为其各种优点,逐渐用到其他方面的相似度度量。这篇文章主要理解EMD的概念。

signature
论文定义,“We introduce a distance between two signatures that we call the Earth Mover's Distance(EMD)”,那么这里的signature是什么呢?

1.图像的直方图就是把全部像素值量化为一系列bin,统计每个bin的像素个数;bin值可以看作特征,bin高度可以看作该特征的重要程度。

2.而 signature 定义为一系列的重要特征,可以写作 s = (m, w),m是某个特征,w是该特征的权重。文中说“A signature is a set of the main clusters or modes of a distribution”,作者认为,传统的完整直方图一般会聚集在某些bin上,这样过于浪费空间,用 signature 可以较稀疏的表达直方图内容。

事实上,虽然原文章是由 histogram 引出 signature 及 EMD 的定义,但实际用于计算EMD时,因为不同情况的使用方式不同,只要是符合要求的特征即可。

EMD
EMD本身是一个线性规划问题。假设,EMD Earth Movers Distance

EMD Earth Movers Distance

然后来通俗点理解EMD的本质:  Earth Move翻译过来是搬土,指把P位置的m个坑的土,用最小的代价搬到Q位置的n个坑中,dij是pi到qj两个坑的距离,fij是从pi搬到qj的土量,则WORK工作量就是要最小化的目标。线性规划求解出fij后,再用fij对WORK作个归一化,就得到了EMD。
 那么问题来了,为什么要用这个运输问题来定义 EMD 呢?
 论文给的解释是,"Signature matching can be naturally cast as a transportation problem by de fining one signature as the supplier and the other as the consumer, and by setting the cost for a supplier-consumer pair to equal the ground distance between an element in the fi rst signature and an element in the second."   这意味着,在求解出最优运输方案 [fij] 时,同时也找到了两边最匹配的signature,如此一来计算的distance是合理的,所以EMD图像相似度匹配是有效的。