Nodes/XB_ToolBox/XB-llama - 🎯 JSON转BBox
ComfyUI Node

XB-llama - 🎯 JSON转BBox

Turn your LLM's bounding-box JSON into real BBOX wires

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-llama - 🎯 JSON转BBox
  • image
  • bboxes
  • image_list
json
modesimple
label

A vision LLM (like a Qwen3-VL GGUF through XB_llamaInstruct) is great at finding objects, but it reports its findings as JSON text: {"bbox_2d": [x1, y1, x2, y2], "label": "cat"}. Nothing downstream in ComfyUI speaks that dialect. XB_llamaJSON2BBox parses that JSON and turns it into proper BBOX wires, so the boxes your local VLM found can drive real masking, detailing, or cropping pipelines.

This is the bridge between the "LLM does detection" half of the workflow and the "detection does the work" half. The KB's masking-detection essay is the perfect mental model: the LLM is playing the detector role, and this node is what makes its output consumable by everything after it.

Inputs

  • json - the STRING wire carrying the LLM's bbox output. This is where the Vision - *Bounding Box preset's output goes.
  • mode - simple, Qwen3-VL, or Qwen2.5-VL. The simple mode expects coordinates in pixel space. Qwen modes expect the normalized 0–1000 coordinate convention those models output, and they require an image input because the node has to scale normalized coordinates to actual pixel dimensions.
  • label - optional filter: keep only bboxes whose label matches. Empty string keeps everything.
  • image (optional) - needed for Qwen modes, and used to draw the boxes onto a copy of the image.

Outputs

  • bboxes - a list of BBOX values, one per detected object, ready for XB_llamaBBox2Mask / XB_llamaBBox2SEGS / XB_llamaBBoxes2BBox.
  • image_list - the input image(s) with colored boxes and labels drawn on. Handy for visually verifying the detection actually found what you asked for before you commit the boxes downstream. Each label gets its own color.

Installing it

Standard XB_ToolBox install (ComfyUI Manager search XB_ToolBox, or git clone), then restart. This node itself needs only ComfyUI core, but it's useless without the llama stack above it - so if you're not running llama-cpp-python yet, see the XB_llamaModelLoader article first.

Where people get burned

Three things, in order of frequency:

  1. Wrong mode. Feeding Qwen-normalized coordinates (0–1000) through simple mode produces boxes that are a fraction of the image - everything's in the top-left corner. If your boxes look tiny or wrong, you're almost certainly on the wrong mode.
  2. Qwen mode without an image. The node raises a hard error (Qwen 模式需要输入图像!) rather than guessing, which is the correct behavior - just remember the image has to be wired in.
  3. Malformed JSON from the LLM. Local 8B models wrap output in markdown fences or add preamble. The node strips ```json fences, but if the model still wraps the list in prose, parse fails and you'll see a clear 无法解析 JSON 数据! error. Fix: steer the prompt harder, or run the output through XB_llamaParseJSON / XB_llamaUnpackCodeBlock to clean it before it hits this node. And as always with VLM detection, audit the drawn image_list before trusting the boxes - hallucinated boxes are real, and the visualization is your cheapest sanity check.
CategoryXB-llama

Inputs (4)

NameTypeDefaultDescription
jsonSTRING
modeCOMBOsimple3 options: simple, Qwen3-VL, Qwen2.5-VL
labelSTRING仅选择特定标签的 BBox
imageoptIMAGE

Outputs (2)

NameTypeDescription
bboxesBBOX
image_listIMAGE