
以前書いたStable DiffusionとLoRAを使ったAIコスプレ写真生成の記事を多く読んで頂いたので、アップデートした記事をサンプルと共に載せておきます。Stable DiffusionとLoRAを使うのは変わりませんが、実写モデルとして話題のBRAV5を、さらにControlNetを使って2次元画像から作る方法になります。
コンテンツ目次
BRA(Beautiful Realistic Asians) V5
まずは、美しいアジア系女性写真で訓練された実写モデル「BRAV5」について。こちらはアジア系女性のポートレート写真を生成するにはかなり良い感じですね。モデルをダンロードして、Stable Diffusionのモデルフォルダに配置して、逆光ウエディングドレス姿のポートレート写真を生成してみたのを載せておきます。なかなか良い感じですね。プロンプトによるのかも知れませんが、比較的顔は似た感じになりますね。AIグラビア写真はプロンプトだけで簡単に生成できそうです。(指の表現は苦手そうです。)



Depth map library and poser で 手を修正
ちょっと脱線しますが、Stable Diffusion web UIの拡張で、手がうまく描けずに試行錯誤する代わりにある程度こんな手を書いてと指示する方法が出てきました。拡張としてまずはControlNetをインストールします(詳細は下記記事を参照)
さらに、拡張として下記URLをExtensionsで指定して、Depth map library and poserをインストールします。
https://github.com/jexom/sd-webui-depth-lib.git
Apply and Restart UIをするとDepth Libraryというタブが現れます。

Add background imageを押して修正したい画像を選びます。widthとheightを画像のサイズにします。

Handsタブ内で描きたい手の形を選んでAddボタンを押すと右の画像に画像が現れるので、サイズを変えたり、回転・反転などして描きたい手の形に合わせて配置します。そしてSave PNGを押してPNGファイルに書き出します。

生成時の画像やプロンプトをimg2imgまたはinpaintに持ってきて(PNG Infoに生成画像を入れてSend toするのが便利)、ControlNetをEnableに、ImageにさきほどのPNGファイルを読み込ませます。PreprocessorをnoneにModelをcontrol_depthにして画像を生成します。


これで思ったような手の形を描けます。とは言っても、あまりうまくいかないこともよくありますね。
ControlNet の canny で 2次元画像を真似した実写写真を生成
前回は実写モデルにLoRAを適用してコスプレ写真を生成しましたが、今回はまず2次元イラスト画像に特化したモデルにLoRAを適用して、2次元イラストを生成します。気に入ったイラストが出てきたら、それをControlNetのImageに設定して、Preprocessorをcanny、Modelをcontrol_cannyに設定、実写モデルに変更して、同じプロンプト、LoRAで画像を生成します。
Stable DiffusionでLoRAを使う方法は前回記事を参照して下さい。
2次元モデルとしてAnythingV4.5、実写モデルとしてBRAV5を使って前回と同じLoRA、プロンプトで様々なキャラクターのコスプレ写真を生成してみました。

最初に2次元画像を生成するのは、その方が服装やポーズなどがしっかりと反映されるからです。

cannyを使うことで2次元画像の輪郭に合わせて画像が生成できるので、かなり良い感じになります。Weightは高すぎると無理やり2次元に合わせる感じになるので、0.35くらいに設定しました。色は2次元から引き継がれないし、輪郭線の解釈も元画像と違ったりしますが、何度か生成するかプロンプトを追加すれば良いですね。

















ピンバック: 実写系モデル✕元素法典で作る AI美少女 #StableDiffusion #majicMIXrealistic #BRV5 | Digital Life Innovator
ピンバック: Macで #ip-adapter を使って1枚のアニメ画像からAIコスプレ写真を生成する方法 と #AnimateDiff でテキストから短いAI動画を生成する方法 #StableDiffusion | Digital Life Innovator