545 字
3 分钟
StableDiffusion:提示词反推
1. 说明
当看到一张喜欢的图,却不知道该如何描述时,可以使用提示词反推的方案。利用AI的 图生文 功能,可以轻松地获得提示词内容。
- 使用WD 14反推方案,可以获得基于词组的提示词。
- 使用Florence 2反推方案,可以获得基于自然语言的提示词。
2. WD 14反推:WebUI方式
2.1 插件安装
-
节点网站:https://github.com/picobyte/stable-diffusion-webui-wd14-tagger
-
手动通过git clone安装
-
安装环境依赖
Terminal window pip install -r requirements.txt
2.2 模型下载
- 使用反推图像功能时,会自动下载模型
2.3 提示词反推

2.4 提示词反推+图像再生成
| 参考图像 | AI生成图像:CetusMix |
|---|---|
![]() | ![]() |
3. WD 14反推:ComfyUI方式
3.1 节点安装
-
手动通过git clone安装,也可以通过节点管理器安装。
-
安装环境依赖
Terminal window pip install -r requirements.txt
3.2 模型下载
- 以wd-v1-4-moat-tagger-v2为例:
- 下载onnx模型model.onnx至ComfyUI/custom_nodes/ComfyUI-WD14-Tagger/models中,并重命名为wd-v1-4-moat-tagger-v2.onnx
- 下载csv文件selected_tag.csv至ComfyUI/custom_nodes/ComfyUI-WD14-Tagger/models中,并重命名为wd-v1-4-moat-tagger-v2.csv
3.3 提示词反推

3.4 提示词反推+图像再生成

| 参考图像 | AI生成图像:CetusMix |
|---|---|
![]() | ![]() |
4. Florence 2反推:WebUI方式
4.1 插件安装
- 节点网站:https://github.com/ilyq/sd-webui-florence-2
- 手动通过git clone安装
4.2 修改代码
- 注释line 43:
imports.remove("flash_attn"),不用安装flash_attn组件
4.3 模型下载
- 下载位置:stable-diffusion-webui/models/florence2/microsoft
- hf-mirror仓库
- modelscope仓库
4.4 提示词反推

4.5 提示词反推+图像再生成
| 参考图像 | AI生成图像:CetusMix |
|---|---|
![]() | ![]() |
5. Florence 2反推:ComfyUI方式
5.1 节点安装
- 节点网站:https://github.com/kijai/ComfyUI-Florence2
- 建议通过git clone安装
- 安装环境依赖
pip install -r requirements.txt5.2 模型下载
- 下载位置:ComfyUI/models/LLM
- hf-mirror仓库
- modelscope仓库
5.3 提示词反推

5.4 提示词反推+图像再生成

| 参考图像 | AI生成图像:FLUX |
|---|---|
![]() | ![]() |
6. 使用经验
通过提示词反推出来的结果,不一定十分准确。如果需要精确出图,建议分步处理:
- 用提示词反推方案,获得提示词
- 对提示词内容进行修正
- 生成图像




