Use GLM-4.7V's multimodal grounding capability to detect and locate objects/text in images. Activate when user asks to find, locate, detect, or ground specific objects, text, UI elements, or regions in an image. Also triggers on phrases like "找到xxx的位置", "框出xxx", "定位xxx", "grounding", "bounding box", "坐标框".
利用 GLM-4.7V 的 grounding 能力,在图片中定位目标对象或文字,输出带标注框的结果图。
用户输入(图片 + prompt)
│
▼
HttpInterface() → 调用模型 API → 得到 response 文本
│
▼
parsebboxesfrom_response() → 从回复中解析出坐标框列表
│
▼
visualize_boxes(renormalize=True) → 反归一化 + 画框 → 保存结果图
使用 HttpInterface 调用模型 API:
python
import os
os.environ[NO_PROXY] =
os.environ[no_proxy] =
from interface_http import HttpInterface
url = http://
prompt = 请在这张图中找到所有{target},并以 [xmin, ymin, xmax, ymax] 格式输出每个目标的边界框坐标,坐标值为 0-1000 的归一化整数。每个目标一行,格式如下:
目标名称: [xmin, ymin, xmax, ymax]
response = HttpInterface(url, prompt, images=[imagepath], nothink=True)
注意: 调用前需设置 NO_PROXY 环境变量跳过代理,否则内网请求会被代理拦截。
python
from utilsboxes import parsebboxesfromresponse
boxes = parsebboxesfrom_response(response)
parsebboxesfrom_response 会自动:
python
from utilsboxes import visualizeboxes
visualize_boxes(
imgpath=imagepath,
boxes=boxes, # parsebboxesfrom_response 的输出
labels=[label1, label2], # 每个框的标签
renormalize=True, # 自动将 0-1000 归一化转为像素坐标
save_path=output.jpg,
colors=[red, blue], # 可选
thickness=[2, 3], # 可选
)
renormalize=True 时,内部自动调用 reversenormalizebox:pixel = coord * img_dimension / 1000
python
import os
os.environ[NO_PROXY] = 172.20.112.202
os.environ[no_proxy] = 172.20.112.202
from interface_http import HttpInterface
from utilsboxes import parsebboxesfromresponse, visualize_boxes
url = http://172.20.112.202:5002/v1/chat/completions
img = /path/to/image.jpg
| 函数 | 作用 |
|---|---|
| HttpInterface(url, prompt, images, nothink) | 调用模型 API,返回文本回复 |
| parsebboxesfromresponse(text) |
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 vlm-grounding-1776115574 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 vlm-grounding-1776115574 技能
skillhub install vlm-grounding-1776115574
文件大小: 648.46 KB | 发布时间: 2026-4-17 16:30