【StyleGAN】StyleGAN2で学習を行う手順

環境

OS Windows11
GPU NVIDIA GeForce GTX 1060 6GB
Python 3.7.11(Anaconda3)

ライブラリのインストール

Anaconda3で必要なライブラリをインストールする。

conda search tensorflow-gpu
conda install tensorflow-gpu==1.14.0
conda install pillow
conda install requests

コードをダウンロード

GitHubからStylegGAN2のコードをダウンロードする。

git clone https://github.com/NVlabs/stylegan2.git

tfrecordsの作成

画像データをtfrecords形式に変換する。

python dataset_tool.py create_from_images /datasets/face /tfrecords

学習

学習を開始。

python stylegan2/run_training.py --data-dir=tfrecords/ --dataset=face --config=config-a --total-kimg 100 --mirror-augment=true  --metrics=None

学習を再開する

「training/training_loop.py」の131、132行目にある

  • resume_pkl
  • resume_kimg

を編集する

resume_pkl              = None,     # Network pickle to resume training from, None = train from scratch.
resume_kimg             = 0.0,      # Assumed training progress at the beginning. Affects reporting and training schedule.