← 开源
alexandre01

deepsvg

[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.

Model DevelopmentArchitectureJupyter Notebook
在 GitHub 打开
增长势头
+124 小时新增 Star+0.1%
1.17k
Star
114
Fork
+1
本周
1
贡献者
创建于 2020-07-23 · 更新于 2026-10-16 · 今日第 5787 名
主要开发者
alexandre01

alexandre01/deepsvg 排名第 5,787,有 1,167 个星标。

同类别比较

alexandre01/deepsvg 排名第 5,787,此处有 8 个同类条目;princeton-nlp/MeZO 排名第 5,778。

同类别比较
名称排名指标
JackHopkins/factorio-learning-environment5,759
语言:
Python
星标数:
1,198
分叉数:
103
简介:
A non-saturating, open-ended environment for evaluating LLMs in Factorio
NVIDIA-AI-IOT/jetracer5,763
语言:
Jupyter Notebook
星标数:
1,196
分叉数:
344
简介:
An autonomous AI racecar using NVIDIA Jetson Nano
aitorzip/DeepGTAV5,765
语言:
C++
星标数:
1,194
分叉数:
274
简介:
A plugin for GTAV that transforms it into a vision-based self-driving car research environment.
princeton-nlp/MeZO5,778
语言:
Python
星标数:
1,180
分叉数:
89
简介:
[NeurIPS 2023] MeZO: Fine-Tuning Language Models with Just Forward Passes. https://arxiv.org/abs/2305.17333
lhotse-speech/lhotse5,799
语言:
Python
星标数:
1,159
分叉数:
288
简介:
Tools for handling multimodal data in machine learning projects.
bendangnuksung/Image-OutPainting5,805
语言:
Jupyter Notebook
星标数:
1,149
分叉数:
223
简介:
🏖 Keras Implementation of Painting outside the box
RUC-NLPIR/ARPO5,814
语言:
Python
星标数:
1,137
分叉数:
62
简介:
[ICLR 2026] Agentic Reinforced Policy Optimization (ARPO)
ndif-team/nnsight5,830
语言:
Python
星标数:
1,124
分叉数:
127
简介:
The nnsight package enables interpreting and manipulating the internals of deep learned models.
关键参数与规格
关键参数与规格
参数值
语言Jupyter Notebook
类别Model Development
子类别Architecture
星标数1,167
分叉数114
贡献者1
创建日期2020-07-23
更新日期2026-10-16
1 天星标数1
7 天星标数1
排名5,787
上次排名11,274
排名变化5,487
7 天星标排名10,114
上次 7 天星标排名12,996
7 天星标排名变化2,882
总星标排名9,920
上次总星标排名9,921
总星标排名变化1
国家France
README 摘录

Introduction This is the official code for the paper "DeepSVG: A Hierarchical Generative Network for Vector Graphics Animation". Please refer to section below for Citation details. A **library for deep learning with SVG data**, including export functionality to differentiable PyTorch tensors. A **Graphical user interface** showing a demo of DeepSVG for vector graphics animation. Updates December 2020: Added raw SVG dataloader (see Dataloader section). September 2020: Accepted to NeurIPS2020 🎉 July 2020: Added pretrained models and notebook for Font generation. Installation

Start by cloning this Git repository: Create a new conda environment (Python 3. 7): And install the dependencies: Please refer to cairosvg's documentation for additional requirements of CairoSVG. 1, PyTorch installed from source Dataset Download the dataset using the script provided in by running: If this is not working for you, download the dataset manually from Google Drive, place the files in the folder, and unzip (this may take a few minutes). (9 MB): (3 GB): By default, the dataset

will be saved with the following tree structure: **NOTE**: The folder contains the 100k icons in pre-augmented PyTorch tensor format, which enables to easily reproduce our work. For full flexbility and more research freedom, we however recommend downloading the original SVG icons from icons8, for which you will need a paid plan. Instructions to download the dataset from source are coming soon. To download the Font-dataset, we recommend following SVG-VAE's instructions: For demo purposes, we also release

a mini version of the dataset. To download it, run: Or use these links: (6 MB): (92 MB): Dataloader To process a custom dataset of SVGs, use the dataloader. To preprocess them on the fly, you can set to , but we recommend preprocessing them before training for better I/O performance. To do so, use the script: This will preprocess all input svgs in a multi-threaded way and generate a meta data file, for easier training filtering. Then modify

the training configuration by providing the correct dataloader module, data folder and meta data file: Deep learning SVG library DeepSVG has been developed along with a library for deep learning with SVG data. The main features are: Parsing of SVG files. Conversion of basic shapes and commands to the subset / / / . Path simplification, using Ramer-Douglas-Peucker and Philip J. Data augmentation: translation, scaling, rotation of SVGs. Draw utilities, including visualization of control points and exporting to GIF animations. The notebook

provides a walk-trough of the library. Here's a little sample code showing the flexibility of our library: And making a GIF of the SVG is as easy as: Differentiable SVG shape optimization Similarly to PyTorch3D, differentiable operations can be performed on a , enabling to deform a circle to match an arbitrary target via gradient descent. Interestingly, using a lower number of Bézier commands in the initial circle (n) creates somehow artistic approximations of the target shape. The code

, available under , is written with Kivy and the UI style is inspired from the design tool Figma. **DISCLAIMER**: this GUI

常见问题

记录了多少星标和分叉?

alexandre01/deepsvg 有 1,167 个星标和 114 个分叉。

仓库排名是多少?

alexandre01/deepsvg 排名第 5,787。

记录的语言和类别是什么?

alexandre01/deepsvg 有 1,167 个星标,语言为 Jupyter Notebook,类别为 Model Development。

哪个仓库排名最接近?

alexandre01/deepsvg 与 princeton-nlp/MeZO 比较,后者排名第 5,778,有 1,180 个星标。

README

[![Stars](https://img.shields.io/github/stars/alexandre01/deepsvg.svg?color=ffd40c)](https://github.com/alexandre01/deepsvg)
[![Licence](https://img.shields.io/github/license/alexandre01/deepsvg.svg?color=blue)](https://github.com/alexandre01/deepsvg/blob/master/LICENCE)
[![AI Unfolded](https://www.aiunfolded.co/badge.svg)](https://www.aiunfolded.co)
[![Website](https://img.shields.io/website/http/alexandre01.github.io/deepsvg/index.html.svg?down_color=red&down_message=offline&up_message=online)](https://alexandre01.github.io/deepsvg/)

Introduction

This is the official code for the paper "DeepSVG: A Hierarchical Generative Network for Vector Graphics Animation". Please refer to section below for Citation details.


This repository includes:

  • The training code to reproduce our Hierarchical Generative Network: DeepSVG.
  • A library for deep learning with SVG data, including export functionality to differentiable PyTorch tensors.
  • The SVG-Icons8 dataset.
  • A Graphical user interface showing a demo of DeepSVG for vector graphics animation.

Updates

  • December 2020: Added raw SVG dataloader (see Dataloader section).

  • September 2020: Accepted to NeurIPS2020 🎉

  • July 2020: Added pretrained models and notebook for Font generation.

Installation

Start by cloning this Git repository:

git clone https://github.com/alexandre01/deepsvg.git
cd deepsvg

Create a new conda environment (Python 3.7):

conda create -n deepsvg python=3.7
conda activate deepsvg

And install the dependencies:

pip install -r requirements.txt

Please refer to cairosvg's documentation for additional requirements of CairoSVG. For example:

  • on Ubuntu: sudo apt-get install libcairo2-dev.
  • on macOS: brew install cairo libffi.

Tested environments

  • Ubuntu 18.04, CUDA 10.1
  • macOS 10.13.6, CUDA 10.1, PyTorch installed from source

Dataset

Download the dataset using the script provided in dataset/ by running:

cd dataset/
bash download.sh

If this is not working for you, download the dataset manually from Google Drive, place the files in the dataset folder, and unzip (this may take a few minutes).

By default, the dataset will be saved with the following tree structure:

deepsvg
 └─dataset/
    ├── icons_meta.csv
    └── icons_tensor/

NOTE: The icons_tensor/ folder contains the 100k icons in pre-augmented PyTorch tensor format, which enables to easily reproduce our work. For full flexbility and more research freedom, we however recommend downloading the original SVG icons from icons8, for which you will need a paid plan. Instructions to download the dataset from source are coming soon.

To download the Font-dataset, we recommend following SVG-VAE's instructions: https://github.com/magenta/magenta/tree/master/magenta/models/svg_vae. For demo purposes, we also release a mini version of the dataset. To download it, run:

cd dataset/
bash download_fonts.sh

Or use these links:

Dataloader

To process a custom dataset of SVGs, use the SVGDataset dataloader. To preprocess them on the fly, you can set already_preprocessed to False, but we recommend preprocessing them before training for better I/O performance.

To do so, use the dataset/preprocess.py script:

python -m dataset.preprocess --data_folder dataset/svgs/ --output_folder dataset/svgs_simplified/ --output_meta_file dataset/svg_meta.csv

This will preprocess all input svgs in a multi-threaded way and generate a meta data file, for easier training filtering.

Then modify the training configuration by providing the correct dataloader module, data folder and meta data file:

cfg.dataloader_module = "deepsvg.svg_dataset"
cfg.data_dir = "./dataset/svgs_simplified/"
cfg.meta_filepath = "./dataset/svg_meta.csv"

Deep learning SVG library

DeepSVG has been developed along with a library for deep learning with SVG data. The main features are:

  • Parsing of SVG files.
  • Conversion of basic shapes and commands to the subset m/l/c/z.
  • Path simplification, using Ramer-Douglas-Peucker and Philip J. Schneider algorithms.
  • Data augmentation: translation, scaling, rotation of SVGs.
  • Conversion to PyTorch tensor format.
  • Draw utilities, including visualization of control points and exporting to GIF animations.

The notebook notebooks/svglib.ipynb provides a walk-trough of the deepsvg.svglib library. Here's a little sample code showing the flexibility of our library:

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()                                 # path simplifcation
icon.zoom(0.75).translate(Point(0, 5)).rotate(Angle(15))  # scale, translate, rotate
icon.draw()

And making a GIF of the SVG is as easy as:

icon.animate()

Differentiable SVG shape optimization

Similarly to PyTorch3D, differentiable operations can be performed on a SVGTensor, enabling to deform a circle to match an arbitrary target via gradient descent. Interestingly, using a lower number of Bézier commands in the initial circle (n) creates somehow artistic approximations of the target shape. See notebooks/svgtensor.ipynb.

n 4 8 16 32
optimization

Graphical User Interface (experimental)

While developing DeepSVG, we have also built a Graphical User Interface (GUI) for easier visualization of our model and as a tool to easily create 2D animations. The code, available under deepsvg/gui, is written with Kivy and the UI style is inspired from the design tool Figma.

DISCLAIMER: this GUI has been developed for demo purposes mainly and features one would expect from a vector graphics editor (like rescaling) will be added in the near future. For more flexibility, we recommend creating animations programmatically using the template code provided in notebooks/animation.ipynb.

Shortcuts:

  • H: hand tool
  • P: pen tool
  • Ctrl/⌘ Cmd P: pencil tool
  • K: make keyframe
  • spacebar: play/pause
  • Ctrl/⌘ Cmd E: export animation to GIF (file is saved by default in ./gui_data)

Training

Start a training by running the following command.

python -m deepsvg.train --config-module configs.deepsvg.hierarchical_ordered

The (optional) --log-dir argument lets you choose the directory where model checkpoints and tensorboard logs will be saved.

Inference (interpolations)

Download pretrained models by running:

cd pretrained/
bash download.sh

If this doesn't work, you can download them manually from Google Drive and place them in the pretrained folder.

We provide sample code in notebooks/interpolate.ipynb to perform interpolation between pairs of SVG icons and notebooks/latent_ops.ipynb for word2vec-like operations in the SVG latent space, as shown in the experiments of our paper.

Notebooks

Description Link to notebook
SVGLib walk-through svglib.ipynb
Differentiable SVGTensor optimization svgtensor.ipynb
DeepSVG interpolation between pairs of icons interpolation.ipynb
DeepSVG latent space operations latent_ops.ipynb
DeepSVG animation between user-drawn images animation.ipynb
DeepSVG generation and interpolation of Fonts fonts.ipynb

Citation

If you find this code useful in your research, please cite:

@misc{carlier2020deepsvg,
    title={DeepSVG: A Hierarchical Generative Network for Vector Graphics Animation},
    author={Alexandre Carlier and Martin Danelljan and Alexandre Alahi and Radu Timofte},
    year={2020},
    eprint={2007.11301},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

Contributing

Contributions are welcome! Feel free to submit a pull request if you have found a bug or developed a feature that may be useful for others. Also, don't hesitate to contact me for any further question related to this code repository.

Licence

This code is released under the MIT licence.

排名相邻
同类项目