How To Put Minecraft Screenshots In The Background Of Pivot Animator
Generating your ain Images with NVIDIA StyleGAN2-ADA for PyTorch on the Ampere Compages
StyleGAN2 ADA allows you lot to railroad train a neural network to generate loftier-resolution images based on a grooming prepare of images. The most archetype example of this is the made-upward faces that StyleGAN2 is often used to generate. Until the latest release, in February 2021, yous had to install an former 1.ten version of TensorFlow and utilize CUDA 10. This requirement made information technology hard to leverage StyleGAN2 ADA on the latest Ampere-based GPUs from NVIDIA. In this article I will show you how to use this new version of StyleGAN from Windows, no Docker or Windows Subsystem for Linux (WSL2) needed!
I've trained GANs to produce a diverseness of different image types, yous tin see samples from some of my GANs to a higher place. I provide pretrained models to produce these images on GitHub:
- Minecraft GAN
- 70s Scifi Fine art GAN
- Fish GAN
- Christmas GAN
You lot can brand use of the in a higher place networks, using but Google Colab online, to generate these sorts of images for yourself.
Hardware Prerequisites
GANs are compute-intensive, there is really no way effectually it. The researchers at NVIDIA threw eight V100s on a DGX system at the job of preparation faces. StyleGAN also scales nearly linearly across multiple GPUs, every bit a result, StyleGAN will take whatever hardware you lot are willing to throw at it on a single car. The images that I present here were trained on a dual Quadro RTX 8000.
For this article, I am assuming that we will apply the latest CUDA 11, with PyTorch 1.7.1. NVIDIA recommends 12GB of RAM on the GPU; withal, it is possible to work with less, if you use lower resolutions, such as 256x256. College-resolution GANs are mostly trained at 1024x1024. A single strong GPU, such as an NVIDIA RTX A6000 likewise does very well.
We will install StyleGAN2 outside of WSL2 or Docker. This gives the highest functioning. Believe me, with GANs, you want as of compute that your machine can provide!
First, make certain you have the latest NVIDIA driver for your graphics card:
- NVIDIA GPU Drivers
Second, install the latest version of CUDA 11. If CUDA 12 has been released, and I take non updated this article, then proceed with circumspection. Check the StyleGAN2 ADA PyTorch instructions for the latest updates on versions.
- CUDA Toolkit Downloads
It is too necessary that you install Visual C++ so that custom CUDA kernels tin can exist compiled by StyleGAN. Visual Studio Community edition can be found at the following URL. Brand certain that you install C++, which is non enabled by default in Microsoft's installer.
- https://visualstudio.microsoft.com/vs/
One time Visual Studio is installed, you lot must add together several items to the organization PATH and ecology variables. You can achieve this by running the following batch program:
- C:\Program Files (x86)\Microsoft Visual Studio\<VERSION>\Community\VC\Auxiliary\Build\vcvars64.bat
I suggest opening a ability shell window and moving into that directory and running the command "vcvars64."
PyTorch Installation
To install PyTorch you will demand Python installed on your system. I suggest either installing Miniconda or Anaconda. Miniconda is small-scale and you will accept to install needed packages. Anaconda is gigantic but contains more often than not everything you will ever need.
- https://docs.anaconda.com/anaconda/install/
- https://docs.conda.io/en/latest/miniconda.html
If y'all are fifty-fifty debating which to install, or you've never heard of the difference between Anaconda and Miniconda, then almost certainly, Anaconda is the correct respond for you lot.
The StyleGAN squad recommends PyTorch 1.7.1 for StyleGAN. Later versions may likely work, depending on the corporeality of "breaking changes" introduced to PyTorch. The install process for PyTorch is astonishing, navigate to the post-obit URL and choose your options:
- https://pytorch.org/
I choose:
- Stable one.vii.1
- Windows
- PIP
- Python
- CUDA 11
This resulted in the post-obit command:
pip install torch===1.7.one+cu110 torchvision===0.eight.2+cu110 torchaudio===0.vii.2 -f https://download.pytorch.org/whl/torch_stable.html
NVIDIA StyleGAN2 ADA PyTorch Installation
The actual NVIDIA StyleGAN2 ADA parcel is distributed through GitHub at the post-obit repository:
- https://github.com/NVlabs/stylegan2-ada-pytorch
You tin cull to download a ZIP file, which should exist extracted to a directory. Y'all tin can as well obtain StyleGAN with the command line git command.
git clone https://github.com/NVlabs/stylegan2-ada-pytorch.git
At the time of this writing, there was not a requirements.txt file provided by StyleGAN to specify required packages. Equally you run the Python scripts, y'all volition see errors about missing packages, just pip install them. To go yous started, these are the ones I found:
pip install click
pip install tqdm
pip install requests
pip installimageio
pip installpsutil
pip installscipy
Preparation a GAN
To train the GAN you must convert all of the images to PNG of the same size and dimension, with a very specific directory structure. This tin can be accomplished with the dataset_tool script provided by StyleGAN. Here I am converting all of the JPEG images that I obtained to train a GAN to generate images of fish.
python dataset_tool.py --source c:\jth\fish_img --dest c:\jth\fish_train
Adjacent, yous volition actually train the GAN. This is washed with the following command:
python train.py --data c:\jth\fish_train --outdir c:\jth\results
Training tin have a long time, as it trains, you will see images created during training that indicate how good the images currently look. The following image shows my Minecraft GAN at 2,800 kimg, meaning it had trained on over 2,800 images (both real and augmented), at this point.
Generating Images
Equally training progresses pickle snapshots will exist made of your generator and discriminator to correspond with each epitome set checkpoint generated. For example, network-snapshot-002800.pkl generated the image checkpoint above. To generate images from this network, the following command is used.
python generate.py --outdir=out --trunc=one --seeds=85,265,297,849 \
--network=network-snapshot-002800.pkl
The seeds specify the individual images to exist generated, each seed is a separate prototype.
YouTube Video
If you would like to come across each of these steps performed, I also have a YouTube video of this same material.
Conclusion
NVIDIA StyleGAN2 ADA is a great manner to generate your own images if you have the hardware for training. The new PyTorch version makes it like shooting fish in a barrel to run under a Windows surround. Following the steps in this article allows you to chop-chop setup an environment for grooming your ain GANs.
Source: https://towardsdatascience.com/generating-your-own-images-with-nvidia-stylegan2-ada-for-pytorch-on-ampere-a80fab52d6b5
Posted by: dickersonmigge1956.blogspot.com
0 Response to "How To Put Minecraft Screenshots In The Background Of Pivot Animator"
Post a Comment