Created
April 16, 2017 07:19
-
-
Save rejunity/a0c2b874668aed725df1adb262648ffd to your computer and use it in GitHub Desktop.
Histrogram style loss based on "Stable and Controllable Neural Texture Synthesis and Style Transfer Using Histogram Losses" (4.3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# output -- per layer feature-map of the image we optimize | |
# style -- per layer feature-map of the style image we want to copy | |
# histogram_matching() -- see reference numpy implementation http://stackoverflow.com/a/33047048/7873678 | |
output_remapped = histogram_matching(output, style, nbins=1024) # non-differentiable | |
sum((output_image - output_remapped)**2) # gradients assume that output_remapped ~~ const |
where is the histogram calculation function ?
Hi there, I see you wrote 'non-differentiable' as a comment there, so could this be used in back-propagation?
The line with that comment isn't differentiable, but the line below it is. So histogram loss (the two lines in combination) can be used in back propagation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there, I see you wrote 'non-differentiable' as a comment there, so could this be used in back-propagation?