【AnimatedDrawings】1枚の手書きイラストを動かす(WSL2での動作確認)

github.com

結果


環境構築

Ubuntu 20.04 on WSL2 (Windows 11)
Python 3.9

CUDAは必要ありません。

以下をインストールする必要があります。

sudo apt install libosmesa6-dev freeglut3-dev
sudo apt install libglfw3-dev libgles2-mesa-dev
sudo apt install libosmesa6

その後に以下を実行すれば完了です。

git clone https://github.com/facebookresearch/AnimatedDrawings.git
cd AnimatedDrawings
pip install -e .

実行

画面に表示

実行

import os
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'

from animated_drawings import render
render.start('./examples/config/mvc/interactive_window_example.yaml')

./examples/config/mvc/interactive_window_example.yaml

scene:
  ANIMATED_CHARACTERS:
    - character_cfg: examples/characters/char2/char_cfg.yaml
      motion_cfg: examples/config/motion/dab.yaml
      retarget_cfg: examples/config/retarget/fair1_ppf.yaml

MP4として保存

実行

import os
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'

from animated_drawings import render
render.start('./examples/config/mvc/export_mp4_example.yaml')

./examples/config/mvc/export_mp4_example.yaml

GitHub通りに実行すると以下のエラーが出ました。

[ERROR:0@6.700] global /io/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2927) open Could not find encoder for codec_id=27, error: Encoder not found
[ERROR:0@6.700] global /io/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (3002) open VIDEOIO/FFMPEG: Failed to initialize VideoWriter

「./examples/config/mvc/export_mp4_example.yaml」の最終行、 OUTPUT_VIDEO_CODECを「avc1」から「mp4v」に変更するとうまくいきました。

scene:
  ANIMATED_CHARACTERS:
    - character_cfg: examples/characters/char2/char_cfg.yaml
      motion_cfg: examples/config/motion/dab.yaml
      retarget_cfg: examples/config/retarget/fair1_ppf.yaml
controller:
  MODE: video_render
  OUTPUT_VIDEO_PATH: ./video.mp4
  OUTPUT_VIDEO_CODEC: mp4v

GIFとして保存

実行

import os
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'

from animated_drawings import render
render.start('./examples/config/mvc/export_gif_example.yaml')

./examples/config/mvc/export_gif_example.yaml

scene:
  ANIMATED_CHARACTERS:
    - character_cfg: examples/characters/char2/char_cfg.yaml
      motion_cfg: examples/config/motion/dab.yaml
      retarget_cfg: examples/config/retarget/fair1_ppf.yaml
controller:
  MODE: video_render
  OUTPUT_VIDEO_PATH: ./video.gif