Show HN: Paint yourself in the style of classic art, in your browser
github.com
github.com
For everyone reading, these guys coded up the neural network I used, all I did was port it to a different library. :)
Eagerly waiting for the Tensorfire API!
Can it be used for artistic purposes, or is it only skin deep like those old filters? It looks to me as if this is pure imitation, your images of a night with friends at the street cafe, or stacking bails of hay can look like a Van Gogh when you upload it to Instagram.
Am I missing something?
I realize these tools are just a proofs-of-concept, which is something I forgot yesterday. What I'd like to be able to do is style transfer between arbitrary images, whether it's my own work or that of others. That would open up the creative possibilities.
With regular Neural Style, you can do style transfer between any two arbitrary images. The disadvantage is it takes longer so doing it in the browser might be unfeasible for now. See https://github.com/anishathalye/neural-style
Anyway, even with Fast Neural Style, you can use any arbitrary image as a Style, but you'll have to train it first (4-6 hours on a GPU).
In my opinion, it is one step -- and an impressive step -- in the direction of computers being able to actually be creative. The areas where humans can do something that computers can't is shrinking. You can dismiss it if you want, but at what point will you acknowledge that what the computer is doing isn't simply imitation? I guess you can keep moving the goalposts, but to me, this is pretty impressive.
I take it that you've never worked in IT support :)
I tend to think everything is somewhat derivative. But some things more than others. The things that are the least derivative, are the most creative.
And what this program does is more creative than most things computer programs do, and probably more creative than lots of things that, if a human did it, you'd call "creative."
Outside of the developer community, no one cares how this works. They only care about whether or not they connect with the result.
And a good historical hint is that no one uses those old Photoshop filters now, because they're uniformly cheesy and terrible.
Artistically, this is similar.
The Deep Dream output was an interesting novelty, for a while, but to most people this style transfer process is going to be Just Another Photo Filter Effect.
Technically, it's not abstracting shape and texture in an intelligent way. It's applying a mechanical effect in a mechanical way with absolutely no insight into texture or spatial geometry.
Even in abstract art, shapes mean something. They're not just a set of coordinates. This process doesn't understand that meaning - and generally, developers who think "art" means "I made an image with my computer" don't understand it either.
Sometimes this process gets lucky and something passable falls out, but mostly the results are mediocre.
https://github.com/jcjohnson/fast-neural-style
https://github.com/lengstrom/fast-style-transfer
Admittedly, though, I haven't seen the Photoshop filters you speak of. Could you link to some of them that show these same effects?
Take the example of the woman's face and Munch's The Scream. Ask an art student to pain a woman in the style of The Scream and you'll probably get her with a simplified, harrowed expression, surrounded by swirly waves and skies. Run this through the algorithm and you'll get a photograph of a woman's face with brushwork superimposed over it including a choppy, vibrant orange forehead instead of a choppy, vibrant orange sky. It's not particularly visually interesting and is obviously the work of a dumb algorithm[1]
On the other hand, I combined the woman's face with Picabia's Udnie and the results were very pleasing, especially the way the contrast of black and white and sharpened edges happened to emphasise the model's cheekbone structure and eyes, and it looks like something a human might draw and sell as an original semi-abstracted portrait (albeit something an art teacher setting the "draw her in the style of Picabia" assignment would probably still frown at and say they'd missed the point of the exercise in producing representative art and not really grasped Picabia's massing or shading either)
[1]And I'm sure it's not the first time I've critiqued computer generated art based on combining Munch's the Scream because it treats the top of the image as vivid orange sky regardless of what it actually is...
This happens regardless of the source content I use (any of the examples or even my own uploaded files) nor any of the reference styles.
User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
(Chromium running on ArchLinux AMD64)
Screenshot showing the same input values used as the one in your example:
My only advice I guess is to try it on a different machine when you have one available. Sorry, if this is a problem with the library I used, I can't really do anything to fix it. :/
(I say "based", I'm not sure just how much of their code - if any - you used. But you did compliment them earlier in this discussion)
If the issue is indeed with the library, there's little I can do.
I will still try to find what the issue is but can't make promises. Sorry for the letdown!
https://github.com/reiinakano/fast-style-transfer-deeplearnj...
Deeplearn.JS library doesn't work on mobile yet, sorry to folks on the go!
This can probably be configured in the server instead of in the application.
I think CSS, JS, and images are cached - HTML is not.
This was a super quick PoC demo I hacked together in a week on a very new library. :)
Shame, I really like the effect!
EDIT: My bad, there are indeed out of range colors! I will update here when fixed.
There should no longer be a problem with Twitter. The way I saved the styled photo was Right click > Save image in Chrome.
Thanks for reporting!
Maybe throw ?<random> on your linked urls? Github's cdn appears to be in terrible shape.
¯\_(ツ)_/¯
I'm not very well versed with the web, what does 'bundle.js?<anything>' do? Will adding that to my code solve the problem?
(fwiw, the cdn has finally resolved itself and the page now loads for me too)
By the way: How does a NN learn from a single image? I understand how a NN can learn to classify images. But how can it learn a style from a single image?
The output is a neural network that can take any content image and outputs it in the style it was trained on.
The browser does this: 1. Downloads the model (6.6MB~) for the particular style. 2. Does one pass through the content image and outputs the styled image.
No training is done in the browser whatsoever.
But I would like to know how the training works. How does a NN learn the style of an image?
The original Neural Style Transfer paper should help you understand the loss functions involved: https://arxiv.org/abs/1508.06576
The paper introducing Real-Time Style Transfer is basically the algorithm used here: https://arxiv.org/abs/1603.08155
It's mostly looking at local regions and seeing what guesses it can make about the next region given one region. (If I understand correctly).
https://www.deeparteffects.com/
Results look very similar
At most they probably tweaked things a little bit for some minor improvements, but the underlying idea and algorithm is very likely the same.
Can't confirm this, though. :)
Anyway, great work. Congrats!
It’s the call to dialogPolyfill.registerDialog(dialog);
I guess if you're not on mobile or Safari, then your browser doesn't support WebGL and you wouldn't be able to run it either. Sorry!
Ubuntu 17.04 FF 57 & Chrome 59 with face and Udnie:
https://screenshots.firefox.com/4bMiETLnl1yx8NOx/reiinakano....
Edit: Looks really cool though! Maybe I can find a windows machine to give it a try on.
https://github.com/reiinakano/fast-style-transfer-deeplearnj...
Practically, if you select something too high, your browser will die for lack of memory or you will grow old waiting for it to finish. My crappy 4GB RAM laptop can only handle around 300 x 500. Try setting the size to maximum, and if your computer can handle it, I'd be glad to guide you in using bigger images.
I am on windows 7 using firefox 55.0.3