MMEditing は, OpenMMLab の構成物で, イメージ・インペインティング(image inpainting),画像のノイズ除去 (画像のノイズ除去 (image restoration)), イメージ・マッティング (image matting), 超解像 (super resolution), 画像生成の機能を持つ.
MMEditing Contributors, OpenMMLab Editing Estimation Toolbox and Benchmark, https://github.com/open-mmlab/mmediting, 2020.
【目次】
Windows での Git のインストール: 別ページ »で説明
【関連する外部ページ】
Git の公式ページ: https://git-scm.com/
Windows での 7-Zip のインストール: 別ページ »で説明
【関連する外部ページ】
7-Zip の公式ページ: https://sevenzip.osdn.jp/
Windows での Python 3.10,関連パッケージ,Python 開発環境のインストール: 別ページ »で説明
【サイト内の関連ページ】
Python のまとめ: 別ページ »にまとめ
【関連する外部ページ】
Python の公式ページ: https://www.python.org/
Windows での Build Tools for Visual Studio 2022,NVIDIA ドライバ,NVIDIA CUDA ツールキット 11.8,NVIDIA cuDNN v8.6 のインストールと動作確認: 別ページ »で説明
【関連する外部ページ】
コマンドプロンプトを管理者として実行: 別ページ »で説明
PyTorch のページ: https://pytorch.org/index.html
次のコマンドは, PyTorch 2.0 (NVIDIA CUDA 11.8 用) をインストールする. 事前に NVIDIA CUDA のバージョンを確認しておくこと(ここでは,NVIDIA CUDA ツールキット 11.8 が前もってインストール済みであるとする).
python -m pip install -U pip python -m pip install -U torch torchvision torchaudio numpy numba --index-url https://download.pytorch.org/whl/cu118 python -c "import torch; print(torch.__version__, torch.cuda.is_available())"
インストールの方法は複数ある. ここでは, NVIDIA CUDA ツールキットを使うことも考え, インストールしやすい方法として,ソースコードからビルドしてインストールする方法を案内している.
MMCV のインストールを行う.
インストールの方法は複数ある. ここでは, NVIDIA CUDA ツールキットを使うことも考え, インストールしやすい方法として,ソースコードからビルドしてインストールする方法を案内している.
コマンドプロンプトを管理者として実行: 別ページ »で説明
python -c "import torch; TORCH_VERSION = '.'.join(torch.__version__.split('.')[:2]); print(TORCH_VERSION)"
このとき,実際には 11.8 をインストールしているのに,「cu117」のように古いバージョンが表示されることがある.このような場合は,気にせずに続行する.
python -c "import torch; CUDA_VERSION = torch.__version__.split('+')[-1]; print(CUDA_VERSION)"
MMTracking が MMCV 1.6.2 に依存している (2022/12). MMTracking を利用するので MMCV 1.6.2 をインストール
https://mmcv.readthedocs.io/en/latest/get_started/installation.html に記載の手順による
python -m pip install -U pip python -m pip install -U opencv-python python -m pip install mmcv-full==1.6.2
python -c "from mmcv.ops import get_compiling_cuda_version, get_compiler_version; print(get_compiling_cuda_version()); print(get_compiler_version())"
コマンドプロンプトを管理者として実行: 別ページ »で説明
python -m pip install -U git+https://github.com/open-mmlab/mim.git python -m pip install -U git+https://github.com/open-mmlab/mmediting.git python -c "import mmedit; print(mmedit.__version__)"
cd %HOMEPATH% rmdir /s /q mmediting git clone https://github.com/open-mmlab/mmediting.git cd mmediting python setup.py develop
cd %HOMEPATH% cd mmediting curl -O https://download.openmmlab.com/mmediting/demo_files.zip "c:\Program Files\7-Zip\7z.exe" x demo_files.zip
SRCNN による画像の超解像 (super resolution) の実行
学習済みモデルを使用.
MMEditing の SRCNN の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/restorers/srcnn/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/restoration_demo.py ./configs/restorers/srcnn/srcnn_x4k915_g1_1000k_div2k.py https://download.openmmlab.com/mmediting/restorers/srcnn/srcnn_x4k915_1x16_1000k_div2k_20200608-4186f232.pth ./demo_files/lq_images/bird.png ./outputs/bird_SRCNN.png python -c "import mmcv; mmcv.imshow('./demo_files/lq_images/bird.png')" python -c "import mmcv; mmcv.imshow('./outputs/bird_SRCNN.png')"
学習済みモデルを使用.
MMEditing の ESRGAN の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/restorers/esrgan/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/restoration_demo.py ./configs/restorers/esrgan/esrgan_x4c64b23g32_g1_400k_div2k.py https://download.openmmlab.com/mmediting/restorers/esrgan/esrgan_x4c64b23g32_1x16_400k_div2k_20200508-f8ccaf3b.pth ./demo_files/lq_images/bird.png ./outputs/bird_ESRGAN.png python -c "import mmcv; mmcv.imshow('./demo_files/lq_images/bird.png')" python -c "import mmcv; mmcv.imshow('./outputs/bird_ESRGAN.png')"
学習済みモデルを使用.
MMEditing の EDVR の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/restorers/edvr/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/restoration_video_demo.py ./configs/restorers/edvr/edvrm_wotsa_x4_g8_600k_reds.py https://download.openmmlab.com/mmediting/restorers/edvr/edvrm_wotsa_x4_8x4_600k_reds_20200522-0570e567.pth demo_files/lq_sequences/city/ ./outputs/city_EDVR --window_size=5 python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000000.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_EDVR/00000000.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000001.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_EDVR/00000001.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000002.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_EDVR/00000002.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000003.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_EDVR/00000003.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000004.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_EDVR/00000004.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000005.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_EDVR/00000005.png')"
学習済みモデルを使用.
MMEditing の EDVR の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/restorers/edvr/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/restoration_video_demo.py ./configs/restorers/basicvsr/basicvsr_reds4.py https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_reds4_20120409-0e599677.pth demo_files/lq_sequences/city/ ./outputs/city_BasicVSR python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000000.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_BasicVSR/00000000.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000001.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_BasicVSR/00000001.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000002.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_BasicVSR/00000002.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000003.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_BasicVSR/00000003.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000004.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_BasicVSR/00000004.png')" python -c "import mmcv; mmcv.imshow('./demo_files/lq_sequences/city/00000005.png')" python -c "import mmcv; mmcv.imshow('./outputs/city_BasicVSR/00000005.png')"
学習済みモデルを使用.
MMEditing の DeepFillv2 の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/inpainting/deepfillv2/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/inpainting_demo.py configs/inpainting/deepfillv2/deepfillv2_256x256_8x2_celeba.py https://download.openmmlab.com/mmediting/inpainting/deepfillv2/deepfillv2_256x256_8x2_celeba_20200619-c96e5f12.pth tests/data/image/celeba_test.png tests/data/image/bbox_mask.png tests/data/pred/inpainting_celeba.png python -c "import mmcv; mmcv.imshow('./tests/data/image/celeba_test.png')" python -c "import mmcv; mmcv.imshow('./tests/data/pred/inpainting_celeba.png')"
学習済みモデルを使用.
MMEditing の Global&Local の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/inpainting/global_local/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/inpainting_demo.py configs/inpainting/global_local/gl_256x256_8x12_celeba.py https://download.openmmlab.com/mmediting/inpainting/global_local/gl_256x256_8x12_celeba_20200619-5af0493f.pth tests/data/image/celeba_test.png tests/data/image/bbox_mask.png tests/data/pred/inpainting_celeba.png python -c "import mmcv; mmcv.imshow('./tests/data/image/celeba_test.png')" python -c "import mmcv; mmcv.imshow('./tests/data/pred/inpainting_celeba.png')"
学習済みモデルを使用.
MMEditing の GCA の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/mattors/gca/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/matting_demo.py configs/mattors/gca/gca_r34_4x10_200k_comp1k.py https://download.openmmlab.com/mmediting/mattors/gca/gca_r34_4x10_200k_comp1k_SAD-34.77_20200604_213848-4369bea0.pth tests/data/merged/GT05.jpg tests/data/trimap/GT05.png tests/data/pred/GT05.png python -c "import mmcv; mmcv.imshow('./tests/data/merged/GT05.jpg')" python -c "import mmcv; mmcv.imshow('./tests/data/trimap/GT05.png')" python -c "import mmcv; mmcv.imshow('./tests/data/pred/GT05.png')"
学習済みモデルを使用.
MMEditing の IndexNet の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/mattors/indexnet/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/matting_demo.py configs/mattors/indexnet/indexnet_mobv2_1x16_78k_comp1k.py https://download.openmmlab.com/mmediting/mattors/indexnet/indexnet_mobv2_1x16_78k_comp1k_SAD-45.6_20200618_173817-26dd258d.pth tests/data/merged/GT05.jpg tests/data/trimap/GT05.png tests/data/pred/GT05.png python -c "import mmcv; mmcv.imshow('./tests/data/merged/GT05.jpg')" python -c "import mmcv; mmcv.imshow('./tests/data/trimap/GT05.png')" python -c "import mmcv; mmcv.imshow('./tests/data/pred/GT05.png')"
学習済みモデルを使用.
MMEditing の DIM の説明ページ: https://github.com/open-mmlab/mmediting/blob/master/configs/mattors/dim/README.md
コマンドの説明: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/matting_demo.py configs/mattors/dim/dim_stage3_v16_pln_1x1_1000k_comp1k.py https://download.openmmlab.com/mmediting/mattors/dim/dim_stage3_v16_pln_1x1_1000k_comp1k_SAD-50.6_20200609_111851-647f24b6.pth tests/data/merged/GT05.jpg tests/data/trimap/GT05.png tests/data/pred/GT05.png python -c "import mmcv; mmcv.imshow('./tests/data/merged/GT05.jpg')" python -c "import mmcv; mmcv.imshow('./tests/data/trimap/GT05.png')" python -c "import mmcv; mmcv.imshow('./tests/data/pred/GT05.png')"
demos URL: https://github.com/open-mmlab/mmediting/blob/master/docs/en/getting_started.md
python demo/generation_demo.py configs/example_config.py work_dirs/example_exp/example_model_20200202.pth demo/demo.jpg demo/demo_out.jpg
python demo/generation_demo.py configs/example_config.py work_dirs/example_exp/example_model_20200202.pth demo/demo.jpg demo/demo_out.jpg --unpaired_path demo/demo_unpaired.jpg