We present an algorithm and package, Redistributor, which forces a collection of scalar samples to follow a desired distribution. When given independent and identically distributed samples of some random variable $S$ and the continuous cumulative distribution function of some desired target $T$, it provably produces a consistent estimator of the transformation $R$ which satisfies $R(S)=T$ in distribution. As the distribution of $S$ or $T$ may be unknown, we also include algorithms for efficiently estimating these distributions from samples. This allows for various interesting use cases in image processing, where Redistributor serves as a remarkably simple and easy-to-use tool that is capable of producing visually appealing results. For color correction it outperforms other model-based methods and excels in achieving photorealistic style transfer, surpassing deep learning methods in content preservation. The package is implemented in Python and is optimized to efficiently handle large datasets, making it also suitable as a preprocessing step in machine learning. The source code is available at https://github.com/paloha/redistributor.
翻译:我们提出了一种算法及相应软件包——Redistributor,该工具能够强制将一组标量样本转换为符合目标分布的样本。当给定随机变量$S$的独立同分布样本以及目标变量$T$的连续累积分布函数时,该算法可证明地生成变换$R$的一致性估计量,该变换满足分布意义上的$R(S)=T$关系。由于$S$或$T$的分布可能未知,我们还提供了从样本中高效估计这些分布的算法。这使得该工具在图像处理领域具有多种有趣的应用场景:Redistributor作为一种极其简洁易用的工具,能够生成视觉效果出众的结果。在色彩校正任务中,其性能优于其他基于模型的方法;在实现逼真风格迁移方面表现卓越,且在内容保持度上超越了深度学习方法。该软件包采用Python实现,并针对大规模数据集进行了效率优化,因此也适用于机器学习中的预处理环节。源代码发布于https://github.com/paloha/redistributor。