LayerMask: Object Detector Florence2(Advance)
Object Detector Florence2 — ComfyUI Node Guide
- image
- florence2_model
- bboxes
- preview
This is the text-prompted object detector built on Microsoft's Florence2 - describe what you want in plain language, and it hands back bounding boxes around matches, the same "find this thing by name" job GroundingDINO does elsewhere in the masking world, just running on a different model. If you're already using Florence2 for captioning in your workflow (it shows up as a solid, well-regarded choice for LoRA dataset captioning too), this node lets you reuse the same model for detection instead of adding a separate GroundingDINO dependency.
The mechanism: you load a Florence2 model separately and wire it in, feed the node an image and a text prompt describing your target, and it runs Florence2's detection capability to return bounding boxes plus a confidence-ranked ordering.
Inputs that matter:
image- your source picture.florence2_model- required input, loaded from a separateLoadFlorence2Modelnode elsewhere in the pack. This node doesn't load its own model; it expects one wired in.prompt- plain-text description of the object to find, defaulting to"subject".sort_method-left_to_right,top_to_bottom,big_to_small, orconfidence, deciding the order detections come back in.bbox_select-allkeeps every detection,firstkeeps only the highest-confidence one,by_indexlets you pick specific ones.select_index- only relevant whenbbox_selectisby_index; defaults to"0,"and accepts multiple indices separated by pretty much any non-numeric character (commas, periods, spaces).
Outputs are bboxes (a BBOXES object - this pack's shared format for detection results, which plugs into DrawBBoxMaskV2, the SAM2 nodes, or anywhere else that consumes boxes) and preview, a rendering of the detected boxes over your source image so you can confirm it found the right thing before trusting it further downstream.
Installing it: ComfyUI Manager, search "ComfyUI Layer Style Advance," or manually git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance into custom_nodes, then install_requirements.bat (or Aki variant) / pip install -r requirements.txt, then repair_dependency.bat, restart. Since this node needs a florence2_model input, you'll also need LoadFlorence2Model set up - its models auto-download on first use, or you can grab them ahead of time from the BaiduNetdisk link in the README and copy them to ComfyUI/models/florence2.
Where people get stuck: the most common failure isn't this node at all - it's the missing florence2_model connection, since the node has nothing to do without one wired in. Beyond that, prompt specificity matters a lot here, same as with any text-grounded detector: a vague prompt like the default "subject" works fine on a simple single-subject image but gets ambiguous fast on anything busier, so narrow it (a specific object, a specific person's clothing, whatever you actually need) if detections come back on the wrong thing. And if you're chaining several images/prompts, remember select_index accepts multiple values - you don't need a separate node per detection if you just want the 2nd and 4th boxes, for instance.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| prompt | STRING | subject | — |
| florence2_model | FLORENCE2 | — | |
| sort_method | COMBO | 4 options: left_to_right, top_to_bottom, big_to_small, confidence | |
| bbox_select | COMBO | 3 options: all, first, by_index | |
| select_index | STRING | 0, | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| bboxes | BBOXES | — |
| preview | IMAGE | — |