This weekend I played with 3 things I ♥: machine learning, #generativeart, and the web.

Here's a small neural network running entirely in a #webgl GLSL shader that hallucinates thousands of new handwritten digits in real-time.

How so? 👇🧵
I first learned about CPPNs in "Generating Large Images from Latent Vectors" by @hardmaru back in 2016 (!).

At the time, GANs were stuck at 256px and I was amazed to learn about these fast, high resolution, generators.

blog.otoro.net/2016/04/01/gen…
The fact that they operate on pixel coordinates makes them particularly good candidates for GLSL shaders.

(figure by @hardmaru)
Then last week, @nicoptere introduced me to SIREN via this mindboggling SDF shader by @suricrasia which is able to ray-march a generated Stanford bunny in less than 100 lines 🤯.
shadertoy.com/view/wtVyWK
The author, @suricrasia also made a great video about it, along with a notebook to train and export the model:
SIREN (for Sinusoidal Representation Networks) were introduced in the NeurIPS 2020 paper "Implicit Neural Representations with Periodic Activation Functions".
vincentsitzmann.com/siren/
After a little bit more research, I was not surprised to find out that @quasimondo had already been there, and created "Call of the Siren", an interactive 3D-ish SIREN encoding of one of his prior artwork. Astonishing!

shadertoy.com/view/7sSSDd
Of course, I had to fire up a notebook and make my own :)

One diff. was that I didn't want to train the model on a single sample, but on a full dataset.

So I added an extra Z noise input to the SIREN module and trained the whole thing as a GAN instead of the SSIM loss.
After a quick training, I used @suricrasia's code to serialize the model as GLSL code. And voilà!

No magic, the result *really* is just a bunch of mat4 multiplications with sin() activations.
As expected, it runs super fast as a shader on GPU, and it's able to generate new digits fairly convincingly, at any resolution (even though it was only trained on 28x28 images).

At very high resolutions, it starts to generate beautiful abstract details.
It's been nice to play with such a compact model & simple pipeline. And a good reminder of how much can be done outside of pytorch.

If you need more convincing, just check out the incredible work of @zzznah (DeepDream creator) on GLSL NCAs: distill.pub/2020/growing-ca
That's it for this week! Please let me know if you have any feedback or question.

Have a great day/night! ❤️

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Cyril Diagne

Cyril Diagne Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @cyrildiagne

22 Oct 20
Aaand here it is..!!! 😱

After months of hard work with @jblanchefr, @ClipDropApp beta (AR Copy Paste) is now publicly available on #Android, #iOS, #macOS, and #Windows

🔥 clipdrop.co 🔥

Here's a thread of what you can already do with it ↓ 1/n

#ML #AR #AI
You can capture directly from your desktop with a screenshot and drag & drop to any other app (my favorite feature 🤩)

It works from/to virtually any application & websites: @figmadesign, @Photoshop, @Canva, @Pitch, @Powerpoint, @GoogleDocs...etc!

#ML #Augmented #DesktopOS
You can extract anything: objects, people, drawings, and text. The quality of the salient object detection, background removal, and text detection is now quite incredible 😳😲🤯
Read 8 tweets
17 May 20
Proto 6/10: Copy printed text to desktop with AR+ML

Code: github.com/cyrildiagne/ar…
Book: Neurones, les intelligences simulées, Frédéric Migayroux & al (Editions Hyx 2018 @centrepompidou)

#ML #AR #AI #AIUX #ARCore #ARKit #WebXR

Technical Insights: ↓
The magic here is to use ARCore + AugmentedImages rather than SIFT.
Phone gets a new desktop screenshot on touch and adds it to ARCore (< 100ms).
Tracking is crazy fast & precise.

Interesting alternative to touch screen for interactive installations!
The text detection is performed on device with @Firebase #MLKit. Super fast, good accuracy and cross platform.
Read 6 tweets
3 May 20
4/10 - Cut & paste your surroundings to Photoshop

Code: github.com/cyrildiagne/ar…

Book: @HOLOmagazine
Garment: SS17 by @thekarentopacio
Type: Sainte Colombe by @MinetYoann @ProductionType
Technical Insights: ↓

#ML #AR #AI #AIUX #Adobe #Photoshop
The secret sauce here is BASNet (Qin et al, CVPR 2019) for salient object detection and background removal.

The accuracy and range of this model are stunning and there are many nice use cases so I packaged it as a micro-service / docker image: github.com/cyrildiagne/ba… Image
And again, the OpenCV SIFT trick to find where the phone is pointing at the screen.

I also packaged it as a small python library: github.com/cyrildiagne/sc…

Send a camera image + a screenshot and you get accurate x, y screen coordinates! Image
Read 6 tweets
10 Feb 19
The coarse knob of #StyleGAN really is mesmerizing. Esp. how it adds/replaces some features to match the artistic style (collars, hats..etc)
On random interpolation, the truncated latent space also looks surprisingly continuous & morphologically coherent.
(Last one) with the fine knobs (range 6-16). Looks much more like a traditional style transfer which keeps the face features & pose relatively intact.
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(