Florence2 Box Coordinates (RMBG)
Turn Florence-2 detections into boxes and points
- data
- image
- CENTER_COORDINATES
- BBOXES
- MASK
The Florence2 node finds things and gives you a mask plus a JSON blob of raw detections. This node is what you attach to that JSON blob to get usable geometry out of it - center coordinates, bounding boxes, and a mask you can act on. It's the adapter between "Florence-2 detected stuff" and "now crop/place/route based on where the stuff is."
On its own it does nothing; it's a companion to Florence2. But paired with it, it unlocks the automation cases: detect an object by text, get its bounding box, crop to it. Detect a face, get its center, place something there. This is the node that makes Florence-2 detections drive the rest of a graph instead of just producing a picture.
How it works
Florence2's DATA output is JSON describing what it found - labels and their coordinates. This node parses that JSON and extracts the parts a ComfyUI graph can use: it emits the center point as a string, the bounding boxes in ComfyUI's BBOX type, and a mask. You pick which detection you want with an index.
The inputs and outputs that matter
data(required JSON) - wire this straight from the Florence2 node's DATA output. This is the input the whole node exists to consume.index- which detection to pull. Florence-2 often returns several; the index selects one (or, with batching, drives iteration). Leave it to grab the first/default.batch(default off) - process all detections instead of a single one, for when you want every box, not just one.image(optional) - pass the source image through so coordinates resolve against the right dimensions.
Outputs: CENTER_COORDINATES (a string, easy to route into placement logic), BBOXES (the ComfyUI BBOX type, which feeds crop-by-bbox nodes), and MASK.
How to install it
- ComfyUI Manager: search
Comfyui-RMBG, install, restart. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/1038lab/ComfyUI-RMBG, thenpip install -r requirements.txt, and restart.
No model of its own - it just parses Florence-2's output. It needs the Florence2 node upstream to have anything to parse.
Common issues
If you get nothing out, the usual cause is that the upstream Florence2 node found nothing - its text_prompt was empty or matched no object - so the DATA blob is empty and there's nothing to extract. Fix the detection first, then this node has something to work with. The other thing: your index can point past the number of detections that actually exist (ask for the third box when Florence-2 found two), which returns empty. When in doubt, turn on batch to see everything, or wire the annotated image from Florence2 to a preview so you can see how many detections there really are before you index into them.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| data | JSON | Florence2 JSON output (list per image). | |
| index | STRING | Comma-separated indexes; blank = use all boxes from first item. | |
| batch | BOOLEAN | false | If true, gather boxes across the batch. |
| imageopt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| CENTER_COORDINATES | STRING | — |
| BBOXES | BBOX | — |
| MASK | MASK | — |