XB-llama - 🎯 JSON转BBox
Turn your LLM's bounding-box JSON into real BBOX wires
- image
- bboxes
- image_list
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
STRINGwire carrying the LLM's bbox output. This is where theVision - *Bounding Boxpreset's output goes. - mode -
simple,Qwen3-VL, orQwen2.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
BBOXvalues, one per detected object, ready forXB_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:
- Wrong mode. Feeding Qwen-normalized coordinates (0–1000) through
simplemode 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. - 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. - 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 throughXB_llamaParseJSON/XB_llamaUnpackCodeBlockto clean it before it hits this node. And as always with VLM detection, audit the drawnimage_listbefore trusting the boxes - hallucinated boxes are real, and the visualization is your cheapest sanity check.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| json | STRING | — | |
| mode | COMBO | simple | 3 options: simple, Qwen3-VL, Qwen2.5-VL |
| label | STRING | 仅选择特定标签的 BBox | |
| imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| bboxes | BBOX | — |
| image_list | IMAGE | — |