使用場景
如果你看到一張漂亮的圖片然後也想產生類似的圖片
其中一個方法就是產生這個圖片的提示詞prompt
然後拿著這個提示詞到你習慣使用的圖片產生器去產生圖片
該用ChatGPT還是ComfyUI
當然你直接放到ChatGPT把圖告訴他叫他產生提示詞也可以
使用ComfyUI+專用圖像理解模型 和 ChatGPT圖像輸入產生提示詞的差異
ComfyUI+專用圖像理解模型方式來說:
- 本機運作(離線使用)
- 善於提取主體物件、顏色、姿勢
- 創造性少, 偏向于描述事實
如果你想要快速產出給 Stable Diffusion / Midjourney 用的清晰 prompt(含主體/背景), 那就可以用ComfyUI+專用圖像理解模型方式
你想要風格分析、場景重構, 那ChatGPT 更適合
使用ComfyUI的重點是它可以串後續的工作流, 例如我們將這個圖像轉成的提示值當作輸入, 提供給後續的放大圖像的工作使用, 增加放大時候的精準度

步驟
輸入圖像, 選擇適當的圖像理解模型 -> 執行圖像理解模型 -> 產生提示
節點使用說明
節點 1: DownloadAndLoadFlorence2Model
這個節點是下載並載入 Microsoft Florence 2 模型。
- model:
microsoft/Florence-2-base
指定使用的模型版本。這是微軟官方釋出的 base 版本(中等大小)。 - precision:
fp16
使用 16-bit 浮點精度,較省記憶體,適合大多數 GPU。 - attention:
sdpa
使用 Scaled Dot Product Attention 加速注意力機制,通常比傳統方式快。
model的話最佳通用效果可以使用microsoft/Florence-2-large-ft
(最高品質、精度)
我會建議嘗試使用MiaoshouAI 系列, 為 prompt 設計、生成高質感描述, 個人使用Florence2-large-PromptGen-v2.0
版本
節點 2: Florence2Run
這是實際執行模型推論的節點,用來生成圖片描述(caption)或執行其他任務。
🔌 輸入連接:
image
:輸入圖片。florence2_model
:來自上一個節點的模型。
🧾 主要參數設定:
- text_input:
若為空,代表僅執行圖像描述任務;若填入文字,則會執行與輸入文字相關的任務(如問答、填空等)。 - task:
more_detailed_caption
指定任務類型。此設定為「更詳細的圖像說明」(比普通 caption 更豐富)。
可選值例如: - caption
- more_detailed_caption
- visual_question_answering(搭配 text_input 啟用)
- grounding 等
- fill_mask:
true
當使用遮罩任務(如填空或 mask-based task)時是否自動填補遮罩,通常在caption
模式中保持true
即可。 - keep_model_loaded:
false
若為true
,會在多次執行時保留模型於記憶體,節省加載時間但會占用顯存。 - max_new_tokens:
1024
模型最多產生的字數,越多越詳細,但可能會拉長生成時間。 - num_beams:
3
使用 beam search 的 beam 數,越高越穩定(較少重複詞或語病),但耗時也更多。 - do_sample:
true
啟用隨機取樣。若設為false
,生成會比較固定。 - output_mask_select: 未連接
用於特定任務(如 grounding)選擇輸出的遮罩區域,此處暫未使用。 - seed:
252416312532741
隨機種子。固定這個數字可保證每次生成結果一致。 - control after generate:
fixed
控制生成後的輸出行為,選項可能與多任務處理相關,通常保留預設fixed
即可。
效果
原圖:

產生的提示
A photo-realistic shoot from a profile camera angle about a female character in ornate golden armor, seated in a contemplative pose, with long white hair tied in a ponytail. the image also shows a dark background with a subtle gradient effect. on the middle of the image, a 1woman, who appears to be in her mid-twenties, is sitting with her upper body facing the viewer, looking to the side with a serious expression. she has light skin, blue eyes, and a slender physique. she is wearing a gold armor with intricate details, including shoulder armor, gauntlets, and thigh boots. her hair is styled in a long ponytail, and her hair color is white hair. her eye color is not specified. her facial expression is neutral. her body is slim, and she is facing away from the viewer.
利用提示再生成的圖像(Flux-1.dev)來看一下產生提示詞的準確度, 當然也和生圖模型的理解力有關:

被穿褲子了 😎
除了盤坐姿勢, 其他如頭髮, 膚色, 衣服盔甲都有很好的被描述出來
之後如果要做放大效果, 就再輔助例如controlnet就可以將結構再現