CVPR '21: In the light of feature distributions: Moment matching for Neural Style Transfer

Overview

In the light of feature distributions: Moment matching for Neural Style Transfer (CVPR 2021)

This repository provides code to recreate results presented in In the light of feature distributions: Moment matching for Neural Style Transfer.

For more information, please see the project website


Contact

If you have any questions, please let me know

Instructions

Running neural style transfer with Central Moment Discrepancy is as easy as running

python main.py --c_img ./path/to/content.jpg --s_img ./path/to/style.jpg

You have the following command line arguments to change to your needs:

  --c_img         The content image that is being stylized.
  --s_img         The style image
  --epsilon       Iterative optimization is stopped if delta value of 
                  moving average loss is smaller than this value.
  --max_iter      Maximum iterations if epsilon is not surpassed
  --alpha         Convex interpolation of style and content loss 
                  (should be set high > 0.9 since we start with content as target)
  --lr            Learning rate of Adam optimizer
  --im_size       Output image size. Can either be single integer for keeping aspect ratio or tuple.

Citations

@article{kalischek2021light,
      title={In the light of feature distributions: moment matching for Neural Style Transfer}, 
      author={Nikolai Kalischek and Jan Dirk Wegner and Konrad Schindler},
      year={2021},
      eprint={2103.07208},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
You might also like...
Fast Neural Style for Image Style Transform by Pytorch
Fast Neural Style for Image Style Transform by Pytorch

FastNeuralStyle by Pytorch Fast Neural Style for Image Style Transform by Pytorch This is famous Fast Neural Style of Paper Perceptual Losses for Real

PyTorch implementation of neural style transfer algorithm
PyTorch implementation of neural style transfer algorithm

neural-style-pt This is a PyTorch implementation of the paper A Neural Algorithm of Artistic Style by Leon A. Gatys, Alexander S. Ecker, and Matthias

Neural style transfer in PyTorch.
Neural style transfer in PyTorch.

style-transfer-pytorch An implementation of neural style transfer (A Neural Algorithm of Artistic Style) in PyTorch, supporting CPUs and Nvidia GPUs.

Towards Ultra-Resolution Neural Style Transfer via Thumbnail Instance Normalization
Towards Ultra-Resolution Neural Style Transfer via Thumbnail Instance Normalization

Towards Ultra-Resolution Neural Style Transfer via Thumbnail Instance Normalization Official PyTorch implementation for our URST (Ultra-Resolution Sty

Official PyTorch implementation of
Official PyTorch implementation of "ArtFlow: Unbiased Image Style Transfer via Reversible Neural Flows"

ArtFlow Official PyTorch implementation of the paper: ArtFlow: Unbiased Image Style Transfer via Reversible Neural Flows Jie An*, Siyu Huang*, Yibing

Neural style transfer as a class in PyTorch

pt-styletransfer Neural style transfer as a class in PyTorch Based on: https://github.com/alexis-jacq/Pytorch-Tutorials Adds: StyleTransferNet as a cl

PyTorch implementation of paper: AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer, ICCV 2021.
PyTorch implementation of paper: AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer, ICCV 2021.

AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer [Paper] [PyTorch Implementation] [Paddle Implementation] Overview This reposit

Implementation of Neural Style Transfer in Pytorch

PytorchNeuralStyleTransfer Code to run Neural Style Transfer from our paper Image Style Transfer Using Convolutional Neural Networks. Also includes co

This script runs neural style transfer against the provided content image.
This script runs neural style transfer against the provided content image.

Neural Style Transfer Content Style Output Description: This script runs neural style transfer against the provided content image. The content image m

Comments
  • Some questions about loss function

    Some questions about loss function

    Hello, senior, I am a graduate student majoring in electronic information from Hangzhou Normal University, Hangzhou, China. I read your article "In the light of feature distributions: moment matching for Neural Style Transfer" and I am deeply inspired. I read your code, but I don’t quite understand the high-order moment loss function. I have some puzzles to ask: 1. This is a method based on image iteration, whether the input of ContentLoss is the feature map of the content image and generated image extracted by relu4_1 , the input of StyleLoss is the feature map of the style image and generated image extracted by multiple relus ? 2. Can you explain in detail how the style loss is calculated? Scientific research is not easy, look forward to it!

    opened by zq-hznu 7
  • Fig.2 in your paper is misleading

    Fig.2 in your paper is misleading

    Apparently:

    1. 1D OT is not equivalent to 1D MMD.
    2. 1D MMD may fail, but 1D OT can surely align these two distributions without difficulty.

    Although these flaws have no influence on your algorithm, it weakens your argument: why on earth do we need CMD?. Therefore if I were the reviewer I would not suggest publication without modification of this part of the paper.

    Nevertheless you could suggest OT is hard to compute or whatever in this case.

    Anyway, Fig.2 is misleading and may confuse a large number of readers.

    opened by wzm2256 2
  • About the code running can not get the result

    About the code running can not get the result

    Hi, I am very interested in your article. But when I run the code according to the prompt you gave, the pictures that need to be updated cannot be updated. The loss obtained in the first iteration is the same as the second, resulting in a Delta smaller than eps, why is this? image

    opened by Tianzh3n 1
  • numeral issue about the power over than 3

    numeral issue about the power over than 3

    Hi experts, The loss function use monomial to align distribution between stylized and style images. https://github.com/D1noFuzi/cmd_styletransfer/blob/e398885c13410126074924e94530630be092351e/losses.py#L53

    However, assumed the feature values to smallest or highest, if some value pass with sigmoid function mapped between 0.0 and 1.0 which almost distribution is concentrated in 0.0 or 1.0! And Then proposed method not useful for calculating loss over than pow 3 which closed to 0.0, but original feature distribution have "large oscillation".

    You can see the results from other paper, the sky (low frequency) or fog(like noise) mapping to wrong style patterns. https://arxiv.org/pdf/2203.07740.pdf

    opened by BossunWang 0
Owner
Nikolai Kalischek
Nikolai Kalischek
Two-Stage Peer-Regularized Feature Recombination for Arbitrary Image Style Transfer

Two-Stage Peer-Regularized Feature Recombination for Arbitrary Image Style Transfer Paper on arXiv Public PyTorch implementation of two-stage peer-reg

NNAISENSE 38 Oct 14, 2022
Official PyTorch implementation of Retrieve in Style: Unsupervised Facial Feature Transfer and Retrieval.

Retrieve in Style: Unsupervised Facial Feature Transfer and Retrieval PyTorch This is the PyTorch implementation of Retrieve in Style: Unsupervised Fa

null 60 Oct 12, 2022
Style transfer, deep learning, feature transform

FastPhotoStyle License Copyright (C) 2018 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons

NVIDIA Corporation 10.9k Jan 2, 2023
Lipstick ain't enough: Beyond Color-Matching for In-the-Wild Makeup Transfer (CVPR 2021)

Table of Content Introduction Datasets Getting Started Requirements Usage Example Training & Evaluation CPM: Color-Pattern Makeup Transfer CPM is a ho

VinAI Research 248 Dec 13, 2022
Code for "LoFTR: Detector-Free Local Feature Matching with Transformers", CVPR 2021

LoFTR: Detector-Free Local Feature Matching with Transformers Project Page | Paper LoFTR: Detector-Free Local Feature Matching with Transformers Jiami

ZJU3DV 1.4k Jan 4, 2023
LoFTR:Detector-Free Local Feature Matching with Transformers CVPR 2021

LoFTR-with-train-script LoFTR:Detector-Free Local Feature Matching with Transformers CVPR 2021 (with train script --- unofficial ---). About Megadepth

Nan Xiaohu 15 Nov 4, 2022
Implementation of CVPR 2021 paper "Spatially-invariant Style-codes Controlled Makeup Transfer"

SCGAN Implementation of CVPR 2021 paper "Spatially-invariant Style-codes Controlled Makeup Transfer" Prepare The pre-trained model is avaiable at http

null 118 Dec 12, 2022
Code for our CVPR 2021 Paper "Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes".

Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes (CVPR 2021) Project page | Paper | Colab | Colab for Drawing App Rethinking Style

CompVis Heidelberg 153 Jan 4, 2023
Simple Tensorflow implementation of "Adaptive Convolutions for Structure-Aware Style Transfer" (CVPR 2021)

AdaConv — Simple TensorFlow Implementation [Paper] : Adaptive Convolutions for Structure-Aware Style Transfer (CVPR 2021) Note This repository does no

Junho Kim 26 Nov 18, 2022
SurfEmb (CVPR 2022) - SurfEmb: Dense and Continuous Correspondence Distributions

SurfEmb SurfEmb: Dense and Continuous Correspondence Distributions for Object Pose Estimation with Learnt Surface Embeddings Rasmus Laurvig Haugard, A

Rasmus Haugaard 56 Nov 19, 2022