見出し画像

【生成系AI】Stable Diffusionを使ってみた

こんにちは。アメリカ・シリコンバレー在住のSeikaです。

今までAIで画像を生成する際はMidjourneyだったのですが、
今回初めてStable Diffusionを使ってみました!
その過程と実際に作ったものをまとめていきます。

Stable Diffusion気になっていた!
Midjourneyとの違いはなに?
と思った方は見てみてくださいね。

(2024年4月4日公開)



1. Stable Diffusionってなに?

Stable Diffusionは、入力したテキストをもとに自動で画像を生成するAIで、OpenAIのDALL·E、GoogleのImagenなどと同様に、テキストから画像を生成するモデルの一つです。

2. MidjourneyとStable Diffusionの違いは?

MidjourneyとStable Diffusionは、どちらも画像を生成するAI技術を用いたツールですが、ちょっと違いがあります。

  1. アクセスと使用法
    Stable Diffusion
    オープンソースのモデルであり、GitHubなどからコードをダウンロードして自分で実行することができる。
    Midjourney
    Discordを通じてアクセスされるサービスであり、サブスクリプションベースのモデル。

  2. カスタマイズ性
    Stable Diffusion
    オープンソースであるため、コードを自由に変更してカスタマイズすることが可能。
    Midjourney
    自由度は低いものの、ユーザーフレンドリーなインターフェース。

  3. 生成スタイルと品質
    Stable Diffusion
    幅広いスタイルとテーマをカバー。
    Midjourney
    アーティスティックなスタイルが特徴。

  4. 料金
    Stable Diffusion
    基本無料。ただし、自分でモデルを実行するためには適切なハードウェア(特にGPU)が必要で、ここでコストがかかる場合がある。
    商用利用に関してはライセンスの条件を確認する必要あり。
    Midjourney
    有料。サブスクリプションモデルを採用していて、月$8 〜。

3.Stable Diffusionのインストール

ではStable Diffusionをインストールしていきます。

1.Macにインストール

brew install cmake protobuf rust python@3.10 git wget
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

2.モデルをダウンロード
https://civitai.com/models/25494 にアクセスしてモデルをダウンロード。

3.ダウンロードしたファイルを配置
ダウンロードしたモデルファイルを
`stable-diffusion-webui/models/Stable-diffusion/`の中の`beautifulRealistic_v7.safetensors`に配置。

4.WebUIを起動
ターミナルで以下のコマンドを実行してWebUIを起動。

cd stable-diffusion-webui
./webui.sh

5.WebUIでモデルを指定して実行
WebUIで`beautifulRealistic_v7.safetensors`モデルを選択。

4. 作ってみた

インストールが終わったので、画像を作っていきます。

プロンプト
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear jacket 
(名作,最高品質,1ガール,美少女,上半身,東京の夜,ロングヘア,茶髪,ジャケット着用 )

ネガティブプロンプト
16-token-negative-deliberate-neg,lowres,bad anatomy,bad hands,text,error,missing fingers,extra digit,fewer digits,cropped,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,username,blurry
(16-token-negative-deliberate-neg,lowres,悪い解剖学,悪い手,テキスト,エラー,指がない,余分な桁,少ない桁,トリミング,最悪の品質,低品質,通常の品質,JPEGアーチファクト,署名,透かし,ユーザー名,ぼやけた)

masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear jacket 
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear jacket 

プロンプト
1girl, (cropped top:1.8),(RAW photo, best quality), (realistic, photo-realistic:1.4), masterpiece, an extremely delicate and beautiful, extremely detailed, 2k wallpaper, Amazing, finely detail, extremely detailed CG unity 8k wallpaper, ultra-detailed, highres, soft light, beautiful detailed girl, extremely detailed eyes and face, beautiful detailed nose, beautiful detailed eyes,cinematic lighting,(blurry,bokeh background), (city:2.0),perfect anatomy,(slender body:1.4),(close up:1.4),(smile gently,Friendly , warm:2.0),(looking at viewer:1.8),(japanese idol:1.8),(shoulder length hair:2.0), (brown eyes:1.8),(standing:2.0), lora:sakuraayane_lora-bra_01:0.8

ネガティブプロンプト
1枚目と同様。

1girl, (cropped top:1.8),(RAW photo, best quality), (realistic, photo-realistic:1.4), masterpiece, an extremely delicate and beautiful, extremely detailed, 2k wallpaper, Amazing, finely detail, extremely detailed CG unity 8k wallpaper, ultra-detailed, highres, soft light, beautiful detailed girl, extremely detailed eyes and face, beautiful detailed nose, beautiful detailed eyes,cinematic lighting,(blurry,bokeh background), (city:2.0),perfect anatomy,(slender body:1.4),(close up:1.4),(smile gently,Friendly , warm:2.0),(looking at viewer:1.8),(japanese idol:1.8),(shoulder length hair:2.0), (brown eyes:1.8),(standing:2.0), lora:sakuraayane_lora-bra_01:0.8

プロンプト
masterpiece,best quality,1girl,bishoujo,smile,upper_body,

ネガティブプロンプト
1枚目と同様。

masterpiece,best quality,1girl,bishoujo,smile,upper_body,
masterpiece,best quality,1girl,bishoujo,smile,upper_body,

プロンプト
youth,1girl,looking at viewer, full body,jewelry, necklace, realistic, brown hair, blurry background, blurry,bangs, black eyes,paris,fashion,peoples in background, winter coat, dynamic pose, motion blur, Warm sun,Winter,snow,

ネガティブプロンプト
1枚目と同様。

youth,1girl,looking at viewer, full body,jewelry, necklace, realistic, brown hair, blurry background, blurry,bangs, black eyes,paris,fashion,peoples in background, winter coat, dynamic pose, motion blur, Warm sun,Winter,snow,
youth,1girl,looking at viewer, full body,jewelry, necklace, realistic, brown hair, blurry background, blurry,bangs, black eyes,paris,fashion,peoples in background, winter coat, dynamic pose, motion blur, Warm sun,Winter,snow,

プロンプト
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear white shirt

ネガティブプロンプト
1枚目と同様。

masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear white shirt
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear white shirt

プロンプト
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo daytime, long hair, brown hair, wear white shirt
ネガティブプロンプト
1枚目と同様。

masterpiece,best quality,1girl,bishoujo,upper_body, tokyo daytime, long hair, brown hair, wear white shirt
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo daytime, long hair, brown hair, wear white shirt

プロンプト
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear white summer dress
ネガティブプロンプト
1枚目と同様。

masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear white summer dress
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear white summer dress

プロンプト
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit
ネガティブプロンプト
1枚目と同様。

masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit

プロンプト
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit
ネガティブプロンプト
1枚目と同様。

masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit

プロンプト
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit sun,Winter,snow,
ネガティブプロンプト
1枚目と同様。

masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit sun,Winter,snow,
masterpiece,best quality,1girl,bishoujo,upper_body, tokyo night, long hair, brown hair, wear suit sun,Winter,snow,

今回はStable DiffusionとMidjourneyの違い、インストール、実際に作った画像までをまとめてみました。

もし記事が役に立ったと思ったら、スキボタンを押してくださいね😊
それでは、次回の記事でお会いしましょう!

Follow me here😊

この記事が参加している募集

AIとやってみた

よろしければサポートお願いいたします。いただいたサポートはクリエイターとしての活動費に使わせていただきます。