about
Im2Vec: Synthesizing Vector Graphics Without Vector Supervision (arxiv.org)
91 points by tomduncalf on Mar 15, 2021 | hide | past | pdf | 15 comments on HN

In plain words: It learns to draw editable curves by rendering them to pixels and comparing with ordinary images, so no vector training files are needed. It compares well with the best models that need such files, and works even on hand-drawn digits with no vector versions.

Abstract · Im2Vec: Synthesizing Vector Graphics without Vector Supervision

Vector graphics are widely used to represent fonts, logos, digital artworks, and graphic designs. But, while a vast body of work has focused on generative algorithms for raster images, only a handful of options exists for vector graphics. One can always rasterize the input graphic and resort to image-based generative approaches, but this negates the advantages of the vector representation. The current alternative is to use specialized models that require explicit supervision on the vector graphics representation at training time. This is not ideal because large-scale high quality vector-graphics datasets are difficult to obtain. Furthermore, the vector representation for a given design is not unique, so models that supervise on the vector representation are unnecessarily constrained. Instead, we propose a new neural network that can generate complex vector graphics with varying topologies, and only requires indirect supervision from readily-available raster training images (i.e., with no vector counterparts). To enable this, we use a differentiable rasterization pipeline that renders the generated vector shapes and composites them together onto a raster canvas. We demonstrate our method on a range of datasets, and provide comparison with state-of-the-art SVG-VAE and DeepSVG, both of which require explicit vector graphics supervision. Finally, we also demonstrate our approach on the MNIST dataset, for which no groundtruth vector representation is available. Source code, datasets, and more results are available at geometry.cs.ucl.ac.uk/projects/2021/Im2Vec/

Pradyumna Reddy, Michael Gharbi, Michal Lukac, Niloy J. Mitra
arXiv:2102.02798 · cs.CV, cs.GR · submitted Feb 4, 2021 · updated Apr 1, 2021
abstract · pdf · html

add comment on HN

Wish I had the research budget to work on the intersection of SVG and ML. I feel there is a rich vein awaiting discovery apart from the semantic stuff. Compact, efficient machine representations that consume 10x less memory for large SVG images, for example.
Isn't this like a solved problem for ages?
This should be an autorespond link, but [cite]?
A few years back I had the idea to morph fonts using vector graphic interpolation. Unfortunately it was a bit more complicated than I had anticipated and as usual it was abandoned in favor of newer, shinier projects. But it's still fun to play around with:

https://heartofnoise.com/fontmix/

This is a standard feature of modern (variable) fonts [0]

However, they are limited to linear interpolation of the control point polygon, IIRC.

If you want arbitrary morphing (of the actual curve) you might want to look into implicit curves [1] represented in geometric algebra [2]. Here [3] is an example of it.

[0] https://v-fonts.com/

[1] https://en.wikipedia.org/wiki/Implicit_curve

[2] https://en.wikipedia.org/wiki/Geometric_algebra

[3] https://enkimute.github.io/ganja.js/examples/coffeeshop.html...

That's all great stuff, but my idea was rather to explore the latent space inbetween existing fonts, so to speak. V-fonts are nice but very limited. Implicit curves are cool but I don't see how they could represent existing font data?
>> the latent space in between existing fonts

Packing multiple different fonts into one parametrizable one is the inverse of using one parametrizable font to generate multiple different fonts, right?

>> V-fonts are nice but very limited

As I already mentioned, therefore I agree.

>> Implicit curves are cool but I don't see how they could represent existing font data?

It might not be obvious from the wikipedia page, but implicit curves are not a class of curves but a different way to formalize them (as opposed to parametric curves). So you can think of / deal with the bezier curve segments either as parametric curves or as implicit curves.

Related work from 2008: Mona Lisa in 50 polygons, using a genetic algorithm.[0][1] Sadly I think they refused to release their source, but I believe others have re-implemented it.

[0] https://news.ycombinator.com/item?id=4912964

[1] https://rogerjohansson.blog/2008/12/07/genetic-programming-e...

For example. Dave Hoskins (shadertoy) To get the triangle look comment out #define ADD_DITHER and press the Compile (play) button. https://www.shadertoy.com/view/MsX3WH
differentiable rasterization pipeline

That's really damn cool.

This is a dumb question, I'm sure:

Does the loss function have to be a function of the derivative somehow? Or does being differentiable just allow gradient descent learning to work?

> Source code, datasets and more results are available at http://geometry.cs.ucl.ac.uk/projects/2020/Im2Vec/.

When I visit that URL all I get currently is the PDF of the paper?

Seems they got the wrong URL, http://geometry.cs.ucl.ac.uk/projects/2021/im2vec/ has more info, also the link to a github repo: https://github.com/preddy5/Im2Vec
So the code has never been published? Edit: seems to be here https://github.com/preddy5/Im2Vec
I was really hopping this was some chain of CV, NLP, and GANs to implement word2vec but for images. I think I just found one of my new side-projects for the year.