Library / SDK
alexandre01/deepsvg avatar
alexandre01/deepsvg

DeepSVG: a PyTorch library and training code for vector graphics

[NeurIPS 2020] Official code for the paper "DeepSVG: A Hierarchical Generative Network for Vector Graphics Animation". Includes a PyTorch library for deep learning with SVG data.

1,164 stars114 forksJupyter NotebookMIT

At a glance

What is it?
DeepSVG is the official NeurIPS 2020 code release for a hierarchical generative network over SVG data, plus a small PyTorch library for parsing, simplifying and animating icons. It is a research artifact, and it shows.
Who is it for?
Adopt DeepSVG if you are reproducing the NeurIPS 2020 paper, need a differentiable SVG tensor to optimise against a target shape, or want a ready-made Icons8 tensor set to train on. Do not adopt it if you need a maintained inference service, a modern PyTorch version, or an npm-style install; requirements.txt pins torch==1.4.0 and the README documents no packaging beyond pip install -r requirements.txt.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 27 days ago.
What is it written in?
Mainly Jupyter Notebook, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 28, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What DeepSVG is for, and who it is actually written for

Most SVG tooling treats a drawing as text: you parse tags, you rewrite attributes, you hand the file to a renderer. DeepSVG treats a drawing as a sequence of commands that a neural network can consume and emit. The README describes the repository as containing the training code to reproduce the Hierarchical Generative Network, a library for deep learning with SVG data including export to differentiable PyTorch tensors, the SVG-Icons8 dataset, and a graphical user interface demo for vector graphics animation.

That combination tells you the audience. This is not aimed at a front-end developer who wants to clean up icons before a build. It is aimed at a researcher or graduate student who has a GPU, a conda habit, and a reason to train or fine-tune a generative model over icon shapes. The library half of the repo is usable on its own: the README shows loading a dolphin SVG, normalising it, simplifying paths, then zooming, translating and rotating it before drawing. If that is all you need, you can ignore the training code entirely and treat deepsvg.svglib as a small geometry toolkit.

The paper target matters for expectations. The repository is the official code for a specific published architecture, so the configs under configs/ and the pretrained/ directory exist to reproduce results, not to serve as a general-purpose API. There are no releases listed for the project, and versioning is whatever the master branch happens to contain.

How the SVG pipeline works: parse, simplify, tensorise

The mechanism described in the README is a three-stage conversion. First, SVG files are parsed. Second, basic shapes and commands are converted to the subset m, l, c and z, which is the vocabulary the model understands: move, line, cubic Bézier and close. Third, paths are simplified using the Ramer-Douglas-Peucker and Philip J. Schneider algorithms, which reduce the number of commands while keeping the curve close to the original.

That reduction is the point. A hand-drawn icon exported from a design tool can carry far more control points than the shape needs, and a sequence model pays for every one of them. Simplification is what makes the command sequence short enough to be a realistic training target. The README also lists data augmentation (translation, scaling, rotation) and conversion to PyTorch tensor format as library features, plus draw utilities that visualise control points and export GIF animations.

For custom data, the README recommends preprocessing ahead of training rather than on the fly, because I/O performance suffers otherwise. The SVGDataset dataloader accepts an already_preprocessed flag, and the preprocess script runs multi-threaded over a folder of SVGs and writes a metadata file used for filtering during training. The metadata file is the filtering hook: it is what lets you train on a subset without rewriting the dataloader.

The differentiable part is separate from the generative part. The README states that operations can be performed on an SVGTensor, letting you deform a circle toward an arbitrary target by gradient descent, in the same spirit as PyTorch3D. It notes that using a lower number of Bézier commands in the initial circle produces artistic approximations of the target. That is a genuinely different use of the library from training the autoencoder, and it is the feature most likely to be useful to someone who never touches the paper's architecture.

Installing DeepSVG and running a first SVG through it

The README gives an explicit install path. Clone the repository, create a conda environment on Python 3.7, and install from requirements.txt.

bash
git clone https://github.com/alexandre01/deepsvg.git
cd deepsvg
conda create -n deepsvg python=3.7
conda activate deepsvg
pip install -r requirements.txt

