{"id":24325619,"url":"https://github.com/SagiPolaczek/NeuralSVG","last_synced_at":"2025-09-27T09:31:35.977Z","repository":{"id":271378809,"uuid":"913223835","full_name":"SagiPolaczek/NeuralSVG","owner":"SagiPolaczek","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-07T11:00:49.000Z","size":9607,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-07T11:25:40.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SagiPolaczek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-07T09:15:42.000Z","updated_at":"2025-01-07T11:00:34.000Z","dependencies_parsed_at":"2025-01-07T11:25:43.042Z","dependency_job_id":"f8693e47-f935-4a3c-b671-bbfbd4db5512","html_url":"https://github.com/SagiPolaczek/NeuralSVG","commit_stats":null,"previous_names":["sagipolaczek/neuralsvg"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagiPolaczek%2FNeuralSVG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagiPolaczek%2FNeuralSVG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagiPolaczek%2FNeuralSVG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SagiPolaczek%2FNeuralSVG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SagiPolaczek","download_url":"https://codeload.github.com/SagiPolaczek/NeuralSVG/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234422924,"owners_count":18830315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-17T20:03:49.420Z","updated_at":"2025-09-27T09:31:35.972Z","avatar_url":"https://github.com/SagiPolaczek.png","language":null,"funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# NeuralSVG: An Implicit Representation for Text-to-Vector Generation\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/teaser.jpg\" width=\"800px\"/\u003e\n\u003c/p\u003e\n\n*NeuralSVG generates vector graphics from text prompts with ordered and editable shapes. Our method supports dynamic conditioning, such as background color, which facilitating the generation of multiple color palettes for a single learned representation.*\n\n#### Sagi Polaczek, Yuval Alaluf, Elad Richardson, Yael Vinker, Daniel Cohen-Or  \n\n\u003e Vector graphics are essential in design, providing artists with a versatile medium for creating resolution-independent and highly editable visual content. Recent advancements in vision-language and diffusion models have fueled interest in text-to-vector graphics generation. However, existing approaches often suffer from over-parameterized outputs or treat the layered structure --- a core feature of vector graphics --- as a secondary goal, diminishing their practical use. Recognizing the importance of layered SVG representations, we propose NeuralSVG, an implicit neural representation for generating vector graphics from text prompts. Inspired by Neural Radiance Fields (NeRFs), NeuralSVG encodes the entire scene into the weights of a small MLP network, optimized using Score Distillation Sampling (SDS). To encourage a layered structure in the generated SVG, we introduce a dropout-based regularization technique that strengthens the standalone meaning of each shape. We additionally demonstrate that utilizing a neural representation provides an added benefit of inference-time control, enabling users to dynamically adapt the generated SVG based on user-provided inputs, all with a single learned representation. Through extensive qualitative and quantitative evaluations, we demonstrate that NeuralSVG outperforms existing methods in generating structured and flexible SVG.\n\n\u003ca href=\"https://arxiv.org/abs/2501.03992\"\u003e\u003cimg src=\"https://img.shields.io/badge/arXiv-2412.06753-b31b1b.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://sagipolaczek.github.io/NeuralSVG/\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Project\u0026message=Website\u0026color=red\" height=20.5\u003e\u003c/a\u003e \n\n\n\n## 🔥 NEWS\n\n**`2025/08/01`**: See you in **ICCV 2025** 🍻!\n\n**`2025/04/17`**: Our code is released!\n\n**`2025/01/07`**: Paper is out!\n\n## Table of Contents\n- [Examples](#examples)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Tips](#tips)\n  - [Color Control](#color-control)\n  - [Aspect Ratio Control](#aspect-ratio-control)\n  - [Sketches](#sketches)\n- [Citation](#citation)\n\n\n## Examples\nHere are some example outputs:\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/examples_generation_1.jpg\" width=\"800px\"/\u003e  \n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/examples_dropout_rooster.jpg\" width=\"700px\"/\u003e  \n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/examples_dropout_bunny.jpg\" width=\"700px\"/\u003e  \n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/examples_dropout_astronaut.jpg\" width=\"700px\"/\u003e  \n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/examples_control_color_sydney.jpg\" width=\"700px\"/\u003e  \n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/examples_sketches_margarita.jpg\" width=\"700px\"/\u003e  \n\u003cbr\u003e\n\n\n## Installation\n\n### Step 0 - Create a new conda env\n```\nconda create -n neuralsvg_env python=3.10 -y\nconda activate neuralsvg_env\n```\n\n### Step 1 - Install `diffvg`\nPlease follow their [installation guide](https://github.com/BachiLi/diffvg?tab=readme-ov-file#install). It might get tricky! be patient :-)\n\n### Step 2 - Install requirements\n```\npip install -r requirements.txt\n```\n\n### Step 3 - Download LoRAs\n```\n# Make sure you are in the correct directory\ncd ./lora_weights/\n\n# Download using HF's CLI\nhuggingface-cli download SagiPolaczek/SD2.1-NeuralSVG-LoRAs lora_weights_sd21b_bg_color.safetensors lora_weights_sd21b_bg_color_colorful.safetensors lora_weights_sd21b_sketches.safetensors --local-dir .\n```\n\n\n## Usage\n\n### Tips\n* Use **simple prompts** - clear scene and few objects.\n* **Seed** - Different seeds results with different outcomes. Moreover, since we don't have control on `diffvg`'s randomness, **we can't reproduce runs.**\n\n\n### Color Control\n```\n# Sunflower\npython scripts/train.py --config_path config_files/run_shaping.yaml --data.text_prompt=\"minimalist vector art of a sunflower\" --model.toggle_color=\"true\" --model.toggle_color_bg_colors=\"['light-red', 'light-green', 'light-blue', 'gold', 'gray']\" --model.lora_weights=\"./lora_weights/lora_weights_sd21b_bg_color.safetensors\" --log.exp_name='neuralsvg_sunflower'\n\n# Baby penguin\npython scripts/train.py --config_path config_files/run_shaping.yaml --data.text_prompt=\"minimalist vector art of a baby penguin\" --model.toggle_color=\"true\" --model.toggle_color_bg_colors=\"['light-red', 'light-green', 'light-blue', 'gold', 'gray']\" --model.lora_weights=\"./lora_weights/lora_weights_sd21b_bg_color.safetensors\" --log.exp_name='neuralsvg_baby_penguin'\n\n# Baby bunny sitting on a stack of pancakes\npython scripts/train.py --config_path config_files/run_shaping.yaml --data.text_prompt=\"minimalist vector art of a baby bunny sitting on a stack of pancakes\" --model.toggle_color=\"true\" --model.toggle_color_bg_colors=\"['light-red', 'light-green', 'light-blue', 'gold', 'gray']\" --model.lora_weights=\"./lora_weights/lora_weights_sd21b_bg_color.safetensors\" --log.exp_name='neuralsvg_bunny_pancakes'\n\n# Dog\npython scripts/train.py --config_path config_files/run_shaping.yaml --data.text_prompt=\"minimalist vector art of a dog\" --model.toggle_color=\"true\" --model.toggle_color_bg_colors=\"['light-red', 'light-green', 'light-blue', 'gold', 'gray']\" --model.lora_weights=\"./lora_weights/lora_weights_sd21b_bg_color.safetensors\" --log.exp_name='neuralsvg_dog'\n```\n\nYou can enhance the color difference by using a different LoRA with slightly different prompt. For example:\n\n\n```\n# Colorful Sydney Opera House\npython scripts/train.py --config_path config_files/run_shaping.yaml --data.text_prompt=\"minimalist colorful vector art of Sydney Opera House\" --model.toggle_color=\"true\" --model.toggle_color_bg_colors=\"['light-red', 'light-green', 'light-blue', 'gold', 'gray']\" --model.lora_weights=\"./lora_weights/lora_weights_sd21b_bg_color_colorful.safetensors\" --log.exp_name='neuralsvg_sydney'\n\n# Colorful Dog with a hat\npython scripts/train.py --config_path config_files/run_shaping.yaml --data.text_prompt=\"minimalist colorful vector art of a cat with a hat\" --model.toggle_color=\"true\" --model.toggle_color_bg_colors=\"['light-red', 'light-green', 'light-blue', 'gold', 'gray']\" --model.lora_weights=\"./lora_weights/lora_weights_sd21b_bg_color_colorful.safetensors\" --log.exp_name='neuralsvg_cat_with_hat'\n```\n\n### Aspect Ratio Control\n```\nTBD\n```\n\n### Sketches\n```\n# Rose\npython scripts/train.py --config_path config_files/run_sketching.yaml --data.text_prompt=\"minimal 2d line drawing of a rose. on a white background.\"\n\n# Flamingo\npython scripts/train.py --config_path config_files/run_sketching.yaml --data.text_prompt=\"minimal 2d line drawing of a flamingo. on a white background.\"\n```\n\n\n## Inference\nA cool use-case for our implicit representation is that we can load the model, post-training, and use it to infer unlimited amount of background colors, hopefully resulting with different coloring.\n\nA detailed script will be published!\n\n\n\n\n\n## Citation\nIf you find this code useful for your research, please consider citing us:\n\n```\n@misc{polaczek2025neuralsvgimplicitrepresentationtexttovector,\n      title={NeuralSVG: An Implicit Representation for Text-to-Vector Generation}, \n      author={Sagi Polaczek and Yuval Alaluf and Elad Richardson and Yael Vinker and Daniel Cohen-Or},\n      year={2025},\n      eprint={2501.03992},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV},\n      url={https://arxiv.org/abs/2501.03992}, \n}\n```\n\n\n## Star History\n[![Star History Chart](https://api.star-history.com/svg?repos=sagipolaczek/neuralSVG\u0026type=Date)](https://www.star-history.com/#sagipolaczek/neuralSVG\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSagiPolaczek%2FNeuralSVG","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSagiPolaczek%2FNeuralSVG","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSagiPolaczek%2FNeuralSVG/lists"}