Sign inSign up

tanguymagne/sldgen

By tanguymagne

•Updated 4 months ago

Official Image for the paper "Single-Line Drawing Generation via Semantics-Driven Optimization"

Image
Machine learning & AI
0

644

tanguymagne/sldgen repository overview

⁠Single Line Drawing Generation via Semantics-Driven Optimization

Prebuilt image for the CGF 2026 paper "Single Line Drawing Generation via Semantics-Driven Optimization".

Tanguy Magne⁠, Alexandre Binninger⁠, Ruben Wiersma⁠, Olga Sorkine-Hornung⁠

website ⁠ website⁠

This image bundles all system and Python dependencies (CUDA 12.4, diffvg with GPU support, the wiregrad repulsion loss, the Concorde TSP solver, and the project code) to run the SLDgen method. Model weights (Stable Diffusion 3.5 medium, CLIP, DINOv2, SigLIP) are not baked in — they are downloaded on first run into a host-mounted cache so they persist across runs.

⁠Requirements

⁠Quick start

docker pull tanguymagne/sldgen

mkdir -p data output ~/sldgen-hf-cache
# put your input image in ./data

docker run --gpus all --rm \
  --user $(id -u):$(id -g) \
  -e HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
  -v "$(pwd)/data:/app/data" \
  -v "$(pwd)/output:/app/output" \
  -v "$HOME/sldgen-hf-cache:/hf-cache" \
  tanguymagne/sldgen \
  python sldgen.py --target data/firefighter.png

What each flag does:

  • --gpus all exposes the host GPU to the container.
  • --user $(id -u):$(id -g) makes the generated files in ./output belong to your user instead of root.
  • -e HF_TOKEN=... is needed on first run to fetch the gated SD3.5 medium weights. Subsequent runs don't need it as long as the cache volume is reused.
  • -v "$(pwd)/data:/app/data" mounts your input images. Replace data/firefighter.png with the path to your own image (relative to ./data).
  • -v "$(pwd)/output:/app/output" is where the generated SVGs are written.
  • -v "$HOME/sldgen-hf-cache:/hf-cache" persists the ~40 GB of model weights across runs. Skip it and the weights re-download every time, because --rm discards the in-container cache.

⁠First-run download

On first run the container downloads:

  • stabilityai/stable-diffusion-3.5-medium (~15 GB, gated — requires HF_TOKEN)
  • openai/clip-vit-large-patch14
  • facebook/dinov2-base
  • google/siglip-so400m-patch14-384

Expect ~40 GB total, several minutes depending on bandwidth. The files land under ~/sldgen-hf-cache and are reused afterwards.

⁠Tuning

The command above uses default parameters. Many knobs are exposed — see docs.md⁠ in the repo or run:

docker run --gpus all --rm tanguymagne/sldgen python sldgen.py --help

⁠Troubleshooting

  • failed to discover GPU vendor from CDI — the NVIDIA Container Toolkit isn't installed or configured. Follow the install guide above and restart the Docker daemon.
  • Cannot access gated repo / 401 — your HF_TOKEN is missing or your account hasn't accepted the SD3.5 medium license.
  • Output files owned by root — you forgot --user $(id -u):$(id -g).
  • Weights re-downloaded every run — you forgot the -v "$HOME/sldgen-hf-cache:/hf-cache" mount.

⁠Citation

@article{Magne:SLDgen:2026,
  title   = {Single Line Drawing Generation via Semantics-Driven Optimization},
  author  = {Magne, Tanguy and Binninger, Alexandre and Wiersma, Ruben and Sorkine-Hornung, Olga},
  journal = {Computer Graphics Forum},
  year    = {2026},
  url     = {https://doi.org/10.1111/cgf.70502},
}

⁠License notes

The image bundles the Concorde TSP solver⁠ under its academic non-commercial license. The Stable Diffusion 3.5 medium weights are not included; they're downloaded at runtime under the Stability AI Community License⁠, which the user accepts directly with Hugging Face.

Tag summary

Content type

Image

Digest

sha256:4cb341218…

Size

15.3 GB

Last updated

4 months ago

docker pull tanguymagne/sldgen