0%
Loading ...

[AI 繪圖中級篇教學] Stable Diffusion WebUI WD14 Tagger 介紹

image 1735210859325

前言

一鍵搞定反推提詞與 LoRA 自動打標吧!

反推 prompt 以及要訓練 LoRA 時的自動打標一直是很熱門的議題。

雖然 SD WebUI 本來就有反推 prompt 的功能,但卻不盡人意。

補充: 如果你想知道原本 SD WebUI 的反推 prompt 功能在哪裡,
你可以切到圖生圖的頁面,他現在藏在 Generate 按鈕的底下一堆小 icon 之中,可以選擇用 CLIP 或是 DeepBooru 反推。有種說法是 CLIP 推出來的比較接近自然語言所以適合畫真實系,DeepBooru 比較像是一堆 tag 適合畫動漫系。

因此接下來我們會使用 stable-diffusion-webui-wd14-tagger 這個擴充功能來幫我們完成這件事情。

前置準備

替 WebUI 安裝 stable-diffusion-webui-wd14-tagger

你可以到擴充功能的頁面搜尋然後一鍵安裝,
也可以直接 clone 了之後丟到 WebUI 的對應資料夾 (stable-diffusion-webui/extensions)。

git clone https://github.com/picobyte/stable-diffusion-webui-wd14-tagger

安裝好之後 refresh UI,就會發現多了一個頁籤叫做 tagger

步驟

Stable Diffusion WebUI 單張反推 prompt

file
有很多反推器,不過我自己覺得 WD14 SwinV2 v1 的效果最好。

像是光憑這張就能推出這些詞,真的蠻厲害。

1girl, barefoot, long hair, sitting, solo, water, jewelry, dress, very long hair, bare shoulders, bangs, full body, breasts, aqua hair, bracelet, thighlet, gem, feet, floating hair, parted lips, aqua dress, hands up, looking at viewer, fish, white dress, armlet, medium breasts

Stable Diffusion WebUI 批量反推 prompt

如果是已經蒐集到一堆圖,想要反推提詞以便拿來訓練 LoRA 的話的人真的有福了😂

我拿了我的一百多張作品為例,並把圖切成指定尺寸之後用 tagger 來反推,
我的命名習慣是在輸入資料夾的後面加個 _p,表示這裡面裝的是處理過的文字檔,之後再自己把圖檔跟文字檔合併回去,這樣想重試反推器也比較容易 XD

file

文字檔的檔名能夠跟相對應的圖檔對上,所以隨便打開一個反推出來的提詞檔案大概會長這樣:

1girl, jewelry, solo, blue eyes, earrings, long hair, gem, necklace, blue hair, parted lips, blue gemstone, upper body, looking at viewer, red lips, lips, dress, flower, blue flower, eyelashes, crystal, makeup

如果你正要訓練 LoRA 且想要指定觸發詞 (trigger word),例如這樣的呼叫方法:

dpys, <lora:dpys_god_of_eyes_first-ver:1>,

此時你可以在 卸載所有反推模型 的下方有個 附加標籤 (逗號分隔) 中的輸入框輸入:

dpys, 

他就會自動把你指定的 tag 加在所有文字 prompt 的最前面。

dpys, 1girl, jewelry, solo, blue eyes, earrings, long hair, gem, necklace, blue hair, parted lips, blue gemstone, upper body, looking at viewer, red lips, lips, dress, flower, blue flower, eyelashes, crystal, makeup

結語

不嫌麻煩的話,其實也是可以用 ChatGPT 或其他多模態模型來反推 prompt 啦 😂

數據女巫 𝔻.𝕡𝕪𝕤 🔮

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.