pytorch AdaIN
v0.0.0
これは、適応インスタンス正規化[Huang+、ICCV2017]を備えたリアルタイムでの任意のスタイル転送の論文の非公式のPytorchの実装です。著者によるトーチの元の実装に本当に感謝しています。これは非常に便利です。

pip install -r requirements.txtで要件をインストールしてください
(オプション、トレーニング用)
decoder.pth / vgg_normalized.pthをリリースからダウンロードし、 models/に配置します。
使用して、 --contentと--styleを使用して、コンテンツとスタイルの画像へのパスを提供します。
CUDA_VISIBLE_DEVICES=<gpu_id> python test.py --content input/content/cornell.jpg --style input/style/woman_with_hat_matisse.jpg
--content_dirと--style_dirを使用して、コンテンツとスタイルの画像のディレクトリでコードを実行することもできます。コンテンツとスタイルのすべての可能な組み合わせを出力ディレクトリに保存します。
CUDA_VISIBLE_DEVICES=<gpu_id> python test.py --content_dir input/content --style_dir input/style
これは、 --styleおよび--style_interpolation_weightsオプションを指定することにより、4つのスタイルを混合する例です。
CUDA_VISIBLE_DEVICES=<gpu_id> python test.py --content input/content/avril.jpg --style input/style/picasso_self_portrait.jpg,input/style/impronte_d_artista.jpg,input/style/trial.jpg,input/style/antimonocromatismo.jpg --style_interpolation_weights 1,1,1,1 --content_size 512 --style_size 512 --crop
他のいくつかのオプション:
--content_size :コンテンツ画像の新しい(最小)サイズ。 0に設定されている場合は、元のサイズを保持します。--style_size :コンテンツ画像の新しい(最小)サイズ。 0に設定されている場合は、元のサイズを保持します。--alpha :様式化の程度を調整します。 0.0〜1.0の値(デフォルト)でなければなりません。--preserve_color :コンテンツ画像の色を保存します。--content_dirと--style_dirを使用して、コンテンツとスタイルの画像にそれぞれのディレクトリを提供します。
CUDA_VISIBLE_DEVICES=<gpu_id> python train.py --content_dir <content_dir> --style_dir <style_dir>
詳細とパラメーターについては、 - ヘルプオプションを参照してください。
このコードでトレーニングされたモデルをリリース時にiter_1000000.pthとして共有します。