Nodes/ComfyUI_InternVL3/Florence2 BBoxes 坐标
ComfyUI Node

Florence2 BBoxes 坐标

Get Object Centers Out of Detection Boxes

By 1H-hobit·Created about a year ago·Updated 11 months ago· 2
Florence2 BBoxes 坐标
  • data
  • center_coordinates
  • BBOXES
  • BBOX_xyxy
  • BBOX_xywh
  • BBOXES_first_mask
  • first_mask_index
index0
batchfalse

Half the time you run object detection in ComfyUI, you don't actually want the box - you want the point: where in the image is the thing. Florence2toCoordinates_hb (display name "Florence2 BBoxes 坐标") is a utility from the 1H-hobit/ComfyUI_InternVL3 pack that takes a BBOXES structure - the batch-of-boxes format Florence2 and InternVL detection nodes emit - and hands back the center of each box as JSON coordinates, plus the box in every flat format a downstream node might ask for.

The mechanism

Feed it data (BBOXES), and it walks the boxes, takes the first four coordinates, and computes the center with integer division: center_x = (x1 + x2) // 2. Which boxes get processed is controlled by:

  • index - default "0", i.e. just the first box per batch. Comma-separate for more ("0,2,5"), or leave empty to grab all of the first batch.
  • batch - false processes only the first batch; true walks every batch.

A box whose first two coordinates are 0,0 - the "nothing detected here" padding box this ecosystem loves to emit - is treated as no detection: it gets zeroed out and yields a center of [0,0] rather than garbage.

Outputs - one value, four disguises

  • center_coordinates - a STRING of JSON: [{"x": 512, "y": 384}, ...]. This is the point you wire into regional conditioning, paint-at-position nodes, or targeted inpainting coordinates.
  • BBOXES - the 2D batch structure, valid boxes only.
  • BBOX_xyxy / BBOX_xywh - flat lists, one with width/height computed. Pick whichever your crop or mask node wants.
  • BBOXES_first_mask and first_mask_index - the first valid box in the 3D [[[x1,y1,x2,y2]]] format some mask/SAM nodes expect, plus its index (or -1 if nothing valid was found). Handy when a batch of detections has one real hit and a wall of padding.

Install

It's part of the InternVL3 pack. Manager → search ComfyUI_InternVL3, or:

cd ComfyUI/custom_nodes
git clone https://github.com/1H-hobit/ComfyUI_InternVL3.git

Restart ComfyUI. The pack has no requirements.txt, so nothing installs automatically - it uses whatever torch/transformers is already there. The model-loading nodes (which pull InternVL3-1B into ComfyUI/models/LLM and need bitsandbytes for quantization) are the heavy part; this node is just list math and runs with no model at all.

Watch out

The name says Florence2, but the node doesn't ship or call Florence2 - it consumes whatever BBOXES you feed it, from Microsoft's Florence2 nodes, this pack's own InternVL detections, or anything else that speaks the format. And the coordinates come out as raw integers straight from the box, so feed it pixel-space boxes - if your detection node outputs normalized 0–1 values, centers will collapse to 0 or 1 and the whole point is lost. Honestly, that's the one trap worth remembering; otherwise this is a "plug it in and read the JSON" node.

Categoryinternvl

Inputs (3)

NameTypeDefaultDescription
dataBBOXES
indexSTRING0
batchBOOLEANfalse

Outputs (6)

NameTypeDescription
center_coordinatesSTRING
BBOXESBBOXES
BBOX_xyxyBBOX
BBOX_xywhBBOX
BBOXES_first_maskBBOXES
first_mask_indexINT