Transfer the style of an image to a content image using VGG19 and different feature transform methods (Exact Optimal Transport, OT between Gaussian mixtures, between Gaussians, and Universal Style Transfer). [demo!] [report]
Adaptation of pietrocarbo/deep-transfer for Master MVA's image processing course project.
References:
- Li, Y., Fang, C., Yang, J., Wang, Z., Lu, X., & Yang, M. H. (2017). Universal style transfer via feature transforms. Advances in neural information processing systems, 30.
- Mroueh, Y. (2019). Wasserstein style transfer. arXiv preprint arXiv:1905.12828.
- Delon, J., Desolneux, A. (2020). A Wasserstein-type distance in the space of Gaussian mixture models. SIAM Journal on Imaging Sciences, 13(2), 936-970.
- numpy, torch, torchvision, scikit-learn, pillow
- POT (Python Optimal Transport), but make sure to have a version that fixes issue #689 or apply patch in
pot-patch/.
python main.py <content> <style> <method> [--out OUT] [--alpha ALPHA] [--K K]content: Path to the content image (must be in.jpgor.pngformat).style: Path to the style image (must be in.jpgor.pngformat).method: Feature transform type to use for style transfer. Available methods:exact: Wasserstein Style Transferwct: Universal Style Transfergaussian: Gaussian-based feature transfergmmot-bary: GMM-OT barycentric mapgmmot-rand: GMM-OT random map
--out: Directory where the stylized results will be saved (default:./outputs/).--alpha: Balance between the original content and stylized features (0 to 1, default: 0.2).--K: Number of Gaussian components for GMM-OT (default: 2).
python main.py ./inputs/content/content1.jpg ./inputs/style/style2.jpg gmmot-bary --alpha 0.2 --K 5 --out ./results/applies the GMM-OT transform to apply style2.jpg to content1.jpg with a balance factor of 0.2, using a Gaussian mixture with 5 components, and saves the result in the ./results/ directory.
(In columns) Gaussian, GMMOT(2), GMMOT(5) and Exact-OT :

Barycenters :

