Là một công cụ AI, junyanz/pytorch-CycleGAN-and-pix2pix đã đạt 25.3k sao trên GitHub, ngôn ngữ Python. Image-to-Image Translation in PyTorch
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Udpate in 2025: we recently updated the code to support Python 3.11 and PyTorch 2.4. It also supports DDP for single-machine multiple-GPU training. (Please use torchrun --nproc_per_node=4 train.py ...)
New: Please check out 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.
Please check out contrastive-unpaired-translation (CUT), our new unpaired image-to-image translation model that enables fast and memory-efficient training.
We provide PyTorch implementations for both unpaired and paired image-to-image translation.
The code was written by Jun-Yan Zhu and Taesung Park, and supported by Tongzhou Wang.
This 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 and pix2pix Torch code in Lua/Torch.
Note: The current software works well with PyTorch 2.4+. Check out the older branch that supports PyTorch 0.1-0.3.
You may find useful information in training/test tips and frequently asked questions. To implement custom models and datasets, check out our templates. To help users better understand and adapt our codebase, we provide an overview of the code structure of this repository.
EdgesCats Demo | pix2pix-tensorflow | by Christopher Hesse
If you use this code for your research, please cite:
Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks.
Jun-Yan Zhu*, Taesung Park*, Phillip Isola, Alexei A. Efros. In ICCV 2017. (* equal contributions) [Bibtex]
Image-to-Image Translation with Conditional Adversarial Networks.
Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, Alexei A. Efros. In CVPR 2017. [Bibtex]
Talks and Course
pix2pix slides: keynote | pdf,
CycleGAN slides: pptx | pdf
CycleGAN course assignment code and handout designed by Prof. Roger Grosse for CSC321 "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.
Colab Notebook
TensorFlow Core CycleGAN Tutorial: Google Colab | Code
TensorFlow Core pix2pix Tutorial: Google Colab | Code
PyTorch Colab notebook: CycleGAN and pix2pix
ZeroCostDL4Mic Colab notebook: CycleGAN and pix2pix
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.
To train and test pix2pix-based colorization models, please add --model colorization and --dataset_mode colorization. See our training tips for more details.
Apply a pre-trained model (CycleGAN)
You can download a pretrained model (e.g. horse2zebra) with the following script:
python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra_pretrained --model test --no_dropout
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.
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 for more details.
Apply a pre-trained model (pix2pix)
Download a pre-trained model with ./scripts/download_pix2pix_model.sh.
Check here for all the available pix2pix models. For example, if you would like to download label2photo model on the Facades dataset,
Note that we specified --direction BtoA as Facades dataset's A to B direction is photos to labels.
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).
See a list of currently available models at ./scripts/download_pix2pix_model.sh
Multi-GPU training
To train a model on multiple GPUs, please use torchrun --nproc_per_node=4 train.py ... instead of python train.py .... We also need to use synchronized batchnorm by setting --norm sync_batch (or --norm sync_instance for instance normgalization). The --norm batch is not compatible with DDP.
Docker
We provide the pre-built Docker image and Dockerfile that can run this code repo. See docker.
Datasets
Download pix2pix/CycleGAN datasets and create your own datasets.
Training/Test Tips
Best practice for training and testing your models.
Frequently Asked Questions
Before you post a new question, please first look at the above Q & A and existing GitHub issues.
Custom Model and Dataset
If you plan to implement custom models and dataset for your new applications, we provide a dataset template and a model template as a starting point.
Code structure
To help users better understand and use our code, we briefly overview the functionality and implementation of each package and each module.
Pull Request
You are always welcome to contribute to this repository by sending a pull request.
Please run flake8 --ignore E501 . and pytest scripts/test_before_push.py -v before you commit the code. Please also update the code structure overview accordingly if you add or remove files.
Citation
If you use this code for your research, please cite our papers.
@inproceedings{CycleGAN2017,
title={Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks},
author={Zhu, Jun-Yan and Park, Taesung and Isola, Phillip and Efros, Alexei A},
booktitle={Computer Vision (ICCV), 2017 IEEE International Conference on},
year={2017}
}
@inproceedings{isola2017image,
title={Image-to-Image Translation with Conditional Adversarial Networks},
author={Isola, Phillip and Zhu, Jun-Yan and Zhou, Tinghui and Efros, Alexei A},
booktitle={Computer Vision and Pattern Recognition (CVPR), 2017 IEEE Conference on},
year={2017}
}
Other Languages
Spanish
Related Projects
img2img-turbo
contrastive-unpaired-translation (CUT)
CycleGAN-Torch |
pix2pix-Torch | pix2pixHD|
BicycleGAN | vid2vid | SPADE/GauGAN
iGAN | GAN Dissection | GAN Paint
Cat Paper Collection
If you love cats, and love reading cool graphics, vision, and learning papers, please check out the Cat Paper Collection.
Đọc thêm về junyanz/pytorch-CycleGAN-and-pix2pix ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/junyanz/pytorch-CycleGAN-and-pix2pix là nguồn chính thức.
junyanz/pytorch-CycleGAN-and-pix2pix có những chủ đề gì?
GitHub topics của junyanz/pytorch-CycleGAN-and-pix2pix: "computer-graphics", "computer-vision", "cyclegan", "deep-learning", "gan", "gans", "generative-adversarial-network", "image-generation", "image-manipulation", "pix2pix", "pytorch". TopGit xếp repo vào nhóm AI Tools.
junyanz/pytorch-CycleGAN-and-pix2pix có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho junyanz/pytorch-CycleGAN-and-pix2pix. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
junyanz/pytorch-CycleGAN-and-pix2pix có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho junyanz/pytorch-CycleGAN-and-pix2pix. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
junyanz/pytorch-CycleGAN-and-pix2pix còn đang phát triển không?
Commit gần nhất trên junyanz/pytorch-CycleGAN-and-pix2pix là 1.3 năm trước (theo timestamp GitHub). Repo có 6.6k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
pytorch-CycleGAN-and-pix2pix có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về pytorch-CycleGAN-and-pix2pix.