Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-issue: Transfer style but not the colors #244

Open
Yotooon opened this issue Jun 10, 2016 · 15 comments
Open

Non-issue: Transfer style but not the colors #244

Yotooon opened this issue Jun 10, 2016 · 15 comments

Comments

@Yotooon
Copy link

Yotooon commented Jun 10, 2016

Is it possible to apply the style of an image but keep the colors of the original?
I've recently read http://blog.deepart.io/2016/06/04/color-independent-style-transfer/ and the results are just awesome.

@jcjohnson
Copy link
Owner

Based on the comments on reddit, it looks like you can achieve this effect with some simple post-processing with HSV or YUV color-spaces; I might try to implement this over the weekend:

https://www.reddit.com/r/MachineLearning/comments/4nbdvz/colorindependent_style_transfer/

@Yotooon
Copy link
Author

Yotooon commented Jun 10, 2016

Thank you! It might not be as hard as I originally thought... 👍

@htoyryla
Copy link

Others appear to be working on this too right now https://github.com/pavelgonchar/color-independent-style-transfer

@ProGamerGov
Copy link

ProGamerGov commented Jun 12, 2016

Along with keeping the colours of the original image, would having a potential third -color_image parameter be possible? So that you could use the colours of a third image along with your style image and content image.

Also, a -color_type parameter with HSV and YUV as the two options would be an excellent addition to controlling the color of the output image.

@jcjohnson
Copy link
Owner

@ProGamerGov The implementation of color-independent style linked above simply converts the content image and generated image to YUV, then replaces the V channel of the generated image with the V channel from the content image. This will not give good results if you try to transfer color from a third image, since the color will be not be aligned to the image content in any way.

@ProGamerGov
Copy link

@jcjohnson I see, so it is limited to the traditional style and content image combo.

@jcjohnson
Copy link
Owner

jcjohnson commented Jun 13, 2016

I added support for this feature here: 8250d35

It's pretty simple: just use the Y channel from the generated image and the UV channels from the content image.

@ProGamerGov
Copy link

ProGamerGov commented Jun 13, 2016

@jcjohnson

This will not give good results if you try to transfer color from a third image, since the color will be not be aligned to the image content in any way.

What if the third image was a previously generated output image which used the same content image, but a different style image? Or would that still not work?

@jcjohnson
Copy link
Owner

That might actually work!

@ProGamerGov
Copy link

@jcjohnson How difficult would this be to implement for testing?

@sebrammer
Copy link

sebrammer commented Jun 14, 2016

Thank you for implementing the V channel translation JC! I've really been enjoying neural-style over the past few months.

Getting an error after replacing neural-style.lua with the new commit of 6/12/16.
/usr/local/bin/luajit: neural_style.lua:5: unexpected symbol near '<'
The error occurs using the new commit and is unaffected by the presence or absence of the -original_colors flag, with or without a valid value.

I merely downloaded and replaced my copy of the neural-style.lua file. Should I have run through the complete dependency install / update?

edit: and I see I just posted this under a 'non-issue' thread. Apologies.

@htoyryla
Copy link

sebrammer [email protected] kirjoitti 14.6.2016 kello 17.54:

Thank you for implementing the V channel translation JC! I've really been enjoying neural-style over the past few months.

Getting an error after replacing neural-style.lua with the new commit of 6/12/16.
/usr/local/bin/luajit: neural_style.lua:5: unexpected symbol near '<'
The error occurs using the new commit and is unaffected by the presence or absence of the -original_colors flag, with or without a valid value.

I merely downloaded and replaced my copy of the neural-style.lua file. Should I have run through the complete dependency install / update

The symptoms suggest that you have downloaded the html page, not the raw text file. Have a look.

@sebrammer
Copy link

I will now slink off and find a rock to call home. Thank you for pointing out the forest hiding behind all those trees.

@htoyryla
Copy link

Happened to me too (how else would I have known).

@jcjohnson
Copy link
Owner

Thanks @htoyryla for figuring this one out! I was confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants