This is the official implementation of the HOT solver. Our paper has been published online at IEEE Transactions on Pattern Analysis and Machine Intelligence.
HOT is designed to solve reduced 2D optimal transport model which can be formulated as a standard linear programming problem:
First, install the necessary packages listed in requirements.txt. For the PyTorch package, we encourage you to visit the official PyTorch website to download the version compatible with your CUDA Toolkit.
pip install -r requirements.txtpython -m demo.pyThe pipeline of this demo is like following:
- Specify the paths to the two images used for the OT problem.
- Specify the desired crop size
$(m, n)$ of two images. - Read the images, convert them to grayscale images, resize and perform
$\ell_{1}$ normalization. - Generate
$b$ and$c$ . - Exucute the HOT Solver.
For computing Kantorovich-Wasserstein distance between two images, you only need to
The HOT solver runs
Apart from the high computational efficiency, HOT also enjoys an 
The ColorTransfer folder contains a Jupyter notebook, color_transfer.ipynb, which provides a detailed walkthrough of performing color transfer using the HOT Solver.
@article{zhang2025hot,
title={HOT: An efficient Halpern accelerating algorithm for optimal transport problems},
author={Zhang, Guojun and Gu, Zhexuan and Yuan, Yancheng and Sun, Defeng},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
year={2025},
publisher={IEEE}
}