← 开源
PeterWang512

GANSketching

Sketch Your Own GAN: Customizing a GAN model with hand-drawn sketches.

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
710
Star
94
Fork
+1
本周
3
贡献者
创建于 2021-08-05 · 更新于 2026-10-13 · 今日第 14700 名
主要开发者
junyanzPeterWang512bionboy

PeterWang512/GANSketching 排名第 14,700,有 710 个星标。

同类别比较

PeterWang512/GANSketching 排名第 14,700,此处有 8 个同类条目;OptMLGroup/VRP-RL 排名第 14,699。

同类别比较
名称排名指标
ajtulloch/dnngraph14,686
语言:
Haskell
星标数:
711
分叉数:
59
简介:
A DSL for deep neural networks, supporting Caffe and Torch
codefuse-ai/MFTCoder14,687
语言:
Python
星标数:
711
分叉数:
69
简介:
High Accuracy and efficiency multi-task fine-tuning framework for Code LLMs. This work has been accepted by KDD 2024.
google/edward214,691
语言:
Jupyter Notebook
星标数:
711
分叉数:
77
简介:
A simple probabilistic programming language.
OptMLGroup/VRP-RL14,699
语言:
Python
星标数:
710
分叉数:
234
简介:
Reinforcement Learning for Solving the Vehicle Routing Problem
agentscope-ai/Trinity-RFT14,701
语言:
Python
星标数:
710
分叉数:
85
简介:
Trinity-RFT is a general-purpose, flexible and scalable framework designed for reinforcement fine-tuning (RFT) of large language models (LLM).
hijkzzz/pymarl214,705
语言:
Python
星标数:
710
分叉数:
135
简介:
Fine-tuned MARL algorithms on SMAC (100% win rates on most scenarios)
kendricktan/suiron14,707
语言:
Python
星标数:
710
分叉数:
77
简介:
Machine Learning for RC Cars
szq0214/DSOD14,711
语言:
Python
星标数:
710
分叉数:
204
简介:
DSOD: Learning Deeply Supervised Object Detectors from Scratch. In ICCV 2017.
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
关键词Image production
星标数710
分叉数94
贡献者3
创建日期2021-08-05
更新日期2026-10-13
1 天星标数0
7 天星标数1
排名14,700
上次排名14,546
排名变化-154
7 天星标排名10,858
上次 7 天星标排名10,924
7 天星标排名变化66
总星标排名14,727
上次总星标排名14,703
总星标排名变化-24
国家USA
README 摘录

Sketch Your Own GAN **Project** | **Paper** | **Youtube** | **Slides** Our method takes in one or a few hand-drawn sketches and customizes an off-the-shelf GAN to match the input sketch. While our new model changes an object’s shape and pose, other visual cues such as color, texture, background, are faithfully preserved after the modification. Sheng-Yu Wang 1 , David Bau 2 , Jun-Yan Zhu 1 . **Aug 16 Update** Training code, evaluation code, and dataset are released. Model weights

are also updated, please re-run if you have downloaded the weights before this update. Results Our method can customize a pre-trained GAN to match input sketches. **Interpolation using our customized models. ** Latent space interpolation is smooth with our customized models. **Image editing using our customized models. ** Given a real image (a), we project it to the original model's latent space z using Huh et al. (c) We then feed the projected z to the our standing cat model

trained on sketches. (d) Finally, we showed edit the image with operation using GANSpace. ** We can interpolate between the customized model by interpolating the W-latent space. We observe similar effect by interpolating the model weights directly. Our method is not capable of generating images to match the Attneave’s cat sketch or the horse sketch by Picasso. We note that Attneave’s cat depicts a complex pose, and Picasso’s sketches are drawn with a distinctive style, both of

which make our method struggle. Getting Started Clone our repo Install packages Install PyTorch (version >= 1. org) Download model weights Run Generate samples from a customized model This command runs the customized model specified by , and generates samples to . Latent space edits by GANSpace Our model preserves the latent space editability of the original model. Our models can apply the same edits using the latents reported in Härkönen et. Colab Thanks to Luke Floden for creating a colab

to do the quick start above. ipynb Model Training Training and evaluating on model trained on PhotoSketch inputs requires running the Precision and Recall metric. The following command pulls the submodule of the forked Precision and Recall repo. Download Datasets and Pre-trained Models The following scripts downloads our sketch data, our evaluation set, LSUN, and pre-trained models from StyleGAN2 and PhotoSketch. To train FFHQ models with image regularization, please download the FFHQ dataset using this link. This is

the zip file of 70,000 images at 1024x1024 resolution. Unzip the files, , rename the folder to and place it in . Training Scripts The example training configurations are specified using the scripts in folder. Use the following commands to launch trainings. The training progress is tracked using by default. To disable wandb logging, please add the tag to the training script. Evaluations Please make sure the evaluation set and model weights are downloaded before running the evaluation. "StyleGAN-NADA: CLIP

-Guided Domain Adaptation of Image Generators. "MineGAN: effective knowledge transfer from GANs to target domains with few images". Acknowledgments This

常见问题

记录了多少星标和分叉?

PeterWang512/GANSketching 有 710 个星标和 94 个分叉。

仓库排名是多少?

PeterWang512/GANSketching 排名第 14,700。

记录的语言和类别是什么?

PeterWang512/GANSketching 有 710 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

PeterWang512/GANSketching 与 OptMLGroup/VRP-RL 比较,后者排名第 14,699,有 710 个星标。

README

Sketch Your Own GAN

Project | Paper | Youtube | Slides

