Table of Contents
Fetching ...

Efficient approximation of Earth Mover's Distance Based on Nearest Neighbor Search

Guangyu Meng, Ruyu Zhou, Liu Liu, Peixian Liang, Fang Liu, Danny Chen, Michael Niemier, X. Sharon Hu

TL;DR

The paper tackles the high computational burden of exact Earth Mover's Distance (EMD) by introducing NNS-EMD, an approximation that uses nearest-neighbor search to replace exhaustive pairwise comparisons and enable efficient, GPU-accelerated computation. It provides theoretical error bounds and time-complexity analyses, along with a GPU-accelerated implementation and extensive experiments showing speedups from 44x to 135x and competitive accuracy against state-of-the-art approximations across image classification, retrieval, and color-transfer tasks. By producing a transport mapping and demonstrating memory efficiency, NNS-EMD broadens EMD's applicability to large-scale CV and NLP problems and transport-based image editing. The work also discusses robustness and practical considerations and outlines directions for differentiable extensions and broader optimal-transport settings.

Abstract

Earth Mover's Distance (EMD) is an important similarity measure between two distributions, used in computer vision and many other application domains. However, its exact calculation is computationally and memory intensive, which hinders its scalability and applicability for large-scale problems. Various approximate EMD algorithms have been proposed to reduce computational costs, but they suffer lower accuracy and may require additional memory usage or manual parameter tuning. In this paper, we present a novel approach, NNS-EMD, to approximate EMD using Nearest Neighbor Search (NNS), in order to achieve high accuracy, low time complexity, and high memory efficiency. The NNS operation reduces the number of data points compared in each NNS iteration and offers opportunities for parallel processing. We further accelerate NNS-EMD via vectorization on GPU, which is especially beneficial for large datasets. We compare NNS-EMD with both the exact EMD and state-of-the-art approximate EMD algorithms on image classification and retrieval tasks. We also apply NNS-EMD to calculate transport mapping and realize color transfer between images. NNS-EMD can be 44x to 135x faster than the exact EMD implementation, and achieves superior accuracy, speedup, and memory efficiency over existing approximate EMD methods.

Efficient approximation of Earth Mover's Distance Based on Nearest Neighbor Search

TL;DR

The paper tackles the high computational burden of exact Earth Mover's Distance (EMD) by introducing NNS-EMD, an approximation that uses nearest-neighbor search to replace exhaustive pairwise comparisons and enable efficient, GPU-accelerated computation. It provides theoretical error bounds and time-complexity analyses, along with a GPU-accelerated implementation and extensive experiments showing speedups from 44x to 135x and competitive accuracy against state-of-the-art approximations across image classification, retrieval, and color-transfer tasks. By producing a transport mapping and demonstrating memory efficiency, NNS-EMD broadens EMD's applicability to large-scale CV and NLP problems and transport-based image editing. The work also discusses robustness and practical considerations and outlines directions for differentiable extensions and broader optimal-transport settings.

Abstract

Earth Mover's Distance (EMD) is an important similarity measure between two distributions, used in computer vision and many other application domains. However, its exact calculation is computationally and memory intensive, which hinders its scalability and applicability for large-scale problems. Various approximate EMD algorithms have been proposed to reduce computational costs, but they suffer lower accuracy and may require additional memory usage or manual parameter tuning. In this paper, we present a novel approach, NNS-EMD, to approximate EMD using Nearest Neighbor Search (NNS), in order to achieve high accuracy, low time complexity, and high memory efficiency. The NNS operation reduces the number of data points compared in each NNS iteration and offers opportunities for parallel processing. We further accelerate NNS-EMD via vectorization on GPU, which is especially beneficial for large datasets. We compare NNS-EMD with both the exact EMD and state-of-the-art approximate EMD algorithms on image classification and retrieval tasks. We also apply NNS-EMD to calculate transport mapping and realize color transfer between images. NNS-EMD can be 44x to 135x faster than the exact EMD implementation, and achieves superior accuracy, speedup, and memory efficiency over existing approximate EMD methods.
Paper Structure (18 sections, 4 theorems, 8 equations, 5 figures, 7 tables, 1 algorithm)

This paper contains 18 sections, 4 theorems, 8 equations, 5 figures, 7 tables, 1 algorithm.

Key Result

Lemma 1

Assume for an $i \!\in\!\{1,2, \ldots, m\}$, the $i$-th supplier from $S$ has at least one matched consumer for $\Delta$ iterations for an integer $\Delta\!>\!0$. Without loss of generality, assume $i \!\in\! \mathbf{m}^{(t_1)}\cap \mathbf{m}^{(t_2)}\cap \cdots \cap \mathbf{m}^{(t_\Delta)}$ with $t_ implying that $\mathbf{F}^*$ is a feasible solution to objective satisfying constraints inflow and

Figures (5)

  • Figure 1: Execution time ($y$-axis) versus classification accuracy ($x$-axis) among exact EMD and SOTA approximate EMD algorithms for the MNIST dataset lecun1998gradient.
  • Figure 2: A toy example illustrating the execution flow of NNS-EMD. The inputs are $C$ and $S$, two sets of data points with weights and position coordinates (e.g., pixels in two images). "w/ " denotes "with". In steps 1-(a) and 2-(a), NNS-EMD identifies the nearest neighbor (NN) in $S$ for each point in $C$ to form groups based on the $L_2$ distance. Steps 1-(b) and 2-(b) compute flows between the NN pairs in $S$ and $C$ and calculate the cost for each group. Steps 1-(c) and 2-(c) update the weight for each data point and eliminate the points with zero weight.
  • Figure 3: Qualitative comparison of color transfer results. The top-left image is the source image, and the bottom-left image is the reference image. The remaining images show color transfers produced by NNS (ours), DPT, HIS, TPS, RHG, and M3S. Red boxes indicate zoom-in regions for detailed inspection.
  • Figure 4: Mean (SD) of quantitative evaluation for color transfer.
  • Figure 5: Memory usage comparison of various approximate EMD algorithms.

Theorems & Definitions (4)

  • Lemma 1: $\mathbf{F}^*$ is a feasible solution
  • Theorem 1: Error bound of EMD approximation by NNS-EMD
  • Theorem 2: Exactness of EMD approximation by NNS-EMD
  • Theorem 3: Time Complexity of NNS-EMD