An easy to use paired dataset creation & training pipeline for making your own image translation models!
You can skip steps 0. through 2. if you already have paired data
- Setup StyleGAN3 and make sure all their scripts are working properly.
- Prepare your dataset and train StyleGAN2 with it.
- Dataset preparation:
python3 dataset_tool.py --source=/path/to/your/dataset --dest=/dest/path --resolution=256x256
- StyleGAN2 training (you may want to experiment with different gamma or other hyperparameters):
python3 train.py --outdir=/path/to/training-runs --data=/dest/path \
--cfg=stylegan2 --gpus=1 --batch=16 --gamma=0.8192 --glr=0.0025 --dlr=0.0025 --cbase=16384 \
--resume=https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan2/versions/1/files/stylegan2-ffhq-256x256.pkl \
--metrics=none --tick=1 --snap=10 --kimg=300
-
Use stylegan_blending.ipynb for creating your own paired dataset. You may have to experiment a fair amount before finding the perfect blending combination, after which you can finally generate your paired training dataset. You can also use the included Real-ESRGAN section to increase dataset image quality. This notebook is my slight rework of @Sxela's amazing stylegan3_blending repo.
-
Use train_paired.ipynb to train a fastai v1 Dynamic U-Net on your paired dataset. You can also use it to get a JIT traced version of your model. To set up an environment for this notebook, you can execute the following commands:
conda create --name easyimg2img python=3.9
conda activate easyimg2img
conda install -c pytorch -c fastai fastai=1.0.61
conda install -c anaconda ipykernel
pip install ipython_genutils
python -m ipykernel install --user --name=easyimg2img
pip install opencv-python
pip install gdown
- Use inference.ipynb to easily inference your model and display and/or save the results.