4
$\begingroup$

There is an application of image restyle here. It is an example in following:

But if I just use ImageRestyle of Mathematica

in=Import["https://i.sstatic.net/L2ifw.png"];
style=Import["https://i.sstatic.net/994ix.png"];
ImageRestyle[in, style, PerformanceGoal -> "Quality",TargetDevice -> "GPU"]

I have to say it is a ugly result. Is there a better method to get an expected result like this?

$\endgroup$
8
  • $\begingroup$ If you run the same example through the deep-photo-styletransfer program yourself do you get their exact results? $\endgroup$
    – ktm
    Apr 26, 2018 at 13:08
  • $\begingroup$ ImageRestyle has weightings options. Did you try changing the defaults? $\endgroup$
    – bill s
    Apr 26, 2018 at 13:50
  • $\begingroup$ Duplicate of mathematica.stackexchange.com/questions/156044/… $\endgroup$
    – M.R.
    Apr 26, 2018 at 14:15
  • $\begingroup$ @M.R. Duplicate??? $\endgroup$
    – yode
    Apr 26, 2018 at 14:46
  • 1
    $\begingroup$ This question seems to rely heavily on your own sense of what would be a "better" or "pretty" result. So, unless you can pinpoint what you would like to improve, I don't see how the question can be answered meaningfully. Do you know what parameters were used to obtain the image you show? $\endgroup$
    – MarcoB
    Apr 26, 2018 at 16:33

2 Answers 2

11
$\begingroup$

Hi from the main developer of ImageRestyle!

Your comment boils down to comparing two different approaches to deep neural style, namely photorealistic and art-oriented one. The torch code you linked falls into the first category, while ImageRestyle belongs to the second.

What you interpreted as noise in your comment is actually the algorithm attempting to provide an artistic, painting-like feeling. Photorealistic style transfer, on the other hand, provides cleaner textures and doesn't bother to introduce artifacts. They are slightly different tools aimed at slightly different tasks.

Unfortunately ImageRestyle doesn't currently support a photorealistic method, but we may add it in future releases.

Happy restyling!

$\endgroup$
3
  • $\begingroup$ How long is your "in future" roughly? $\endgroup$
    – yode
    May 22, 2018 at 8:06
  • $\begingroup$ Can I expect this upgrade in future releases? $\endgroup$
    – yode
    Nov 24, 2022 at 17:10
  • $\begingroup$ @yode we have no plans to expand on ImageRestyle currently $\endgroup$ Nov 25, 2022 at 18:36
5
$\begingroup$

I must confess that I feel this question has to do with Arts at some extent. How do we define "better" or "pretty", as @MarcoB point out?

Anyway, I cannot refuse to give my approach, not as a solution, but rather my vision of a "better" or "pretty" image restyle, by playing with options and functions such as GuidedFilter.

So let us try with:

imrs = ImageRestyle[Import["https://i.sstatic.net/L2ifw.png"], 
0.45 -> Import["https://i.sstatic.net/994ix.png"], 
PerformanceGoal -> "Speed"]

enter image description here

I choose Speed to not wait for a long time as with Quality option. We also can play with the weight w (0.45). However, a noticeable change in the final image can be obtained, and it may not be accepted.

However, the final image has some noise as a result of running the process in favor of Speed. So taking the original image as the guide, I tried to reduce the noise by means of GuidedFilter:

GuidedFilter[imrs, Import["https://i.sstatic.net/L2ifw.png"], 2, 0.001]

enter image description here

Not too bad, isn't it?

Well, time for all of you that want to play.

Oh, please, be advised that the algorithms in which ImageRestyle relies change in different versions of the Wolfram Language, yielding different result, as documentation notes.

$\endgroup$
4
  • $\begingroup$ I mean, the mma's ImageRestyle not also change the color, but also change the original image's outline. It is not my expectation $\endgroup$
    – yode
    Apr 26, 2018 at 18:47
  • 1
    $\begingroup$ @yode That is why you have to play with the weight w in the style (see the documentation). You also have to bear in mind that MMA could use different algorithms to restyle the image, different from those used in the software you cited (used)... $\endgroup$ Apr 26, 2018 at 18:50
  • $\begingroup$ @JoséAntonioDíazNavas Can you try importing the higher quality github referenced network? $\endgroup$
    – user5601
    Apr 29, 2018 at 21:54
  • $\begingroup$ @user5601 I am not sure what you mean... $\endgroup$ Apr 30, 2018 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.