Im2Vec β Logo Raster-to-SVG
A PyTorch model that converts a raster logo (PNG/JPEG) into an editable SVG vector file.
Model
- Architecture: ResNet-18 encoder + autoregressive Transformer decoder
(6 layers, 8 heads,
d_model=512) that emits SVG drawing tokens. - Checkpoint:
model_epoch100.ptβ trained 100 epochs on ~3,500 FIGR-8 logos.
Usage
See the logo-to-svg Space for a ready-to-use drag-and-drop demo, or the source repo at github.com/R1ley-w/JPG-to-SVG-web-tool.
Known limitation (current checkpoint): monochrome-only output
model_epoch100.pt was trained only on
FIGR-8, which turns
out to contain zero color information: every sampled training SVG relies
on the SVG default fill (black), with no fill/style attribute at all. The
model therefore always predicts black fills, regardless of the input logo's
actual colors β this is a property of the training data, not a bug in the
model code.
Two related bugs in the surrounding code (fixed in the source repo, and in
the live Space) made this worse: Image.convert("RGB") doesn't
alpha-composite, so transparent input backgrounds were rendered solid black
instead of left transparent/white; and the SVG tokenizer ignored CSS
style="fill:...;" paint declarations.
A colored training set, starvector/svg-emoji (10k rows, full color, mixed permissive licenses), and the pipeline fixes are available in the source repo now. A retrained, color-capable checkpoint has not been produced yet β training needs a GPU, which wasn't available when these fixes were made.
Dataset
Trained on FIGR-8, a logo/pictogram SVG dataset licensed for non-commercial use only. This model is therefore distributed under CC BY-NC 4.0.
A future checkpoint trained on starvector/svg-emoji would additionally be bound by that dataset's mixed licenses (Twemoji CC-BY 4.0, Noto Emoji Apache-2.0/OFL, OpenMoji CC BY-SA 4.0 share-alike).
Limitations
- Output is normalized to a 256Γ256 canvas; non-square inputs are squashed.
- Supports flat fills and simple strokes; no gradients, patterns, or text.
- Current checkpoint outputs black/monochrome shapes only β see above.