{"id":26307971,"url":"https://github.com/safememoryzone/sketch2face","last_synced_at":"2025-07-03T00:05:07.400Z","repository":{"id":280190917,"uuid":"907033694","full_name":"SafeMemoryZone/sketch2face","owner":"SafeMemoryZone","description":"GAN model trained to convert a simple sketch into a detailed face picture.","archived":false,"fork":false,"pushed_at":"2025-03-01T20:54:26.000Z","size":7619,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T10:02:52.494Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SafeMemoryZone.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":"2024-12-22T16:18:07.000Z","updated_at":"2025-03-01T20:54:32.000Z","dependencies_parsed_at":"2025-03-01T21:37:45.753Z","dependency_job_id":null,"html_url":"https://github.com/SafeMemoryZone/sketch2face","commit_stats":null,"previous_names":["safememoryzone/sketch2face"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SafeMemoryZone/sketch2face","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafeMemoryZone%2Fsketch2face","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafeMemoryZone%2Fsketch2face/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafeMemoryZone%2Fsketch2face/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafeMemoryZone%2Fsketch2face/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SafeMemoryZone","download_url":"https://codeload.github.com/SafeMemoryZone/sketch2face/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafeMemoryZone%2Fsketch2face/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263234940,"owners_count":23434917,"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-03-15T10:16:54.937Z","updated_at":"2025-07-03T00:05:07.362Z","avatar_url":"https://github.com/SafeMemoryZone.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cimg src='imgs/horse2zebra.gif' align=\"right\" width=384\u003e\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n# CycleGAN and pix2pix in PyTorch\n\n**New**:  Please check out [img2img-turbo](https://github.com/GaParmar/img2img-turbo) repo that includes both pix2pix-turbo and CycleGAN-Turbo. Our new one-step image-to-image translation methods can support both paired and unpaired training and produce better results by leveraging the pre-trained StableDiffusion-Turbo model. The inference time for 512x512 image is 0.29 sec on A6000 and 0.11 sec on A100.\n\nPlease check out [contrastive-unpaired-translation](https://github.com/taesungp/contrastive-unpaired-translation) (CUT), our new unpaired image-to-image translation model that enables fast and memory-efficient training.\n\nWe provide PyTorch implementations for both unpaired and paired image-to-image translation.\n\nThe code was written by [Jun-Yan Zhu](https://github.com/junyanz) and [Taesung Park](https://github.com/taesungp), and supported by [Tongzhou Wang](https://github.com/SsnL).\n\nThis PyTorch implementation produces results comparable to or better than our original Torch software. If you would like to reproduce the same results as in the papers, check out the original [CycleGAN Torch](https://github.com/junyanz/CycleGAN) and [pix2pix Torch](https://github.com/phillipi/pix2pix) code in Lua/Torch.\n\n**Note**: The current software works well with PyTorch 1.4. Check out the older [branch](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/tree/pytorch0.3.1) that supports PyTorch 0.1-0.3.\n\nYou may find useful information in [training/test tips](docs/tips.md) and [frequently asked questions](docs/qa.md). To implement custom models and datasets, check out our [templates](#custom-model-and-dataset). To help users better understand and adapt our codebase, we provide an [overview](docs/overview.md) of the code structure of this repository.\n\n**CycleGAN: [Project](https://junyanz.github.io/CycleGAN/) |  [Paper](https://arxiv.org/pdf/1703.10593.pdf) |  [Torch](https://github.com/junyanz/CycleGAN) |\n[Tensorflow Core Tutorial](https://www.tensorflow.org/tutorials/generative/cyclegan) | [PyTorch Colab](https://colab.research.google.com/github/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/CycleGAN.ipynb)**\n\n\u003cimg src=\"https://junyanz.github.io/CycleGAN/images/teaser_high_res.jpg\" width=\"800\"/\u003e\n\n**Pix2pix:  [Project](https://phillipi.github.io/pix2pix/) |  [Paper](https://arxiv.org/pdf/1611.07004.pdf) |  [Torch](https://github.com/phillipi/pix2pix) |\n[Tensorflow Core Tutorial](https://www.tensorflow.org/tutorials/generative/pix2pix) | [PyTorch Colab](https://colab.research.google.com/github/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/pix2pix.ipynb)**\n\n\u003cimg src=\"https://phillipi.github.io/pix2pix/images/teaser_v3.png\" width=\"800px\"/\u003e\n\n\n**[EdgesCats Demo](https://affinelayer.com/pixsrv/) | [pix2pix-tensorflow](https://github.com/affinelayer/pix2pix-tensorflow) | by [Christopher Hesse](https://twitter.com/christophrhesse)**\n\n\u003cimg src='imgs/edges2cats.jpg' width=\"400px\"/\u003e\n\nIf you use this code for your research, please cite:\n\nUnpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks.\u003cbr\u003e\n[Jun-Yan Zhu](https://www.cs.cmu.edu/~junyanz/)\\*,  [Taesung Park](https://taesung.me/)\\*, [Phillip Isola](https://people.eecs.berkeley.edu/~isola/), [Alexei A. Efros](https://people.eecs.berkeley.edu/~efros). In ICCV 2017. (* equal contributions) [[Bibtex]](https://junyanz.github.io/CycleGAN/CycleGAN.txt)\n\n\nImage-to-Image Translation with Conditional Adversarial Networks.\u003cbr\u003e\n[Phillip Isola](https://people.eecs.berkeley.edu/~isola), [Jun-Yan Zhu](https://www.cs.cmu.edu/~junyanz/), [Tinghui Zhou](https://people.eecs.berkeley.edu/~tinghuiz), [Alexei A. Efros](https://people.eecs.berkeley.edu/~efros). In CVPR 2017. [[Bibtex]](https://www.cs.cmu.edu/~junyanz/projects/pix2pix/pix2pix.bib)\n\n## Talks and Course\npix2pix slides: [keynote](http://efrosgans.eecs.berkeley.edu/CVPR18_slides/pix2pix.key) | [pdf](http://efrosgans.eecs.berkeley.edu/CVPR18_slides/pix2pix.pdf),\nCycleGAN slides: [pptx](http://efrosgans.eecs.berkeley.edu/CVPR18_slides/CycleGAN.pptx) | [pdf](http://efrosgans.eecs.berkeley.edu/CVPR18_slides/CycleGAN.pdf)\n\nCycleGAN course assignment [code](http://www.cs.toronto.edu/~rgrosse/courses/csc321_2018/assignments/a4-code.zip) and [handout](http://www.cs.toronto.edu/~rgrosse/courses/csc321_2018/assignments/a4-handout.pdf) designed by Prof. [Roger Grosse](http://www.cs.toronto.edu/~rgrosse/) for [CSC321](http://www.cs.toronto.edu/~rgrosse/courses/csc321_2018/) \"Intro to Neural Networks and Machine Learning\" at University of Toronto. Please contact the instructor if you would like to adopt it in your course.\n\n## Colab Notebook\nTensorFlow Core CycleGAN Tutorial: [Google Colab](https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/generative/cyclegan.ipynb) | [Code](https://github.com/tensorflow/docs/blob/master/site/en/tutorials/generative/cyclegan.ipynb)\n\nTensorFlow Core pix2pix Tutorial: [Google Colab](https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/generative/pix2pix.ipynb) | [Code](https://github.com/tensorflow/docs/blob/master/site/en/tutorials/generative/pix2pix.ipynb)\n\nPyTorch Colab notebook: [CycleGAN](https://colab.research.google.com/github/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/CycleGAN.ipynb) and [pix2pix](https://colab.research.google.com/github/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/pix2pix.ipynb)\n\nZeroCostDL4Mic Colab notebook: [CycleGAN](https://colab.research.google.com/github/HenriquesLab/ZeroCostDL4Mic/blob/master/Colab_notebooks_Beta/CycleGAN_ZeroCostDL4Mic.ipynb) and [pix2pix](https://colab.research.google.com/github/HenriquesLab/ZeroCostDL4Mic/blob/master/Colab_notebooks_Beta/pix2pix_ZeroCostDL4Mic.ipynb)\n\n## Other implementations\n### CycleGAN\n\u003cp\u003e\u003ca href=\"https://github.com/leehomyc/cyclegan-1\"\u003e [Tensorflow]\u003c/a\u003e (by Harry Yang),\n\u003ca href=\"https://github.com/architrathore/CycleGAN/\"\u003e[Tensorflow]\u003c/a\u003e (by Archit Rathore),\n\u003ca href=\"https://github.com/vanhuyz/CycleGAN-TensorFlow\"\u003e[Tensorflow]\u003c/a\u003e (by Van Huy),\n\u003ca href=\"https://github.com/XHUJOY/CycleGAN-tensorflow\"\u003e[Tensorflow]\u003c/a\u003e (by Xiaowei Hu),\n\u003ca href=\"https://github.com/LynnHo/CycleGAN-Tensorflow-2\"\u003e [Tensorflow2]\u003c/a\u003e (by Zhenliang He),\n\u003ca href=\"https://github.com/luoxier/CycleGAN_Tensorlayer\"\u003e [TensorLayer1.0]\u003c/a\u003e (by luoxier),\n\u003ca href=\"https://github.com/tensorlayer/cyclegan\"\u003e [TensorLayer2.0]\u003c/a\u003e (by zsdonghao),\n\u003ca href=\"https://github.com/Aixile/chainer-cyclegan\"\u003e[Chainer]\u003c/a\u003e (by Yanghua Jin),\n\u003ca href=\"https://github.com/yunjey/mnist-svhn-transfer\"\u003e[Minimal PyTorch]\u003c/a\u003e (by yunjey),\n\u003ca href=\"https://github.com/Ldpe2G/DeepLearningForFun/tree/master/Mxnet-Scala/CycleGAN\"\u003e[Mxnet]\u003c/a\u003e (by Ldpe2G),\n\u003ca href=\"https://github.com/tjwei/GANotebooks\"\u003e[lasagne/Keras]\u003c/a\u003e (by tjwei),\n\u003ca href=\"https://github.com/simontomaskarlsson/CycleGAN-Keras\"\u003e[Keras]\u003c/a\u003e (by Simon Karlsson),\n\u003ca href=\"https://github.com/Ldpe2G/DeepLearningForFun/tree/master/Oneflow-Python/CycleGAN\"\u003e[OneFlow]\u003c/a\u003e (by Ldpe2G)\n\u003c/p\u003e\n\u003c/ul\u003e\n\n### pix2pix\n\u003cp\u003e\u003ca href=\"https://github.com/affinelayer/pix2pix-tensorflow\"\u003e [Tensorflow]\u003c/a\u003e (by Christopher Hesse),\n\u003ca href=\"https://github.com/Eyyub/tensorflow-pix2pix\"\u003e[Tensorflow]\u003c/a\u003e (by Eyyüb Sariu),\n\u003ca href=\"https://github.com/datitran/face2face-demo\"\u003e [Tensorflow (face2face)]\u003c/a\u003e (by Dat Tran),\n\u003ca href=\"https://github.com/awjuliani/Pix2Pix-Film\"\u003e [Tensorflow (film)]\u003c/a\u003e (by Arthur Juliani),\n\u003ca href=\"https://github.com/kaonashi-tyc/zi2zi\"\u003e[Tensorflow (zi2zi)]\u003c/a\u003e (by Yuchen Tian),\n\u003ca href=\"https://github.com/pfnet-research/chainer-pix2pix\"\u003e[Chainer]\u003c/a\u003e (by mattya),\n\u003ca href=\"https://github.com/tjwei/GANotebooks\"\u003e[tf/torch/keras/lasagne]\u003c/a\u003e (by tjwei),\n\u003ca href=\"https://github.com/taey16/pix2pixBEGAN.pytorch\"\u003e[Pytorch]\u003c/a\u003e (by taey16)\n\u003c/p\u003e\n\u003c/ul\u003e\n\n## Prerequisites\n- Linux or macOS\n- Python 3\n- CPU or NVIDIA GPU + CUDA CuDNN\n\n## Getting Started\n### Installation\n\n- Clone this repo:\n```bash\ngit clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix\ncd pytorch-CycleGAN-and-pix2pix\n```\n\n- Install [PyTorch](http://pytorch.org) and 0.4+ and other dependencies (e.g., torchvision, [visdom](https://github.com/facebookresearch/visdom) and [dominate](https://github.com/Knio/dominate)).\n  - For pip users, please type the command `pip install -r requirements.txt`.\n  - For Conda users, you can create a new Conda environment using `conda env create -f environment.yml`.\n  - For Docker users, we provide the pre-built Docker image and Dockerfile. Please refer to our [Docker](docs/docker.md) page.\n  - For Repl users, please click [![Run on Repl.it](https://repl.it/badge/github/junyanz/pytorch-CycleGAN-and-pix2pix)](https://repl.it/github/junyanz/pytorch-CycleGAN-and-pix2pix).\n\n### CycleGAN train/test\n- Download a CycleGAN dataset (e.g. maps):\n```bash\nbash ./datasets/download_cyclegan_dataset.sh maps\n```\n- To view training results and loss plots, run `python -m visdom.server` and click the URL http://localhost:8097.\n- To log training progress and test images to W\u0026B dashboard, set the `--use_wandb` flag with train and test script\n- Train a model:\n```bash\n#!./scripts/train_cyclegan.sh\npython train.py --dataroot ./datasets/maps --name maps_cyclegan --model cycle_gan\n```\nTo see more intermediate results, check out `./checkpoints/maps_cyclegan/web/index.html`.\n- Test the model:\n```bash\n#!./scripts/test_cyclegan.sh\npython test.py --dataroot ./datasets/maps --name maps_cyclegan --model cycle_gan\n```\n- The test results will be saved to a html file here: `./results/maps_cyclegan/latest_test/index.html`.\n\n### pix2pix train/test\n- Download a pix2pix dataset (e.g.[facades](http://cmp.felk.cvut.cz/~tylecr1/facade/)):\n```bash\nbash ./datasets/download_pix2pix_dataset.sh facades\n```\n- To view training results and loss plots, run `python -m visdom.server` and click the URL http://localhost:8097.\n- To log training progress and test images to W\u0026B dashboard, set the `--use_wandb` flag with train and test script\n- Train a model:\n```bash\n#!./scripts/train_pix2pix.sh\npython train.py --dataroot ./datasets/facades --name facades_pix2pix --model pix2pix --direction BtoA\n```\nTo see more intermediate results, check out  `./checkpoints/facades_pix2pix/web/index.html`.\n\n- Test the model (`bash ./scripts/test_pix2pix.sh`):\n```bash\n#!./scripts/test_pix2pix.sh\npython test.py --dataroot ./datasets/facades --name facades_pix2pix --model pix2pix --direction BtoA\n```\n- The test results will be saved to a html file here: `./results/facades_pix2pix/test_latest/index.html`. You can find more scripts at `scripts` directory.\n- To train and test pix2pix-based colorization models, please add `--model colorization` and `--dataset_mode colorization`. See our training [tips](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/docs/tips.md#notes-on-colorization) for more details.\n\n### Apply a pre-trained model (CycleGAN)\n- You can download a pretrained model (e.g. horse2zebra) with the following script:\n```bash\nbash ./scripts/download_cyclegan_model.sh horse2zebra\n```\n- The pretrained model is saved at `./checkpoints/{name}_pretrained/latest_net_G.pth`. Check [here](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/scripts/download_cyclegan_model.sh#L3) for all the available CycleGAN models.\n- To test the model, you also need to download the  horse2zebra dataset:\n```bash\nbash ./datasets/download_cyclegan_dataset.sh horse2zebra\n```\n\n- Then generate the results using\n```bash\npython test.py --dataroot datasets/horse2zebra/testA --name horse2zebra_pretrained --model test --no_dropout\n```\n- The option `--model test` is used for generating results of CycleGAN only for one side. This option will automatically set `--dataset_mode single`, which only loads the images from one set. On the contrary, using `--model cycle_gan` requires loading and generating results in both directions, which is sometimes unnecessary. The results will be saved at `./results/`. Use `--results_dir {directory_path_to_save_result}` to specify the results directory.\n\n- For pix2pix and your own models, you need to explicitly specify `--netG`, `--norm`, `--no_dropout` to match the generator architecture of the trained model. See this [FAQ](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/docs/qa.md#runtimeerror-errors-in-loading-state_dict-812-671461-296) for more details.\n\n### Apply a pre-trained model (pix2pix)\nDownload a pre-trained model with `./scripts/download_pix2pix_model.sh`.\n\n- Check [here](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/scripts/download_pix2pix_model.sh#L3) for all the available pix2pix models. For example, if you would like to download label2photo model on the Facades dataset,\n```bash\nbash ./scripts/download_pix2pix_model.sh facades_label2photo\n```\n- Download the pix2pix facades datasets:\n```bash\nbash ./datasets/download_pix2pix_dataset.sh facades\n```\n- Then generate the results using\n```bash\npython test.py --dataroot ./datasets/facades/ --direction BtoA --model pix2pix --name facades_label2photo_pretrained\n```\n- Note that we specified `--direction BtoA` as Facades dataset's A to B direction is photos to labels.\n\n- If you would like to apply a pre-trained model to a collection of input images (rather than image pairs), please use `--model test` option. See `./scripts/test_single.sh` for how to apply a model to Facade label maps (stored in the directory `facades/testB`).\n\n- See a list of currently available models at `./scripts/download_pix2pix_model.sh`\n\n## [Docker](docs/docker.md)\nWe provide the pre-built Docker image and Dockerfile that can run this code repo. See [docker](docs/docker.md).\n\n## [Datasets](docs/datasets.md)\nDownload pix2pix/CycleGAN datasets and create your own datasets.\n\n## [Training/Test Tips](docs/tips.md)\nBest practice for training and testing your models.\n\n## [Frequently Asked Questions](docs/qa.md)\nBefore you post a new question, please first look at the above Q \u0026 A and existing GitHub issues.\n\n## Custom Model and Dataset\nIf you plan to implement custom models and dataset for your new applications, we provide a dataset [template](data/template_dataset.py) and a model [template](models/template_model.py) as a starting point.\n\n## [Code structure](docs/overview.md)\nTo help users better understand and use our code, we briefly overview the functionality and implementation of each package and each module.\n\n## Pull Request\nYou are always welcome to contribute to this repository by sending a [pull request](https://help.github.com/articles/about-pull-requests/).\nPlease run `flake8 --ignore E501 .` and `python ./scripts/test_before_push.py` before you commit the code. Please also update the code structure [overview](docs/overview.md) accordingly if you add or remove files.\n\n## Citation\nIf you use this code for your research, please cite our papers.\n```\n@inproceedings{CycleGAN2017,\n  title={Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks},\n  author={Zhu, Jun-Yan and Park, Taesung and Isola, Phillip and Efros, Alexei A},\n  booktitle={Computer Vision (ICCV), 2017 IEEE International Conference on},\n  year={2017}\n}\n\n\n@inproceedings{isola2017image,\n  title={Image-to-Image Translation with Conditional Adversarial Networks},\n  author={Isola, Phillip and Zhu, Jun-Yan and Zhou, Tinghui and Efros, Alexei A},\n  booktitle={Computer Vision and Pattern Recognition (CVPR), 2017 IEEE Conference on},\n  year={2017}\n}\n```\n\n## Other Languages\n[Spanish](docs/README_es.md)\n\n## Related Projects\n**[contrastive-unpaired-translation](https://github.com/taesungp/contrastive-unpaired-translation) (CUT)**\u003cbr\u003e\n**[CycleGAN-Torch](https://github.com/junyanz/CycleGAN) |\n[pix2pix-Torch](https://github.com/phillipi/pix2pix) | [pix2pixHD](https://github.com/NVIDIA/pix2pixHD)|\n[BicycleGAN](https://github.com/junyanz/BicycleGAN) | [vid2vid](https://tcwang0509.github.io/vid2vid/) | [SPADE/GauGAN](https://github.com/NVlabs/SPADE)**\u003cbr\u003e\n**[iGAN](https://github.com/junyanz/iGAN) | [GAN Dissection](https://github.com/CSAILVision/GANDissect) | [GAN Paint](http://ganpaint.io/)**\n\n## Cat Paper Collection\nIf you love cats, and love reading cool graphics, vision, and learning papers, please check out the Cat Paper [Collection](https://github.com/junyanz/CatPapers).\n\n## Acknowledgments\nOur code is inspired by [pytorch-DCGAN](https://github.com/pytorch/examples/tree/master/dcgan).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsafememoryzone%2Fsketch2face","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsafememoryzone%2Fsketch2face","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsafememoryzone%2Fsketch2face/lists"}