Stable Diffusion 是一款開源軟體,得益於全球許多工程師的共同努力和貢獻,它的功能不斷完善和優化。最初,使用 Stable Diffusion 可能需要在電腦上擁有高階顯示卡,並消耗大量機器資源才能運作。然而,現在的情況已經有所改變。
由於 Google Colab 這種免費的雲端運算平台的出現,使用者現在可以直接在瀏覽器上運行 Stable Diffusion,而無需擔心硬體需求和資源消耗。Google Colab 提供了一個方便的環境,讓任何人都可以輕鬆地在雲端運行 AI 模型,而無需自己配置硬體設備。以下是在Google Colab上使用Stable Diffusion流程:
- 選擇 Github 上面開源的筆記本檔案
- 使用 Google Colab 架設 Stable Diffusion WebUI 環境
- 進入 Stable Diffusion WebUI 內提供 Prompt 關鍵字咒語以及設計圖片參數
- 產生數張不同的 AI 圖片
這意味著,無論您使用的是什麼裝置,甚至是手機,您都可以免費使用 Stable Diffusion 進行 AI 繪圖。這大大降低了使用門檻,讓更多人能夠享受到 AI 繪圖帶來的便捷和創意樂趣。如果你還不認識Stable Diffusion,可以參考 Stable Diffusion教學:深度解析ai繪圖
看完本篇可以學到:
利用Google colab免費使用Stable Diffusion
Time needed: 12 minutes
4步驟部屬Stable Diffusion到Google Colab
- 從Colab筆記本清單進行挑選
在 Github 會有很多已經寫好檔案可以直接一鍵使用,camenduru製作的stable-diffusion-webui-colab是目前最多模型可供選擇的地方:
訓練好的Stable Diffusion模型ChilloutMix是目前亞洲最多人使用的,作出來的圖片成效非常逼近真人,也因為裡面都是用韓星進行訓練好的模型,偏向亞洲人的喜好;可在Github頁面直接搜尋ChilloutMix。
這邊是一些我用Chillout做出來的圖片
另一個推薦的是Perfect World,做出來的效果也很棒 - 雲端安裝Stable Diffusion WebUI
找到『chillout_mix_webui_colab 』,點中間那個寫stable的小圖示後會自動跳轉到Google Colab 頁面,不止Stable Diffusion直接可以一鍵部屬,連進階plugin ControlNet都安裝到位。
- 執行Colab筆記本
到Google Colab頁面,點選畫面左上方的執行按鈕
點下開始運行後會需要確認執行,確認後Stable Diffusion就開始在 Google Colab部屬囉,大約10分鐘以內就可以完成。 - 開啟Stable Diffusion網頁版頁面(WebUI)
判斷完成的方式很簡單,看到頁面下方出現兩行網址就是安裝完成囉!兩個網址都能點擊,都會一樣到運行於Google Colab的Stable Diffusion網頁版頁面(WebUI)。
*注意,每個Google帳號每天有做圖運算額度限制,超過使用量可以換另一個帳號馬上繼續用,或是維持原帳號等24小時後再用。
Stable Diffusion 的 WebUI 教學
我們會在Stable Diffusion 的 WebUI 介面,輸入關鍵字、咒語與調整調整參數來產圖。以下教學使用Perfect World模型當案例。
Stable Diffusion 的 WebUI 介面說明
當 Stable Diffusion 網頁版介面建立好,首先左上角可以看到現在使用的模型,接著中間是讓我們能夠跟Ai溝通的核心區域:關鍵字咒語輸入區。Stable Diffusion關鍵字,英文是Prompt,又稱為Stable Diffusion咒語。用Ai繪圖的人稱為Ai詠唱師,可以參考 Ai詠唱師3種賺錢技能
這邊有兩個區塊:
- Prompt在上半部,是我們要Ai繪圖的各種指示
- Negative Prompt在下半部,是我們要Ai繪圖時必須避開的各種指示
下方的敘述則是圖片寬度、高度、產生幾張圖等設定,如果你算出來的人物壞掉再勾選 Restore Face即可,我通常不用這個功能
CFG Scale則是告訴Ai他繪圖的自由度,數字越小表示越自由創作,越大則表示需要更遵守你的咒語關鍵字,我通常會使用6.5,而當靈感枯竭時會調整到3:建議Stable Diffusion的CFG Scale使用3~7即可。
Stable Diffusion WebUI的Ai電繪實作教學
提供兩個我畫的圖片使用的咒語prompt與Negative Prompt
prompt
realistic 8k, picture-perfect face, flawless, clean, masterpiece, professional artwork, famous artwork, cinematic lighting, cinematic bloom, perfect face, beautiful face, beautiful eyes, ((perfect female body, narrow waist)), fantasy, dreamlike, unreal, science fiction,1girl, intricate detail, delicate pattern, sexy, charming, alluring, seductive, erotic, enchanting,
smiling, looking away, pink hair, undercut, apron, amazing body, 1girl, corset, cinematic, (portrait), sideface, foreshortening, breasts, cleavage, full_body, high_heels, long_hair, solo, depth_of_field, outdoors, realistic, photo_\(medium\), photorealistic, (ultra-detailed:1.2), ((high ornamented dress)), detailed light, HDR, Empire_dress, (awaitingtongue:1.2), ((realistic)), photo referenced, highest quality, high quality, (detailed face and eyes:1.1), ((goth)), golden hour, freckles, queen dress, green royalty, green eyes, full body, red dress,((crown)), thin lips, victorian clothes, highly detailed clothes, green engravings on clothes,on the street, (embarrassed laughing:1.2),
emphasizing her curves and sex appeal, The overall tone of the image is dark.
- 這段咒語,第一段描述圖片大方向,包含professional artwork, famous artwork和描述女主角身材特徵並用括弧強調((perfect female body, narrow waist))
- 第二段說明女主角細節,例如服裝要是維多利亞風並帶有刺繡 victorian clothes, green engravings on clothes、髮型是undercut、髮色是粉紅色pink hair,皇冠髮飾((crown))
- 第三段說明圖片風格是展示女主角的線條和性感,並用暗色風格dark呈現。
Negative Prompt
Negative Prompt直接複製貼上即可,說明不要出現一些刺青、品牌、標語、醜臉和6根手指頭等等。
(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation. tattoo,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, out of focus, censorship, ugly, old, deformed, amateur drawing, odd, bad hands
接著按下執行「Generate」產生圖片:
工作區右下角,點擊任何一張就會顯示大圖,你可以直接右鍵存到電腦裡,也可以透過下方的 Download 按鈕下載,圖片只會保存一小段時間喔。
Stable Diffusion修改咒語教學
如果你想看Ai女主角的背面,用一樣的咒語單純加上動作,例如:
wearing red skirt, panties ,showing buttocks, skirt above ass, wearing skirt, back to viewer(穿裙子,露出屁股,背對鏡頭),女主角有一樣風格但畫面呈現結果完全不同。
以髮型、髮色與頭飾為案例,以下是一個表格,用來說明可以將英文中括弧標示的文字進行替換。以髮型為例,您可以將 “undercut” 替換成其他髮型,如 “ponytail”。
hair style[undercut], [red] hiar, [crown],dress style [Goth], [in a classroom],下表列出於括弧內可供替換的關鍵字
類別 | 替換選項 |
---|---|
髮型 | undercut, ponytail, bob, pixie, braid, mohawk, dreadlocks, bun, shag, wavy, straight, curly, pompadour, slicked back, side part, quiff, top knot, mullet |
髮色 | red, black, brown, blonde, gray, green, blue, purple, pink, orange, balayage, highlights, pastel, burgundy, ombre, ash blonde |
頭飾 | crown, hat, headband, beret, baseball cap, beanie, fedora, turban, veil, bonnet, hairpin, headscarf, fascinator, tiara, bow |
服裝風格 | Goth, casual, business formal, vintage, athletic, hip hop, rock, mori girl, military, bohemian, country, beachwear, retro, kimono, hanfu, ethnic |
地點/背景 | in a classroom, in a studio, at the beach, in a forest, on a mountain, in a city, in a park, in a garden, at a party, in a cafe, in a library, at home |
以上表格展示了一些可以替換的選項。在使用時,只需將英文中括弧內的文字替換成您希望使用的選項即可;更多跟Ai溝通的方式可以參考 成為Ai溝通師不用懂程式,學會用精準指令prompt跟ai溝通能拿千萬年薪
如果你想加上更多畫風條件,一樣prompts再加上一些情色形容詞,例如:intricate detail, delicate pattern, sexy, charming, alluring, seductive, erotic, enchanting
以上教學模型是Perfect World,比較偏向電腦畫作,而模型到ChilloutMix是真人,如果把一樣Stable Diffusion咒語關鍵字放到ChilloutMix中能得到的結果是?….依照這篇教學自己操作一次就知道了。
下方放小圖案例供您參考。P.S.我把髮型從undercut改成綁馬尾ponytail
更多 Stable Diffusion 生成的 AI 圖參考與結論
Stable Diffusion 是一個非常實用的 AI 圖片生成工具。您可以透過 Civitai.com 網站查看其他人分享的作品和相應的參數設定,以提供更多靈感和選擇;只要網站上圖片有 i 的標示,就可以點進去看他下週與,可以直接複製並且貼到 Stable Diffusion WebUI 編輯器即可使用。當然別忘了還可以利用 ChatGPT 來產生適合 Stable Diffusion 使用的 Prompt 指令。
再複習一次本篇文章提到的使用步驟:
- 選擇 Github 上面開源的筆記本檔案
- 使用 Google Colab 架設 Stable Diffusion WebUI 環境
- 進入 Stable Diffusion WebUI 內提供 Prompt 關鍵字咒語以及設計圖片參數
- 產生數張不同的 AI 圖片
雖然使用 Stable Diffusion 的過程看似複雜,但經過一兩次的嘗試後,您將熟悉操作流程。此工具不僅可以生成美女圖,還能根據您使用的指令和算法創建具有電影風格的畫面。您可以在現有參數的基礎上加入自己的創意,如穿著運動服、比基尼或洋裝。此外,建議多嘗試使用其他模型。