Our method takes in one or a few hand-drawn sketches and customizes an off-the-shelf GAN to match the input sketch. While our new model changes an object’s shape and pose, other visual cues such as color, texture, background, are faithfully preserved after the modification.

Sheng-Yu Wang1, David Bau2, Jun-Yan Zhu1.

CMU1, MIT CSAIL2

In ICCV, 2021.

Aug 16 Update Training code, evaluation code, and dataset are released. Model weights are also updated, please re-run bash weights/download_weights.sh if you have downloaded the weights before this update.

Results

Our method can customize a pre-trained GAN to match input sketches.

Interpolation using our customized models. Latent space interpolation is smooth with our customized models.

Image 1

Interoplation

Image 2

Image editing using our customized models. Given a real image (a), we project it to the original model's latent space z using Huh et al. (b). (c) We then feed the projected z to the our standing cat model trained on sketches. (d) Finally, we showed edit the image with add fur operation using GANSpace.

Model interpolation. We can interpolate between the customized model by interpolating the W-latent space.

Model 1

Interoplation in W-latent space

Model 2

We observe similar effect by interpolating the model weights directly.

Model 1

Interoplation in the model weight space

Model 2

Failure case. Our method is not capable of generating images to match the Attneave’s cat sketch or the horse sketch by Picasso. We note that Attneave’s cat depicts a complex pose, and Picasso’s sketches are drawn with a distinctive style, both of which make our method struggle.

Getting Started

Clone our repo

git clone git@github.com:PeterWang512/GANSketching.git
cd GANSketching

Install packages

  • Install PyTorch (version >= 1.6.0) (pytorch.org)
    pip install -r requirements.txt
    

Download model weights

  • Run bash weights/download_weights.sh

Generate samples from a customized model

This command runs the customized model specified by ckpt, and generates samples to save_dir.

# generates samples from the "standing cat" model.
python generate.py --ckpt weights/photosketch_standing_cat_noaug.pth --save_dir output/samples_standing_cat

# generates samples from the cat face model in Figure. 1 of the paper.
python generate.py --ckpt weights/by_author_cat_aug.pth --save_dir output/samples_teaser_cat

# generates samples from the customized ffhq model.
python generate.py --ckpt weights/by_author_face0_aug.pth --save_dir output/samples_ffhq_face0 --size 1024 --batch_size 20

Latent space edits by GANSpace

Our model preserves the latent space editability of the original model. Our models can apply the same edits using the latents reported in Härkönen et.al. (GANSpace).

# add fur to the standing cats
python ganspace.py --obj cat --comp_id 27 --scalar 50 --layers 2,4 --ckpt weights/photosketch_standing_cat_noaug.pth --save_dir output/ganspace_fur_standing_cat

# close the eyes of the standing cats
python ganspace.py --obj cat --comp_id 45 --scalar 60 --layers 5,7 --ckpt weights/photosketch_standing_cat_noaug.pth --save_dir output/ganspace_eye_standing_cat

Colab

Thanks to Luke Floden for creating a colab to do the quick start above. Colab link: quickstart_colab.ipynb

Model Training

Training and evaluating on model trained on PhotoSketch inputs requires running the Precision and Recall metric. The following command pulls the submodule of the forked Precision and Recall repo.

git submodule update --init --recursive

Download Datasets and Pre-trained Models

The following scripts downloads our sketch data, our evaluation set, LSUN, and pre-trained models from StyleGAN2 and PhotoSketch.

# Download the sketches
bash data/download_sketch_data.sh

# Download evaluation set
bash data/download_eval_data.sh

# Download pretrained models from StyleGAN2 and PhotoSketch
bash pretrained/download_pretrained_models.sh

# Download LSUN cat, horse, and church dataset
bash data/download_lsun.sh

To train FFHQ models with image regularization, please download the FFHQ dataset using this link. This is the zip file of 70,000 images at 1024x1024 resolution. Unzip the files, , rename the images1024x1024 folder to ffhq and place it in ./data/image/.

Training Scripts

The example training configurations are specified using the scripts in scripts folder. Use the following commands to launch trainings.

# Train the "horse riders" model
bash scripts/train_photosketch_horse_riders.sh

# Train the cat face model in Figure. 1 of the paper.
bash scripts/train_teaser_cat.sh

# Train on a single quickdraw sketch
bash scripts/train_quickdraw_single_horse0.sh

# Train on sketches of faces (1024px)
bash scripts/train_authorsketch_ffhq0.sh

The training progress is tracked using wandb by default. To disable wandb logging, please add the --no_wandb tag to the training script.

Evaluations

Please make sure the evaluation set and model weights are downloaded before running the evaluation.

# You may have run these scripts already in the previous sections
bash weights/download_weights.sh
bash data/download_eval_data.sh

Use the following script to evaluate the models, the results will be saved in a csv file specified by the --output flag. --models_list should contain a list of tuple of model weight paths and evaluation data. Please see weights/eval_list for example.

python run_metrics.py --models_list weights/eval_list --output metric_results.csv

Related Works

Acknowledgments

This repository borrows partially from SPADE, stylegan2-pytorch, PhotoSketch, GANSpace, and data-efficient-gans.

Reference

If you find this useful for your research, please cite the following work.

@inproceedings{wang2021sketch,
  title={Sketch Your Own GAN},
  author={Wang, Sheng-Yu and Bau, David and Zhu, Jun-Yan},
  booktitle={Proceedings of the IEEE International Conference on Computer Vision},
  year={2021}
}

Feel free to contact us with any comments or feedback.

排名相邻
同类项目