jcjohnson / neural-style

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

Has anyone been able to match Ostagram results? #240

Open StryxZilla opened 8 years ago

StryxZilla commented 8 years ago

I am curious if anyone has been able to match these results. I can't seem to get close. If you have, what sort of settings are you running?

3DTOPO commented 8 years ago

Did you try, Ostagram?

https://github.com/SergeyMorugin/ostagram

htoyryla commented 8 years ago

As far as I can see, https://github.com/SergeyMorugin/ostagram is only a web front-end and uses neural-style for the actual style transfer. This, of course, does not exclude the possibility that the actualOstagram service is using a modified version of neural-style.

StryxZilla commented 8 years ago

Yeah. Their results come out quite a bit better than mine, so I am trying to determine which settings they are using (I have grabbed some high resolution input images from their site and I am messing around with the settings to get closer).

Inkognitovsky commented 8 years ago

StryxZilla, do you have any results ? what settings ostagram uses.

minxdragon commented 8 years ago

Fwiw I found putting in -init image as suggested in the ostagram forums really helped improve the quality. And suddenly more iterations seem to be making a difference too.

Inkognitovsky commented 8 years ago

yes, i found it too yesterday. i get very close result with these options: -content_weight 100 -style_weight 1500 -init image -normalize_gradients. Normalize_gradients gives good results but if you use it you should change content_weight and style_weight. Now i am playing with these numbers. also i found here "https://github.com/jcjohnson/neural-style/issues/237" that the weight of every style can be changed, and i think if we can increase the weight of style "relu4_1" the result wil be very good

StryxZilla commented 8 years ago

@minxdragon yeah, my results with random init haven't been good. @Inkognitovsky, I will give those settings a shot. Let me know if you get that fork to give better results through layer weighting modification.

rayset commented 8 years ago

what's this ostagram forum? I'm messing with the normalized gradients but I think a ratio of 100/1500 is a bit too low.

@Inkognitovsky how do you pick your style relus? do you use the default ones?

ProGamerGov commented 8 years ago

@Inkognitovsky @htoyryla

Using this command:

th neural_style.lua -seed 219 -content_image content.jpg -style_image style.jpg -content_weight 100 -style_weight 1500 -init image -normalize_gradients

How do I get the -style_layer_weights parameter to increase the style weight of relu4_1 without changing the style weights of the other layers?

Would this achieve the task?

th neural_style3.lua -image_size 1000 -content_image content.jpg -style_image image.jpg -content_layers relu4_2 -style_layers relu1_1,relu2_1,relu3_1,relu4_1,relu5_1 -style_layer_weights 1,1,1,20,1-content_weight 100 -style_weight 1500 -init image -normalize_gradients -num_iterations 1500 -backend cudnn -cudnn_autotune -optimizer adam

htoyryla commented 8 years ago

First you need to know which style layers you are using. The weights need to be given in the same order. In that command line you are using the default style layers: relu1_1,relu2_1,relu3_1,relu4_1,relu5_1.

To increase the weight of style layer relu4_1, set -style_layer_weights 1,1,1,10,1 That sets relu1_1 relative weight to 1 and so on, relu4_1 relative weight to 10, and relu5_1 again to 1. By relative weight I mean that the real weight will be 1 times style_weight and 10 times style_weight, respectively.

Assuming you are using my version with style layer weights. This discussion is, as far as I know, about the original neural_style.

ProGamerGov commented 8 years ago

@htoyryla I am using the default layers.

The weights need to be given in the same order. In that command line you are using the default style layers: relu1_1,relu2_1,relu3_1,relu4_1,relu5_1.

To increase the weight of style layer relu4_1, set -style_layer_weights 1,1,1,10,1

This is what I was wondering about, thanks for the answer!

ProGamerGov commented 8 years ago

@Inkognitovsky Any progress on farther refining the settings to resemble Ostagram's results?

kirilledelman commented 6 years ago

@htoyryla Heya, could you update your repo and merge with most recent jcjohnson? I couldn't get original_colors param to work with yours. Thank you!

htoyryla commented 6 years ago

I'd rather not, sorry to say. Style layer weights was an experiment that made sense back then. After that, jcjohnson made a complete rewrite of his code.

I've done lots of experiments with neural-style code, but don't really have time and interest to maintain old experimental code.