画像生成AI Stable Diffusionを使って画像出力する。その3 自分好みの女の子を作成しよう

今回で、3回目になります。ただの風景画像を生成しても面白みがないので自分の癖にくる女の子の画像を自分で作っていきましょう。

具体的な画像出力方法は、以前書いたその1を参考にしてください。

また、今回は基本的なコードの解説は行わない予定です。その2を参考にしてください。

今回は、実際に出力に関わるところのコードのみを取り扱おうと思います。


いきなりですが、実際に使用したコードを載せます。

prompt = """
(((girl))),
((sky)),
(short hair),
(gray hair),
arrange one's hair,
illustration,
Night view,
Marble floor,
documents,
files,
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
((((illustration)))),
lens flare,
film Reflection,
colorful refraction,
light diffusion,
cute,
chair,
interview,
Unreal Engine,
Realistic,photorealistic,
4k,
8k,
((16k)),
(((elaborate))),
hyper quality,
(global illumination),
atmospheric,
highly detailed,
soft lighting,
cinematic,
wide shot,
(sharp focus),
realistic shaded,
pale light,
((anime)),
(((trending on pixiv fanbox))),
((Pixiv contest winner)),
brush stroke,
((((8k_wallpaper)))),
(((anime face))),
looking_at_viewer,
full body shot,
look back,
feeling of transparency,
"""
n_prompt = """
(((having only one leg))),
You only have one eye,
bad hands,
missing fingers,
too many fingers,
bad hands,
cropped,
bad anatomy,
jpeg artifacts,
worst quality,
low quality,
normal quality,
username,
artist name,
text,
nsfw,
Choenomeles lagenaria,
fog,
"""

cfg_scale = 18 # スケール
steps = 120# ステップ

width = 1280 # 出力画像の幅
height = 832 #出力画像の高さ

# 画像を生成
image = pipeline(prompt=prompt,
negative_prompt=n_prompt,
guidance_scale=cfg_scale,
num_inference_steps=steps,
width=width,
height=height).images[0]

# 画像を表示
image



英単語の意味と使用目的を載せておきます。


promptの内容
【キャラクター関連】#女の子の特徴
(((girl))): 女の子
(short hair): ショートヘア
(gray hair): グレーの髪
arrange one's hair: 髪を整える

【イラスト関連】#イラスト感を高める
illustration: イラスト
(((illustration))): イラスト

【風景関連】#大まかな背景など
Night view: 夜景
Marble floor: 大理石の床

【書類・ファイル関連】#細部の書き込みの要素が欲しかった。
documents: 書類
files: ファイル

【写真関連】#この記述によって、写真で撮ったようなイラスト、構図になる。
lens flare: レンズフレア
film Reflection: フィルムの反射
colorful refraction: カラフルな屈折
light diffusion: 光の拡散

【その他のキーワード】#細かな要素。
cute: 可愛い
chair: 椅子
interview: インタビュー
Unreal Engine: アンリアルエンジン

【画質関連】#画質が良くなったり、イラストのノイズ感を少なくする。
Realistic,photorealistic: リアル、写真のような
4k: 4K解像度
8k: 8K解像度
((16k)): 16K解像度
(((elaborate))): 手の込んだ
hyper quality: 高品質


【照明関連】#光の反射などを操作する
(global illumination): グローバルイルミネーション
atmospheric: 雰囲気のある
highly detailed: 非常に詳細な
soft lighting: ソフトな照明
cinematic: 映画のような
wide shot: 広角撮影
(sharp focus): 鮮明な焦点
realistic shaded: リアルな陰影
pale light: 薄い光

【アニメ関連】#顔のパーツの配置の安定化。
((anime)): アニメ
(((trending on pixiv fanbox))): Pixivファンボックスで話題になっている
((Pixiv contest winner)): Pixivコンテストの優勝作品
brush stroke: 筆のストローク
((((8k_wallpaper)))): 8Kの壁紙
(((anime face))): アニメ顔

【ポーズ・構図関連】
looking_at_viewer: 見つめる
full body shot: 全身のショット
look back: 振り返る

【その他】#画像全体に、白いモヤがかかっていたので、記述。
feeling of transparency: 透明感のある

n_promptの内容
(((having only one leg))): 1本の足しかない
You only have one eye: 目が1つしかありません
bad hands: 下手な手
missing fingers: 指がない
too many fingers: 指が多すぎる
cropped: 切り抜かれた
bad anatomy: 悪い解剖学
jpeg artifacts: JPEGのアーティファクト
worst quality: 最悪の品質
low quality: 低品質
normal quality: 標準品質
username: ユーザー名
artist name: アーティスト名
text: テキスト
nsfw: 閲覧注意(Not Safe for Work)
Choenomeles lagenaria: チョウジンエンレイシャ(植物の一種)
fog: 霧

実行結果をまとめたもの。

何か、質問ややってほしいことがあれば、コメントで!!

コメント

このブログの人気の投稿

FFmpegで画像のピクセルサイズを指定して、変換する方法 忘備録