Skip to main content

A png drawing to svg converter

Project description

sketch-vectorization

Goal

The goal of this project is to implement the following paper: https://www-sop.inria.fr/reves/Basilic/2016/FLB16/fidelity_simplicity.pdf

We also implemented several new ideas, such as a convolutional neural network with synthetic data augmentation for preprocessing.

Demo

Guess what: the entire library can run in your browser !

If you want a guided tour of how the library works, go here:

If you just want to test it for yourself, with your own drawings, go here:

Install

The library is also available as a pip package:

pip install "sketchy-svg[onnx]"
# or use uv: uv add "sketchy-svg[onnx]"

There is no command line interface. You can easily build your own, to get inspiration look at src/sketchy_svg/viz inside the class Demo

Use locally

To install the dependencies, install uv and run:

uv sync --extra onnx 

To launch the notebooks, run uv run marimo edit ., it should open the notebooks in your browser.

Train the CNN

The CNN denoiser can be trained from notebooks/cnn.py.

1. Install training dependencies

On a machine with a GPU (Linux, default CUDA torch):

uv sync --group train

On a CPU-only machine (e.g. your local machine):

uv sync --group train --extra cpu

2. Run the notebook

uv run marimo edit notebooks/cnn.py

Set USE_RAY = False to train locally, or USE_RAY = True to offload to a remote Ray cluster (set RAY_ADDRESS accordingly). The trained model is exported to src/sketchy_cnn/model.onnx at the end of the notebook.

How the SVG dataset is downloaded

data/svg_dataset.csv is tracked in git so no download is needed in most cases.

If you need to refresh it, the dataset comes from OmniSVG/MMSVG-Icon on HuggingFace. Create a token at https://huggingface.co/settings/tokens and add it to a .env file at the project root:

HF_TOKEN=hf_...

Then use the download button in notebooks/svg_dataset.py.

Documentation

If you want, you can read the Presentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sketchy_svg-0.2.4.tar.gz (270.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sketchy_svg-0.2.4-py3-none-any.whl (272.0 kB view details)

Uploaded Python 3

File details

Details for the file sketchy_svg-0.2.4.tar.gz.

File metadata

  • Download URL: sketchy_svg-0.2.4.tar.gz
  • Upload date:
  • Size: 270.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sketchy_svg-0.2.4.tar.gz
Algorithm Hash digest
SHA256 0d037c97c5fc99a411ea3467c1c47e3471bd006b3900e3f92933cec6e526a02d
MD5 ed07003d53a52ca1d403df19b0f49870
BLAKE2b-256 ca031cccd0d14afdae2d7b2eb687057052fdfe448b0944583388eb5d62a49ce3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sketchy_svg-0.2.4.tar.gz:

Publisher: publish.yml on rambip/sketch-vectorization

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sketchy_svg-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: sketchy_svg-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 272.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sketchy_svg-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c673da3a39547777aee9ca5eed4805022f9315dc1f54d6a1c0199cdc0ab78069
MD5 2a21a005cb2165f0eaaf3dfb40c263c1
BLAKE2b-256 304aa8a8f8c745eb9db2828d18348571d9daf3cd899567ea45f0d1f4a55813b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for sketchy_svg-0.2.4-py3-none-any.whl:

Publisher: publish.yml on rambip/sketch-vectorization

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page