[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-NVlabs--stylegan3":3,"tool-NVlabs--stylegan3":64},[4,17,26,40,48,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},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,2,"2026-04-03T11:11:01",[13,14,15],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":23,"last_commit_at":32,"category_tags":33,"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,34,35,36,15,37,38,13,39],"数据工具","视频","插件","其他","语言模型","音频",{"id":41,"name":42,"github_repo":43,"description_zh":44,"stars":45,"difficulty_score":10,"last_commit_at":46,"category_tags":47,"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,38,37],{"id":49,"name":50,"github_repo":51,"description_zh":52,"stars":53,"difficulty_score":10,"last_commit_at":54,"category_tags":55,"status":16},519,"PaddleOCR","PaddlePaddle\u002FPaddleOCR","PaddleOCR 是一款基于百度飞桨框架开发的高性能开源光学字符识别工具包。它的核心能力是将图片、PDF 等文档中的文字提取出来，转换成计算机可读取的结构化数据，让机器真正“看懂”图文内容。\n\n面对海量纸质或电子文档，PaddleOCR 解决了人工录入效率低、数字化成本高的问题。尤其在人工智能领域，它扮演着连接图像与大型语言模型（LLM）的桥梁角色，能将视觉信息直接转化为文本输入，助力智能问答、文档分析等应用场景落地。\n\nPaddleOCR 适合开发者、算法研究人员以及有文档自动化需求的普通用户。其技术优势十分明显：不仅支持全球 100 多种语言的识别，还能在 Windows、Linux、macOS 等多个系统上运行，并灵活适配 CPU、GPU、NPU 等各类硬件。作为一个轻量级且社区活跃的开源项目，PaddleOCR 既能满足快速集成的需求，也能支撑前沿的视觉语言研究，是处理文字识别任务的理想选择。",74939,"2026-04-05T23:16:38",[38,14,13,37],{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":23,"last_commit_at":62,"category_tags":63,"status":16},2471,"tesseract","tesseract-ocr\u002Ftesseract","Tesseract 是一款历史悠久且备受推崇的开源光学字符识别（OCR）引擎，最初由惠普实验室开发，后由 Google 维护，目前由全球社区共同贡献。它的核心功能是将图片中的文字转化为可编辑、可搜索的文本数据，有效解决了从扫描件、照片或 PDF 文档中提取文字信息的难题，是数字化归档和信息自动化的重要基础工具。\n\n在技术层面，Tesseract 展现了强大的适应能力。从版本 4 开始，它引入了基于长短期记忆网络（LSTM）的神经网络 OCR 引擎，显著提升了行识别的准确率；同时，为了兼顾旧有需求，它依然支持传统的字符模式识别引擎。Tesseract 原生支持 UTF-8 编码，开箱即用即可识别超过 100 种语言，并兼容 PNG、JPEG、TIFF 等多种常见图像格式。输出方面，它灵活支持纯文本、hOCR、PDF、TSV 等多种格式，方便后续数据处理。\n\nTesseract 主要面向开发者、研究人员以及需要构建文档处理流程的企业用户。由于它本身是一个命令行工具和库（libtesseract），不包含图形用户界面（GUI），因此最适合具备一定编程能力的技术人员集成到自动化脚本或应用程序中",73286,"2026-04-03T01:56:45",[13,14],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":79,"owner_email":79,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":99,"forks":100,"last_commit_at":101,"license":102,"difficulty_score":103,"env_os":104,"env_gpu":105,"env_ram":106,"env_deps":107,"category_tags":115,"github_topics":79,"view_count":116,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":117,"updated_at":118,"faqs":119,"releases":149},2606,"NVlabs\u002Fstylegan3","stylegan3","Official PyTorch implementation of StyleGAN3","StyleGAN3 是英伟达推出的新一代图像生成开源框架，作为 StyleGAN2 的进化版，它致力于解决传统生成模型中存在的“混叠”难题。在旧版模型中，生成的图像细节往往像被“粘”在固定的像素坐标上，导致物体移动或旋转时纹理出现不自然的闪烁或撕裂。StyleGAN3 通过引入无混叠（Alias-Free）架构，将网络信号视为连续数据，从根本上消除了这一缺陷。\n\n其核心亮点在于实现了完美的平移和旋转等变性，即便在亚像素级别的操作下，生成内容也能保持自然流畅，仿佛真实物体表面的纹理随视角变化而自然流动。这一突破不仅提升了静态图像的质感，更为视频生成和动画制作铺平了道路，使生成的动态画面更加稳定逼真。\n\nStyleGAN3 主要面向 AI 研究人员、深度学习开发者以及需要高质量合成内容的视觉设计师。虽然它支持加载旧版 StyleGAN2 的模型，但要体验其独特的架构优势，用户需使用提供的配置进行重新训练。项目配套了丰富的可视化工具、频谱分析脚本及预训练模型，并优化了对新版 PyTorch 和安培架构显卡的支持，是探索高保真生成式人工智能的理想选择。","## Alias-Free Generative Adversarial Networks (StyleGAN3)\u003Cbr>\u003Csub>Official PyTorch implementation of the NeurIPS 2021 paper\u003C\u002Fsub>\n\n![Teaser image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNVlabs_stylegan3_readme_d0ac17a8a8ee.png)\n\n**Alias-Free Generative Adversarial Networks**\u003Cbr>\nTero Karras, Miika Aittala, Samuli Laine, Erik H&auml;rk&ouml;nen, Janne Hellsten, Jaakko Lehtinen, Timo Aila\u003Cbr>\nhttps:\u002F\u002Fnvlabs.github.io\u002Fstylegan3\u003Cbr>\n\nAbstract: *We observe that despite their hierarchical convolutional nature, the synthesis process of typical generative adversarial networks depends on absolute pixel coordinates in an unhealthy manner. This manifests itself as, e.g., detail appearing to be glued to image coordinates instead of the surfaces of depicted objects. We trace the root cause to careless signal processing that causes aliasing in the generator network. Interpreting all signals in the network as continuous, we derive generally applicable, small architectural changes that guarantee that unwanted information cannot leak into the hierarchical synthesis process. The resulting networks match the FID of StyleGAN2 but differ dramatically in their internal representations, and they are fully equivariant to translation and rotation even at subpixel scales. Our results pave the way for generative models better suited for video and animation.*\n\nFor business inquiries, please visit our website and submit the form: [NVIDIA Research Licensing](https:\u002F\u002Fwww.nvidia.com\u002Fen-us\u002Fresearch\u002Finquiries\u002F)\n\n## Release notes\n\nThis repository is an updated version of [stylegan2-ada-pytorch](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan2-ada-pytorch), with several new features:\n- Alias-free generator architecture and training configurations (`stylegan3-t`, `stylegan3-r`).\n- Tools for interactive visualization (`visualizer.py`), spectral analysis (`avg_spectra.py`), and video generation (`gen_video.py`).\n- Equivariance metrics (`eqt50k_int`, `eqt50k_frac`, `eqr50k`).\n- General improvements: reduced memory usage, slightly faster training, bug fixes.\n\nCompatibility:\n- Compatible with old network pickles created using [stylegan2-ada](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan2-ada) and [stylegan2-ada-pytorch](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan2-ada-pytorch).  (Note: running old StyleGAN2 models on StyleGAN3 code will produce the same results as running them on stylegan2-ada\u002Fstylegan2-ada-pytorch.  To benefit from the StyleGAN3 architecture, you need to retrain.)\n- Supports old StyleGAN2 training configurations, including ADA and transfer learning. See [Training configurations](.\u002Fdocs\u002Fconfigs.md) for details.\n- Improved compatibility with Ampere GPUs and newer versions of PyTorch, CuDNN, etc.\n\n## Synthetic image detection\n\nWhile new generator approaches enable new media synthesis capabilities, they may also present a new challenge for AI forensics algorithms for detection and attribution of synthetic media. In collaboration with digital forensic researchers participating in DARPA's SemaFor program, we curated a synthetic image dataset that allowed the researchers to test and validate the performance of their image detectors in advance of the public release. Please see [here](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3-detector) for more details.\n\n## Additional material\n\n- [Result videos](https:\u002F\u002Fnvlabs-fi-cdn.nvidia.com\u002Fstylegan3\u002Fvideos\u002F)\n- [Curated example images](https:\u002F\u002Fnvlabs-fi-cdn.nvidia.com\u002Fstylegan3\u002Fimages\u002F)\n- [StyleGAN3 pre-trained models](https:\u002F\u002Fngc.nvidia.com\u002Fcatalog\u002Fmodels\u002Fnvidia:research:stylegan3) for config T (translation equiv.) and config R (translation and rotation equiv.)\n  > \u003Csub>Access individual networks via `https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002F\u003CMODEL>`, where `\u003CMODEL>` is one of:\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-t-ffhq-1024x1024.pkl`, `stylegan3-t-ffhqu-1024x1024.pkl`, `stylegan3-t-ffhqu-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-r-ffhq-1024x1024.pkl`, `stylegan3-r-ffhqu-1024x1024.pkl`, `stylegan3-r-ffhqu-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-t-metfaces-1024x1024.pkl`, `stylegan3-t-metfacesu-1024x1024.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-r-metfaces-1024x1024.pkl`, `stylegan3-r-metfacesu-1024x1024.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-t-afhqv2-512x512.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-r-afhqv2-512x512.pkl`\u003C\u002Fsub>\u003Cbr>\n- [StyleGAN2 pre-trained models](https:\u002F\u002Fngc.nvidia.com\u002Fcatalog\u002Fmodels\u002Fnvidia:research:stylegan2) compatible with this codebase\n  > \u003Csub>Access individual networks via `https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan2\u002Fversions\u002F1\u002Ffiles\u002F\u003CMODEL>`, where `\u003CMODEL>` is one of:\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-ffhq-1024x1024.pkl`, `stylegan2-ffhq-512x512.pkl`, `stylegan2-ffhq-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-ffhqu-1024x1024.pkl`, `stylegan2-ffhqu-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-metfaces-1024x1024.pkl`, `stylegan2-metfacesu-1024x1024.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-afhqv2-512x512.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-afhqcat-512x512.pkl`, `stylegan2-afhqdog-512x512.pkl`, `stylegan2-afhqwild-512x512.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-brecahad-512x512.pkl`, `stylegan2-cifar10-32x32.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-celebahq-256x256.pkl`, `stylegan2-lsundog-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n\n## Requirements\n\n* Linux and Windows are supported, but we recommend Linux for performance and compatibility reasons.\n* 1&ndash;8 high-end NVIDIA GPUs with at least 12 GB of memory. We have done all testing and development using Tesla V100 and A100 GPUs.\n* 64-bit Python 3.8 and PyTorch 1.9.0 (or later). See https:\u002F\u002Fpytorch.org for PyTorch install instructions.\n* CUDA toolkit 11.1 or later.  (Why is a separate CUDA toolkit installation required?  See [Troubleshooting](.\u002Fdocs\u002Ftroubleshooting.md#why-is-cuda-toolkit-installation-necessary)).\n* GCC 7 or later (Linux) or Visual Studio (Windows) compilers.  Recommended GCC version depends on CUDA version, see for example [CUDA 11.4 system requirements](https:\u002F\u002Fdocs.nvidia.com\u002Fcuda\u002Farchive\u002F11.4.1\u002Fcuda-installation-guide-linux\u002Findex.html#system-requirements).\n* Python libraries: see [environment.yml](.\u002Fenvironment.yml) for exact library dependencies.  You can use the following commands with Miniconda3 to create and activate your StyleGAN3 Python environment:\n  - `conda env create -f environment.yml`\n  - `conda activate stylegan3`\n* Docker users:\n  - Ensure you have correctly installed the [NVIDIA container runtime](https:\u002F\u002Fdocs.docker.com\u002Fconfig\u002Fcontainers\u002Fresource_constraints\u002F#gpu).\n  - Use the [provided Dockerfile](.\u002FDockerfile) to build an image with the required library dependencies.\n\nThe code relies heavily on custom PyTorch extensions that are compiled on the fly using NVCC. On Windows, the compilation requires Microsoft Visual Studio. We recommend installing [Visual Studio Community Edition](https:\u002F\u002Fvisualstudio.microsoft.com\u002Fvs\u002F) and adding it into `PATH` using `\"C:\\Program Files (x86)\\Microsoft Visual Studio\\\u003CVERSION>\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"`.\n\nSee [Troubleshooting](.\u002Fdocs\u002Ftroubleshooting.md) for help on common installation and run-time problems.\n\n## Getting started\n\nPre-trained networks are stored as `*.pkl` files that can be referenced using local filenames or URLs:\n\n```.bash\n# Generate an image using pre-trained AFHQv2 model (\"Ours\" in Figure 1, left).\npython gen_images.py --outdir=out --trunc=1 --seeds=2 \\\n    --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-afhqv2-512x512.pkl\n\n# Render a 4x2 grid of interpolations for seeds 0 through 31.\npython gen_video.py --output=lerp.mp4 --trunc=1 --seeds=0-31 --grid=4x2 \\\n    --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-afhqv2-512x512.pkl\n```\n\nOutputs from the above commands are placed under `out\u002F*.png`, controlled by `--outdir`. Downloaded network pickles are cached under `$HOME\u002F.cache\u002Fdnnlib`, which can be overridden by setting the `DNNLIB_CACHE_DIR` environment variable. The default PyTorch extension build directory is `$HOME\u002F.cache\u002Ftorch_extensions`, which can be overridden by setting `TORCH_EXTENSIONS_DIR`.\n\n**Docker**: You can run the above curated image example using Docker as follows:\n\n```.bash\n# Build the stylegan3:latest image\ndocker build --tag stylegan3 .\n\n# Run the gen_images.py script using Docker:\ndocker run --gpus all -it --rm --user $(id -u):$(id -g) \\\n    -v `pwd`:\u002Fscratch --workdir \u002Fscratch -e HOME=\u002Fscratch \\\n    stylegan3 \\\n    python gen_images.py --outdir=out --trunc=1 --seeds=2 \\\n         --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-afhqv2-512x512.pkl\n```\n\nNote: The Docker image requires NVIDIA driver release `r470` or later.\n\nThe `docker run` invocation may look daunting, so let's unpack its contents here:\n\n- `--gpus all -it --rm --user $(id -u):$(id -g)`: with all GPUs enabled, run an interactive session with current user's UID\u002FGID to avoid Docker writing files as root.\n- ``-v `pwd`:\u002Fscratch --workdir \u002Fscratch``: mount current running dir (e.g., the top of this git repo on your host machine) to `\u002Fscratch` in the container and use that as the current working dir.\n- `-e HOME=\u002Fscratch`: let PyTorch and StyleGAN3 code know where to cache temporary files such as pre-trained models and custom PyTorch extension build results. Note: if you want more fine-grained control, you can instead set `TORCH_EXTENSIONS_DIR` (for custom extensions build dir) and `DNNLIB_CACHE_DIR` (for pre-trained model download cache). You want these cache dirs to reside on persistent volumes so that their contents are retained across multiple `docker run` invocations.\n\n## Interactive visualization\n\nThis release contains an interactive model visualization tool that can be used to explore various characteristics of a trained model.  To start it, run:\n\n```.bash\npython visualizer.py\n```\n\n\u003Ca href=\".\u002Fdocs\u002Fvisualizer_screen0.png\">\u003Cimg alt=\"Visualizer screenshot\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNVlabs_stylegan3_readme_3f994a136cb5.png\">\u003C\u002Fimg>\u003C\u002Fa>\n\n## Using networks from Python\n\nYou can use pre-trained networks in your own Python code as follows:\n\n```.python\nwith open('ffhq.pkl', 'rb') as f:\n    G = pickle.load(f)['G_ema'].cuda()  # torch.nn.Module\nz = torch.randn([1, G.z_dim]).cuda()    # latent codes\nc = None                                # class labels (not used in this example)\nimg = G(z, c)                           # NCHW, float32, dynamic range [-1, +1], no truncation\n```\n\nThe above code requires `torch_utils` and `dnnlib` to be accessible via `PYTHONPATH`. It does not need source code for the networks themselves &mdash; their class definitions are loaded from the pickle via `torch_utils.persistence`.\n\nThe pickle contains three networks. `'G'` and `'D'` are instantaneous snapshots taken during training, and `'G_ema'` represents a moving average of the generator weights over several training steps. The networks are regular instances of `torch.nn.Module`, with all of their parameters and buffers placed on the CPU at import and gradient computation disabled by default.\n\nThe generator consists of two submodules, `G.mapping` and `G.synthesis`, that can be executed separately. They also support various additional options:\n\n```.python\nw = G.mapping(z, c, truncation_psi=0.5, truncation_cutoff=8)\nimg = G.synthesis(w, noise_mode='const', force_fp32=True)\n```\n\nPlease refer to [`gen_images.py`](.\u002Fgen_images.py) for complete code example.\n\n## Preparing datasets\n\nDatasets are stored as uncompressed ZIP archives containing uncompressed PNG files and a metadata file `dataset.json` for labels. Custom datasets can be created from a folder containing images; see [`python dataset_tool.py --help`](.\u002Fdocs\u002Fdataset-tool-help.txt) for more information. Alternatively, the folder can also be used directly as a dataset, without running it through `dataset_tool.py` first, but doing so may lead to suboptimal performance.\n\n**FFHQ**: Download the [Flickr-Faces-HQ dataset](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fffhq-dataset) as 1024x1024 images and create a zip archive using `dataset_tool.py`:\n\n```.bash\n# Original 1024x1024 resolution.\npython dataset_tool.py --source=\u002Ftmp\u002Fimages1024x1024 --dest=~\u002Fdatasets\u002Fffhq-1024x1024.zip\n\n# Scaled down 256x256 resolution.\npython dataset_tool.py --source=\u002Ftmp\u002Fimages1024x1024 --dest=~\u002Fdatasets\u002Fffhq-256x256.zip \\\n    --resolution=256x256\n```\n\nSee the [FFHQ README](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fffhq-dataset) for information on how to obtain the unaligned FFHQ dataset images. Use the same steps as above to create a ZIP archive for training and validation.\n\n**MetFaces**: Download the [MetFaces dataset](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fmetfaces-dataset) and create a ZIP archive:\n\n```.bash\npython dataset_tool.py --source=~\u002Fdownloads\u002Fmetfaces\u002Fimages --dest=~\u002Fdatasets\u002Fmetfaces-1024x1024.zip\n```\n\nSee the [MetFaces README](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fmetfaces-dataset) for information on how to obtain the unaligned MetFaces dataset images. Use the same steps as above to create a ZIP archive for training and validation.\n\n**AFHQv2**: Download the [AFHQv2 dataset](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fstargan-v2\u002Fblob\u002Fmaster\u002FREADME.md#animal-faces-hq-dataset-afhq) and create a ZIP archive:\n\n```.bash\npython dataset_tool.py --source=~\u002Fdownloads\u002Fafhqv2 --dest=~\u002Fdatasets\u002Fafhqv2-512x512.zip\n```\n\nNote that the above command creates a single combined dataset using all images of all three classes (cats, dogs, and wild animals), matching the setup used in the StyleGAN3 paper. Alternatively, you can also create a separate dataset for each class:\n\n```.bash\npython dataset_tool.py --source=~\u002Fdownloads\u002Fafhqv2\u002Ftrain\u002Fcat --dest=~\u002Fdatasets\u002Fafhqv2cat-512x512.zip\npython dataset_tool.py --source=~\u002Fdownloads\u002Fafhqv2\u002Ftrain\u002Fdog --dest=~\u002Fdatasets\u002Fafhqv2dog-512x512.zip\npython dataset_tool.py --source=~\u002Fdownloads\u002Fafhqv2\u002Ftrain\u002Fwild --dest=~\u002Fdatasets\u002Fafhqv2wild-512x512.zip\n```\n\n## Training\n\nYou can train new networks using `train.py`. For example:\n\n```.bash\n# Train StyleGAN3-T for AFHQv2 using 8 GPUs.\npython train.py --outdir=~\u002Ftraining-runs --cfg=stylegan3-t --data=~\u002Fdatasets\u002Fafhqv2-512x512.zip \\\n    --gpus=8 --batch=32 --gamma=8.2 --mirror=1\n\n# Fine-tune StyleGAN3-R for MetFaces-U using 1 GPU, starting from the pre-trained FFHQ-U pickle.\npython train.py --outdir=~\u002Ftraining-runs --cfg=stylegan3-r --data=~\u002Fdatasets\u002Fmetfacesu-1024x1024.zip \\\n    --gpus=8 --batch=32 --gamma=6.6 --mirror=1 --kimg=5000 --snap=5 \\\n    --resume=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-ffhqu-1024x1024.pkl\n\n# Train StyleGAN2 for FFHQ at 1024x1024 resolution using 8 GPUs.\npython train.py --outdir=~\u002Ftraining-runs --cfg=stylegan2 --data=~\u002Fdatasets\u002Fffhq-1024x1024.zip \\\n    --gpus=8 --batch=32 --gamma=10 --mirror=1 --aug=noaug\n```\n\nNote that the result quality and training time depend heavily on the exact set of options. The most important ones (`--gpus`, `--batch`, and `--gamma`) must be specified explicitly, and they should be selected with care. See [`python train.py --help`](.\u002Fdocs\u002Ftrain-help.txt) for the full list of options and [Training configurations](.\u002Fdocs\u002Fconfigs.md) for general guidelines &amp; recommendations, along with the expected training speed &amp; memory usage in different scenarios.\n\nThe results of each training run are saved to a newly created directory, for example `~\u002Ftraining-runs\u002F00000-stylegan3-t-afhqv2-512x512-gpus8-batch32-gamma8.2`. The training loop exports network pickles (`network-snapshot-\u003CKIMG>.pkl`) and random image grids (`fakes\u003CKIMG>.png`) at regular intervals (controlled by `--snap`). For each exported pickle, it evaluates FID (controlled by `--metrics`) and logs the result in `metric-fid50k_full.jsonl`. It also records various statistics in `training_stats.jsonl`, as well as `*.tfevents` if TensorBoard is installed.\n\n## Quality metrics\n\nBy default, `train.py` automatically computes FID for each network pickle exported during training. We recommend inspecting `metric-fid50k_full.jsonl` (or TensorBoard) at regular intervals to monitor the training progress. When desired, the automatic computation can be disabled with `--metrics=none` to speed up the training slightly.\n\nAdditional quality metrics can also be computed after the training:\n\n```.bash\n# Previous training run: look up options automatically, save result to JSONL file.\npython calc_metrics.py --metrics=eqt50k_int,eqr50k \\\n    --network=~\u002Ftraining-runs\u002F00000-stylegan3-r-mydataset\u002Fnetwork-snapshot-000000.pkl\n\n# Pre-trained network pickle: specify dataset explicitly, print result to stdout.\npython calc_metrics.py --metrics=fid50k_full --data=~\u002Fdatasets\u002Fffhq-1024x1024.zip --mirror=1 \\\n    --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-t-ffhq-1024x1024.pkl\n```\n\nThe first example looks up the training configuration and performs the same operation as if `--metrics=eqt50k_int,eqr50k` had been specified during training. The second example downloads a pre-trained network pickle, in which case the values of `--data` and `--mirror` must be specified explicitly.\n\nNote that the metrics can be quite expensive to compute (up to 1h), and many of them have an additional one-off cost for each new dataset (up to 30min). Also note that the evaluation is done using a different random seed each time, so the results will vary if the same metric is computed multiple times.\n\nRecommended metrics:\n* `fid50k_full`: Fr&eacute;chet inception distance\u003Csup>[1]\u003C\u002Fsup> against the full dataset.\n* `kid50k_full`: Kernel inception distance\u003Csup>[2]\u003C\u002Fsup> against the full dataset.\n* `pr50k3_full`: Precision and recall\u003Csup>[3]\u003C\u002Fsup> againt the full dataset.\n* `ppl2_wend`: Perceptual path length\u003Csup>[4]\u003C\u002Fsup> in W, endpoints, full image.\n* `eqt50k_int`: Equivariance\u003Csup>[5]\u003C\u002Fsup> w.r.t. integer translation (EQ-T).\n* `eqt50k_frac`: Equivariance w.r.t. fractional translation (EQ-T\u003Csub>frac\u003C\u002Fsub>).\n* `eqr50k`: Equivariance w.r.t. rotation (EQ-R).\n\nLegacy metrics:\n* `fid50k`: Fr&eacute;chet inception distance against 50k real images.\n* `kid50k`: Kernel inception distance against 50k real images.\n* `pr50k3`: Precision and recall against 50k real images.\n* `is50k`: Inception score\u003Csup>[6]\u003C\u002Fsup> for CIFAR-10.\n\nReferences:\n1. [GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium](https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.08500), Heusel et al. 2017\n2. [Demystifying MMD GANs](https:\u002F\u002Farxiv.org\u002Fabs\u002F1801.01401), Bi&nacute;kowski et al. 2018\n3. [Improved Precision and Recall Metric for Assessing Generative Models](https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.06991), Kynk&auml;&auml;nniemi et al. 2019\n4. [A Style-Based Generator Architecture for Generative Adversarial Networks](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.04948), Karras et al. 2018\n5. [Alias-Free Generative Adversarial Networks](https:\u002F\u002Fnvlabs.github.io\u002Fstylegan3), Karras et al. 2021\n6. [Improved Techniques for Training GANs](https:\u002F\u002Farxiv.org\u002Fabs\u002F1606.03498), Salimans et al. 2016\n\n## Spectral analysis\n\nThe easiest way to inspect the spectral properties of a given generator is to use the built-in FFT mode in `visualizer.py`. In addition, you can visualize average 2D power spectra (Appendix A, Figure 15) as follows:\n\n```.bash\n# Calculate dataset mean and std, needed in subsequent steps.\npython avg_spectra.py stats --source=~\u002Fdatasets\u002Fffhq-1024x1024.zip\n\n# Calculate average spectrum for the training data.\npython avg_spectra.py calc --source=~\u002Fdatasets\u002Fffhq-1024x1024.zip \\\n    --dest=tmp\u002Ftraining-data.npz --mean=112.684 --std=69.509\n\n# Calculate average spectrum for a pre-trained generator.\npython avg_spectra.py calc \\\n    --source=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-ffhq-1024x1024.pkl \\\n    --dest=tmp\u002Fstylegan3-r.npz --mean=112.684 --std=69.509 --num=70000\n\n# Display results.\npython avg_spectra.py heatmap tmp\u002Ftraining-data.npz\npython avg_spectra.py heatmap tmp\u002Fstylegan3-r.npz\npython avg_spectra.py slices tmp\u002Ftraining-data.npz tmp\u002Fstylegan3-r.npz\n```\n\n\u003Ca href=\".\u002Fdocs\u002Favg_spectra_screen0.png\">\u003Cimg alt=\"Average spectra screenshot\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNVlabs_stylegan3_readme_753dd42e95da.png\">\u003C\u002Fimg>\u003C\u002Fa>\n\n## License\n\nCopyright &copy; 2021, NVIDIA Corporation & affiliates. All rights reserved.\n\nThis work is made available under the [Nvidia Source Code License](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3\u002Fblob\u002Fmain\u002FLICENSE.txt).\n\n## Citation\n\n```\n@inproceedings{Karras2021,\n  author = {Tero Karras and Miika Aittala and Samuli Laine and Erik H\\\"ark\\\"onen and Janne Hellsten and Jaakko Lehtinen and Timo Aila},\n  title = {Alias-Free Generative Adversarial Networks},\n  booktitle = {Proc. NeurIPS},\n  year = {2021}\n}\n```\n\n## Development\n\nThis is a research reference implementation and is treated as a one-time code drop. As such, we do not accept outside code contributions in the form of pull requests.\n\n## Acknowledgements\n\nWe thank David Luebke, Ming-Yu Liu, Koki Nagano, Tuomas Kynk&auml;&auml;nniemi, and Timo Viitanen for reviewing early drafts and helpful suggestions. Fr&eacute;do Durand for early discussions. Tero Kuosmanen for maintaining our compute infrastructure. AFHQ authors for an updated version of their dataset. Getty Images for the training images in the Beaches dataset. We did not receive external funding or additional revenues for this project.\n","## 无混叠生成对抗网络（StyleGAN3）\u003Cbr>\u003Csub>NeurIPS 2021 论文的官方 PyTorch 实现\u003C\u002Fsub>\n\n![预告图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNVlabs_stylegan3_readme_d0ac17a8a8ee.png)\n\n**无混叠生成对抗网络**\u003Cbr>\n特罗·卡拉斯、米卡·艾塔拉、萨穆利·莱内、埃里克·哈尔科宁、扬内·赫尔斯特恩、雅各·莱蒂宁、蒂莫·艾拉\u003Cbr>\nhttps:\u002F\u002Fnvlabs.github.io\u002Fstylegan3\u003Cbr>\n\n摘要：*我们观察到，尽管典型的生成对抗网络具有分层卷积结构，但其合成过程却以一种不健康的方式依赖于绝对像素坐标。这表现为细节似乎被“粘”在图像坐标上，而非所描绘物体的表面。我们将根本原因归结为粗心的信号处理，导致生成器网络中出现混叠现象。通过将网络中的所有信号视为连续信号，我们推导出通用且微小的架构改进，确保有害信息不会渗入分层合成过程。由此产生的网络在 FID 指标上与 StyleGAN2 相当，但在内部表示上却有显著差异，并且即使在亚像素尺度下也完全具备平移和旋转等变性。我们的研究为更适合视频和动画的生成模型开辟了道路。*\n\n如需商务合作，请访问我们的官网并提交表格：[NVIDIA Research Licensing](https:\u002F\u002Fwww.nvidia.com\u002Fen-us\u002Fresearch\u002Finquiries\u002F)\n\n## 发布说明\n\n本仓库是 [stylegan2-ada-pytorch](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan2-ada-pytorch) 的更新版本，新增多项功能：\n- 无混叠生成器架构及训练配置（`stylegan3-t`、`stylegan3-r`）。\n- 交互式可视化工具（`visualizer.py`）、频谱分析工具（`avg_spectra.py`）和视频生成工具（`gen_video.py`）。\n- 等变性指标（`eqt50k_int`、`eqt50k_frac`、`eqr50k`）。\n- 其他改进：降低内存占用、略微加快训练速度、修复若干 bug。\n\n兼容性：\n- 兼容使用 [stylegan2-ada](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan2-ada) 和 [stylegan2-ada-pytorch](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan2-ada-pytorch) 创建的旧版网络快照。（注意：在 StyleGAN3 代码上运行旧版 StyleGAN2 模型，结果将与在 stylegan2-ada\u002Fstylegan2-ada-pytorch 上运行时相同。若要享受 StyleGAN3 架构的优势，需重新训练。）\n- 支持旧版 StyleGAN2 的训练配置，包括 ADA 和迁移学习。详情请参阅 [训练配置](.\u002Fdocs\u002Fconfigs.md)。\n- 对 Ampere 架构 GPU 以及较新版本的 PyTorch、CuDNN 等的兼容性有所提升。\n\n## 合成图像检测\n\n虽然新的生成器方法带来了全新的媒体合成能力，但也可能对用于检测和溯源合成媒体的人工智能取证算法构成新的挑战。我们与参与 DARPA SemaFor 项目的数字取证研究人员合作，整理了一个合成图像数据集，使研究人员能够在公开发布前测试并验证其图像检测器的性能。更多详情请参见 [此处](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3-detector)。\n\n## 补充资料\n\n- [结果视频](https:\u002F\u002Fnvlabs-fi-cdn.nvidia.com\u002Fstylegan3\u002Fvideos\u002F)\n- [精选示例图片](https:\u002F\u002Fnvlabs-fi-cdn.nvidia.com\u002Fstylegan3\u002Fimages\u002F)\n- [StyleGAN3 预训练模型](https:\u002F\u002Fngc.nvidia.com\u002Fcatalog\u002Fmodels\u002Fnvidia:research:stylegan3)，适用于 T 配置（平移等变）和 R 配置（平移和旋转等变）。\n  > \u003Csub>可通过 `https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002F\u003CMODEL>` 访问单个模型，其中 `\u003CMODEL>` 包括：\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-t-ffhq-1024x1024.pkl`、`stylegan3-t-ffhqu-1024x1024.pkl`、`stylegan3-t-ffhqu-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-r-ffhq-1024x1024.pkl`、`stylegan3-r-ffhqu-1024x1024.pkl`、`stylegan3-r-ffhqu-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-t-metfaces-1024x1024.pkl`、`stylegan3-t-metfacesu-1024x1024.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-r-metfaces-1024x1024.pkl`、`stylegan3-r-metfacesu-1024x1024.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-t-afhqv2-512x512.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan3-r-afhqv2-512x512.pkl`\u003C\u002Fsub>\u003Cbr>\n- [StyleGAN2 预训练模型](https:\u002F\u002Fngc.nvidia.com\u002Fcatalog\u002Fmodels\u002Fnvidia:research:stylegan2)，与本代码库兼容。\n  > \u003Csub>可通过 `https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan2\u002Fversions\u002F1\u002Ffiles\u002F\u003CMODEL>` 访问单个模型，其中 `\u003CMODEL>` 包括：\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-ffhq-1024x1024.pkl`、`stylegan2-ffhq-512x512.pkl`、`stylegan2-ffhq-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-ffhqu-1024x1024.pkl`、`stylegan2-ffhqu-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-metfaces-1024x1024.pkl`、`stylegan2-metfacesu-1024x1024.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-afhqv2-512x512.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-afhqcat-512x512.pkl`、`stylegan2-afhqdog-512x512.pkl`、`stylegan2-afhqwild-512x512.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-brecahad-512x512.pkl`、`stylegan2-cifar10-32x32.pkl`\u003C\u002Fsub>\u003Cbr>\n  > \u003Csub>`stylegan2-celebahq-256x256.pkl`、`stylegan2-lsundog-256x256.pkl`\u003C\u002Fsub>\u003Cbr>\n\n## 需求\n\n* 支持 Linux 和 Windows，但出于性能和兼容性考虑，我们推荐使用 Linux。\n* 1–8 张高端 NVIDIA GPU，每张显存至少 12 GB。我们所有的测试和开发都是在 Tesla V100 和 A100 GPU 上完成的。\n* 64 位 Python 3.8 和 PyTorch 1.9.0（或更高版本）。PyTorch 的安装说明请参见 https:\u002F\u002Fpytorch.org。\n* CUDA 工具包 11.1 或更高版本。（为什么需要单独安装 CUDA 工具包？请参阅 [故障排除](.\u002Fdocs\u002Ftroubleshooting.md#why-is-cuda-toolkit-installation-necessary)。）\n* GCC 7 或更高版本（Linux）或 Visual Studio（Windows）编译器。推荐的 GCC 版本取决于 CUDA 版本，例如，请参阅 [CUDA 11.4 系统要求](https:\u002F\u002Fdocs.nvidia.com\u002Fcuda\u002Farchive\u002F11.4.1\u002Fcuda-installation-guide-linux\u002Findex.html#system-requirements)。\n* Python 库：确切的库依赖关系请参见 [environment.yml](.\u002Fenvironment.yml)。您可以使用 Miniconda3 中的以下命令来创建并激活 StyleGAN3 的 Python 环境：\n  - `conda env create -f environment.yml`\n  - `conda activate stylegan3`\n* Docker 用户：\n  - 确保已正确安装 [NVIDIA 容器运行时](https:\u002F\u002Fdocs.docker.com\u002Fconfig\u002Fcontainers\u002Fresource_constraints\u002F#gpu)。\n  - 使用 [提供的 Dockerfile](.\u002FDockerfile) 来构建包含所需库依赖的镜像。\n\n该代码大量依赖于使用 NVCC 动态编译的自定义 PyTorch 扩展。在 Windows 上，编译需要 Microsoft Visual Studio。我们建议安装 [Visual Studio Community Edition](https:\u002F\u002Fvisualstudio.microsoft.com\u002Fvs\u002F)，并通过 `\"C:\\Program Files (x86)\\Microsoft Visual Studio\\\u003CVERSION>\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"` 将其添加到 `PATH` 中。\n\n有关常见安装和运行时问题的帮助，请参阅 [故障排除](.\u002Fdocs\u002Ftroubleshooting.md)。\n\n## 快速入门\n\n预训练网络以 `*.pkl` 文件的形式存储，可以通过本地文件名或 URL 引用：\n\n```.bash\n# 使用预训练的 AFHQv2 模型生成一张图像（图 1 左侧的“Ours”）。\npython gen_images.py --outdir=out --trunc=1 --seeds=2 \\\n    --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-afhqv2-512x512.pkl\n\n# 渲染一个由种子 0 至 31 构成的 4×2 插值网格。\npython gen_video.py --output=lerp.mp4 --trunc=1 --seeds=0-31 --grid=4x2 \\\n    --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-afhqv2-512x512.pkl\n```\n\n上述命令的输出将放置在 `out\u002F*.png` 目录下，由 `--outdir` 控制。下载的网络 pickle 文件会缓存在 `$HOME\u002F.cache\u002Fdnnlib` 目录下，可以通过设置 `DNNLIB_CACHE_DIR` 环境变量来覆盖此路径。默认的 PyTorch 扩展构建目录是 `$HOME\u002F.cache\u002Ftorch_extensions`，也可以通过设置 `TORCH_EXTENSIONS_DIR` 来覆盖。\n\n**Docker**：您可以通过以下方式使用 Docker 运行上述示例：\n\n```.bash\n# 构建 stylegan3:latest 镜像\ndocker build --tag stylegan3 .\n\n# 使用 Docker 运行 gen_images.py 脚本：\ndocker run --gpus all -it --rm --user $(id -u):$(id -g) \\\n    -v `pwd`:\u002Fscratch --workdir \u002Fscratch -e HOME=\u002Fscratch \\\n    stylegan3 \\\n    python gen_images.py --outdir=out --trunc=1 --seeds=2 \\\n         --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-afhqv2-512x512.pkl\n```\n\n注意：Docker 镜像需要 NVIDIA 驱动程序版本 `r470` 或更高版本。\n\n`docker run` 命令可能看起来有些复杂，下面我们来逐项解释：\n\n- `--gpus all -it --rm --user $(id -u):$(id -g)`：启用所有 GPU，以当前用户的 UID\u002FGID 运行交互式会话，避免 Docker 以 root 用户身份写入文件。\n- `-v `pwd`:\u002Fscratch --workdir \u002Fscratch`：将当前工作目录（例如，您主机上的这个 Git 仓库根目录）挂载到容器内的 `\u002Fscratch` 目录，并将其设为当前工作目录。\n- `-e HOME=\u002Fscratch`：让 PyTorch 和 StyleGAN3 代码知道临时文件（如预训练模型和自定义 PyTorch 扩展的构建结果）应该缓存在哪里。注意：如果您需要更精细的控制，可以分别设置 `TORCH_EXTENSIONS_DIR`（用于自定义扩展的构建目录）和 `DNNLIB_CACHE_DIR`（用于预训练模型的下载缓存）。这些缓存目录应位于持久化卷上，以便在多次 `docker run` 调用之间保留内容。\n\n## 交互式可视化\n\n此版本包含一个交互式模型可视化工具，可用于探索训练好的模型的各种特性。要启动它，请运行：\n\n```.bash\npython visualizer.py\n```\n\n\u003Ca href=\".\u002Fdocs\u002Fvisualizer_screen0.png\">\u003Cimg alt=\"Visualizer 截图\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNVlabs_stylegan3_readme_3f994a136cb5.png\">\u003C\u002Fimg>\u003C\u002Fa>\n\n## 在 Python 中使用网络\n\n您可以在自己的 Python 代码中使用预训练网络，如下所示：\n\n```.python\nwith open('ffhq.pkl', 'rb') as f:\n    G = pickle.load(f)['G_ema'].cuda()  # torch.nn.Module\nz = torch.randn([1, G.z_dim]).cuda()    # 隐变量编码\nc = None                                # 类标签（本示例中未使用）\nimg = G(z, c)                           # NCHW, float32, 动态范围 [-1, +1], 无截断\n```\n\n上述代码需要 `torch_utils` 和 `dnnlib` 可通过 `PYTHONPATH` 访问。它不需要网络本身的源代码——它们的类定义会通过 `torch_utils.persistence` 从 pickle 中加载。\n\npickle 文件中包含三个网络。“G”和“D”是在训练过程中拍摄的即时快照，“G_ema”则是生成器权重在多个训练步骤中的移动平均值。这些网络是普通的 `torch.nn.Module` 实例，在导入时所有参数和缓冲区都位于 CPU 上，且默认情况下禁用了梯度计算。\n\n生成器由两个子模块组成：`G.mapping` 和 `G.synthesis`，可以分别执行。它们还支持多种附加选项：\n\n```.python\nw = G.mapping(z, c, truncation_psi=0.5, truncation_cutoff=8)\nimg = G.synthesis(w, noise_mode='const', force_fp32=True)\n```\n\n完整的代码示例请参阅 [`gen_images.py`](.\u002Fgen_images.py)。\n\n## 准备数据集\n\n数据集以未压缩的 ZIP 存档形式存储，其中包含未压缩的 PNG 文件和一个用于标签的元数据文件 `dataset.json`。自定义数据集可以从包含图像的文件夹中创建；更多信息请参阅 [`python dataset_tool.py --help`](.\u002Fdocs\u002Fdataset-tool-help.txt)。或者，也可以直接将文件夹用作数据集，无需先通过 `dataset_tool.py` 处理，但这样做可能会导致性能不佳。\n\n**FFHQ**：下载 [Flickr-Faces-HQ 数据集](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fffhq-dataset)，格式为 1024×1024 像素的图像，并使用 `dataset_tool.py` 创建一个 ZIP 存档：\n\n```.bash\n# 原始分辨率为 1024×1024。\npython dataset_tool.py --source=\u002Ftmp\u002Fimages1024x1024 --dest=~\u002Fdatasets\u002Fffhq-1024x1024.zip\n\n# 缩小至256x256分辨率。\npython dataset_tool.py --source=\u002Ftmp\u002Fimages1024x1024 --dest=~\u002Fdatasets\u002Fffhq-256x256.zip \\\n    --resolution=256x256\n```\n\n有关如何获取未对齐的FFHQ数据集图像的信息，请参阅[FFHQ README](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fffhq-dataset)。使用上述相同步骤创建用于训练和验证的ZIP存档。\n\n**MetFaces**：下载[MetFaces数据集](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fmetfaces-dataset)，并创建一个ZIP存档：\n\n```.bash\npython dataset_tool.py --source=~\u002Fdownloads\u002Fmetfaces\u002Fimages --dest=~\u002Fdatasets\u002Fmetfaces-1024x1024.zip\n```\n\n有关如何获取未对齐的MetFaces数据集图像的信息，请参阅[MetFaces README](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fmetfaces-dataset)。使用上述相同步骤创建用于训练和验证的ZIP存档。\n\n**AFHQv2**：下载[AFHQv2数据集](https:\u002F\u002Fgithub.com\u002Fclovaai\u002Fstargan-v2\u002Fblob\u002Fmaster\u002FREADME.md#animal-faces-hq-dataset-afhq)，并创建一个ZIP存档：\n\n```.bash\npython dataset_tool.py --source=~\u002Fdownloads\u002Fafhqv2 --dest=~\u002Fdatasets\u002Fafhqv2-512x512.zip\n```\n\n请注意，上述命令会使用所有三个类别（猫、狗和野生动物）的所有图像创建一个单一的合并数据集，这与StyleGAN3论文中使用的设置一致。或者，您也可以为每个类别单独创建一个数据集：\n\n```.bash\npython dataset_tool.py --source=~\u002Fdownloads\u002Fafhqv2\u002Ftrain\u002Fcat --dest=~\u002Fdatasets\u002Fafhqv2cat-512x512.zip\npython dataset_tool.py --source=~\u002Fdownloads\u002Fafhqv2\u002Ftrain\u002Fdog --dest=~\u002Fdatasets\u002Fafhqv2dog-512x512.zip\npython dataset_tool.py --source=~\u002Fdownloads\u002Fafhqv2\u002Ftrain\u002Fwild --dest=~\u002Fdatasets\u002Fafhqv2wild-512x512.zip\n```\n\n## 训练\n\n您可以使用`train.py`来训练新网络。例如：\n\n```.bash\n# 使用8个GPU为AFHQv2训练StyleGAN3-T。\npython train.py --outdir=~\u002Ftraining-runs --cfg=stylegan3-t --data=~\u002Fdatasets\u002Fafhqv2-512x512.zip \\\n    --gpus=8 --batch=32 --gamma=8.2 --mirror=1\n\n# 使用1个GPU为MetFaces-U微调StyleGAN3-R，从预训练的FFHQ-U pickle开始。\npython train.py --outdir=~\u002Ftraining-runs --cfg=stylegan3-r --data=~\u002Fdatasets\u002Fmetfacesu-1024x1024.zip \\\n    --gpus=8 --batch=32 --gamma=6.6 --mirror=1 --kimg=5000 --snap=5 \\\n    --resume=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-ffhqu-1024x1024.pkl\n\n# 使用8个GPU在1024x1024分辨率下为FFHQ训练StyleGAN2。\npython train.py --outdir=~\u002Ftraining-runs --cfg=stylegan2 --data=~\u002Fdatasets\u002Fffhq-1024x1024.zip \\\n    --gpus=8 --batch=32 --gamma=10 --mirror=1 --aug=noaug\n```\n\n请注意，结果质量和训练时间在很大程度上取决于具体的选项设置。其中最重要的几个选项（`--gpus`、`--batch`和`--gamma`）必须明确指定，并且应谨慎选择。有关完整选项列表，请参阅[`python train.py --help`](.\u002Fdocs\u002Ftrain-help.txt)，有关一般指导原则和建议以及不同场景下的预期训练速度和内存使用情况，请参阅[训练配置](.\u002Fdocs\u002Fconfigs.md)。\n\n每次训练的结果都会保存到一个新创建的目录中，例如`~\u002Ftraining-runs\u002F00000-stylegan3-t-afhqv2-512x512-gpus8-batch32-gamma8.2`。训练循环会定期导出网络pickle文件（`network-snapshot-\u003CKIMG>.pkl`）和随机图像网格（`fakes\u003CKIMG>.png`），间隔由`--snap`控制。对于每个导出的pickle文件，它会评估FID（由`--metrics`控制），并将结果记录在`metric-fid50k_full.jsonl`中。此外，它还会将各种统计信息记录在`training_stats.jsonl`中，如果安装了TensorBoard，则还会生成`*.tfevents`文件。\n\n## 质量指标\n\n默认情况下，`train.py`会在训练过程中自动计算每个网络pickle文件的FID值。我们建议定期检查`metric-fid50k_full.jsonl`（或TensorBoard）以监控训练进度。如果需要，可以通过设置`--metrics=none`来禁用自动计算，从而略微加快训练速度。\n\n训练完成后，还可以计算其他质量指标：\n\n```.bash\n# 上一次训练运行：自动查找选项，将结果保存到JSONL文件。\npython calc_metrics.py --metrics=eqt50k_int,eqr50k \\\n    --network=~\u002Ftraining-runs\u002F00000-stylegan3-r-mydataset\u002Fnetwork-snapshot-000000.pkl\n\n# 预训练的网络pickle：显式指定数据集，将结果打印到标准输出。\npython calc_metrics.py --metrics=fid50k_full --data=~\u002Fdatasets\u002Fffhq-1024x1024.zip --mirror=1 \\\n    --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-t-ffhq-1024x1024.pkl\n```\n\n第一个示例会查找训练配置，并执行与在训练时指定`--metrics=eqt50k_int,eqr50k`相同的操作。第二个示例则下载了一个预训练的网络pickle，在这种情况下，必须显式指定`--data`和`--mirror`的值。\n\n请注意，计算这些指标可能相当耗时（最长可达1小时），并且许多指标对于每个新数据集都需要额外的一次性成本（最长可达30分钟）。此外，每次评估都会使用不同的随机种子，因此如果多次计算同一指标，结果可能会有所不同。\n\n推荐的指标：\n* `fid50k_full`：针对整个数据集的Fr&eacute;chet inception距离\u003Csup>[1]\u003C\u002Fsup>。\n* `kid50k_full`：针对整个数据集的Kernel inception距离\u003Csup>[2]\u003C\u002Fsup>。\n* `pr50k3_full`：针对整个数据集的精确率和召回率\u003Csup>[3]\u003C\u002Fsup>。\n* `ppl2_wend`：在W空间中，端点与完整图像之间的感知路径长度\u003Csup>[4]\u003C\u002Fsup>。\n* `eqt50k_int`：相对于整数平移的等变性\u003Csup>[5]\u003C\u002Fsup>（EQ-T）。\n* `eqt50k_frac`：相对于分数平移的等变性（EQ-T\u003Csub>frac\u003C\u002Fsub>）。\n* `eqr50k`：相对于旋转的等变性（EQ-R）。\n\n旧版指标：\n* `fid50k`：针对5万张真实图像的Fr&eacute;chet inception距离。\n* `kid50k`：针对5万张真实图像的Kernel inception距离。\n* `pr50k3`：针对5万张真实图像的精确率和召回率。\n* `is50k`：CIFAR-10的Inception评分\u003Csup>[6]\u003C\u002Fsup>。\n\n参考文献：\n1. [通过双时间尺度更新规则训练的GAN收敛到局部纳什均衡](https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.08500)，Heusel等人，2017年\n2. [揭秘MMD GAN](https:\u002F\u002Farxiv.org\u002Fabs\u002F1801.01401)，Bi&nacute;kowski等人，2018年\n3. [用于评估生成模型的改进型精确率和召回率指标](https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.06991)，Kynk&auml;&auml;nniemi等人，2019年\n4. [基于风格的生成器架构用于生成对抗网络](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.04948)，Karras等人，2018年\n5. [无混叠生成对抗网络](https:\u002F\u002Fnvlabs.github.io\u002Fstylegan3)，Karras等人，2021年\n6. [训练GAN的改进技术](https:\u002F\u002Farxiv.org\u002Fabs\u002F1606.03498)，Salimans等人，2016年\n\n## 光谱分析\n\n检查给定生成器光谱特性的最简单方法是使用`visualizer.py`中的内置FFT模式。此外，您还可以按照以下方式可视化平均2D功率谱（附录A，图15）：\n\n```.bash\n\n# 计算数据集的均值和标准差，后续步骤需要用到。\npython avg_spectra.py stats --source=~\u002Fdatasets\u002Fffhq-1024x1024.zip\n\n# 计算训练数据的平均频谱。\npython avg_spectra.py calc --source=~\u002Fdatasets\u002Fffhq-1024x1024.zip \\\n    --dest=tmp\u002Ftraining-data.npz --mean=112.684 --std=69.509\n\n# 计算预训练生成器的平均频谱。\npython avg_spectra.py calc \\\n    --source=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-ffhq-1024x1024.pkl \\\n    --dest=tmp\u002Fstylegan3-r.npz --mean=112.684 --std=69.509 --num=70000\n\n# 展示结果。\npython avg_spectra.py heatmap tmp\u002Ftraining-data.npz\npython avg_spectra.py heatmap tmp\u002Fstylegan3-r.npz\npython avg_spectra.py slices tmp\u002Ftraining-data.npz tmp\u002Fstylegan3-r.npz\n```\n\n\u003Ca href=\".\u002Fdocs\u002Favg_spectra_screen0.png\">\u003Cimg alt=\"平均频谱截图\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNVlabs_stylegan3_readme_753dd42e95da.png\">\u003C\u002Fimg>\u003C\u002Fa>\n\n## 许可证\n\n版权所有 &copy; 2021，英伟达公司及其关联公司。保留所有权利。\n\n本作品根据 [NVIDIA 源代码许可证](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3\u002Fblob\u002Fmain\u002FLICENSE.txt) 提供。\n\n## 引用\n\n```\n@inproceedings{Karras2021,\n  author = {Tero Karras 和 Miika Aittala 和 Samuli Laine 和 Erik H\\\"ark\\\"onen 和 Janne Hellsten 和 Jaakko Lehtinen 和 Timo Aila},\n  title = {无混叠生成对抗网络},\n  booktitle = {NeurIPS 会议论文集},\n  year = {2021}\n}\n```\n\n## 开发\n\n这是一个研究参考实现，被视为一次性代码发布。因此，我们不接受外部以拉取请求形式提交的代码贡献。\n\n## 致谢\n\n我们感谢 David Luebke、Ming-Yu Liu、Koki Nagano、Tuomas Kynk&auml;&auml;nniemi 和 Timo Viitanen 对早期草稿的审阅及有益建议。感谢 Fr&eacute;do Durand 的早期讨论。感谢 Tero Kuosmanen 维护我们的计算基础设施。感谢 AFHQ 团队提供其数据集的更新版本。感谢 Getty Images 提供 Beaches 数据集中用于训练的图像。本项目未获得任何外部资助或额外收入。","# StyleGAN3 快速上手指南\n\nStyleGAN3 是 NVIDIA 推出的无混叠生成对抗网络，解决了传统 GAN 中细节“粘”在像素坐标上的问题，实现了完美的平移和旋转等变性，特别适合视频生成和动画应用。\n\n## 环境准备\n\n**系统要求：**\n*   **操作系统**：推荐 Linux（性能与兼容性最佳），支持 Windows。\n*   **GPU**：1-8 张高端 NVIDIA 显卡，显存至少 12GB（测试基于 Tesla V100\u002FA100）。\n*   **软件版本**：\n    *   Python 3.8 (64-bit)\n    *   PyTorch 1.9.0 或更高版本\n    *   CUDA Toolkit 11.1 或更高版本\n    *   编译器：Linux 需 GCC 7+，Windows 需 Visual Studio（用于编译自定义 PyTorch 扩展）。\n\n**依赖安装：**\n建议使用 Miniconda3 创建独立环境。虽然官方未提供国内镜像源配置，但在使用 `conda` 时可手动替换为清华或中科大源以加速下载。\n\n```bash\n# 创建并激活环境\nconda env create -f environment.yml\nconda activate stylegan3\n```\n\n> **注意**：代码依赖即时编译的自定义 PyTorch 扩展。Windows 用户需确保已安装 Visual Studio 并将其 `vcvars64.bat` 加入 PATH。\n\n## 安装步骤\n\n克隆仓库后无需额外编译命令，首次运行脚本时会自动编译所需的 CUDA 扩展。\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3.git\ncd stylegan3\n```\n\n若使用 Docker（推荐，可避免环境配置问题）：\n\n```bash\n# 构建镜像\ndocker build --tag stylegan3 .\n\n# 运行容器（挂载当前目录，启用 GPU）\ndocker run --gpus all -it --rm --user $(id -u):$(id -g) \\\n    -v $(pwd):\u002Fscratch --workdir \u002Fscratch -e HOME=\u002Fscratch \\\n    stylegan3\n```\n\n## 基本使用\n\n### 1. 生成图像\n使用预训练模型（如 AFHQv2 动物数据集）生成单张图片。模型文件会自动下载并缓存。\n\n```bash\npython gen_images.py --outdir=out --trunc=1 --seeds=2 \\\n    --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-afhqv2-512x512.pkl\n```\n*   输出图片将保存在 `out\u002F` 目录下。\n*   `stylegan3-r` 表示支持平移和旋转等变性的模型配置。\n\n### 2. 生成插值视频\n生成种子点之间的平滑过渡视频。\n\n```bash\npython gen_video.py --output=lerp.mp4 --trunc=1 --seeds=0-31 --grid=4x2 \\\n    --network=https:\u002F\u002Fapi.ngc.nvidia.com\u002Fv2\u002Fmodels\u002Fnvidia\u002Fresearch\u002Fstylegan3\u002Fversions\u002F1\u002Ffiles\u002Fstylegan3-r-afhqv2-512x512.pkl\n```\n\n### 3. 交互式可视化\n启动可视化工具，实时探索潜空间（Latent Space）特性。\n\n```bash\npython visualizer.py\n```\n\n### 4. 在 Python 代码中调用\n直接在脚本中加载预训练模型进行推理：\n\n```python\nimport torch\nimport pickle\n\n# 加载模型\nwith open('ffhq.pkl', 'rb') as f:\n    G = pickle.load(f)['G_ema'].cuda()  # 使用指数移动平均生成器\n\n# 准备潜变量\nz = torch.randn([1, G.z_dim]).cuda()    \nc = None                                # 类别标签（本例不使用）\n\n# 生成图像\nimg = G(z, c)                           # 输出范围 [-1, +1]\n```\n\n> **提示**：运行上述 Python 代码前，请确保当前目录包含 `torch_utils` 和 `dnnlib`，或将它们添加到 `PYTHONPATH` 环境变量中。","某动画工作室正在制作一部需要大量高质量人脸特写的短片，要求角色在镜头平移和旋转时保持面部纹理的自然连贯。\n\n### 没有 stylegan3 时\n- **纹理“粘”在屏幕上**：生成的图像细节似乎被固定在绝对像素坐标上，当角色移动时，皮肤纹理像贴纸一样不随面部表面流动，产生严重的视觉违和感。\n- **动态画面闪烁抖动**：由于生成器内部信号处理不当导致混叠（aliasing），在制作视频或连续帧动画时，画面会出现高频噪点和非自然的闪烁。\n- **微动表现僵硬**：在进行亚像素级别的微调或缓慢运镜时，模型缺乏平移和旋转等变性能力，导致物体边缘出现锯齿或细节断裂。\n- **后期修复成本高昂**：为了掩盖上述缺陷，特效团队必须手动逐帧修饰或使用复杂的战后处理算法，极大拖慢了生产管线。\n\n### 使用 stylegan3 后\n- **纹理自然贴合表面**：stylegan3 通过无混叠架构，确保细节紧紧“长”在物体表面上，无论镜头如何移动，皮肤纹理都能随几何结构自然形变。\n- **视频生成流畅稳定**：得益于对连续信号的严格解释，生成的连续帧之间过渡平滑，彻底消除了因混叠导致的视频闪烁和伪影。\n- **完美支持亚像素运动**：模型具备完全的平移和旋转等变性，即使在极微小的镜头晃动或旋转下，也能保持图像结构的完整与清晰。\n- **直接输出可用素材**：动画师可直接利用预训练的 stylegan3 模型生成广播级质量的动态素材，大幅减少了人工修图和时间成本。\n\nstylegan3 通过从根本上解决信号混叠问题，让生成式 AI 真正具备了服务于专业视频与动画制作所需的时空一致性能力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FNVlabs_stylegan3_d0ac17a8.png","NVlabs","NVIDIA Research Projects","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FNVlabs_fc20d641.jpg","",null,"http:\u002F\u002Fresearch.nvidia.com","https:\u002F\u002Fgithub.com\u002FNVlabs",[83,87,91,95],{"name":84,"color":85,"percentage":86},"Python","#3572A5",78.4,{"name":88,"color":89,"percentage":90},"Cuda","#3A4E3A",16.2,{"name":92,"color":93,"percentage":94},"C++","#f34b7d",5.2,{"name":96,"color":97,"percentage":98},"Dockerfile","#384d54",0.1,6912,1238,"2026-04-03T04:14:55","NOASSERTION",4,"Linux, Windows","必需：1-8 块高端 NVIDIA GPU（推荐 Tesla V100 或 A100），显存至少 12GB；需安装 CUDA Toolkit 11.1 或更高版本","未说明",{"notes":108,"python":109,"dependencies":110},"代码依赖即时编译的自定义 PyTorch 扩展（使用 NVCC），Windows 用户需安装 Visual Studio 并配置环境变量。推荐使用 Miniconda3 通过 environment.yml 创建环境。Docker 用户需安装 NVIDIA 容器运行时且驱动版本不低于 r470。预训练模型和编译缓存默认存储在用户主目录下，可通过环境变量自定义路径。","3.8",[111,112,113,114],"torch>=1.9.0","cuda-toolkit>=11.1","GCC>=7 (Linux)","Visual Studio (Windows)",[14,35],7,"2026-03-27T02:49:30.150509","2026-04-06T08:42:13.457393",[120,125,130,135,140,145],{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},12077,"运行代码时遇到 'ninja: build stopped: subcommand failed' 错误怎么办？","该错误通常由依赖项版本不兼容引起。解决方案包括：1. 将 PyTorch 升级到 1.11.0 或更高版本；2. 升级 GCC 编译器至 11.4 或更高版本（gcc-9.5 可能会失败）；3. 建议在 Linux 环境下运行以获得更好的兼容性。如果是 Windows 用户，确保安装了正确的构建工具链。","https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3\u002Fissues\u002F2",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},12078,"恢复训练预训练模型（.pkl）时出现 'tensor size mismatch' 错误如何解决？","当从特定的 256x256 预训练模型恢复训练时，需要在命令中添加 '--cbase=16384' 参数以匹配模型的通道基数。例如：python train.py ... --resume=model.pkl --cbase=16384。如果不添加此参数，会导致张量尺寸不匹配的错误。","https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3\u002Fissues\u002F23",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},12079,"StyleGAN3 是否有将图像投影到潜在空间（latent space）的脚本？","官方未直接提供，但可以使用社区方案。方法是：1. 从 rosinality 的 stylegan2-pytorch 项目中复制 'lpips' 目录到 stylegan3 项目中；2. 编写或使用现有的 projector.py 脚本，加载 .pkl 模型并进行优化投影。核心代码需导入 lpips 模块并使用 torch 进行梯度下降优化以最小化感知损失。","https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3\u002Fissues\u002F4",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},12080,"使用 gen_images.py 生成图像时，即使设置 noise_mode='random'，相同种子生成的图像仍然完全一样？","这是预期行为。StyleGAN3 的架构与 StyleGAN2 不同，其噪声输入机制已改变。在 StyleGAN3 的网络实现中（networks_stylegan3.py），'noise_mode' 参数实际上并未被使用，它仅保留用于兼容 StyleGAN2 模型。因此，在纯 StyleGAN3 模型中，该参数不起作用，生成结果主要取决于截断值（truncation）和潜在向量。","https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3\u002Fissues\u002F76",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},12081,"在黑白医学图像（如 CT 扫描）上训练 StyleGAN3 时，生成图像中出现奇怪的形状或线条伪影怎么办？","这通常是因为数据分布或增强策略不适合医学图像。建议尝试：1. 关闭数据增强（--aug noaug）；2. 调整 beta 值（如 --betas 0.,0.99）；3. 检查是否使用了适合灰度图的配置。如果问题依旧，可尝试改用 StyleGAN2 的配置进行训练，因为某些情况下 StyleGAN2 对这类数据的噪声处理表现更稳定。","https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan3\u002Fissues\u002F77",{"id":146,"question_zh":147,"answer_zh":148,"source_url":129},12082,"如何在 StyleGAN3 中使用条件生成（conditional training, --cond=True）恢复训练？","目前官方文档对此支持有限。用户反馈在恢复带有条件标签的预训练模型时遇到困难。建议检查数据集标签格式是否与模型期望一致，并确保在恢复命令中正确传递了所有必要的条件参数。如果官方脚本不支持，可能需要修改 training_loop.py 以正确处理条件向量的加载。",[]]