
画像生成AIに思った通りの姿勢の画像を出力させるのに、プロンプトで指示するのはとても難しかったのですが、画像で簡単に指示できるようになりました。img2imgを使う手もあったのですが、近い感じの画像を出力するので姿勢だけを指示するというのは難しかったので良いですね。
Stable Diffusion web UIにControlNetをインストール

Stable Diffusion web UIのExtensionsタブで”Install from URL”を選んで”URL for extension’s git repository”に下記URLを入力して”Install”ボタンを押します。
https://github.com/Mikubill/sd-webui-controlnet.git

インストールが完了したら、”Installed”を選び、”Apply and restart UI”ボタンを押します。
さらに、下記よりControlNet用のモデルをダウンロードします。control_openpose-fp16.safetensorsだけでも良いですが、他のモデルも入れておくと良いかも。
https://huggingface.co/webui/ControlNet-modules-safetensors/tree/main
- canny:輪郭検出アルゴリズムを使用するモデル
- depth:画像の深度情報を元に画像生成を行うモデル
- hed:色変更やスタイル設定に適したモデル
- mlsd:直線的な輪郭の検出アルゴリズムを使用するモデル
- normal:法線マップ(ノーマルマップ)を使用するモデル
- openpose:ポーズ検出を使って画像生成を行うモデル
- scribble:落書きを元に画像生成を行うモデル
- seg:セマンティックセグメンテーションを使用するモデル
ダウンロードしたら、stable diffusion web UI配下の”extensions/sd-webui-controlnet/models“フォルダに入れます。
ControlNetの使い方

txt2imgやimg2imgタブで、ControlNetの◀を押して展開します。
Enableにチェックを入れて、Processorと対応するModelを設定します。
canny と control_canny-fp16.safetensors
openposeやopenpose_hand と control_openpose-fp16.safetensors
Imageのところに姿勢の参考になる画像を入れます。

この画像でcannyで輪郭抽出して絵を描くと

こんな感じに。img2imgよりは形に忠実に、その他はあまり引っ張られない感じですね。
背景があると背景の形も指示した感じになります。

openposeを使うと、画像から姿勢(関節等)の情報を抽出して絵を描いてくれます。

姿勢以外はプロンプトで指示した感じになります。


別の画像でも。openposeの例。

cannyの例。

openposeを使ってモーション模写に再チャレンジ
以前、img2imgを使って、人の動きを模写できるかチャレンジしてみましたが、かなり難しい感じでした。

今回、ControlNetのopenposeを使って同じ画像を使って生成してみたのがこちら。

動きはかなりそれっぽくなりました(一部姿勢の検出が間違っているところもありますが)。
ただ、やはり顔や服装の一貫性を持たせるのが一番難しい感じです。(プロンプトでなるべく変わりにくいものを指示するのと、seedを固定すると同じような絵になりやすいですが。)








もう一つ、かなり以前に撮影させていただいた動画からも生成してみました。
服装はフレームごとにコロコロ変わっていますが、姿勢は連続性がある感じで面白いですね。
(元画像が姿勢の認識が難しい画像なので、間違いも多いのですが)




















(追記) 下記記事で、openposeの骨格モデルを編集できるOpenPose Editorや、実写風画像の生成について書きましたので合わせてご覧ください。
ピンバック: #StableDiffusion で 実写風女性画像生成に適したモデル3選 と モデルのマージ #ControlNet による姿勢の指定に便利な openpose-editor | Digital Life Innovator
ピンバック: 最新実写美少女モデル #BRAV5 と イラストモデル #AnythingV4 の併用による AIコスプレ写真 と #DepthLib での手の補正 #StableDiffusion #LoRA #ControlNet #コスプレ | Digital Life Innovator
ピンバック: Stable Diffusion の mov2mov で AI動画作成 #StableDiffusion #mov2mov #ControlNet | Digital Life Innovator
ピンバック: 2023年の振り返り | Digital Life Innovator