CairoSVG has native dependencies that pip will not resolve for you. The README points at the CairoSVG documentation and gives two examples: sudo apt-get install libcairo2-dev on Ubuntu, and brew install cairo libffi on macOS. Expect this step to be the one that fails first, especially on a machine without a compiler toolchain.

The dataset download is a script inside the dataset folder, not a package index.

bash
cd dataset/
bash download.sh

The README states that the result lands as dataset/icons_meta.csv and dataset/icons_tensor/. The tensor archive is 3 GB and the metadata file is 9 MB. If the script does not work, the README gives manual Google Drive links for both files and says to place them in the dataset folder and unzip, which it notes may take a few minutes. There is also a smaller font dataset, downloaded with bash download_fonts.sh, consisting of fonts_meta.csv at 6 MB and fonts_tensor.zip at 92 MB.

For a first real use, the notebook notebooks/svglib.ipynb is the walkthrough the README points to. The README's own sample is short enough to reproduce directly.

python
from deepsvg.svglib.svg import SVG
from deepsvg.svglib.geom import Point, Angle

icon = SVG.load_svg("docs/imgs/dolphin.svg").normalize()
icon.simplify_heuristic()
icon.zoom(0.75).translate(Point(0, 5)).rotate(Angle(15))
icon.draw()

What you should see is the dolphin rendered with its control points visible. Calling icon.animate() on the same object produces a GIF, which the README illustrates with docs/imgs/dolphin_animate.gif. If the draw call fails, the failure is almost always the CairoSVG native library rather than the Python code.

The dependency pins are the real cost of entry

requirements.txt pins torch==1.4.0, torchvision==0.5.0 and numpy==1.16.1, and pulls in tensorflow, tensorboardX, kivy, moviepy, numba, shapely, umap-learn, scikit-image, networkx and pandas alongside the SVG libraries. That is a wide surface. The README lists tested environments as Ubuntu 18.04 with CUDA 10.1, and macOS 10.13.6 with CUDA 10.1 and PyTorch installed from source.

Those are the environments the authors validated, and they are old. Installing torch==1.4.0 on a current CUDA stack is not guaranteed, and the kivy dependency exists for the GUI demo, so a headless training box still pays for it. If your goal is only the svglib parsing and simplification code, you are installing a deep learning framework and a TensorFlow build to use a geometry library that does not need either.

There is a second, quieter cost. The README does not document rollback, migration between versions, or a supported upgrade path, and no releases are listed. The practical consequence is that a working environment is something you build once and then avoid disturbing. Treat the conda environment as disposable and reproducible from requirements.txt rather than as something you incrementally upgrade.

Where DeepSVG is the wrong tool

The clearest limitation is stated by the README itself, in the dataset section. The icons_tensor folder holds 100k icons in pre-augmented PyTorch tensor format, which the README says enables easy reproduction of the published work. For what it calls full flexibility and more research freedom, it recommends downloading the original SVG icons from icons8, which requires a paid plan, and notes that instructions to download the dataset from source are coming soon.

So the free path gives you preprocessed tensors, not raw SVGs. If your research question is about preprocessing choices, or about SVG features the conversion to m, l, c and z discards, the shipped dataset has already made those decisions for you. You would be training on someone else's simplification pipeline. The Font dataset has the same shape of problem: the README recommends following SVG-VAE's instructions for the full set and releases only a mini version for demo purposes.

Two other cases argue against it. If you need to convert SVGs in a production service, the Python 3.7 environment and the torch 1.4.0 pin make this a poor fit for a modern deployment, and the repository offers no serving layer. If you want to generate SVG from a text prompt, this is not that kind of model: DeepSVG is a hierarchical generative network over vector graphics with an autoencoder lineage, and the README's demo is animation and shape manipulation, not text conditioning.

Alternatives and how their approach differs

The README names PyTorch3D as the point of comparison for the differentiable shape optimisation feature, and the comparison is apt but partial. PyTorch3D provides differentiable rendering and 3D operators for meshes and point clouds. DeepSVG operates on 2D vector command sequences, so the gradient flows through Bézier control points rather than through a rasterised or mesh-based renderer. If your target is a 3D asset, PyTorch3D is the relevant library; if your target is a flat icon or glyph outline, DeepSVG's SVGTensor is the one that speaks your format.

