How ctlab-itmo/livboc works
LIVBOC converts raster images into layered SVG artwork: contour extraction and color selection initialize vector shapes, which are optimized against the target and saved as SVG. main.py is the experiment entry point; classes.py, functions.py, and utils.py support the optimization workflow. DiffVG supplies differentiable rendering and SVG handling through its PyTorch interface and native renderer. The documented stages are clear, but unsampled LIVBOC implementation details limit attribution of some individual steps.
Main entry points: main.py Experiment runner · diffvg.cpp Differentiable renderer · optimize_svg.py SVG optimizer · render_pytorch.py PyTorch render interface
Components 18
Vectorization workflow
- Experiment runner
LIVBOC/main.py - Contour extraction
LIVBOC/functions.py - Color selection
LIVBOC/functions.py - Shape initialization
LIVBOC/classes.py - Workflow utilities
LIVBOC/utils.py
Optimization
- Shape alignment
LIVBOC/main.py - Image and smoothness losses
LIVBOC/smoothness_loss.py - SVG optimizer
DiffVG/pydiffvg/optimize_svg.py
DiffVG rendering
- PyTorch render interface
DiffVG/pydiffvg/render_pytorch.py - Differentiable renderer
DiffVG/diffvg.cpp - Scene and shapes
DiffVG/scene.h - Geometry and distance
DiffVG/compute_distance.h - Render support
DiffVG
SVG and image I/O
- SVG parsing
DiffVG/pydiffvg/parse_svg.py - SVG saving
DiffVG/pydiffvg/save_svg.py
Other components
- Experiment user
- Raster target
- SVG result
Connections 18
- Experiment user → Experiment runner: configures run
README.md - Raster target → Experiment runner: provides target
README.md - Experiment runner → Contour extraction: extracts contours
README.md - Experiment runner → Color selection: selects colors
README.md - Experiment runner → Shape initialization: initializes vectors
LIVBOC/main.py - Experiment runner → Workflow utilities: uses utilities
LIVBOC/main.py - Experiment runner → Shape alignment: optimizes vectors
README.md - Experiment runner → Image and smoothness losses: computes losses
LIVBOC/main.py - Experiment runner → PyTorch render interface: renders scene
LIVBOC/main.py - Shape alignment → SVG optimizer: optimizes SVG
- PyTorch render interface → Differentiable renderer: invokes renderer
- Differentiable renderer → Scene and shapes: uses scene data
DiffVG/diffvg.cpp - Differentiable renderer → Geometry and distance: computes distances
DiffVG/diffvg.cpp - Differentiable renderer → Render support: uses support
DiffVG/diffvg.cpp - SVG parsing → Scene and shapes: builds scenes
- Experiment runner → SVG saving: saves initialization
LIVBOC/main.py - Experiment runner → SVG result: exports artwork
README.md - SVG optimizer → SVG result: writes optimized SVG