Nodes/comfyui_gr85/Florence2toCoordinatesGR85
ComfyUI Node

Florence2toCoordinatesGR85

Turning grounding JSON into usable numbers

By veighnsche·Created 2 years ago·Updated 8 months ago· 1
Florence2toCoordinatesGR85
  • data
  • center_coordinates
  • bboxes
index0
batchfalse
image_width
image_height
max_bbox_area_percentage90.0

GR85_Florence2RunCTPG hands you back a JSON blob full of detection data - bounding boxes, labels, whatever Florence-2 found. That's not directly wireable into most downstream nodes, which want coordinates or a BBOX type, not raw JSON. This node is the translation step: feed it that JSON and it extracts actual coordinates you can use.

Inputs. data is the JSON output straight from GR85_Florence2RunCTPG. index (default "0") picks which detection to pull out of that data if there were multiple - Florence-2's grounding can return several matches for a phrase, and this is how you select one. batch (default false) switches modes - enable it if you want to process every detection rather than a single indexed one. Two optional inputs, image_width and image_height, convert the model's normalized coordinates back into actual pixel space for your specific image - Florence-2's outputs are typically resolution-independent internally, so without these the coordinates you get may not map to your image's real dimensions. max_bbox_area_percentage (default 90) is a sanity filter: it caps how large a single detected box is allowed to be as a percentage of the image, which catches the failure mode where a grounding query with no real match in the image gets answered with a box covering almost the whole frame instead of nothing.

Outputs. center_coordinates gives you the center point of the selected detection as a string - useful for anything that wants a click point rather than a full box (a mask-from-point node, a crop-around-point workflow). bboxes gives you the detection as a proper BBOX type, ready for crop, composite, or detail-pass nodes downstream that expect that type specifically.

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

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

Restart ComfyUI. No model downloads attach to this node - the actual Florence-2 inference already happened upstream in GR85_Florence2RunCTPG; this one is pure post-processing on its JSON output.

Common issues. Leave image_width/image_height unset and you risk coordinates that don't line up with your actual image - always wire these to your real image dimensions (a Get Image Size node or similar) rather than skipping them, especially if you've resized the image anywhere between the original detection and this node. If index points past however many detections actually came back for your phrase (say Florence-2 only found one region but you asked for index 1), expect this to either error or silently return nothing useful - check the upstream data with a GR85_ShowText-style inspection if results look empty. And if you're seeing suspiciously huge boxes that seem to cover most of the image, that's exactly the failure mode max_bbox_area_percentage is meant to catch - lower it if oversized false-positive boxes keep slipping through.

CategoryGR85/Florence2

Inputs (6)

NameTypeDefaultDescription
dataJSON
indexSTRING0
batchBOOLEANfalse
image_widthoptINT1–10000
image_heightoptINT1–10000
max_bbox_area_percentageoptFLOAT90.00–100

Outputs (2)

NameTypeDescription
center_coordinatesSTRING
bboxesBBOX