The README also points to SVG-VAE, specifically its instructions for obtaining the Font dataset. SVG-VAE is the earlier generative model over SVG glyphs, and the difference in approach is architectural: SVG-VAE uses a variational autoencoder over a flat sequence of drawing commands, while DeepSVG's contribution is the hierarchy, modelling groups and their contents rather than treating the whole drawing as one sequence. That hierarchy is the reason the paper exists, and it is what you are choosing when you pick this repository over the older one.

For the broader question of generating or optimising vector graphics, the related searches around this project surface names such as Im2Vec, VectorFusion, DiffVG, StarVector, OmniSVG and LLM4SVG. None of those are discussed in the README, so there is no basis here for comparing their internals. What can be said is that they occupy the same problem space from different angles, and a reader evaluating DeepSVG today should treat it as the 2020 baseline in that space rather than the current state of the art.

Licence, maintenance and upgrade expectations

The repository is MIT licensed. That is permissive: it allows commercial use, modification and redistribution provided the copyright notice and permission notice are retained. The repository contains a LICENCE file at the top level, and the README links to it. Nothing in the README adds field-of-use restrictions or a separate model licence, but the dataset is a separate question from the code: the README notes that the original icons8 SVGs require a paid plan, and the shipped tensors are distributed through Google Drive links rather than through the repository itself. If you plan to redistribute anything derived from the Icons8 data, read the icons8 terms rather than assuming the MIT licence on the code covers the images. This is not legal advice; it is a pointer to the two different licences in play.

The last push to the default branch was on 2026-09-04. The README's own updates section stops in December 2020, with the raw SVG dataloader, the NeurIPS acceptance in September 2020, and the pretrained models and font generation notebook in July 2020. There are no releases listed. The gap between the 2020 changelog and a 2026 push is not explained by anything in the README, so do not read it as a roadmap. Plan for an environment you pin and reproduce, not one you track.

Editorial conclusion

Adopt DeepSVG if you are reproducing the NeurIPS 2020 paper, need a differentiable SVG tensor to optimise against a target shape, or want a ready-made Icons8 tensor set to train on. Do not adopt it if you need a maintained inference service, a modern PyTorch version, or an npm-style install; requirements.txt pins torch==1.4.0 and the README documents no packaging beyond pip install -r requirements.txt. Before committing, verify that your CUDA and Python 3.7 environment can build cairosvg, since the README lists libcairo2-dev on Ubuntu and cairo plus libffi on macOS as prerequisites, and confirm the dataset download script completes rather than falling back to the manual Google Drive links for icons_meta.csv and icons_tensor.zip.

Frequently asked questions

What does DeepSVG do?

It is the official code for the NeurIPS 2020 paper on a hierarchical generative network for vector graphics animation, and it also ships a library for working with SVG data in PyTorch. The library handles parsing, conversion to the m/l/c/z command subset, path simplification and export to differentiable tensors.

How do I install DeepSVG?

Clone the repository, create a conda environment with Python 3.7, and run pip install -r requirements.txt. CairoSVG needs native libraries first, which the README gives as sudo apt-get install libcairo2-dev on Ubuntu or brew install cairo libffi on macOS.

Where can I download the DeepSVG dataset?

From the dataset folder using bash download.sh, which places icons_meta.csv and icons_tensor/ under dataset/. If the script fails, the README provides manual Google Drive links for both files.

What Python and PyTorch versions does DeepSVG need?

requirements.txt pins torch==1.4.0, torchvision==0.5.0 and numpy==1.16.1, and the README creates the environment with Python 3.7. The tested environments listed are Ubuntu 18.04 with CUDA 10.1 and macOS 10.13.6 with CUDA 10.1.

Official sources

  1. alexandre01/deepsvg on GitHub
  2. Issues
  3. License: MIT
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/alexandre01-deepsvg.svg)](https://hysenlabs.com/projects/alexandre01-deepsvg)