Numerical
Optimal Transport
http://optimaltransport.github.io

Applications
Gabriel Peyré
www.numerical-tours.com
ÉCOLE NORMALES U P É R I E U R E

Grayscale Image Equalization

Figure 2.9: 1-D optimal couplings: each arrow xi æ yj indicates a non-zero Pi,j in the optimal
coupling. Top: empirical measures with same number of points (optimal matching). Bottom: genericcase. This corresponds to monotone rearrangements, if xi Æ xiÕ are such that Pi,j ”= 0, PiÕ ,j Õ ”= 0, thennecessarily yj Æ yj Õ .

t=0

t = 0.25

t = 0.5t = .75

t=1Figure 2.10: Histogram equalization for image processing, where t parameterizes the displacement
interpolation between the histograms.

an equalized version of x̄, whose empirical distribution matches exactly the one ofȳ. The equalized version of that image can be recovered by folding back that nmdimensional vector as an image of size n ◊ m. Also, t œ [0, 1] ‘æ (1 ≠ t)x̄ + tȳ
de-Image Color Palette Equalization
OptimaltransportShape Interpolation

MRI Data Procesing [with A. Gramfort]
Ground cost c = dM : geodesic on cortical surface M .

L2 barycenter

W22 barycenter

Gradient Flows Simulation

https://www.youtube.com/watch?v=tDQw21ntR64
Tim Whittaker (New Zealand)OT Loss for Diffeomorphic Registration+ȩȒɔʕɾǞȘǃ ɾǕƚ °÷ ˙ƇƚȀǞɾʿ ŏɾ ŏ żȩɯɾ ȩ

Joint work with J. Feydy, B. Charier, F-X. Vialard.
Shape registration:

min D('(µ), ⌫) + R(')' di↵eo
regularityloss

Hilbertian loss (MMD/RKHS):

D(µ, ⌫) = ||k ? (µ⌫)||2L2+ȩȒɔʕɾǞȘǃ ɾǕƚ °÷ ˙ƇƚȀǞɾʿ ŏɾ ŏ żȩɯɾ ȩSinkhorn divergence:D(µ, ⌫) = W̄" (µ, ⌫)it 250_Ǟǃʕɟƚࠊ ëɾŏɟɾǞȘǃ ƚɯɾǞȒŏɾƚࠒ

output⌫) ? k_Ǟǃʕɟƚࠊ +ȩȒɔʕɾǞȘǃ ɾǕƚ °÷ ɔȀŏȘࠒ

outputinputit 0⌫

input(µµ! Do not use OT for registration . . . but as a loss.
! Sinkhorn’s iterates “propagate” a small bandwidth kernel.
! Automatic di↵erentation: game changer for advanced loss and models.

Bag of Wordsµ⌫
The Word Mover’s Distance[Kusner’15]

dist(D1 , D2 ) = W2 (µ, ⌫)Topic Models[Rolet’16]

Shapeswith
VladimirAnalysis
G. KimSuvritSra Gromov-WassersteinphineAdobe ResearchMITUse T to define registration between:
Shape

Colorsdistribution

Shape

Shape

Teddies
Humans
Four-legged
Armadillo

0.02

000.02
Figure 15: MDS embedding of four classes from SHREC dataset.
00.02

0.04

Teddies
Humans
Four-legged
Armadillo

40

1!"" " " " " " " # " " " " " " " $ !"" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" $Source

0.02

Targets

51530

PCA 2

18: Mapping a set of 185 images onto a two shapes while
Figure 1: Entropic GW can find correspondences
between a source Figure
preserving color similarity. (Images from Flickr public domain collection.)
0.5
0 a surface with similar structure, a surface withsurface (left) andGW
distances
Geodesic distances cloud, an icon,
ShapesRand D ∈ R
we are given symmetricweight matrices
MDS
shared semantic structure, a noisy 3D point
andaW ∈ Rand W ∈ R. We could solve a weighted
000.020.04 0.02
version of the GW matching problem(3) that prioritizes maps
(X)
Vizualization
handsdrawing.
Each fuzzy map was computed
using the same code. preserving distances corresponding
s0to large W values:
n0 ×n0+

251

45

020

35

n×n+

α1

MDS
2-DFigure
16: Recovery of galloping algorithm
horse sequence. thatIn this paper, we propose
a newincorrespondenceminPCA 1

40n0 ×n0+

10

Figure 15: MDS embedding of four classes from
0 SHREC dataset.
0.5
1n×n+

Γ∈M5!
ijkℓ(D0ij −Dkℓ )2 Γik ΓjℓW0ijWjℓ µ0i µ0j µk µℓ .

MDS in 3-D(8)minimizes distortion of long-0 isandshort-range
We For instance, (W , W) might contain confidence values expressing Te
the baseshape) as a feature distances
vector for shape i.alike.
We reproduce
the quality of the entries of (D , D). Or, W , W could take values Hu
the result
presented ofin theworkof Rustamov et al., recovering
study an entropically-regularizedversion
theGromov-Wassersteinin {ε, 1} reducing the weight of distances that are unknown or do Fo
the circular structure of meshes from a galloping horse animationAr
not need to
be preserved by Γ.
0.02
sequence (Figure16).[Mémoli
Unlike Rustamov
et al., however,our method(GW) mapping objective function
from2011]
measuring
Figure 18: Mapping
a set of 185 images onto a two shapes while
does not require ground truth maps between shapes as input.
Following the same simplifications as §3.1, we can optimize thispreserving
colorsimilarity.
(Images frompublicwhere
domain collection.)
0.5⟨Γ,Flickr
Λ (Γ)⟩,
the distortion of geodesic distances. The optimizer is a probabilistic objective by minimizing
5.2 Supervised Matchingn ×n
1
matching expressed as a “fuzzy”
correspondence matrix in Rthe
style
0 are:=given
and D ∈ Rn×n
weight matrices[D symmetric⊗ W ][[µ ]]Γ[[µ]]W++ Λwe(Γ)
2n ×nn×n
Animportantfeatureofa
matching
toolistheabilitytoincorporate
W0 ∈ Rofand W ∈ R+ −.[DWecould
a weightedof [Kim et al. 2012; Solomonuser
etinput,al. e.g.
2012];
we control sharpness+⊗W][[µ solve]]Γ[[µ]][D⊗ W]
ground truth matches of points or regions. In theversion
oftheGW
matching
problem(3)that
prioritizes
maps 0α1
GW framework,
oneentropic
way to enforce these
constraints
is to provide
Figure1:The
databasethathasbeenused,divid
the correspondence viaof theregularizer.
00.02
W[[µ]]Γ[[µ]][D⊗W]+0.04
0 the weight
preserving distances corresponding to large W values:
0.0200150PCA 230

W00251

W04510αa stencil S specifying a sparsity pattern for the map Γ. Incorporating

0000002035∧2020∧20