GLM Vision BBox Extractor
Ask GLM where the logos are and get clean bbox JSON back
- image
- bbox_json
Local OCR is great at finding text, but text-only detectors are blind to the things you actually want to remove from a product shot: stylized logos, badges, banners, storefronts, warranty seals - the visual furniture that has no clean text box around it. This node skips the detector entirely and asks a vision model, GLM, to look at the image and hand back bounding boxes as JSON. It's the semantic half of the mask pipeline, and it runs on a cloud API rather than your GPU.
The default prompt (it's in Chinese, matching the GLM endpoint's home turf) asks for JSON boxes covering banners, logos, brands, platforms, activities, warranty, and store-related regions - i.e., everything an e-commerce cleanup would want gone. You can edit that prompt to anything: "find all the text regions," "mark the face," whatever produces boxes.
How it works
Mechanically this is a thin, dependency-free wrapper: it base64-encodes your image, POSTs an OpenAI-compatible chat-completions request to the configurable endpoint (default Zhipu's https://open.bigmodel.cn/api/paas/v4/chat/completions, model glm-4.6v-flash) using only Python's standard urllib, and returns the parsed JSON.
The useful part is what happens after the model talks: the node strips markdown fences and surrounding prose, keeps only desc, class, and bbox per item, and preserves the model's bbox values verbatim - no scaling, no swapping, no clamping. That means whatever coordinate rules your prompt asked for (normalized 0–1000, pixel, x-first or y-first) are the rules downstream must use. Malformed items get dropped, but zero-area, reversed, negative, and fractional coordinates are kept for downstream to interpret. One image per call; a batch larger than one raises an error.
Inputs
image- exactly one image.prompt- the instruction that defines what to box and in what coordinate system. Default is the Chinese logo/banner prompt.api_key- your Zhipu/BigModel key, entered directly on the node. It's not stored in the repo, and it's not persisted in any config file.endpoint/model- override if you're pointed at a proxy or a different GLM model.
Output: bbox_json - the cleaned JSON string. Wire it to the pack's GLM BBox JSON To Mask (set coord_base and coordinate_order to match what your prompt asked for) or to GLM BBox JSON Protected Expand.
Installing
Part of comfyui-dsocr-bbox. ComfyUI Manager (search "dsocr") or:
cd ComfyUI/custom_nodes
git clone https://github.com/maomaozi/comfyui-dsocr-bbox
restart, and you're done - the GLM nodes add zero package dependencies (stdlib only). The rapidocr-onnxruntime requirement in the pack's requirements.txt is for the local-OCR nodes, not this one.
The honest gotchas
This is an API node that carries a credential, which is exactly the shape of thing worth a skeptical look (the community has been burned once by a "vision" node that turned out malicious - this one is plain urllib, no telemetry, and the key lives only where you type it, but check anything you install regardless). It costs per call and your image leaves the machine - fine for product-cleanup batches, wrong for private data.
The real footgun is coordinate discipline. The node deliberately does not normalize what GLM returns, so if your prompt says "normalized 0–1000" but your downstream mask expects pixels, your mask is garbage. The 429 handling is decent - the free Flash tier throttles, and the node retries a few times with backoff before failing - so the most common real error you'll hit is a wrong or missing api_key, or a prompt that doesn't pin down the coordinate format.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| prompt | STRING | 输出图中所有banner,logo,品牌,平台,活动,质保,店铺相关描述的区域bbox,输出为json list,格式如下,不要输出任何其他内容/格式: [ { "desc": "官方旗舰店", "class": "店铺", "bbox": [x1,y1,x2,y2] } ] | — |
| endpoint | STRING | https://open.bigmodel.cn/api/paas/v4/chat/completions | — |
| model | STRING | glm-4.6v-flash | — |
| api_key | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| bbox_json | STRING | — |