jcjohnson / neural-style

Torch implementation of neural style algorithm
MIT License
18.31k stars 2.7k forks source link

Can I transfer the color of the style image not its style? #413

Open youyou0988 opened 7 years ago

youyou0988 commented 7 years ago

I see there is a 'style only' option '-original_colors 1 ', Do you support a color only option?

ProGamerGov commented 7 years ago

@youyou0988 Neural-Style is a style transfer system, so you can't really avoid transferring the style. If you want to transfer the color from one image to another, I would suggest you use one of the Python scripts from my Neural-Tools project: https://github.com/ProGamerGov/Neural-Tools

htoyryla commented 7 years ago

One can also try to use neural-style with only (some) relu1_x layers as style layers, as it is the very lowest layers that respond specifically to color. I used -style_layers relu1_1,relu1_3 -init image to color a B&W photo into this. Not perfect, but perhaps worth while to experiment.

colortest-initimage_750

htoyryla commented 7 years ago

By the way, @ProGamerGov , I see nothing neural in the implementations of your Neural Tools. I guess the name of the project is because these statistical color manipulation tools are meant to be used together with neural style transfer? Or did I miss something?

ProGamerGov commented 7 years ago

@htoyryla

I guess the name of the project is because these statistical color manipulation tools are meant to be used together with neural style transfer?

Yep, the repository contains the code I produced from: https://github.com/jcjohnson/neural-style/issues/376 along with some more modifications, and a wiki guide on how to properly use it. It is meant for use alongside style transfer projects like Neural-Style, style_transfer, CNNMRF, etc... that don't perform histogram matching or luminance transfer on their own.

I see nothing neural in the implementations of your Neural Tools.

The name was originally chosen because of the intent to use the scripts to enhance the style transfer process. But I do agree that it is misleading in because the code does not need to be used with any style transfer system. I have been thinking about whether or not it would be a good idea to change the name of the project, though that would probably break links that I and others have shared to the project.

AndreJFBico commented 7 years ago

I believe what facebook is doing with its style transfer is using what @htoyryla is talking about, using the lower layers to transfer more color instead of style.