eightban's memo

残しておきたい記事をまとめてみました。このブログに書いてあるドキュメントやブログで配布しているファイルの使用によって発生するいかなる損害に対してもこのブログの管理者は責任を負いません。使用する場合は自己責任のもとに使用してください。

Python

MagicAnimate で使用しているDensePose モーションシーケンスを Windows パソコンを使い自分で作成する WSL は使わないで

更新日:

vid2densepose

Windows パソコンにインストールできないという記事が多数ありますがコンパイルしなければインストールできたので記事にさせていただきます

GitHub - Flode-Labs/vid2densepose: Convert your videos to densepose and use it on MagicAnimate

MagicAnimate と同じフォルダーに入れます

(venv) D:\WinPython\content\magic-animate>git clone https://github.com/Flode-Labs/vid2densepose.git

git clone https://github.com/Flode-Labs/vid2densepose.git
cd vid2densepose
git clone https://github.com/facebookresearch/detectron2.git

必要であれば次のライブラリをインストールしてください

pip install torch torchvision opencv-python 

ソースをあまり変更しないで対応したいと思います

"D:\WinPython\content\magic-animate\vid2densepose\detectron2"配下のファイルフォルダーを1つ上の階層に移動します

"D:\WinPython\content\magic-animate\vid2densepose\projects\DensePose\densepose"フォルダーを"D:\WinPython\content\magic-animate\vid2densepose\"フォルダーにコピーします

"D:\WinPython\content\magic-animate\vid2densepose\densepose"

"D:\WinPython\content\magic-animate\vid2densepose\app.py"を少し変更します

    cfg.merge_from_file("projects/DensePose/configs/densepose_rcnn_R_50_FPN_s1x.yaml")
#    cfg.merge_from_file("detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_s1x.yaml")
Python -m app

どうして Windows パソコンにインストールできないのか

git clone https://github.com/facebookresearch/detectron2.git
pip install torch torchvision opencv-python 
pip install git+https://github.com/facebookresearch/detectron2@main#subdirectory=projects/DensePose

DensePose のインストールのところでコンパイルをしているのですが私の環境ですとファイル名の長さが長すぎるためフォルダをクリエイトできないようです

ただし一時的にテンポラリーフォルダを変更することでビルドすることができました

c:/users/appdata/local/temp/

これでフォルダーの構造を気にしなくても良いと思います

set TEMP=C:\T
pip install -e  "D:\WinPython\content\magic-animate\vid2densepose\projects\DensePose"

"D:\WinPython\content\magic-animate\venv\Lib\site-packages\detectron2"

"D:\WinPython\content\magic-animate\venv\Lib\site-packages\detectron2-densepose.egg-link"

バッチコマンドでの実行

main.py を少し変更します

    cfg.merge_from_file("projects/DensePose/configs/densepose_rcnn_R_50_FPN_s1x.yaml")
#    cfg.merge_from_file("detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_s1x.yaml")
(venv) D:\WinPython\content\magic-animate\vid2densepose>Python main.py -i ./sample_videos/input_video.mp4 -o  ./sample_videos/output_video.mp4

magic-animate

-Python

Copyright© eightban's memo , 2024 All Rights Reserved Powered by STINGER.