Home

Awesome

<h1> A Unified Framework for Implicit Sinkhorn Differentiation </h1>

Implementation of the CVPR 2022 paper ([paper],[arXiv]). We analyze the use of implicit gradients for generic Sinkhorn layers within a neural network. In the paper, we provide extensive theoretical and empirical analysis. Here, we provide the PyTorch source code for many of the experiments from the paper.

Usage

Sinkhorn module

pip3 install torch

Setting up the repo

pip3 install torch torchvision numpy scipy opencv-python matplotlib

Alternatively, the repo can be installed directly via anaconda:

conda env create --name implicit_sinkhorn_env -f implicit_sinkhorn_env.yml
conda activate implicit_sinkhorn_env

Experiments

We provide an implementation of two experimental settings, where the Sinkhorn module in sinkhorn/sinkhorn.py is at the core of both of them.

Image barycenter

python3 main_image_barycenter.py 1 4
python3 main_image_barycenter.py 1 4 --backward_type ad

MNIST k-means clustering

python3 main_mnist_kmeans.py

Citation

If you use our implementation, please cite:

@article{eisenberger2022unified,
  title={A Unified Framework for Implicit Sinkhorn Differentiation},
  author={Eisenberger, Marvin and Toker, Aysim and Leal-Taix{\'e}, Laura and Bernard, Florian and Cremers, Daniel},
  journal={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year={2022}
}