18
27

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

いろいろな画像系機械学習機能が手軽に使える mmeditingの使いかた

Last updated at Posted at 2023-02-02

MMEditingは、
・Inpainting
・Matting
・SuperResolution
・フレーム補完
・画像変換

が使えるツールボックス。

使用可能なモデルはいっぱいある。

Supported algorithms:

Inpainting
Global&Local (ToG'2017)
DeepFillv1 (CVPR'2018)
PConv (ECCV'2018)
DeepFillv2 (CVPR'2019)
AOT-GAN (TVCG'2021)
Matting
DIM (CVPR'2017)
IndexNet (ICCV'2019)
GCA (AAAI'2020)
Image-Super-Resolution
SRCNN (TPAMI'2015)
SRResNet&SRGAN (CVPR'2016)
EDSR (CVPR'2017)
ESRGAN (ECCV'2018)
RDN (CVPR'2018)
DIC (CVPR'2020)
TTSR (CVPR'2020)
GLEAN (CVPR'2021)
LIIF (CVPR'2021)
Video-Super-Resolution
EDVR (CVPR'2019)
TOF (IJCV'2019)
TDAN (CVPR'2020)
BasicVSR (CVPR'2021)
IconVSR (CVPR'2021)
BasicVSR++ (CVPR'2022)
RealBasicVSR (CVPR'2022)
Generation
CycleGAN (ICCV'2017)
pix2pix (CVPR'2017)
Video Interpolation
TOFlow (IJCV'2019)
CAIN (AAAI'2020)
FLAVR (CVPR'2021)

158984079-c4754015-c1f6-48c5-ac46-62e79448c372.jpg
↑公式リポジトリより

使いかた

インストール

pip3 install openmim
mim install mmcv-full
git clone https://github.com/open-mmlab/mmediting.git
cd mmediting
pip3 install -e .

推論

それぞれのタスクのデモスクリプトを実行する。
引数に、タスクのコンフィグファイルパスとチェックポイントパス、入出力パスなどを指定する。

Inpainting

python demo/inpainting_demo.py \
    configs/inpainting/global_local/gl_256x256_8x12_celeba.py \ # config
    https://download.openmmlab.com/mmediting/inpainting/global_local/gl_256x256_8x12_celeba_20200619-5af0493f.pth \ # checkpoint
    tests/data/image/celeba_test.png \ # input
    tests/data/image/bbox_mask.png \ # mask
    tests/data/pred/inpainting_celeba.png # result

input / mask / result

celeba_test.pngbbox_mask.pnginpainting_celeba.png

Matting

python demo/matting_demo.py \
    configs/mattors/dim/dim_stage3_v16_pln_1x1_1000k_comp1k.py \ # config
    https://download.openmmlab.com/mmediting/mattors/dim/dim_stage3_v16_pln_1x1_1000k_comp1k_SAD-50.6_20200609_111851-647f24b6.pth \ # checkpoint
    tests/data/merged/GT05.jpg \ # input
    tests/data/trimap/GT05.png \ # trimap
    tests/data/pred/GT05.png # result

input / trimap / result

SuperResolution

python demo/restoration_demo.py \
    configs/restorers/esrgan/esrgan_x4c64b23g32_g1_400k_div2k.py \ # config
    https://download.openmmlab.com/mmediting/restorers/esrgan/esrgan_x4c64b23g32_1x16_400k_div2k_20200508-f8ccaf3b.pth \ # checkpoint
    tests/data/lq/baboon_x4.png \ # input
    demo/demo_out_baboon.png # result

input / result

Video Super Resolution

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 \
    tests/data/vimeo90k/00001/0266/ \
    ./output \
    --window-size=5

フレーム補完

python demo/video_interpolation_demo.py \
    configs/video_interpolators/cain/cain_b5_g1b32_vimeo90k_triplet.py \
    https://download.openmmlab.com/mmediting/video_interpolators/cain/cain_b5_g1b32_vimeo90k_triplet_20220530-3520b00c.pth    tests/data/test_inference.mp4 \
    tests/data/test_inference_vfi_out.mp4 \
    --fps-multiplier 2.0 \
    --device 0

画像生成

python demo/generation_demo.py \
    configs/synthesizers/pix2pix/pix2pix_vanilla_unet_bn_1x1_80k_facades.py \
    https://download.openmmlab.com/mmediting/synthesizers/pix2pix/pix2pix_facades/pix2pix_vanilla_unet_bn_1x1_80k_facades_20200524-6206de67.pth \
    tests/data/paired/test/3.jpg \
    demo/demo_out.jpg

input / result / ground truth

demo_out.jpg

🐣


フリーランスエンジニアです。
お仕事のご相談こちらまで
rockyshikoku@gmail.com

機械学習、ARアプリ(Web/iOS)を作っています。
機械学習/AR関連の情報を発信しています。

Twitter
Medium
GitHub

18
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
27

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?