Nodes/comfyui_gr85/Florence2RunCTPG (GR85)
ComfyUI Node

Florence2RunCTPG (GR85)

Find things in an image by describing them in words

By veighnsche·Created 2 years ago·Updated 8 months ago· 1
Florence2RunCTPG (GR85)
  • image
  • florence2_model
  • image
  • mask
  • caption
  • data
text_input
fill_masktrue
combine_maskstrue
keep_model_loadedfalse
max_new_tokens1024
num_beams3
do_sampletrue
output_mask_select
seed1

CTPG stands for Caption to Phrase Grounding - one of Florence-2's built-in tasks, and a genuinely useful one: instead of running a fixed object detector with a closed vocabulary, you hand it a phrase in plain language ("the woman's jacket", "the car in the background") and it locates that specific thing in the image, bounding box and mask included. This node is GR85's wrapper for running that task.

What it needs, and the one thing that trips people up. image is your standard IMAGE input. florence2_model takes a type called FL2MODEL - and this node does not load that model itself. FL2MODEL is produced by a separate Florence-2 loader node from another pack (community setups typically use one like kijai's ComfyUI-Florence2, which downloads the actual model weights and outputs the FL2MODEL object this node expects). If you only install comfyui_gr85, you'll have this node in your library but nothing to plug into florence2_model - you need a Florence-2 loader pack installed alongside it. text_input is the phrase (or list of phrases, if you're feeding it from GR85_CTGPhrases/GR85_CTGPhrasesSimple) describing what to find.

The toggles that matter. fill_mask (default true) controls whether detected regions come back as filled solid masks rather than outlines. combine_masks (default true) merges multiple detected regions into a single mask output instead of keeping them separate - turn it off if you need per-detection masks downstream. The optional fields give you generation control over the underlying VLM: max_new_tokens (default 1024) caps how much text it can generate internally, num_beams (default 3) is standard beam-search width, do_sample (default true) enables sampling rather than greedy decoding, seed makes that sampling reproducible, output_mask_select lets you pick which detected output to use if there are several, and keep_model_loaded (default false) skips unloading the model between runs - flip it on if you're running this node repeatedly in a session and don't want the reload cost every time.

Outputs. image passes the input through (or an annotated version, depending on the pack's implementation), mask is your grounded region as a mask ready for inpainting or compositing, caption gives you back text describing what it found, and data is the raw JSON - bounding boxes and detection metadata - which is exactly what GR85_Florence2toCoordinatesGR85 is built to consume next.

Installing it. Search "comfyui_gr85" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/veighnsche/comfyui_gr85

Restart ComfyUI. Beyond that, install a Florence-2 model loader pack separately - this node is the consumer, not the source, of the FL2MODEL.

Common issues. The FL2MODEL type mismatch is the number one snag: if the wire from your loader won't connect, check that the loader you installed actually outputs FL2MODEL and not some other type name. Florence-2 itself is a real VLM running inference, so expect meaningfully more VRAM and time cost than a plain detector - if you're running this on a batch, keep_model_loaded will save you real time versus reloading per image. And because this is a language-model-driven grounding task rather than a fixed-class detector, the quality of what it finds depends heavily on how you phrase text_input - vague phrases get vague or missing detections, specific ones ground reliably.

CategoryGR85/Florence2

Inputs (11)

NameTypeDefaultDescription
imageIMAGE
florence2_modelFL2MODEL
text_inputSTRING
fill_maskBOOLEANtrue
combine_masksBOOLEANtrue
keep_model_loadedoptBOOLEANfalse
max_new_tokensoptINT10241–4096
num_beamsoptINT31–64
do_sampleoptBOOLEANtrue
output_mask_selectoptSTRING
seedoptINT11–18446744073709550000

Outputs (4)

NameTypeDescription
imageIMAGE
maskMASK
captionSTRING
dataJSON