[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70783":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":22,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},70783,"stylegan2","NVlabs\u002Fstylegan2","NVlabs","StyleGAN2 - Official TensorFlow Implementation","http:\u002F\u002Farxiv.org\u002Fabs\u002F1912.04958",null,"Python",11183,2499,366,25,0,1,70.1,"Other",false,"master",true,[],"2026-06-12 04:00:57","## StyleGAN2 &mdash; Official TensorFlow Implementation\n\n![Teaser image](.\u002Fdocs\u002Fstylegan2-teaser-1024x256.png)\n\n**Analyzing and Improving the Image Quality of StyleGAN**\u003Cbr>\nTero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, Timo Aila\u003Cbr>\n\nPaper: http:\u002F\u002Farxiv.org\u002Fabs\u002F1912.04958\u003Cbr>\nVideo: https:\u002F\u002Fyoutu.be\u002Fc-NJtV9Jvp0\u003Cbr>\n\nAbstract: *The style-based GAN architecture (StyleGAN) yields state-of-the-art results in data-driven unconditional generative image modeling. We expose and analyze several of its characteristic artifacts, and propose changes in both model architecture and training methods to address them. In particular, we redesign generator normalization, revisit progressive growing, and regularize the generator to encourage good conditioning in the mapping from latent vectors to images. In addition to improving image quality, this path length regularizer yields the additional benefit that the generator becomes significantly easier to invert. This makes it possible to reliably detect if an image is generated by a particular network. We furthermore visualize how well the generator utilizes its output resolution, and identify a capacity problem, motivating us to train larger models for additional quality improvements. Overall, our improved model redefines the state of the art in unconditional image modeling, both in terms of existing distribution quality metrics as well as perceived image quality.*\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**&#9733;&#9733;&#9733; NEW: [StyleGAN2-ADA-PyTorch](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan2-ada-pytorch) is now available; see the full list of versions [here](https:\u002F\u002Fnvlabs.github.io\u002Fstylegan2\u002Fversions.html) &#9733;&#9733;&#9733;**\n\n| Additional material | &nbsp;\n| :--- | :----------\n| [StyleGAN2](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1QHc-yF5C3DChRwSdZKcx1w6K8JvSxQi7) | Main Google Drive folder\n| &boxvr;&nbsp; [stylegan2-paper.pdf](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1fnF-QsiQeKaxF-HbvFiGtzHF_Bf3CzJu) | High-quality version of the paper\n| &boxvr;&nbsp; [stylegan2-video.mp4](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1f_gbKW6FUUHKkUxciJ_lQx29mCq_fSBy) | High-quality version of the video\n| &boxvr;&nbsp; [images](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1Sak157_DLX84ytqHHqZaH_59HoEWzfB7) | Example images produced using our method\n| &boxv;&nbsp; &boxvr;&nbsp;  [curated-images](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1ydWb8xCHzDKMTW9kQ7sL-B1R0zATHVHp) | Hand-picked images showcasing our results\n| &boxv;&nbsp; &boxur;&nbsp;  [100k-generated-images](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1BA2OZ1GshdfFZGYZPob5QWOGBuJCdu5q) | Random images with and without truncation\n| &boxvr;&nbsp; [videos](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1yXDV96SFXoUiZKU7AyE6DyKgDpIk4wUZ) | Individual clips of the video as high-quality MP4\n| &boxur;&nbsp; [networks](https:\u002F\u002Fnvlabs-fi-cdn.nvidia.com\u002Fstylegan2\u002Fnetworks\u002F) | Pre-trained networks\n| &ensp;&ensp; &boxvr;&nbsp;  stylegan2-ffhq-config-f.pkl | StyleGAN2 for \u003Cspan style=\"font-variant:small-caps\">FFHQ\u003C\u002Fspan> dataset at 1024&times;1024\n| &ensp;&ensp; &boxvr;&nbsp;  stylegan2-car-config-f.pkl | StyleGAN2 for \u003Cspan style=\"font-variant:small-caps\">LSUN Car\u003C\u002Fspan> dataset at 512&times;384\n| &ensp;&ensp; &boxvr;&nbsp;  stylegan2-cat-config-f.pkl | StyleGAN2 for \u003Cspan style=\"font-variant:small-caps\">LSUN Cat\u003C\u002Fspan> dataset at 256&times;256\n| &ensp;&ensp; &boxvr;&nbsp;  stylegan2-church-config-f.pkl | StyleGAN2 for \u003Cspan style=\"font-variant:small-caps\">LSUN Church\u003C\u002Fspan> dataset at 256&times;256\n| &ensp;&ensp; &boxvr;&nbsp;  stylegan2-horse-config-f.pkl | StyleGAN2 for \u003Cspan style=\"font-variant:small-caps\">LSUN Horse\u003C\u002Fspan> dataset at 256&times;256\n| &ensp;&ensp; &boxur;&nbsp;&#x22ef;  | Other training configurations used in the paper\n\n## Requirements\n\n* Both Linux and Windows are supported. Linux is recommended for performance and compatibility reasons.\n* 64-bit Python 3.6 installation. We recommend Anaconda3 with numpy 1.14.3 or newer.\n* We recommend TensorFlow 1.14, which we used for all experiments in the paper, but TensorFlow 1.15 is also supported on Linux. TensorFlow 2.x is not supported.\n* On Windows you need to use TensorFlow 1.14, as the standard 1.15 installation does not include necessary C++ headers.\n* One or more high-end NVIDIA GPUs, NVIDIA drivers, CUDA 10.0 toolkit and cuDNN 7.5. To reproduce the results reported in the paper, you need an NVIDIA GPU with at least 16 GB of DRAM.\n* Docker users: use the [provided Dockerfile](.\u002FDockerfile) to build an image with the required library dependencies.\n\nStyleGAN2 relies on custom TensorFlow ops that are compiled on the fly using [NVCC](https:\u002F\u002Fdocs.nvidia.com\u002Fcuda\u002Fcuda-compiler-driver-nvcc\u002Findex.html). To test that your NVCC installation is working correctly, run:\n\n```.bash\nnvcc test_nvcc.cu -o test_nvcc -run\n| CPU says hello.\n| GPU says hello.\n```\n\nOn Windows, the compilation requires Microsoft Visual Studio to be in `PATH`. We recommend installing [Visual Studio Community Edition](https:\u002F\u002Fvisualstudio.microsoft.com\u002Fvs\u002F) and adding into `PATH` using `\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"`.\n\n## Using pre-trained networks\n\nPre-trained networks are stored as `*.pkl` files on the [StyleGAN2 Google Drive folder](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1QHc-yF5C3DChRwSdZKcx1w6K8JvSxQi7). Below, you can either reference them directly using the syntax `gdrive:networks\u002F\u003Cfilename>.pkl`, or download them manually and reference by filename.\n\n```.bash\n# Generate uncurated ffhq images (matches paper Figure 12)\npython run_generator.py generate-images --network=gdrive:networks\u002Fstylegan2-ffhq-config-f.pkl \\\n  --seeds=6600-6625 --truncation-psi=0.5\n\n# Generate curated ffhq images (matches paper Figure 11)\npython run_generator.py generate-images --network=gdrive:networks\u002Fstylegan2-ffhq-config-f.pkl \\\n  --seeds=66,230,389,1518 --truncation-psi=1.0\n\n# Generate uncurated car images\npython run_generator.py generate-images --network=gdrive:networks\u002Fstylegan2-car-config-f.pkl \\\n  --seeds=6000-6025 --truncation-psi=0.5\n\n# Example of style mixing (matches the corresponding video clip)\npython run_generator.py style-mixing-example --network=gdrive:networks\u002Fstylegan2-ffhq-config-f.pkl \\\n  --row-seeds=85,100,75,458,1500 --col-seeds=55,821,1789,293 --truncation-psi=1.0\n```\n\nThe results are placed in `results\u002F\u003CRUNNING_ID>\u002F*.png`. You can change the location with `--result-dir`. For example, `--result-dir=~\u002Fmy-stylegan2-results`.\n\nYou can import the networks in your own Python code using `pickle.load()`. For this to work, you need to include the `dnnlib` source directory in `PYTHONPATH` and create a default TensorFlow session by calling `dnnlib.tflib.init_tf()`. See [run_generator.py](.\u002Frun_generator.py) and [pretrained_networks.py](.\u002Fpretrained_networks.py) for examples.\n\n## Preparing datasets\n\nDatasets are stored as multi-resolution TFRecords, similar to the [original StyleGAN](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fstylegan). Each dataset consists of multiple `*.tfrecords` files stored under a common directory, e.g., `~\u002Fdatasets\u002Fffhq\u002Fffhq-r*.tfrecords`. In the following sections, the datasets are referenced using a combination of `--dataset` and `--data-dir` arguments, e.g., `--dataset=ffhq --data-dir=~\u002Fdatasets`.\n\n**FFHQ**. To download the [Flickr-Faces-HQ](https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fffhq-dataset) dataset as multi-resolution TFRecords, run:\n\n```.bash\npushd ~\ngit clone https:\u002F\u002Fgithub.com\u002FNVlabs\u002Fffhq-dataset.git\ncd ffhq-dataset\npython download_ffhq.py --tfrecords\npopd\npython dataset_tool.py display ~\u002Fffhq-dataset\u002Ftfrecords\u002Fffhq\n```\n\n**LSUN**. Download the desired LSUN categories in LMDB format from the [LSUN project page](https:\u002F\u002Fwww.yf.io\u002Fp\u002Flsun). To convert the data to multi-resolution TFRecords, run:\n\n```.bash\npython dataset_tool.py create_lsun_wide ~\u002Fdatasets\u002Fcar ~\u002Flsun\u002Fcar_lmdb --width=512 --height=384\npython dataset_tool.py create_lsun ~\u002Fdatasets\u002Fcat ~\u002Flsun\u002Fcat_lmdb --resolution=256\npython dataset_tool.py create_lsun ~\u002Fdatasets\u002Fchurch ~\u002Flsun\u002Fchurch_outdoor_train_lmdb --resolution=256\npython dataset_tool.py create_lsun ~\u002Fdatasets\u002Fhorse ~\u002Flsun\u002Fhorse_lmdb --resolution=256\n```\n\n**Custom**. Create custom datasets by placing all training images under a single directory. The images must be square-shaped and they must all have the same power-of-two dimensions. To convert the images to multi-resolution TFRecords, run:\n\n```.bash\npython dataset_tool.py create_from_images ~\u002Fdatasets\u002Fmy-custom-dataset ~\u002Fmy-custom-images\npython dataset_tool.py display ~\u002Fdatasets\u002Fmy-custom-dataset\n```\n\n## Projecting images to latent space\n\nTo find the matching latent vectors for a set of images, run:\n\n```.bash\n# Project generated images\npython run_projector.py project-generated-images --network=gdrive:networks\u002Fstylegan2-car-config-f.pkl \\\n  --seeds=0,1,5\n\n# Project real images\npython run_projector.py project-real-images --network=gdrive:networks\u002Fstylegan2-car-config-f.pkl \\\n  --dataset=car --data-dir=~\u002Fdatasets\n```\n\n## Training networks\n\nTo reproduce the training runs for config F in Tables 1 and 3, run:\n\n```.bash\npython run_training.py --num-gpus=8 --data-dir=~\u002Fdatasets --config=config-f \\\n  --dataset=ffhq --mirror-augment=true\npython run_training.py --num-gpus=8 --data-dir=~\u002Fdatasets --config=config-f \\\n  --dataset=car --total-kimg=57000\npython run_training.py --num-gpus=8 --data-dir=~\u002Fdatasets --config=config-f \\\n  --dataset=cat --total-kimg=88000\npython run_training.py --num-gpus=8 --data-dir=~\u002Fdatasets --config=config-f \\\n  --dataset=church --total-kimg 88000 --gamma=100\npython run_training.py --num-gpus=8 --data-dir=~\u002Fdatasets --config=config-f \\\n  --dataset=horse --total-kimg 100000 --gamma=100\n```\n\nFor other configurations, see `python run_training.py --help`.\n\nWe have verified that the results match the paper when training with 1, 2, 4, or 8 GPUs. Note that training FFHQ at 1024&times;1024 resolution requires GPU(s) with at least 16 GB of memory. The following table lists typical training times using NVIDIA DGX-1 with 8 Tesla V100 GPUs:\n\n| Configuration | Resolution      | Total kimg | 1 GPU   | 2 GPUs  | 4 GPUs  | 8 GPUs | GPU mem |\n| :------------ | :-------------: | :--------: | :-----: | :-----: | :-----: | :----: | :-----: |\n| `config-f`    | 1024&times;1024 | 25000      | 69d 23h | 36d 4h  | 18d 14h | 9d 18h | 13.3 GB |\n| `config-f`    | 1024&times;1024 | 10000      | 27d 23h | 14d 11h | 7d 10h  | 3d 22h | 13.3 GB |\n| `config-e`    | 1024&times;1024 | 25000      | 35d 11h | 18d 15h | 9d 15h  | 5d 6h  | 8.6 GB  |\n| `config-e`    | 1024&times;1024 | 10000      | 14d 4h  | 7d 11h  | 3d 20h  | 2d 3h  | 8.6 GB  |\n| `config-f`    | 256&times;256   | 25000      | 32d 13h | 16d 23h | 8d 21h  | 4d 18h | 6.4 GB  |\n| `config-f`    | 256&times;256   | 10000      | 13d 0h  | 6d 19h  | 3d 13h  | 1d 22h | 6.4 GB  |\n\nTraining curves for FFHQ config F (StyleGAN2) compared to original StyleGAN using 8 GPUs:\n\n![Training curves](.\u002Fdocs\u002Fstylegan2-training-curves.png)\n\nAfter training, the resulting networks can be used the same way as the official pre-trained networks:\n\n```.bash\n# Generate 1000 random images without truncation\npython run_generator.py generate-images --seeds=0-999 --truncation-psi=1.0 \\\n  --network=results\u002F00006-stylegan2-ffhq-8gpu-config-f\u002Fnetworks-final.pkl\n```\n\n## Evaluation metrics\n\nTo reproduce the numbers for config F in Tables 1 and 3, run:\n\n```.bash\npython run_metrics.py --data-dir=~\u002Fdatasets --network=gdrive:networks\u002Fstylegan2-ffhq-config-f.pkl \\\n  --metrics=fid50k,ppl_wend --dataset=ffhq --mirror-augment=true\npython run_metrics.py --data-dir=~\u002Fdatasets --network=gdrive:networks\u002Fstylegan2-car-config-f.pkl \\\n  --metrics=fid50k,ppl2_wend --dataset=car\npython run_metrics.py --data-dir=~\u002Fdatasets --network=gdrive:networks\u002Fstylegan2-cat-config-f.pkl \\\n  --metrics=fid50k,ppl2_wend --dataset=cat\npython run_metrics.py --data-dir=~\u002Fdatasets --network=gdrive:networks\u002Fstylegan2-church-config-f.pkl \\\n  --metrics=fid50k,ppl2_wend --dataset=church\npython run_metrics.py --data-dir=~\u002Fdatasets --network=gdrive:networks\u002Fstylegan2-horse-config-f.pkl \\\n  --metrics=fid50k,ppl2_wend --dataset=horse\n```\n\nFor other configurations, see the [StyleGAN2 Google Drive folder](https:\u002F\u002Fdrive.google.com\u002Fopen?id=1QHc-yF5C3DChRwSdZKcx1w6K8JvSxQi7).\n\nNote that the metrics are evaluated using a different random seed each time, so the results will vary between runs. In the paper, we reported the average result of running each metric 10 times. The following table lists the available metrics along with their expected runtimes and random variation:\n\n| Metric      | FFHQ config F  | 1 GPU  | 2 GPUs  | 4 GPUs | Description |\n| :---------- | :------------: | :----: | :-----: | :----: | :---------- |\n| `fid50k`    | 2.84 &pm; 0.03 | 22 min | 14 min  | 10 min | [Fr&eacute;chet Inception Distance](https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.08500)\n| `is50k`     | 5.13 &pm; 0.02 | 23 min | 14 min  | 8 min  | [Inception Score](https:\u002F\u002Farxiv.org\u002Fabs\u002F1606.03498)\n| `ppl_zfull` | 348.0 &pm; 3.8 | 41 min | 22 min  | 14 min | [Perceptual Path Length](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.04948) in Z, full paths\n| `ppl_wfull` | 126.9 &pm; 0.2 | 42 min | 22 min  | 13 min | [Perceptual Path Length](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.04948) in W, full paths\n| `ppl_zend`  | 348.6 &pm; 3.0 | 41 min | 22 min  | 14 min | [Perceptual Path Length](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.04948) in Z, path endpoints\n| `ppl_wend`  | 129.4 &pm; 0.8 | 40 min | 23 min  | 13 min | [Perceptual Path Length](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.04948) in W, path endpoints\n| `ppl2_wend` | 145.0 &pm; 0.5 | 41 min | 23 min  | 14 min | [Perceptual Path Length](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.04948) without center crop\n| `ls`        | 154.2 \u002F 4.27   | 10 hrs | 6 hrs   | 4 hrs  | [Linear Separability](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.04948)\n| `pr50k3`    | 0.689 \u002F 0.492  | 26 min | 17 min  | 12 min | [Precision and Recall](https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.06991)\n\nNote that some of the metrics cache dataset-specific data on the disk, and they will take somewhat longer when run for the first time.\n\n## License\n\nCopyright &copy; 2019, NVIDIA Corporation. All rights reserved.\n\nThis work is made available under the Nvidia Source Code License-NC. To view a copy of this license, visit https:\u002F\u002Fnvlabs.github.io\u002Fstylegan2\u002Flicense.html\n\n## Citation\n\n```\n@inproceedings{Karras2019stylegan2,\n  title     = {Analyzing and Improving the Image Quality of {StyleGAN}},\n  author    = {Tero Karras and Samuli Laine and Miika Aittala and Janne Hellsten and Jaakko Lehtinen and Timo Aila},\n  booktitle = {Proc. CVPR},\n  year      = {2020}\n}\n```\n\n## Acknowledgements\n\nWe thank Ming-Yu Liu for an early review, Timo Viitanen for his help with code release, and Tero Kuosmanen for compute infrastructure.\n","StyleGAN2 是一个官方的 TensorFlow 实现，用于生成高质量的图像。该项目通过改进模型架构和训练方法来解决原有 StyleGAN 中存在的问题，如重新设计生成器归一化、调整渐进式增长策略，并引入路径长度正则化以提高从潜在向量到图像映射的良好条件性。这些改进不仅提升了生成图像的质量，还使得生成器更容易被逆向工程，有助于检测特定网络生成的图像。StyleGAN2 适用于需要高保真度图像生成的应用场景，比如艺术创作、虚拟人物生成及数据增强等。",2,"2026-06-11 03:34:10","high_star"]