:::

母親節快樂~ Stable Diffusion Latent Couple練習 / Happy Mother's Day & Practice to Stable Diffusion Latent Couple

2023-0514-201927.png

母親節大家都做了什麼呢?


起源 / Inspiration

2023-0514-154314.png

https://www.facebook.com/polatouche88/posts/pfbid0bQrcecRNvUsqxVQSxwRNKJGkJ6cvuXD24pTrhJ37K9HuwgqKLYcyofR2kXwimrVJl

一開始是看到Polatouche 飛鼠畫さん的作品,那種母子之間互動的溫馨氣氛真是令人嚮往。剛好飛鼠畫さん也分享了他的prompt,那我們也不妨來試試看吧。

模型 / Checkpoint

2023-0514-155231.png

https://civitai.com/models/36520?modelVersionId=59685

飛鼠畫さん使用的Checkpoint (常被叫做大模型)是cetusMix,這是偏動畫風格、少女畫風的模型。用cetusMix畫出來的角色通常有種較年輕的感覺。

這部分我將Checkpoint改用GhostMix,這一樣是動畫女性風格的模型,畫風上較偏2.5D寫實風格,但人物看起來比較成熟。GhostMix也是近期熱門的模型,許多人都在發掘GhostMix的可能性。

構圖工具 Latent Couple

既然是要畫給以使用手機為主的長輩看的,那我們不妨擺脫傳統的512x512的標準方形畫布,以瘦長的512x1024為目標來繪圖看看。特別是我希望畫面上方多留些空白,好讓我擺入裝飾字,因此這次對整體構圖有些要求。

https://youtu.be/L97jCIIY07A 

如果要做到這種程度的版面控制,那就需要使用Stable Diffusion的兩大神器之一的Latent Couple了 (另一個神器是ControlNet)。

  2023-0514-160338.png

很久之前我就裝了Latent Couple,不過之前一直都沒有需要構圖的需求。那這次我們就來做做看吧。

Latent Couple的教學網路上已經非常非常多了,這次我只是記錄一下整個製作的過程而已,不會講的很細。


Step 1. 決定構圖版面 / Draw the layout

2023-0514-160604.png

http://badnoise.net/latentcoupleregionmapper/ 

Latent Couple原本的參數真的很難理解。大多情況下,我們會推薦大家使用Latent Couple Region Mapper來繪製Latent Couple的版面。

2023-0514-160746.png

調整畫布為512x1024。

2023-0514-163734.png

用滑鼠拉出想要的範圍,多畫的範圍可以用滑鼠右鍵移除,適時地按「Snap Regions to Grid」讓繪製範圍貼齊格線。我的構想是上方1的位置就是普通的房間,2則是人物的位置。

2023-0514-163746.png

再到下方取得Latent Couple所需要的三個參數。上圖的構圖會產生的參數是:

  • Divisions: 1.00:1.00,2.00:1.00,2.00:1.00
  • Positions: 0.00:0.00,0.00:0.00,1.00:0.00
  • Weights: 0.20,0.80,0.80

這裡我不設定Prompt,因為我打算自己在Stable Diffusion Webui裡面手動調整。


Step 2. 設定Latent Couple / Configuration in Latent Couple

2023-0514-163630.png

回到Stable Diffusion Webui,找到Latent Couple,進行以下操作:

  1. 開啟Enabled
  2. 在Rectangular裡面
  3. 設定Divisions、Positions跟Weights。
  4. 按下Visualize
  5. 檢查版面是否如自己預期

如果不是的話,就再回到Latent Couple Region Mapper進行調整。不過也不需要調整得太過仔細,Stable Diffusion是按照Weight繪製該區域的內容,並不會完整遵循你的限制。

2023-0514-162031.png

再回到Mask這裡,將Canvas調整為512x1024。這部分我不確定是不是一定要調整。許多Latent Couple其實沒有提到這裡的設定。但在我設定之後,感覺上Stable Diffusion才開始照設定的版面繪圖。也許只是心理上的錯覺也說不定?


Step 3. 文字產生圖片 / Text to image

接著就要在txt2img裡面產生圖片。嘗試幾次不同的組合後,我覺得最合理的設定如下:

(8k, best quality, masterpiece, ultra highres:1.2), focused, extreme details, unreal engine 5, cinematic,Amazing, finely detail, A Mother's Day card featuring a pink carnation with its petals blooming, The contrast between the delicate carnation, the mother conveys a gentle, warm atmosphere, showcasing the elegance of the mother, the beauty of maternal love. A girl, a mother,
AND (best quality:1.3), room,
AND (best quality:1.3), child give a bouquet of carnations as a present to mature woman, mother sit, mother smiling, look at each other, A Mother's Day card featuring a pink carnation with its petals blooming, and in the center, a mother smilingly receives a gift from her child. The card bears the slogan "Happy Mother's Day. You are the most wonderful presence in our lives," expressing love and gratitude to the mother. The contrast between the delicate carnation and the mother conveys a gentle and warm atmosphere, showcasing the elegance of the mother and the beauty of maternal love.


Negative prompt: (worst quality:2.0),
Steps: 16, Sampler: DPM++ SDE Karras, CFG scale: 4, Seed: 3328305521, Size: 512x1024, Model hash: f20c91bd27, Model: ghostmix_v12, Denoising strength: 0.6, Clip skip: 2, ENSD: 31337, ControlNet 0 Enabled: True, ControlNet 0 Preprocessor: tile_resample, ControlNet 0 Model: control_v11f1e_sd15_tile [a371b31b], ControlNet 0 Weight: 1, ControlNet 0 Starting Step: 0, ControlNet 0 Ending Step: 1, ControlNet 0 Resize Mode: Crop and Resize, ControlNet 0 Pixel Perfect: True, ControlNet 0 Control Mode: Balanced, ControlNet 0 Preprocessor Parameters: "(64, 8, 64)", Hires upscale: 2, Hires upscaler: R-ESRGAN 4x+

出來的結果如下:

00086-3328305521.png

這些設定中有些事項需要額外注意。

2023-0514-163845.png

使用Latent Couple的好處是可以用「AND」為不同區域指定不同的prompt。我們的區域有gloabl、區域1、區域2,所以可以用兩個「AND」來指定這些區域的畫法。我在這些區域的prompt設定如下,中間用換行跟「AND」隔開:

  • Global: (8k, best quality, masterpiece, ultra highres:1.2), focused, extreme details, unreal engine 5, cinematic,Amazing, finely detail, A Mother's Day card featuring a pink carnation with its petals blooming, The contrast between the delicate carnation, the mother conveys a gentle, warm atmosphere, showcasing the elegance of the mother, the beauty of maternal love. A girl, a mother,
  • Area 1: AND (best quality:1.3), room,
  • Area 2: AND (best quality:1.3), child give a bouquet of carnations as a present to mature woman, mother sit, mother smiling, look at each other, A Mother's Day card featuring a pink carnation with its petals blooming, and in the center, a mother smilingly receives a gift from her child. The card bears the slogan "Happy Mother's Day. You are the most wonderful presence in our lives," expressing love and gratitude to the mother. The contrast between the delicate carnation and the mother conveys a gentle and warm atmosphere, showcasing the elegance of the mother and the beauty of maternal love.

prompt很多內容參考自Polatouche 飛鼠畫さん的分享。

2023-0514-164414.png

另一個重要的設定是加入了ControlNet tile的控制。tile可以讓畫面整體添增很多細節。我通常會把Down Sampling Rate開到8,它可以大幅度修正很多本來很奇怪的地方。

2023-0514-164602.png

使用GhostMix模型還要注意的VAE有沒有設定成「vae-ft-mse-840000-ema-pruned.ckpt」或是「kl-f8-anme2.ckpt」,而不要用預設的Automatic,不然畫面會看起來灰濛濛的。


仍需修正 / Problems

00086-3328305521.png

這張圖片的問題仍多到不行,似乎也沒辦法單純靠修正來改善。我這次的主要目的是記錄Latent Couple的用法,修正圖片就不是這次的主題了。

以下記錄一下這張圖片的問題。

2023-0514-165258.png

右下角出現了文字。

2023-0514-165505.png

小女孩身上有很多手。

2023-0514-165911.png

腳已經萎縮了。

2023-0514-170435.png

兩人沒有在對視。

2023-0514-170112.png

這領口有點低。

綜合以上問題來看,可能修正prompt或是重抽seed會比較快一點。


另一個完成品 / Another finished product

00005-3328305521.png

這是之前做的另一個完成品。雖然我試著用同樣的參數來重製看看,但是似乎ControlNet tile那邊的隨機性導致我一直做不出一樣的圖片。

大家看看就好。

祝大家母親節快樂啦!


最後要來提問的是:你覺得AI繪圖真的能用嗎?

下面講講你的看法吧。