私的AI研究会 > CycleGAN2
AI技術「CycleGAN」で画像のスタイル変換をローカル環境で動かす
「https://farml1.com/ukiyoe_cyclegan/」 より引用
cd /anaconda_win/workspace_2 ← Windows の場合 cd ~/workspace_2 ← Linux の場合 git clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix.git CycleGAN
update └─workspace_2 └─CycleGAN ← GitHub からクローンしたプロジェクトに上書きする ├─checkpoints │ ├─style_cezanne_pretrained │ ├─style_monet_pretrained │ ├─style_ukiyoe_pretrained │ └─style_vangogh_pretrained ├─data ├─images ├─images2 ├─models ├─options ├─results └─util・解凍してできる「update/」フォルダ以下を次のフォルダの下に上書きコピーする
(py38_learn) python test.py --dataroot ./images --name style_ukiyoe_pretrained --model test --no_dropout --preprocess scale_width --load_size 1024
(py38_learn) python test.py --dataroot ./images --name style_ukiyoe_pretrained --model test --no_dropout --preprocess scale_width --load_size 1024 Warning: wandb package cannot be found. The option "--use_wandb" will result in error. creating web directory ./results/style_ukiyoe_pretrained\test_latest processing (0000)-th image... ['./images\\20210117_091324_001m.jpg']
コマンドオプション | 引数 | 初期値 | 意味 |
--dataroot | str | 内部で source_image に設定 | |
--source_image | str | '' (ダイアログによる指定) | 静止画ファイルフォルダ |
--result_image | str | './result/result.jpg' | 出力保存ファイルパス |
--load_size | int | 1024 | 画像処理サイズ |
(py38_learn) python test2.py CycleGan test program Ver. 0.01: Starting application... - dataroot : C:/anaconda_win/workspace_2/CycleGAN/images - source_dir : C:/anaconda_win/workspace_2/CycleGAN/images - result_path : ./results/result.png - load_size : 1024 <style_ukiyoe_pretrained> result images → ./results/style_ukiyoe_pretrained processing (0000)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210117_091324_001m.jpg processing (0001)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210121_082725_001m.jpg processing (0002)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210130_073729_001m.jpg processing (0003)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210221_082254_001m.jpg processing (0004)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210329_101513_001m.jpg <style_monet_pretrained> result images → ./results/style_monet_pretrained processing (0000)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210117_091324_001m.jpg processing (0001)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210121_082725_001m.jpg processing (0002)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210130_073729_001m.jpg processing (0003)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210221_082254_001m.jpg processing (0004)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210329_101513_001m.jpg <style_cezanne_pretrained> result images → ./results/style_cezanne_pretrained processing (0000)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210117_091324_001m.jpg processing (0001)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210121_082725_001m.jpg processing (0002)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210130_073729_001m.jpg processing (0003)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210221_082254_001m.jpg processing (0004)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210329_101513_001m.jpg <style_vangogh_pretrained> result images → ./results/style_vangogh_pretrained processing (0000)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210117_091324_001m.jpg processing (0001)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210121_082725_001m.jpg processing (0002)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210130_073729_001m.jpg processing (0003)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210221_082254_001m.jpg processing (0004)-th image... C:/anaconda_win/workspace_2/CycleGAN/images/20210329_101513_001m.jpg processing start >> 2024/08/03 15:47:21 processing end >> 2024/08/03 15:47:32 processing time >> 0:00:11.018841 Finished.・CPU 動作の場合の処理時間
processing start >> 2024/08/03 14:05:19 processing end >> 2024/08/03 14:06:43 processing time >> 0:01:24.492427
コマンドオプション | 引数 | 初期値 | 意味 |
--dataroot | str | 内部で source_image に設定 | |
--source_image | str | '' (ダイアログによる指定) | 静止画ファイルフォルダ |
--result_image | str | './result/result.jpg' | 出力保存ファイルパス |
--load_size | int | 1024 | 画像処理サイズ |
(py38_learn) python gan_paint.py CycleGan image to ukiyoe/monet/cezanne/vangogh Ver. 0.01: Starting application... - dataroot : C:/anaconda_win/workspace_2/CycleGAN/images2 - source_dir : C:/anaconda_win/workspace_2/CycleGAN/images2 - result_path : ./results/result.png - load_size : 1024 <style_ukiyoe_pretrained> processing (0000)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20030804_01_063.jpg processing (0001)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20060805_211944_001.JPG processing (0002)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20070825_07_020.jpg processing (0003)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20110702_104226_001.JPG processing (0004)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20181202_073804_001.jpg <style_monet_pretrained> processing (0000)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20030804_01_063.jpg processing (0001)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20060805_211944_001.JPG processing (0002)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20070825_07_020.jpg processing (0003)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20110702_104226_001.JPG processing (0004)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20181202_073804_001.jpg <style_cezanne_pretrained> processing (0000)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20030804_01_063.jpg processing (0001)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20060805_211944_001.JPG processing (0002)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20070825_07_020.jpg processing (0003)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20110702_104226_001.JPG processing (0004)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20181202_073804_001.jpg <style_vangogh_pretrained> processing (0000)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20030804_01_063.jpg processing (0001)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20060805_211944_001.JPG processing (0002)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20070825_07_020.jpg processing (0003)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20110702_104226_001.JPG processing (0004)-th image... C:/anaconda_win/workspace_2/CycleGAN/images2/20181202_073804_001.jpg <<output image save>> ./results/result_20030804_01_063.png ./results/result_20060805_211944_001.png ./results/result_20070825_07_020.png ./results/result_20110702_104226_001.png ./results/result_20181202_073804_001.png processing start >> 2024/08/03 16:11:00 processing end >> 2024/08/03 16:11:10 processing time >> 0:00:09.910690 Finished.・CPU 動作の場合の処理時間
processing start >> 2024/08/03 14:07:14 processing end >> 2024/08/03 14:08:37 processing time >> 0:01:23.587273