[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-junyanz--pytorch-CycleGAN-and-pix2pix":3,"tool-junyanz--pytorch-CycleGAN-and-pix2pix":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":81,"owner_email":82,"owner_twitter":83,"owner_website":84,"owner_url":85,"languages":86,"stars":107,"forks":108,"last_commit_at":109,"license":110,"difficulty_score":10,"env_os":111,"env_gpu":112,"env_ram":113,"env_deps":114,"category_tags":122,"github_topics":123,"view_count":135,"oss_zip_url":82,"oss_zip_packed_at":82,"status":16,"created_at":136,"updated_at":137,"faqs":138,"releases":169},2860,"junyanz\u002Fpytorch-CycleGAN-and-pix2pix","pytorch-CycleGAN-and-pix2pix","Image-to-Image Translation in PyTorch","pytorch-CycleGAN-and-pix2pix 是一个基于 PyTorch 框架的开源项目，专注于实现高效的“图像到图像”转换。它核心解决了两大难题：一是如何在拥有成对数据（如素描与对应照片）时进行精准翻译（pix2pix 模型）；二是如何在完全没有成对数据的情况下，实现不同风格域之间的自由转换，例如将马变成斑马，或将夏日风景变为冬日雪景（CycleGAN 模型）。\n\n该项目非常适合计算机视觉研究人员、AI 开发者以及需要定制图像生成流程的技术人员使用。对于希望深入理解生成对抗网络（GAN）原理或复现经典论文结果的学者，它提供了结构清晰、文档完善的代码库；对于开发者，它不仅支持最新的 Python 3.11 和 PyTorch 2.4 环境，还引入了分布式数据并行（DDP）训练功能，显著提升了在多 GPU 机器上的训练效率。此外，项目团队还推荐了结合 Stable Diffusion Turbo 技术的新一代快速推理方案，进一步降低了高分辨率图像生成的时间成本。无论是用于学术探索还是构建自定义的图像风格迁移应用，pytorch-CycleGAN-and-pix2pix 都是一","pytorch-CycleGAN-and-pix2pix 是一个基于 PyTorch 框架的开源项目，专注于实现高效的“图像到图像”转换。它核心解决了两大难题：一是如何在拥有成对数据（如素描与对应照片）时进行精准翻译（pix2pix 模型）；二是如何在完全没有成对数据的情况下，实现不同风格域之间的自由转换，例如将马变成斑马，或将夏日风景变为冬日雪景（CycleGAN 模型）。\n\n该项目非常适合计算机视觉研究人员、AI 开发者以及需要定制图像生成流程的技术人员使用。对于希望深入理解生成对抗网络（GAN）原理或复现经典论文结果的学者，它提供了结构清晰、文档完善的代码库；对于开发者，它不仅支持最新的 Python 3.11 和 PyTorch 2.4 环境，还引入了分布式数据并行（DDP）训练功能，显著提升了在多 GPU 机器上的训练效率。此外，项目团队还推荐了结合 Stable Diffusion Turbo 技术的新一代快速推理方案，进一步降低了高分辨率图像生成的时间成本。无论是用于学术探索还是构建自定义的图像风格迁移应用，pytorch-CycleGAN-and-pix2pix 都是一个经过时间验证、社区活跃且功能强大的基础工具。","\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_7567749554db.gif' align=\"right\" width=384>\n\n\u003Cbr>\u003Cbr>\u003Cbr>\n\n# CycleGAN and pix2pix in PyTorch\n\n**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 ...`)\n\n**New**: Please check out [img2img-turbo](https:\u002F\u002Fgithub.com\u002FGaParmar\u002Fimg2img-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:\u002F\u002Fgithub.com\u002Ftaesungp\u002Fcontrastive-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:\u002F\u002Fgithub.com\u002Fjunyanz) and [Taesung Park](https:\u002F\u002Fgithub.com\u002Ftaesungp), and supported by [Tongzhou Wang](https:\u002F\u002Fgithub.com\u002FSsnL).\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:\u002F\u002Fgithub.com\u002Fjunyanz\u002FCycleGAN) and [pix2pix Torch](https:\u002F\u002Fgithub.com\u002Fphillipi\u002Fpix2pix) code in Lua\u002FTorch.\n\n**Note**: The current software works well with PyTorch 2.4+. Check out the older [branch](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Ftree\u002Fpytorch0.3.1) that supports PyTorch 0.1-0.3.\n\nYou may find useful information in [training\u002Ftest tips](docs\u002Ftips.md) and [frequently asked questions](docs\u002Fqa.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\u002Foverview.md) of the code structure of this repository.\n\n**CycleGAN: [Project](https:\u002F\u002Fjunyanz.github.io\u002FCycleGAN\u002F) | [Paper](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1703.10593.pdf) | [Torch](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FCycleGAN) |\n[Tensorflow Core Tutorial](https:\u002F\u002Fwww.tensorflow.org\u002Ftutorials\u002Fgenerative\u002Fcyclegan) | [PyTorch Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002FCycleGAN.ipynb)**\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_9ca7bf930668.jpg\" width=\"800\"\u002F>\n\n**Pix2pix: [Project](https:\u002F\u002Fphillipi.github.io\u002Fpix2pix\u002F) | [Paper](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1611.07004.pdf) | [Torch](https:\u002F\u002Fgithub.com\u002Fphillipi\u002Fpix2pix) |\n[Tensorflow Core Tutorial](https:\u002F\u002Fwww.tensorflow.org\u002Ftutorials\u002Fgenerative\u002Fpix2pix) | [PyTorch Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fpix2pix.ipynb)**\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_6994d71a1329.png\" width=\"800px\"\u002F>\n\n**[EdgesCats Demo](https:\u002F\u002Faffinelayer.com\u002Fpixsrv\u002F) | [pix2pix-tensorflow](https:\u002F\u002Fgithub.com\u002Faffinelayer\u002Fpix2pix-tensorflow) | by [Christopher Hesse](https:\u002F\u002Ftwitter.com\u002Fchristophrhesse)**\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_32aef78fa461.jpg' width=\"400px\"\u002F>\n\nIf you use this code for your research, please cite:\n\nUnpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks.\u003Cbr>\n[Jun-Yan Zhu](https:\u002F\u002Fwww.cs.cmu.edu\u002F~junyanz\u002F)\\*, [Taesung Park](https:\u002F\u002Ftaesung.me\u002F)\\*, [Phillip Isola](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~isola\u002F), [Alexei A. Efros](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~efros). In ICCV 2017. (\\* equal contributions) [[Bibtex]](https:\u002F\u002Fjunyanz.github.io\u002FCycleGAN\u002FCycleGAN.txt)\n\nImage-to-Image Translation with Conditional Adversarial Networks.\u003Cbr>\n[Phillip Isola](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~isola), [Jun-Yan Zhu](https:\u002F\u002Fwww.cs.cmu.edu\u002F~junyanz\u002F), [Tinghui Zhou](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~tinghuiz), [Alexei A. Efros](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~efros). In CVPR 2017. [[Bibtex]](https:\u002F\u002Fwww.cs.cmu.edu\u002F~junyanz\u002Fprojects\u002Fpix2pix\u002Fpix2pix.bib)\n\n## Talks and Course\n\npix2pix slides: [keynote](http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002FCVPR18_slides\u002Fpix2pix.key) | [pdf](http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002FCVPR18_slides\u002Fpix2pix.pdf),\nCycleGAN slides: [pptx](http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002FCVPR18_slides\u002FCycleGAN.pptx) | [pdf](http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002FCVPR18_slides\u002FCycleGAN.pdf)\n\nCycleGAN course assignment [code](http:\u002F\u002Fwww.cs.toronto.edu\u002F~rgrosse\u002Fcourses\u002Fcsc321_2018\u002Fassignments\u002Fa4-code.zip) and [handout](http:\u002F\u002Fwww.cs.toronto.edu\u002F~rgrosse\u002Fcourses\u002Fcsc321_2018\u002Fassignments\u002Fa4-handout.pdf) designed by Prof. [Roger Grosse](http:\u002F\u002Fwww.cs.toronto.edu\u002F~rgrosse\u002F) for [CSC321](http:\u002F\u002Fwww.cs.toronto.edu\u002F~rgrosse\u002Fcourses\u002Fcsc321_2018\u002F) \"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\n\nTensorFlow Core CycleGAN Tutorial: [Google Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Ftensorflow\u002Fdocs\u002Fblob\u002Fmaster\u002Fsite\u002Fen\u002Ftutorials\u002Fgenerative\u002Fcyclegan.ipynb) | [Code](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fdocs\u002Fblob\u002Fmaster\u002Fsite\u002Fen\u002Ftutorials\u002Fgenerative\u002Fcyclegan.ipynb)\n\nTensorFlow Core pix2pix Tutorial: [Google Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Ftensorflow\u002Fdocs\u002Fblob\u002Fmaster\u002Fsite\u002Fen\u002Ftutorials\u002Fgenerative\u002Fpix2pix.ipynb) | [Code](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fdocs\u002Fblob\u002Fmaster\u002Fsite\u002Fen\u002Ftutorials\u002Fgenerative\u002Fpix2pix.ipynb)\n\nPyTorch Colab notebook: [CycleGAN](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002FCycleGAN.ipynb) and [pix2pix](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fpix2pix.ipynb)\n\nZeroCostDL4Mic Colab notebook: [CycleGAN](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FHenriquesLab\u002FZeroCostDL4Mic\u002Fblob\u002Fmaster\u002FColab_notebooks_Beta\u002FCycleGAN_ZeroCostDL4Mic.ipynb) and [pix2pix](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FHenriquesLab\u002FZeroCostDL4Mic\u002Fblob\u002Fmaster\u002FColab_notebooks_Beta\u002Fpix2pix_ZeroCostDL4Mic.ipynb)\n\n## Other implementations\n\n### CycleGAN\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fleehomyc\u002Fcyclegan-1\"> [Tensorflow]\u003C\u002Fa> (by Harry Yang),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Farchitrathore\u002FCycleGAN\u002F\">[Tensorflow]\u003C\u002Fa> (by Archit Rathore),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fvanhuyz\u002FCycleGAN-TensorFlow\">[Tensorflow]\u003C\u002Fa> (by Van Huy),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FXHUJOY\u002FCycleGAN-tensorflow\">[Tensorflow]\u003C\u002Fa> (by Xiaowei Hu),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FLynnHo\u002FCycleGAN-Tensorflow-2\"> [Tensorflow2]\u003C\u002Fa> (by Zhenliang He),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fluoxier\u002FCycleGAN_Tensorlayer\"> [TensorLayer1.0]\u003C\u002Fa> (by luoxier),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftensorlayer\u002Fcyclegan\"> [TensorLayer2.0]\u003C\u002Fa> (by zsdonghao),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FAixile\u002Fchainer-cyclegan\">[Chainer]\u003C\u002Fa> (by Yanghua Jin),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fyunjey\u002Fmnist-svhn-transfer\">[Minimal PyTorch]\u003C\u002Fa> (by yunjey),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FLdpe2G\u002FDeepLearningForFun\u002Ftree\u002Fmaster\u002FMxnet-Scala\u002FCycleGAN\">[Mxnet]\u003C\u002Fa> (by Ldpe2G),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftjwei\u002FGANotebooks\">[lasagne\u002FKeras]\u003C\u002Fa> (by tjwei),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsimontomaskarlsson\u002FCycleGAN-Keras\">[Keras]\u003C\u002Fa> (by Simon Karlsson),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FLdpe2G\u002FDeepLearningForFun\u002Ftree\u002Fmaster\u002FOneflow-Python\u002FCycleGAN\">[OneFlow]\u003C\u002Fa> (by Ldpe2G)\n\u003C\u002Fp>\n\u003C\u002Ful>\n\n### pix2pix\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Faffinelayer\u002Fpix2pix-tensorflow\"> [Tensorflow]\u003C\u002Fa> (by Christopher Hesse),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FEyyub\u002Ftensorflow-pix2pix\">[Tensorflow]\u003C\u002Fa> (by Eyyüb Sariu),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatitran\u002Fface2face-demo\"> [Tensorflow (face2face)]\u003C\u002Fa> (by Dat Tran),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fawjuliani\u002FPix2Pix-Film\"> [Tensorflow (film)]\u003C\u002Fa> (by Arthur Juliani),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fkaonashi-tyc\u002Fzi2zi\">[Tensorflow (zi2zi)]\u003C\u002Fa> (by Yuchen Tian),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpfnet-research\u002Fchainer-pix2pix\">[Chainer]\u003C\u002Fa> (by mattya),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftjwei\u002FGANotebooks\">[tf\u002Ftorch\u002Fkeras\u002Flasagne]\u003C\u002Fa> (by tjwei),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftaey16\u002Fpix2pixBEGAN.pytorch\">[Pytorch]\u003C\u002Fa> (by taey16)\n\u003C\u002Fp>\n\u003C\u002Ful>\n\n## Prerequisites\n\n- Linux or macOS\n- Python 3\n- CPU or NVIDIA GPU + CUDA CuDNN\n\n## Getting Started\n\n### Installation\n\n- Clone this repo:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\ncd pytorch-CycleGAN-and-pix2pix\n```\n\n- Install [PyTorch](http:\u002F\u002Fpytorch.org) and other dependencies. For Conda users, you can create a new Conda environment by\n\n```bash\nconda env create -f environment.yml\n```\n\nand then activate the environment by\n\n```bash\nconda activate pytorch-img2img\n```\n\n- For Docker users, we provide the pre-built Docker image and Dockerfile. Please refer to our [Docker](docs\u002Fdocker.md) page.\n- For Repl users, please click [![Run on Repl.it](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_26e23a0dcf49.png)](https:\u002F\u002Frepl.it\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix).\n\n### CycleGAN train\u002Ftest\n\n- Download a CycleGAN dataset (e.g. maps):\n\n```bash\nbash .\u002Fdatasets\u002Fdownload_cyclegan_dataset.sh maps\n```\n\n- To log training progress and test images to W&B dashboard, set the `--use_wandb` flag with training script\n- Train a model:\n\n```bash\n#!.\u002Fscripts\u002Ftrain_cyclegan.sh\npython train.py --dataroot .\u002Fdatasets\u002Fmaps --name maps_cyclegan --model cycle_gan --use_wandb\n```\n\nTo see more intermediate results, check out `.\u002Fcheckpoints\u002Fmaps_cyclegan\u002Fweb\u002Findex.html`.\n\n- Test the model:\n\n```bash\n#!.\u002Fscripts\u002Ftest_cyclegan.sh\npython test.py --dataroot .\u002Fdatasets\u002Fmaps --name maps_cyclegan --model cycle_gan\n```\n\n- The test results will be saved to a html file here: `.\u002Fresults\u002Fmaps_cyclegan\u002Flatest_test\u002Findex.html`.\n\n### pix2pix train\u002Ftest\n\n- Download a pix2pix dataset (e.g.[facades](http:\u002F\u002Fcmp.felk.cvut.cz\u002F~tylecr1\u002Ffacade\u002F)):\n\n```bash\nbash .\u002Fdatasets\u002Fdownload_pix2pix_dataset.sh facades\n```\n\n- To log training progress and test images to W&B dashboard, set the `--use_wandb` flag with training script\n- Train a model:\n\n```bash\n#!.\u002Fscripts\u002Ftrain_pix2pix.sh\npython train.py --dataroot .\u002Fdatasets\u002Ffacades --name facades_pix2pix --model pix2pix --direction BtoA  --use_wandb\n```\n\nTo see more intermediate results, check out `.\u002Fcheckpoints\u002Ffacades_pix2pix\u002Fweb\u002Findex.html`.\n\n- Test the model (`bash .\u002Fscripts\u002Ftest_pix2pix.sh`):\n\n```bash\n#!.\u002Fscripts\u002Ftest_pix2pix.sh\npython test.py --dataroot .\u002Fdatasets\u002Ffacades --name facades_pix2pix --model pix2pix --direction BtoA\n```\n\n- The test results will be saved to a html file here: `.\u002Fresults\u002Ffacades_pix2pix\u002Ftest_latest\u002Findex.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:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fdocs\u002Ftips.md#notes-on-colorization) for more details.\n\n### Apply a pre-trained model (CycleGAN)\n\n- You can download a pretrained model (e.g. horse2zebra) with the following script:\n\n```bash\nbash .\u002Fscripts\u002Fdownload_cyclegan_model.sh horse2zebra\n```\n\n- The pretrained model is saved at `.\u002Fcheckpoints\u002F{name}_pretrained\u002Flatest_net_G.pth`. Check [here](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fscripts\u002Fdownload_cyclegan_model.sh#L3) for all the available CycleGAN models.\n- To test the model, you also need to download the horse2zebra dataset:\n\n```bash\nbash .\u002Fdatasets\u002Fdownload_cyclegan_dataset.sh horse2zebra\n```\n\n- Then generate the results using\n\n```bash\npython test.py --dataroot datasets\u002Fhorse2zebra\u002FtestA --name horse2zebra_pretrained --model test --no_dropout\n```\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 `.\u002Fresults\u002F`. 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:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fdocs\u002Fqa.md#runtimeerror-errors-in-loading-state_dict-812-671461-296) for more details.\n\n### Apply a pre-trained model (pix2pix)\n\nDownload a pre-trained model with `.\u002Fscripts\u002Fdownload_pix2pix_model.sh`.\n\n- Check [here](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fscripts\u002Fdownload_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\n```bash\nbash .\u002Fscripts\u002Fdownload_pix2pix_model.sh facades_label2photo\n```\n\n- Download the pix2pix facades datasets:\n\n```bash\nbash .\u002Fdatasets\u002Fdownload_pix2pix_dataset.sh facades\n```\n\n- Then generate the results using\n\n```bash\npython test.py --dataroot .\u002Fdatasets\u002Ffacades\u002F --direction BtoA --model pix2pix --name facades_label2photo_pretrained\n```\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 `.\u002Fscripts\u002Ftest_single.sh` for how to apply a model to Facade label maps (stored in the directory `facades\u002FtestB`).\n\n- See a list of currently available models at `.\u002Fscripts\u002Fdownload_pix2pix_model.sh`\n\n### Multi-GPU training\n\nTo 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.\n\n## [Docker](docs\u002Fdocker.md)\n\nWe provide the pre-built Docker image and Dockerfile that can run this code repo. See [docker](docs\u002Fdocker.md).\n\n## [Datasets](docs\u002Fdatasets.md)\n\nDownload pix2pix\u002FCycleGAN datasets and create your own datasets.\n\n## [Training\u002FTest Tips](docs\u002Ftips.md)\n\nBest practice for training and testing your models.\n\n## [Frequently Asked Questions](docs\u002Fqa.md)\n\nBefore you post a new question, please first look at the above Q & A and existing GitHub issues.\n\n## Custom Model and Dataset\n\nIf you plan to implement custom models and dataset for your new applications, we provide a dataset [template](data\u002Ftemplate_dataset.py) and a model [template](models\u002Ftemplate_model.py) as a starting point.\n\n## [Code structure](docs\u002Foverview.md)\n\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\n\nYou are always welcome to contribute to this repository by sending a [pull request](https:\u002F\u002Fhelp.github.com\u002Farticles\u002Fabout-pull-requests\u002F).\nPlease run `flake8 --ignore E501 .` and `pytest scripts\u002Ftest_before_push.py -v` before you commit the code. Please also update the code structure [overview](docs\u002Foverview.md) accordingly if you add or remove files.\n\n## Citation\n\nIf you use this code for your research, please cite our papers.\n\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\n[Spanish](docs\u002FREADME_es.md)\n\n## Related Projects\n\n[img2img-turbo](https:\u002F\u002Fgithub.com\u002FGaParmar\u002Fimg2img-turbo)\u003Cbr>\n[contrastive-unpaired-translation](https:\u002F\u002Fgithub.com\u002Ftaesungp\u002Fcontrastive-unpaired-translation) (CUT)\u003Cbr>\n[CycleGAN-Torch](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FCycleGAN) |\n[pix2pix-Torch](https:\u002F\u002Fgithub.com\u002Fphillipi\u002Fpix2pix) | [pix2pixHD](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fpix2pixHD)|\n[BicycleGAN](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FBicycleGAN) | [vid2vid](https:\u002F\u002Ftcwang0509.github.io\u002Fvid2vid\u002F) | [SPADE\u002FGauGAN](https:\u002F\u002Fgithub.com\u002FNVlabs\u002FSPADE)\u003Cbr>\n[iGAN](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FiGAN) | [GAN Dissection](https:\u002F\u002Fgithub.com\u002FCSAILVision\u002FGANDissect) | [GAN Paint](http:\u002F\u002Fganpaint.io\u002F)\n\n## Cat Paper Collection\n\nIf you love cats, and love reading cool graphics, vision, and learning papers, please check out the Cat Paper [Collection](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FCatPapers).\n\n## Acknowledgments\n\nOur code is inspired by [pytorch-DCGAN](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fexamples\u002Ftree\u002Fmaster\u002Fdcgan).\n","\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_7567749554db.gif' align=\"right\" width=384>\n\n\u003Cbr>\u003Cbr>\u003Cbr>\n\n# PyTorch中的CycleGAN和pix2pix\n\n**2025年更新**：我们最近更新了代码，以支持Python 3.11和PyTorch 2.4。它还支持单机多GPU训练的DDP。（请使用`torchrun --nproc_per_node=4 train.py ...`）\n\n**新功能**：请查看[img2img-turbo](https:\u002F\u002Fgithub.com\u002FGaParmar\u002Fimg2img-turbo)仓库，其中包含了pix2pix-turbo和CycleGAN-Turbo。我们新的单步图像到图像转换方法既支持成对训练也支持非成对训练，并通过利用预训练的StableDiffusion-Turbo模型来生成更好的结果。在A6000上，512x512图像的推理时间为0.29秒，在A100上则为0.11秒。\n\n请查看[contrastive-unpaired-translation](https:\u002F\u002Fgithub.com\u002Ftaesungp\u002Fcontrastive-unpaired-translation)（CUT），这是我们新的非成对图像到图像转换模型，能够实现快速且内存高效的训练。\n\n我们提供了针对非成对和成对图像到图像转换的PyTorch实现。\n\n代码由[Jun-Yan Zhu](https:\u002F\u002Fgithub.com\u002Fjunyanz)和[Taesung Park](https:\u002F\u002Fgithub.com\u002Ftaesungp)编写，并得到了[Tongzhou Wang](https:\u002F\u002Fgithub.com\u002FSsnL)的支持。\n\n这个PyTorch实现产生的结果与我们最初的Torch软件相当或更好。如果您希望复现论文中的相同结果，请查看原始的[CycleGAN Torch](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FCycleGAN)和[pix2pix Torch](https:\u002F\u002Fgithub.com\u002Fphillipi\u002Fpix2pix)代码，它们是用Lua\u002FTorch编写的。\n\n**注意**：当前的软件在PyTorch 2.4及以上版本上运行良好。请查看较旧的[分支](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Ftree\u002Fpytorch0.3.1)，该分支支持PyTorch 0.1至0.3版本。\n\n您可以在[训练\u002F测试技巧](docs\u002Ftips.md)和[常见问题解答](docs\u002Fqa.md)中找到有用的信息。要实现自定义模型和数据集，请查看我们的[模板](#custom-model-and-dataset)。为了帮助用户更好地理解并适应我们的代码库，我们提供了本仓库代码结构的[概述](docs\u002Foverview.md)。\n\n**CycleGAN：[项目](https:\u002F\u002Fjunyanz.github.io\u002FCycleGAN\u002F) | [论文](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1703.10593.pdf) | [Torch](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FCycleGAN) |\n[TensorFlow Core教程](https:\u002F\u002Fwww.tensorflow.org\u002Ftutorials\u002Fgenerative\u002Fcyclegan) | [PyTorch Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002FCycleGAN.ipynb)**\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_9ca7bf930668.jpg\" width=\"800\"\u002F>\n\n**Pix2pix：[项目](https:\u002F\u002Fphillipi.github.io\u002Fpix2pix\u002F) | [论文](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1611.07004.pdf) | [Torch](https:\u002F\u002Fgithub.com\u002Fphillipi\u002Fpix2pix) |\n[TensorFlow Core教程](https:\u002F\u002Fwww.tensorflow.org\u002Ftutorials\u002Fgenerative\u002Fpix2pix) | [PyTorch Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fpix2pix.ipynb)**\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_6994d71a1329.png\" width=\"800px\"\u002F>\n\n**[EdgesCats演示](https:\u002F\u002Faffinelayer.com\u002Fpixsrv\u002F) | [pix2pix-tensorflow](https:\u002F\u002Fgithub.com\u002Faffinelayer\u002Fpix2pix-tensorflow) | 由[Christopher Hesse](https:\u002F\u002Ftwitter.com\u002Fchristophrhesse)制作**\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_32aef78fa461.jpg' width=\"400px\"\u002F>\n\n如果您将此代码用于您的研究，请引用以下内容：\n\n使用循环一致性对抗网络进行非成对图像到图像转换。\u003Cbr>\n[Jun-Yan Zhu](https:\u002F\u002Fwww.cs.cmu.edu\u002F~junyanz\u002F)\\*, [Taesung Park](https:\u002F\u002Ftaesung.me\u002F)\\*, [Phillip Isola](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~isola), [Alexei A. Efros](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~efros)。发表于ICCV 2017。（\\*贡献相等）[[Bibtex]](https:\u002F\u002Fjunyanz.github.io\u002FCycleGAN\u002FCycleGAN.txt)\n\n使用条件对抗网络进行图像到图像转换。\u003Cbr>\n[Phillip Isola](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~isola), [Jun-Yan Zhu](https:\u002F\u002Fwww.cs.cmu.edu\u002F~junyanz\u002F), [Tinghui Zhou](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~tinghuiz), [Alexei A. Efros](https:\u002F\u002Fpeople.eecs.berkeley.edu\u002F~efros)。发表于CVPR 2017。[[Bibtex]](https:\u002F\u002Fwww.cs.cmu.edu\u002F~junyanz\u002Fprojects\u002Fpix2pix\u002Fpix2pix.bib)\n\n## 演讲和课程\n\npix2pix幻灯片：[主题演讲](http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002FCVPR18_slides\u002Fpix2pix.key) | [PDF](http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002FCVPR18_slides\u002Fpix2pix.pdf),\nCycleGAN幻灯片：[PPTX](http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002FCVPR18_slides\u002FCycleGAN.pptx) | [PDF](http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002FCVPR18_slides\u002FCycleGAN.pdf)\n\nCycleGAN课程作业[代码](http:\u002F\u002Fwww.cs.toronto.edu\u002F~rgrosse\u002Fcourses\u002Fcsc321_2018\u002Fassignments\u002Fa4-code.zip)和[讲义](http:\u002F\u002Fwww.cs.toronto.edu\u002F~rgrosse\u002Fcourses\u002Fcsc321_2018\u002Fassignments\u002Fa4-handout.pdf)，由[Roger Grosse](http:\u002F\u002Fwww.cs.toronto.edu\u002F~rgrosse\u002F)教授为多伦多大学的[CSC321](http:\u002F\u002Fwww.cs.toronto.edu\u002F~rgrosse\u002Fcourses\u002Fcsc321_2018\u002F)“神经网络与机器学习导论”课程设计。如果您希望在您的课程中采用这些材料，请联系授课教师。\n\n## Colab笔记本\n\nTensorFlow Core CycleGAN教程：[Google Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Ftensorflow\u002Fdocs\u002Fblob\u002Fmaster\u002Fsite\u002Fen\u002Ftutorials\u002Fgenerative\u002Fcyclegan.ipynb) | [代码](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fdocs\u002Fblob\u002Fmaster\u002Fsite\u002Fen\u002Ftutorials\u002Fgenerative\u002Fcyclegan.ipynb)\n\nTensorFlow Core pix2pix教程：[Google Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Ftensorflow\u002Fdocs\u002Fblob\u002Fmaster\u002Fsite\u002Fen\u002Ftutorials\u002Fgenerative\u002Fpix2pix.ipynb) | [代码](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fdocs\u002Fblob\u002Fmaster\u002Fsite\u002Fen\u002Ftutorials\u002Fgenerative\u002Fpix2pix.ipynb)\n\nPyTorch Colab笔记本：[CycleGAN](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002FCycleGAN.ipynb)和[pix2pix](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fpix2pix.ipynb)\n\nZeroCostDL4Mic Colab笔记本：[CycleGAN](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FHenriquesLab\u002FZeroCostDL4Mic\u002Fblob\u002Fmaster\u002FColab_notebooks_Beta\u002FCycleGAN_ZeroCostDL4Mic.ipynb)和[pix2pix](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FHenriquesLab\u002FZeroCostDL4Mic\u002Fblob\u002Fmaster\u002FColab_notebooks_Beta\u002Fpix2pix_ZeroCostDL4Mic.ipynb)\n\n## 其他实现\n\n### CycleGAN\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fleehomyc\u002Fcyclegan-1\"> [TensorFlow]\u003C\u002Fa> (由 Harry Yang 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Farchitrathore\u002FCycleGAN\u002F\">[TensorFlow]\u003C\u002Fa> (由 Archit Rathore 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fvanhuyz\u002FCycleGAN-TensorFlow\">[TensorFlow]\u003C\u002Fa> (由 Van Huy 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FXHUJOY\u002FCycleGAN-tensorflow\">[TensorFlow]\u003C\u002Fa> (由 Xiaowei Hu 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FLynnHo\u002FCycleGAN-Tensorflow-2\"> [TensorFlow 2]\u003C\u002Fa> (由 Zhenliang He 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fluoxier\u002FCycleGAN_Tensorlayer\"> [TensorLayer 1.0]\u003C\u002Fa> (由 luoxier 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftensorlayer\u002Fcyclegan\"> [TensorLayer 2.0]\u003C\u002Fa> (由 zsdonghao 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FAixile\u002Fchainer-cyclegan\">[Chainer]\u003C\u002Fa> (由 Yanghua Jin 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fyunjey\u002Fmnist-svhn-transfer\">[Minimal PyTorch]\u003C\u002Fa> (由 yunjey 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FLdpe2G\u002FDeepLearningForFun\u002Ftree\u002Fmaster\u002FMxnet-Scala\u002FCycleGAN\">[Mxnet]\u003C\u002Fa> (由 Ldpe2G 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftjwei\u002FGANotebooks\">[lasagne\u002FKeras]\u003C\u002Fa> (由 tjwei 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsimontomaskarlsson\u002FCycleGAN-Keras\">[Keras]\u003C\u002Fa> (由 Simon Karlsson 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FLdpe2G\u002FDeepLearningForFun\u002Ftree\u002Fmaster\u002FOneflow-Python\u002FCycleGAN\">[OneFlow]\u003C\u002Fa> (由 Ldpe2G 提供)\n\u003C\u002Fp>\n\u003C\u002Ful>\n\n### pix2pix\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Faffinelayer\u002Fpix2pix-tensorflow\"> [TensorFlow]\u003C\u002Fa> (由 Christopher Hesse 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FEyyub\u002Ftensorflow-pix2pix\">[TensorFlow]\u003C\u002Fa> (由 Eyyüb Sariu 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatitran\u002Fface2face-demo\"> [TensorFlow (face2face)]\u003C\u002Fa> (由 Dat Tran 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fawjuliani\u002FPix2Pix-Film\"> [TensorFlow (film)]\u003C\u002Fa> (由 Arthur Juliani 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fkaonashi-tyc\u002Fzi2zi\">[TensorFlow (zi2zi)]\u003C\u002Fa> (由 Yuchen Tian 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpfnet-research\u002Fchainer-pix2pix\">[Chainer]\u003C\u002Fa> (由 mattya 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftjwei\u002FGANotebooks\">[tf\u002Ftorch\u002Fkeras\u002Flasagne]\u003C\u002Fa> (由 tjwei 提供),\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftaey16\u002Fpix2pixBEGAN.pytorch\">[PyTorch]\u003C\u002Fa> (由 taey16 提供)\n\u003C\u002Fp>\n\u003C\u002Ful>\n\n## 先决条件\n\n- Linux 或 macOS\n- Python 3\n- CPU 或 NVIDIA GPU + CUDA CuDNN\n\n## 快速入门\n\n### 安装\n\n- 克隆本仓库：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\ncd pytorch-CycleGAN-and-pix2pix\n```\n\n- 安装 [PyTorch](http:\u002F\u002Fpytorch.org) 及其他依赖项。对于 Conda 用户，可以创建一个新的 Conda 环境：\n\n```bash\nconda env create -f environment.yml\n```\n\n然后激活该环境：\n\n```bash\nconda activate pytorch-img2img\n```\n\n- 对于 Docker 用户，我们提供了预构建的 Docker 镜像和 Dockerfile。请参阅我们的 [Docker](docs\u002Fdocker.md) 页面。\n- 对于 Repl 用户，请点击 [![在 Repl.it 上运行](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_readme_26e23a0dcf49.png)](https:\u002F\u002Frepl.it\u002Fgithub\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix)。\n\n### CycleGAN 训练与测试\n\n- 下载一个 CycleGAN 数据集（例如 maps）：\n\n```bash\nbash .\u002Fdatasets\u002Fdownload_cyclegan_dataset.sh maps\n```\n\n- 若要将训练进度和测试图像记录到 W&B 仪表板，请在训练脚本中设置 `--use_wandb` 标志。\n- 训练模型：\n\n```bash\n#!.\u002Fscripts\u002Ftrain_cyclegan.sh\npython train.py --dataroot .\u002Fdatasets\u002Fmaps --name maps_cyclegan --model cycle_gan --use_wandb\n```\n\n如需查看更多中间结果，请查看 `.\u002Fcheckpoints\u002Fmaps_cyclegan\u002Fweb\u002Findex.html`。\n\n- 测试模型：\n\n```bash\n#!.\u002Fscripts\u002Ftest_cyclegan.sh\npython test.py --dataroot .\u002Fdatasets\u002Fmaps --name maps_cyclegan --model cycle_gan\n```\n\n- 测试结果将保存到此处的 HTML 文件：`.\u002Fresults\u002Fmaps_cyclegan\u002Flatest_test\u002Findex.html`。\n\n### pix2pix 训练与测试\n\n- 下载一个 pix2pix 数据集（例如 [facades](http:\u002F\u002Fcmp.felk.cvut.cz\u002F~tylecr1\u002Ffacade\u002F)）：\n\n```bash\nbash .\u002Fdatasets\u002Fdownload_pix2pix_dataset.sh facades\n```\n\n- 若要将训练进度和测试图像记录到 W&B 仪表板，请在训练脚本中设置 `--use_wandb` 标志。\n- 训练模型：\n\n```bash\n#!.\u002Fscripts\u002Ftrain_pix2pix.sh\npython train.py --dataroot .\u002Fdatasets\u002Ffacades --name facades_pix2pix --model pix2pix --direction BtoA  --use_wandb\n```\n\n如需查看更多中间结果，请查看 `.\u002Fcheckpoints\u002Ffacades_pix2pix\u002Fweb\u002Findex.html`。\n\n- 测试模型（`bash .\u002Fscripts\u002Ftest_pix2pix.sh`）：\n\n```bash\n#!.\u002Fscripts\u002Ftest_pix2pix.sh\npython test.py --dataroot .\u002Fdatasets\u002Ffacades --name facades_pix2pix --model pix2pix --direction BtoA\n```\n\n- 测试结果将保存到此处的 HTML 文件：`.\u002Fresults\u002Ffacades_pix2pix\u002Ftest_latest\u002Findex.html`。更多脚本可在 `scripts` 目录中找到。\n- 若要训练和测试基于 pix2pix 的彩色化模型，请添加 `--model colorization` 和 `--dataset_mode colorization`。有关更多详细信息，请参阅我们的训练 [提示](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fdocs\u002Ftips.md#notes-on-colorization)。\n\n### 应用预训练模型（CycleGAN）\n\n- 您可以通过以下脚本下载预训练模型（例如 horse2zebra）：\n\n```bash\nbash .\u002Fscripts\u002Fdownload_cyclegan_model.sh horse2zebra\n```\n\n- 预训练模型保存在 `.\u002Fcheckpoints\u002F{name}_pretrained\u002Flatest_net_G.pth` 中。所有可用的 CycleGAN 模型请参见 [这里](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fscripts\u002Fdownload_cyclegan_model.sh#L3)。\n- 要测试该模型，您还需要下载 horse2zebra 数据集：\n\n```bash\nbash .\u002Fdatasets\u002Fdownload_cyclegan_dataset.sh horse2zebra\n```\n\n- 然后使用以下命令生成结果：\n\n```bash\npython test.py --dataroot datasets\u002Fhorse2zebra\u002FtestA --name horse2zebra_pretrained --model test --no_dropout\n```\n\n- 选项 `--model test` 仅用于生成 CycleGAN 单侧的结果。此选项会自动设置 `--dataset_mode single`，即只加载单个数据集中的图像。相反，使用 `--model cycle_gan` 则需要同时加载并生成双向结果，这有时是不必要的。结果将保存到 `.\u002Fresults\u002F`。您可以使用 `--results_dir {directory_path_to_save_result}` 来指定保存结果的目录。\n\n- 对于 pix2pix 和您自己的模型，您需要显式指定 `--netG`、`--norm`、`--no_dropout`，以匹配已训练模型的生成器架构。有关更多详细信息，请参阅此 [常见问题解答](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fdocs\u002Fqa.md#runtimeerror-errors-in-loading-state_dict-812-671461-296)。\n\n### 应用预训练模型（pix2pix）\n\n使用 `.\u002Fscripts\u002Fdownload_pix2pix_model.sh` 脚本下载预训练模型。\n\n- 请参阅 [此处](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fblob\u002Fmaster\u002Fscripts\u002Fdownload_pix2pix_model.sh#L3) 查看所有可用的 pix2pix 模型。例如，如果您想下载 Fadaces 数据集上的 label2photo 模型：\n\n```bash\nbash .\u002Fscripts\u002Fdownload_pix2pix_model.sh facades_label2photo\n```\n\n- 下载 pix2pix 的 Facades 数据集：\n\n```bash\nbash .\u002Fdatasets\u002Fdownload_pix2pix_dataset.sh facades\n```\n\n- 然后使用以下命令生成结果：\n\n```bash\npython test.py --dataroot .\u002Fdatasets\u002Ffacades\u002F --direction BtoA --model pix2pix --name facades_label2photo_pretrained\n```\n\n- 请注意，我们指定了 `--direction BtoA`，因为 Facades 数据集的 A 到 B 方向是从照片到标签。\n\n- 如果您希望将预训练模型应用于一组输入图像（而不是图像对），请使用 `--model test` 选项。有关如何将模型应用于 Facade 标签图（存储在 `facades\u002FtestB` 目录中）的示例，请参阅 `.\u002Fscripts\u002Ftest_single.sh`。\n\n- 当前可用模型列表请参见 `.\u002Fscripts\u002Fdownload_pix2pix_model.sh`。\n\n### 多 GPU 训练\n\n要在多 GPU 上训练模型，请使用 `torchrun --nproc_per_node=4 train.py ...` 而不是 `python train.py ...`。此外，还需要通过设置 `--norm sync_batch` 来使用同步批归一化（对于实例归一化则使用 `--norm sync_instance`）。`--norm batch` 不兼容 DDP。\n\n## [Docker](docs\u002Fdocker.md)\n\n我们提供了可运行此代码库的预构建 Docker 镜像和 Dockerfile。详情请参阅 [docker](docs\u002Fdocker.md)。\n\n## [数据集](docs\u002Fdatasets.md)\n\n下载 pix2pix\u002FCycleGAN 数据集，并创建您自己的数据集。\n\n## [训练\u002F测试技巧](docs\u002Ftips.md)\n\n训练和测试您的模型的最佳实践。\n\n## [常见问题解答](docs\u002Fqa.md)\n\n在您提出新问题之前，请先查看上述问答以及现有的 GitHub 问题。\n\n## 自定义模型和数据集\n\n如果您计划为新的应用实现自定义模型和数据集，我们提供了一个数据集 [模板](data\u002Ftemplate_dataset.py) 和一个模型 [模板](models\u002Ftemplate_model.py)，作为起点。\n\n## [代码结构](docs\u002Foverview.md)\n\n为了帮助用户更好地理解和使用我们的代码，我们简要概述了每个包和每个模块的功能及实现方式。\n\n## 拉取请求\n\n欢迎您通过发送 [拉取请求](https:\u002F\u002Fhelp.github.com\u002Farticles\u002Fabout-pull-requests\u002F) 为本仓库做出贡献。\n在提交代码之前，请运行 `flake8 --ignore E501 .` 和 `pytest scripts\u002Ftest_before_push.py -v`。如果您添加或删除了文件，请相应地更新代码结构 [概览](docs\u002Foverview.md)。\n\n## 引用\n\n如果您在研究中使用了此代码，请引用我们的论文。\n\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## 其他语言\n\n[西班牙语](docs\u002FREADME_es.md)\n\n## 相关项目\n\n[img2img-turbo](https:\u002F\u002Fgithub.com\u002FGaParmar\u002Fimg2img-turbo)\u003Cbr>\n[contrastive-unpaired-translation](https:\u002F\u002Fgithub.com\u002Ftaesungp\u002Fcontrastive-unpaired-translation) (CUT)\u003Cbr>\n[CycleGAN-Torch](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FCycleGAN) |\n[pix2pix-Torch](https:\u002F\u002Fgithub.com\u002Fphillipi\u002Fpix2pix) | [pix2pixHD](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fpix2pixHD)|\n[BicycleGAN](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FBicycleGAN) | [vid2vid](https:\u002F\u002Ftcwang0509.github.io\u002Fvid2vid\u002F) | [SPADE\u002FGauGAN](https:\u002F\u002Fgithub.com\u002FNVlabs\u002FSPADE)\u003Cbr>\n[iGAN](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FiGAN) | [GAN Dissection](https:\u002F\u002Fgithub.com\u002FCSAILVision\u002FGANDissect) | [GAN Paint](http:\u002F\u002Fganpaint.io\u002F)\n\n## 猫论文合集\n\n如果您喜欢猫，并且喜欢阅读酷炫的图形、视觉和学习相关论文，请查看猫论文 [合集](https:\u002F\u002Fgithub.com\u002Fjunyanz\u002FCatPapers)。\n\n## 致谢\n\n我们的代码灵感来源于 [pytorch-DCGAN](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fexamples\u002Ftree\u002Fmaster\u002Fdcgan)。","# pytorch-CycleGAN-and-pix2pix 快速上手指南\n\n本指南帮助中国开发者快速部署和使用基于 PyTorch 的 CycleGAN 和 pix2pix 图像转换工具。\n\n## 环境准备\n\n在开始之前，请确保您的系统满足以下要求：\n\n*   **操作系统**: Linux 或 macOS\n*   **Python 版本**: Python 3 (推荐 3.11+)\n*   **硬件**: CPU 或 NVIDIA GPU (需安装 CUDA 和 CuDNN)\n*   **框架版本**: PyTorch 2.4+ (代码已更新支持最新特性及多卡 DDP 训练)\n\n> **国内加速建议**：\n> 安装依赖时，建议使用清华源或阿里源加速下载：\n> ```bash\n> pip install -r requirements.txt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n## 安装步骤\n\n### 1. 克隆仓库\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\ncd pytorch-CycleGAN-and-pix2pix\n```\n\n### 2. 创建 Conda 环境并安装依赖\n推荐使用 Conda 管理环境，一键安装所有依赖：\n\n```bash\nconda env create -f environment.yml\nconda activate pytorch-img2img\n```\n\n*(注：`environment.yml` 会自动配置适配 PyTorch 2.4+ 的环境)*\n\n### 3. Docker 用户（可选）\n如果您习惯使用 Docker，可参考项目内的 `docs\u002Fdocker.md` 构建预制镜像。\n\n## 基本使用\n\n以下展示最基础的 **CycleGAN**（非配对数据，如马变斑马）和 **pix2pix**（配对数据，如素描变照片）的使用流程。\n\n### 场景一：CycleGAN (非配对图像转换)\n\n**1. 下载数据集**\n以 `maps` (地图转卫星图) 为例：\n```bash\nbash .\u002Fdatasets\u002Fdownload_cyclegan_dataset.sh maps\n```\n\n**2. 训练模型**\n```bash\npython train.py --dataroot .\u002Fdatasets\u002Fmaps --name maps_cyclegan --model cycle_gan\n```\n*训练过程中的中间结果和日志可在 `.\u002Fcheckpoints\u002Fmaps_cyclegan\u002Fweb\u002Findex.html` 查看。*\n\n**3. 测试模型**\n```bash\npython test.py --dataroot .\u002Fdatasets\u002Fmaps --name maps_cyclegan --model cycle_gan\n```\n*生成结果保存在 `.\u002Fresults\u002Fmaps_cyclegan\u002Flatest_test\u002Findex.html`。*\n\n---\n\n### 场景二：pix2pix (配对图像转换)\n\n**1. 下载数据集**\n以 `facades` (建筑标签转实景图) 为例：\n```bash\nbash .\u002Fdatasets\u002Fdownload_pix2pix_dataset.sh facades\n```\n\n**2. 训练模型**\n注意指定 `--direction BtoA` (根据数据集需求调整方向)：\n```bash\npython train.py --dataroot .\u002Fdatasets\u002Ffacades --name facades_pix2pix --model pix2pix --direction BtoA\n```\n\n**3. 测试模型**\n```bash\npython test.py --dataroot .\u002Fdatasets\u002Ffacades --name facades_pix2pix --model pix2pix --direction BtoA\n```\n\n---\n\n### 场景三：直接使用预训练模型 (推理)\n\n如果您不想训练，可以直接下载官方预训练模型进行推理。以“马变斑马”为例：\n\n**1. 下载预训练模型**\n```bash\nbash .\u002Fscripts\u002Fdownload_cyclegan_model.sh horse2zebra\n```\n\n**2. 下载测试数据**\n```bash\nbash .\u002Fdatasets\u002Fdownload_cyclegan_dataset.sh horse2zebra\n```\n\n**3. 生成结果**\n使用 `--model test` 仅进行单向转换（无需加载双向数据）：\n```bash\npython test.py --dataroot datasets\u002Fhorse2zebra\u002FtestA --name horse2zebra_pretrained --model test --no_dropout\n```\n*结果将保存至 `.\u002Fresults\u002F` 目录。*\n\n> **提示**：如需记录训练过程到 WandB 面板，请在训练命令中添加 `--use_wandb` 参数。","一家独立游戏开发团队正在为一款奇幻题材的游戏制作资产，需要将大量手绘的草图线稿快速转化为具有统一美术风格的上色成品图。\n\n### 没有 pytorch-CycleGAN-and-pix2pix 时\n- **成对数据依赖严重**：若使用传统的 pix2pix 方法，美术团队必须手动绘制数百张“线稿 - 成品”完全对应的配对图片，耗时耗力且成本极高。\n- **风格迁移困难**：面对游戏中不同场景（如白天变黑夜、夏季变冬季）的转换需求，因缺乏成对训练数据，传统监督学习模型完全无法训练。\n- **人工修图效率低**：设计师只能依靠手工逐帧上色或使用简单的滤镜堆叠，导致输出结果缺乏光影细节，且难以保持整体艺术风格的一致性。\n- **迭代周期漫长**：每次调整美术风格都需要重新收集数据并训练新模型，严重拖慢了游戏原型的验证进度。\n\n### 使用 pytorch-CycleGAN-and-pix2pix 后\n- **突破数据配对限制**：利用 CycleGAN 的非配对训练特性，团队仅需收集独立的“线稿库”和“上色图库”即可直接训练，省去了繁琐的人工配对环节。\n- **实现无监督风格转换**：轻松完成季节变换、昼夜交替等无成对数据的图像翻译任务，模型能自动学习源域与目标域之间的映射关系。\n- **生成质量显著提升**：生成的图像不仅保留了原始线稿的结构特征，还自动添加了符合逻辑的光影和纹理细节，大幅减少了后期人工修饰的工作量。\n- **敏捷迭代开发**：借助 PyTorch 2.4+ 及 DDP 多卡加速支持，团队能在数小时内完成新风格的模型训练与验证，快速响应策划需求的变化。\n\npytorch-CycleGAN-and-pix2pix 通过消除对成对训练数据的强依赖，让游戏团队以极低的成本实现了高质量、自动化的美术资产风格迁移。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjunyanz_pytorch-CycleGAN-and-pix2pix_75677495.gif","junyanz","Jun-Yan Zhu","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fjunyanz_aea33318.jpg","Understanding and creating pixels."," Carnegie Mellon University:","Pittsburgh, PA",null,"junyanz89","https:\u002F\u002Fwww.cs.cmu.edu\u002F~junyanz\u002F","https:\u002F\u002Fgithub.com\u002Fjunyanz",[87,91,95,99,103],{"name":88,"color":89,"percentage":90},"Python","#3572A5",87.5,{"name":92,"color":93,"percentage":94},"Jupyter Notebook","#DA5B0B",7.9,{"name":96,"color":97,"percentage":98},"Shell","#89e051",2.4,{"name":100,"color":101,"percentage":102},"MATLAB","#e16737",1.1,{"name":104,"color":105,"percentage":106},"TeX","#3D6117",1,25057,6576,"2026-04-03T12:48:37","NOASSERTION","Linux, macOS","训练需要 NVIDIA GPU + CUDA CuDNN（CPU 也可运行但仅适用于测试或极小模型）；支持多卡分布式训练 (DDP)；具体显存大小未说明，建议根据图像分辨率调整（通常 512x512 需 8GB+）","未说明",{"notes":115,"python":116,"dependencies":117},"2025 年更新已支持 Python 3.11 和 PyTorch 2.4，并支持单机多卡分布式训练（使用 torchrun 命令）。可通过 conda 环境文件 (environment.yml) 一键安装依赖。提供 Docker 镜像和 Colab 笔记本以便快速上手。若需复现论文原始结果，建议使用旧版 Lua\u002FTorch 代码库。","3.11",[118,119,120,121],"torch>=2.4","dominate","visdom","wandb",[14,13],[124,125,126,127,128,129,130,131,132,133,134],"pytorch","gan","cyclegan","pix2pix","deep-learning","computer-vision","computer-graphics","image-manipulation","image-generation","generative-adversarial-network","gans",7,"2026-03-27T02:49:30.150509","2026-04-06T05:44:10.533224",[139,144,149,154,159,164],{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},13216,"CycleGAN 中的判别器是 PatchGAN 吗？代码中哪里体现了 70x70 的感受野处理？","是的，代码实现的是 PatchGAN。虽然代码中没有显式的 70x70 切片操作，但这是通过卷积层的堆叠自然形成的感受野（Receptive Field）。对于 256x256 的输入，网络结构（4 层步长为 2 的卷积 + 若干层步长为 1 的卷积）使得最终输出特征图上的每个点对应输入图像上 70x70 的区域。具体计算逻辑为：前几层 stride=2 快速扩大感受野，后续层 stride=1 继续增加感受野大小，最终达到 70x70。","https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fissues\u002F39",{"id":145,"question_zh":146,"answer_zh":147,"source_url":148},13217,"如何在 CycleGAN 或 pix2pix 中使用 Wasserstein 损失（WGAN）？效果如何？","可以在代码库中添加 Wasserstein 损失和梯度惩罚（Gradient Penalty）。根据社区反馈，带有梯度裁剪（gradient clipping）的 WGAN 在 CycleGAN 上效果很好，而 WGAN-GP 的效果可能较差。如果在训练过程中发现 D_real 和 D_fake 全程为负值，这在 WGAN 架构下通常是正常现象。","https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fissues\u002F439",{"id":150,"question_zh":151,"answer_zh":152,"source_url":153},13218,"为什么训练时生成的图像很好，但加载最新检查点进行测试时结果却变差或出现奇怪的现象？","这通常与测试时的模式设置有关。建议在测试时尝试不使用 eval 模式（即保持 dropout 和 batch normalization 的训练状态），特别是在批量大小（batchSize）为 1 的情况下。原始论文实验中，测试阶段往往不使用 eval 模式以获得更好的每图像统计特性。此外，如果存在过拟合问题，可以尝试增加 `--lambda_identity` 参数的值来缓解。对于填充方式，推荐使用反射填充（reflection padding）而非零填充。","https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fissues\u002F336",{"id":155,"question_zh":156,"answer_zh":157,"source_url":158},13219,"在哪里可以下载预训练的 CycleGAN 模型？","预训练模型的下载地址已更新。你可以访问 http:\u002F\u002Fefrosgans.eecs.berkeley.edu\u002Fcyclegan\u002Fpretrained_models\u002F 获取模型文件。也可以直接运行项目中的脚本 `scripts\u002Fdownload_cyclegan_model.sh` 来自动下载所需的预训练模型。默认提供的预训练模型通常使用的是 ResNet 9-blocks 生成器。","https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fissues\u002F10",{"id":160,"question_zh":161,"answer_zh":162,"source_url":163},13220,"生成的图像中出现白色斑点或彩色伪影（artifacts）是什么原因？如何解决？","这通常与模型结构中的归一化层或激活函数设置不当有关。有效的解决方案包括：\n1. 检查是否遗漏了归一化（norm）和激活（act）函数。\n2. 尝试移除实例归一化（Instance Normalization）。\n3. 将所有的普通卷积层（conv2d）替换为“解调卷积”（Demodulated Convolution，参考 StyleGANv2 论文第 2.2 节）。注意，如果使用解调卷积，可能需要将学习率调得非常小（例如 1e-5），否则模型可能在训练初期崩溃。","https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fissues\u002F411",{"id":165,"question_zh":166,"answer_zh":167,"source_url":168},13221,"加载预训练模型或检查点时出现 'Error(s) in loading state_dict' 错误怎么办？","该错误通常是由于当前定义的模型结构与保存权重时的模型结构不一致导致的。请确保：\n1. 使用的生成器类型（如 ResNetGenerator 或 UnetGenerator）与训练时一致。\n2. 模型的超参数（如残差块数量、输入输出通道数等）完全匹配。\n3. 如果是从旧版本代码加载到新版本，可能需要检查代码变更是否影响了网络层的命名或结构。","https:\u002F\u002Fgithub.com\u002Fjunyanz\u002Fpytorch-CycleGAN-and-pix2pix\u002Fissues\u002F296",[]]