luanfujun / deep-photo-styletransfer

Code and data for paper "Deep Photo Style Transfer": https://arxiv.org/abs/1703.07511
9.98k stars 1.4k forks source link

Where to find λ – "photorealism regularization weight" from paper in code | segmentation colors #28

Closed subzerofun closed 7 years ago

subzerofun commented 7 years ago

Hey there, i was wondering where i can find the λ parameter from the original paper in your code.

The paper states that a value of 10e4 gave the best results, but i woud like to try to experiment a little bit with lower values. I imagine that a lower value could preserve more style detail – for the cost of looking more like the CNNMRF method.

Am i simply overlooking the parameter because it's named differently or is it hidden in the more complex functions?

default

I also tried playing around withf_radius – reducing the value preserved more detail – transferred more style detail to the final image. Could you explain what f_edge does?

Since you have a lot of landscape examples, but no animals, my test example was an attempt to transfer the style of a tiger to a housecat 😀. Maybe CNNMRF would be better suited for that – but i wanted to take advantage of the photorealistic effect of this method. CNNMRF would make the final image look more like a painting, and i've seen that often enough by now. The masking of your method offers a great degree of control for finetuning how you want your output to look like. EDIT: I wrote lion, but of course it's a tiger... Note to self: stripes? = tiger. no stripes, furry mane? = lion. If you f*ck with nature? = liger

in62

tar62

Temp result (neural style):

out_62_550_t_1000

Final results :-) : (f_radius @ 5 – 0.5)

best62_t_1000

best62_t_1000

best62_t_1000

out_62_550x380px_t_300_f3_e0 01

And the masks: in62 tar62


Mask colors

Another quick question about the colors you can use for your mask pngs: In neuralstyle_seg.lua and deepmatting_seg.lua you define that these colors are processed from the segmentation images:

`local color_codes = {'blue', 'green', 'black', 'white', 'red', 'yellow', 'grey', 'lightblue', 'purple'}`

The problem for me (and maybe others users too) was to recognize that you are restricted to these colors when you "paint" your masks. At first i didn't look at the code and just chose random colors – i only realized that something was wrong when the generated output didn't match my selections.

So could you maybe include a info in your Readme how to manually create a mask – which colors you can use (maybe hex colors?). I'm not sure if everyone automatically knows what colors are actually processed.

Thanks!

martinbenson commented 7 years ago

Line 33 in deepmatting_seg.lua:

cmd:option('-lambda', 1e4)

You can change the default value there or add the -lambda flag in gen_all.py to set it.

subzerofun commented 7 years ago

Thanks – it's not even that hard to miss. Should've looked more carefully at the code.