Skip to main content
QUICK REVIEW

[Paper Review] On the Computation of Kantorovich-Wasserstein Distances between 2D-Histograms by Uncapacitated Minimum Cost Flows

Federico Bassetti, Stefano Gualandi|arXiv (Cornell University)|Apr 2, 2018
Advanced Numerical Analysis TechniquesEngineering48 references10 citations
TL;DR

This paper proposes an efficient method to compute the 1st-order Kantorovich-Wasserstein distance between 2D histograms by reformulating the problem as an uncapacitated minimum cost flow on a reduced network. For 1-norm and ∞-norm costs, it achieves exact solutions in O(n) time; for 2-norm costs, it provides an O(n)-sized network with a provable error bound ε, enabling fast, scalable computation on large images like 512×512 with sub-0.12% error.

ABSTRACT

In this work, we present a method to compute the Kantorovich-Wasserstein distance of order one between a pair of two-dimensional histograms. Recent works in Computer Vision and Machine Learning have shown the benefits of measuring Wasserstein distances of order one between histograms with $n$ bins, by solving a classical transportation problem on very large complete bipartite graphs with $n$ nodes and $n^2$ edges. The main contribution of our work is to approximate the original transportation problem by an uncapacitated min cost flow problem on a reduced flow network of size $O(n)$ that exploits the geometric structure of the cost function. More precisely, when the distance among the bin centers is measured with the 1-norm or the $\infty$-norm, our approach provides an optimal solution. When the distance among bins is measured with the 2-norm: (i) we derive a quantitative estimate on the error between optimal and approximate solution; (ii) given the error, we construct a reduced flow network of size $O(n)$. We numerically show the benefits of our approach by computing Wasserstein distances of order one on a set of grey scale images used as benchmark in the literature. We show how our approach scales with the size of the images with 1-norm, 2-norm and $\infty$-norm ground distances, and we compare it with other two methods which are largely used in the literature.

Motivation & Objective

  • To accelerate the computation of Kantorovich-Wasserstein distances between 2D histograms, which are critical in computer vision and machine learning but computationally expensive.
  • To address the scalability issue of solving large-scale transportation problems on complete bipartite graphs with O(n²) edges for n-bin histograms.
  • To reduce the problem size from O(n²) to O(n) by exploiting geometric structure of the cost function, enabling faster and memory-efficient computation.
  • To provide a provable error bound for approximate solutions when using the Euclidean (2-norm) distance as the ground metric.
  • To demonstrate the method's superiority in runtime and accuracy over existing approaches like Network Simplex and Sinkhorn’s algorithm.

Proposed method

  • Reformulate the 2D histogram Wasserstein distance computation as an uncapacitated minimum cost flow problem on a directed graph with a structured topology.
  • Construct a reduced flow network of size O(n) that preserves optimality for 1-norm and ∞-norm cost functions by leveraging the geometric properties of the underlying distance metric.
  • For the 2-norm case, derive a parameterized approximation scheme using a grid resolution parameter L, where L controls the approximation accuracy and network size.
  • Prove that the original transportation problem and the reduced min-cost flow problem are equivalent when the cost function is a distance, ensuring correctness for 1- and ∞-norms.
  • Establish a quantitative error estimate between the approximate and exact solutions in the 2-norm case, showing that the error is bounded by ε for a network of size O(n) when L ≥ N−1.
  • Implement and benchmark the method using classical image datasets, comparing runtime and accuracy against Network Simplex and Sinkhorn’s algorithm.

Experimental results

Research questions

  • RQ1Can the computation of Kantorovich-Wasserstein distances between 2D histograms be accelerated by reducing the size of the underlying network flow problem while preserving optimality or providing a bounded error?
  • RQ2Is it possible to construct a reduced flow network of size O(n) that yields the exact Wasserstein distance when the ground distance is the 1-norm or ∞-norm?
  • RQ3What is the theoretical error bound between the approximate and exact Wasserstein distances when using a reduced network for the Euclidean (2-norm) ground distance?
  • RQ4How does the proposed method scale in practice on large images (e.g., 512×512) compared to existing methods like Network Simplex and Sinkhorn’s algorithm?
  • RQ5Can the approximation scheme achieve both high speed and high accuracy, with error below a user-defined threshold ε, in a practical setting?

Key findings

  • For 1-norm and ∞-norm ground distances, the proposed method computes the exact Wasserstein distance using a flow network of size O(n), significantly reducing computational complexity compared to the full O(n²) transportation problem.
  • For the 2-norm ground distance, the method provides an approximate solution with a provable error bound: for L = N−1, the error is less than 0.12% on 512×512 images.
  • The method achieves sub-20-minute runtime for computing Wasserstein distances between 512×512 images using the 2-norm approximation with L=10, demonstrating practical scalability.
  • The proposed approach is consistently faster than the Network Simplex-based method from [29], especially for larger image sizes, with performance gains increasing with resolution.
  • Compared to Sinkhorn’s algorithm, the method is not only faster (up to two orders of magnitude for the same optimality gap) but also guarantees a bounded error, unlike the heuristic Sinkhorn approach.
  • The implementation outperforms both exact and approximate baselines in runtime while maintaining high accuracy, particularly when parallelization is not available (e.g., single-threaded Network Simplex vs. 20-threaded Sinkhorn).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.