<学習シリーズ>Stable Diffusionでpromptを学んでみた
1.概要
本記事は”学習シリーズ”として自分の勉強備忘録用になります。
AIを用いてテキストから画像を生成するAI Generated Artが活発となり、特に2022年8月23日にstable diffusionがOSSとして公開されてから隆盛を極めております。
「自分が生成したい画像」をAIで作成するため「最適なPrompt」の記法をトライアルしました。なお画像生成方法は下記記事をご確認ください。
2.学習1:ラマの画像生成をマネしてみた
Zhong氏の記事では理想の画像を生成するためのpromptを試行錯誤しており、今回はこの記事から画像生成を学びました。
なおZhong氏はDALL-E2を使用しておりますが、私はstable diffusionを使用しました。
出力結果の構成としては、上にZhong氏の写真(DALL-E2)、下に私が作成した画像(stable diffusion)を示します。
2-1.シンプルなprompt
シンプルなpromptで実行した結果は下記の通りです。
【promptまとめ】
llama playing basketball
realistic photo of llama playing basketball
【llama playing basketball】
【realistic photo of llama playing basketball】
2-2.改善prompt/Zhong氏コメントまとめ
Zhong氏コメントより重要そうな部分を抜粋しました。
【promptまとめ】
Film still of a llama dunking a basketball, low angle, extreme long shot, indoors, dramatic backlighting.
film still of an alpaca wearing a jersey, dunking a basketball, low angle, long shot, indoors, dramatic backlighting, high detail.
film still of a llama in a jersey dunking a basketball like Michael Jordan, low angle, show from below, tilted frame, 35°, Dutch angle, extreme long shot, high detail, indoors, dramatic backlighting.”
Abstract painting of a llama in a jersey dunking a basketball like Michael Jordan, shot from below, tilted frame, 35°, Dutch angle, extreme long shot, high detail, dramatic backlighting, indoors. In the background is a stadium full of people.
Film still of a llama in a jersey dunking a basketball like Michael Jordan, dramatic backlighting, vibrant sunset, vaporwave.
llama in a jersey dunking a basketball like Michael Jordan, shot from below, tilted frame, 35°, Dutch angle, extreme long shot, high detail, dramatic backlighting, epic, digital art
Film still of a llama in a jersey dunking a basketball like Michael Jordan, low angle, show from below, tilted frame, 35°, Dutch angle, extreme long shot, high detail, indoors, dramatic backlighting.
【Film still of a llama dunking a basketball, low angle, extreme long shot, indoors, dramatic backlighting.】
【film still of an alpaca wearing a jersey, dunking a basketball, low angle, long shot, indoors, dramatic backlighting, high detail.】
【film still of a llama in a jersey dunking a basketball like Michael Jordan, low angle, show from below, tilted frame, 35°, Dutch angle, extreme long shot, high detail, indoors, dramatic backlighting.】
【Abstract painting of a llama in a jersey dunking a basketball like Michael Jordan, shot from below, tilted frame, 35°, Dutch angle, extreme long shot, high detail, dramatic backlighting, indoors. In the background is a stadium full of people.】
【Film still of a llama in a jersey dunking a basketball like Michael Jordan, dramatic backlighting, vibrant sunset, vaporwave.】
【llama in a jersey dunking a basketball like Michael Jordan, shot from below, tilted frame, 35°, Dutch angle, extreme long shot, high detail, dramatic backlighting, epic, digital art】
【Film still of a llama in a jersey dunking a basketball like Michael Jordan, low angle, show from below, tilted frame, 35°, Dutch angle, extreme long shot, high detail, indoors, dramatic backlighting.】
2-3.所感:DALL-E2とStable diffusionの違い
Promptに関してはDALL-E2を参照してStable diffusionに適用してもよさそうではあるが、Stable diffusion側の特徴もしっかりつかまないと期待する絵は出力できなさそうである。
3.学習2:自分の好きな画像を生成してみた
前回の学習をベースに自分が表現したい画像を生成してみます。私が一番好きな動物はコツメカワウソです。よって①コツメカワウソ、②可愛い感じ、③アートっぽい感じ の画像を生成させてみました。
3-1.シンプルなprompt
とりあえずシンプルに結果を出力してみました。
【promptまとめ】
little otters
realistic photo of little otters
little otter gazing at here
little otter gazing at here on the rock
【little otters】
【realistic photo of little otters】
【little otter gazing at here】
【little otter gazing at here on the rock】
3-2.promptに修飾語を追加
より可愛く表示させたいため詳細を追加していきました。追加した修飾語は"fluffy(ふわふわした)※", "round eye(丸い目)", "looking up(見上げる)", "full body(全身)", "dry(乾燥した)"などです。
※DALL-E2のLlamaだと「fluffyという単語は結果を最悪にした」ことを後で気づきましたが、今回のstable diffusionでは悪影響はありませんでした。
【promptまとめ】
fluffy little otter gazing at here on the rock
fluffy little otter gazing at here ,round eye
fluffy little otter gazing at here ,round eye, looking up
fluffy little otter gazing at here,dry ,round eye, looking up
fluffy little otter gazing at here,dry ,round eye, looking up, full body
cute fluffy little otter gazing at here,dry ,round eye, looking up, full body
【fluffy little otter gazing at here on the rock】
【fluffy little otter gazing at here ,round eye】
【fluffy little otter gazing at here ,round eye, looking up】
【fluffy little otter gazing at here,dry ,round eye, looking up】
【fluffy little otter gazing at here,dry ,round eye, looking up, full body】
【cute fluffy little otter gazing at here,dry ,round eye, looking up, full body】
3-3.promptにスタイルを追加
DALL-E2でも得意であるスタイルの追加をしてアートっぽい絵にしていきます。絵に詳しくないのでとりあえず”油絵”をベースにしながら背景も追加していきました。
追加した単語は"oil painting(油絵)", "vibrant sunset(鮮やかな夕日・夕焼け)", "Dutch angle(ダッチアングル)", "in space(宇宙で)"です。
【promptまとめ】
oil painting of fluffy little otter gazing at here,dry ,round eye, looking up, full body
oil painting of fluffy little otter gazing at here, dry ,round eye, looking up, full body, vibrant sunset
oil painting of fluffy little otter gazing at here, dry ,round eye, looking up, full body, Dutch angle
oil painting of fluffy little otter gazing at here, dry ,round eye, looking up, full body, in space
【oil painting of fluffy little otter gazing at here,dry ,round eye, looking up, full body】
【oil painting of fluffy little otter gazing at here, dry ,round eye, looking up, full body, vibrant sunset】
【oil painting of fluffy little otter gazing at here, dry ,round eye, looking up, full body, Dutch angle】
【oil painting of fluffy little otter gazing at here, dry ,round eye, looking up, full body, in space】
3-4.マイベストフォト
タイトルにもしてる通り好きなのはこれらでした。
4.学習3:img2promptでリバースエンジニアリング
Promptの入力方法を学びましたがまだ自分が欲しいpromptを自在に作れるほどではありません。すでに逆の操作として画像からpromptを生成するサービスを提供している人がいるためそちらでも試してみました。
前章で作成した画像からどのようなpromptが生成されるか確認します。
Origin1:oil painting of fluffy little otter gazing at here,dry ,round eye, looking up, full body
img2p1:a painting of a sea otter sitting on a rock, an airbrush painting by Valerie Petts, featured on deviantart, photorealism, oil on canvas, acrylic art, detailed painting
Origin2:oil painting of fluffy little otter gazing at here, dry ,round eye, looking up, full body, in space
img2p2:a painting of two otters with a blue background, a fine art painting by Lisa Frank, featured on pixiv, massurrealism, storybook illustration, airbrush art, oil on canvas
Origin3:oil painting of fluffy little otter gazing at here, dry ,round eye, looking up, full body, vibrant sunset
img2p3:a painting of a sea lion in a circle, an airbrush painting by Lorraine Fox, featured on deviantart, metaphysical painting, oil on canvas, acrylic art, airbrush art
用語もそうですが"Valerie Petts"や"Lorraine Fox"などアーティストの名前も入ってきております。画風が似ているかはよくわかりませんがアーティスト名を入れるとスタイルに大きく影響するかもしれません。
5.学習4:他の人のPromptを参考
シンプルですが他の人のアイデアを模倣しながら構図の作り方を学びます。
参考資料1:技術
参考資料2:絵画
あとがき
遊びのつもりだったけど出力したい表現を考えるのめちゃくちゃ頭使うし、語彙力が低すぎて思ってた以上にしんどかった。
あといろいろな人が既にfine tuningしたいろいろなサービス出してて早すぎる・・・・・
この記事が気に入ったらサポートをしてみませんか?