微算力 · API 导航与自营网关
API 接入 EN
未登录登录
✨

GLM-V-Grounding

GLM-V-Grounding · v1.0.5
安全 A 级 作者 jaredforreal 公开目录收录
1k 下载 1 安装 3.9k 收藏 18 浏览

简介

GLM-V-Grounding

原始描述

A skill that uses GLM-V native grounding capabilities for coordinate conversion, bounding-box visualization, and more. GLM-V native grounding can locate any...

通过你的 Agent 添加

安装目录:glmv-grounding/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/glm-v-grounding/
Codex CLI~/.codex/skills/glm-v-grounding/
DeepSeek Harness~/.agents/skills/glm-v-grounding/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

GLMV-Grounding Skill 是智谱AI官方推出的视觉定位增强工具,基于GLM-V原生grounding能力实现图像与视频的多模态理解。该技能通过调用Zhipu AI官方API,支持三大核心场景:图像目标定位(2D边界框、2D点、3D边界框)、视频目标追踪(时空序列检测)以及可视化渲染(自动生成标注图像/视频)。

用户通过CLI工具glm_grounding_cli.py传入图像/视频URL及自然语言提示词,模型返回归一化坐标(0-1000范围)并完成可视化输出。技能内置完整的工具链,包括坐标解析、归一化/反归一化转换、多种可视化格式(红色边界框、自定义标签、线宽调节)以及视频帧级追踪渲染。

显著优点

1. 官方技术背书:直接对接智谱AI GLM-V大模型,享受前沿多模态能力,无需自建视觉理解基础设施。

2. 输出格式标准化:统一采用0-1000归一化坐标系,自动兼容2D bbox、3D bbox、点集、多边形及视频追踪JSON等多种格式,便于下游系统集成。

3. 可视化能力完整:集成PIL、OpenCV、Matplotlib等成熟库,支持一键生成带标注的可视化结果,降低技术使用门槛。

4. 安全防护到位:实现URL白名单验证(阻断localhost/私有IP)、固定API端点、请求超时控制,有效防范SSRF攻击和配置漂移风险。

5. 扩展性良好:模块化设计,utility函数可独立调用,便于集成至更大的视觉处理流水线。

潜在缺点与局限性

1. 外部依赖较重:必须配置ZHIPU_API_KEY,且核心计算完全依赖Zhipu AI云服务,存在网络延迟和API可用性风险;离线场景无法使用。

2. 系统依赖复杂:视频处理需预装ffmpeg,且Python依赖包含decord等编译型包,跨平台部署(尤其Windows/arm64)可能遇到兼容性问题。

3. 坐标精度受限:归一化至0-1000的相对坐标在大分辨率图像上可能损失亚像素精度,对高精度测量场景不够理想。

4. 成本不可控:按API调用量计费,批量处理大量视频/高分辨率图像时成本可能显著上升,无本地缓存或批量优化机制。

5. 可视化风格固定:默认渲染样式(颜色、字体、标签格式)虽可参数调节,但灵活性不如专业标注工具,定制化需求需二次开发。

适合的目标群体

  • 计算机视觉开发者:需快速验证grounding算法效果或构建原型系统
  • 内容创作者/运营人员:需要自动化图像标注、视频内容分析工具
  • 科研教育用户:进行多模态大模型能力评测、教学演示
  • 智能客服/安防监控:需要集成目标检测能力的垂直应用开发者

使用风险

性能风险:大文件上传至云端API可能超时(默认60秒),高分辨率视频处理延迟明显;建议配置GLM_GROUNDING_TIMEOUT环境变量并压缩输入。

数据安全风险:图像、视频及提示词需上传至Zhipu AI服务器,涉及敏感内容(人脸、机密文档)时存在合规风险,建议部署前完成隐私影响评估。

依赖项风险:ffmpeg版本差异可能导致视频编解码失败;decord库维护状态不稳定,长期可能面临依赖弃用问题。

API成本风险:未内置用量监控或预算熔断机制,异常循环调用可能导致费用激增,建议外层封装调用配额控制。

技能正文


name: glmv-grounding description: > A skill that uses GLM-V native grounding capabilities for coordinate conversion, bounding-box visualization, and more. GLM-V native grounding can locate any target specified by the prompt in an image and output relative coordinates normalized to 0-1000 based on image size. Coordinate formats include 2D bounding box (default), 2D points, and 3D bounding box. GLM-V also supports spatiotemporal localization and tracking of multiple prompt-specified targets in videos, outputting 2D bounding boxes per second. metadata: openclaw: requires: env: - ZHIPU_API_KEY - GLM_GROUNDING_TIMEOUT primaryEnv: ZHIPU_API_KEY emoji: "🖼️" source: https://github.com/zai-org/GLM-V/tree/main/skills/glmv-grounding homepage: https://github.com/zai-org/GLM-V/tree/main/skills/glmv-grounding

GLMV-Grounding Skill

Extract and visualize grounding results produced by GLM-V. Depending on the user prompt, grounding coordinates in model outputs may appear in different forms, including 2D bounding boxes, Objects Detection JSON, 2D points, 3D bounding boxes, and target-tracking JSON.

Note: GLM-V outputs coordinates where x and y are relative coordinates normalized from pixel coordinates x_pixel and y_pixel using image width W and height H (range 0-1000), i.e., x=round(x_pixel/W1000), y=round(y_pixel/H1000). The origin of the pixel coordinate system is the top-left corner. Note: If the prompt does not explicitly specify a grounding format (for example, "find the location of xxx" or "draw a box around xxx"), treat the request as 2D bounding boxes by default.

When to use

  • Use GLM-V to ground targets in images: obtain grounding results in an image for any prompt-described target, with output formats such as 2D bounding box (default), 2D points, and 3D bounding box.
  • Use GLM-V to track targets in videos: obtain tracking results in a video for any prompt-described target, with output format like {"0": [{"label": ..., "bbox_2d": ...}, ...], ...}.
  • Use utility functions for extraction, conversion, and visualization: extract coordinates, points, and JSON from natural text; normalize and de-normalize coordinates; visualize boxes, points, 3D boxes, and video tracking results.

Setup your API Key

Configure ZHIPU_API_KEY to call the GLM-V API.

  1. Get your API key: https://www.bigmodel.cn/usercenter/proj-mgmt/apikeys
  2. Configure it with:
python scripts/config_setup.py setup --api-key YOUR_KEY

Security & Transparency

  • Primary API key env: ZHIPU_API_KEY (required).
  • Timeout env: GLM_GROUNDING_TIMEOUT (optional, seconds, default 60).
  • API endpoint: fixed to official Zhipu Chat Completions endpoint in CLI implementation.
  • No dynamic key name switching: the skill expects ZHIPU_API_KEY consistently.
  • URL/local file handling: the skill can read local files or fetch user-provided URLs for processing/visualization; URL inputs are restricted to public http/https targets (localhost/private network targets are rejected).

Runtime Dependencies

Install dependencies before use:

pip install -r scripts/requirements.txt

Main packages used by this skill:

  • requests
  • Pillow
  • opencv-python
  • numpy
  • matplotlib
  • decord

System dependency for video visualization:

  • ffmpeg

General workflow

	Input (image or video + Prompt)
		|
		▼
	Run glm_grounding_cli.py to get grounding results (natural language)
		|
		▼
	Return results (grounding results, visualized image or video)

How to Use

Run glm_grounding_cli.py to get grounding results

  • Ground any target in an image
python scripts/glm_grounding_cli.py --image-url "URL provided by user" --prompt "description of target for grounding"
  • Track any target in a video
python scripts/glm_grounding_cli.py --video-url /path/to/image.jpg --prompt "description of target for tracking" --visualize --visualization-dir "./vis"

Reply with grounding results

After receiving a grounding prompt from the user, your direct reply should be natural language that includes grounding coordinates. Coordinates $x$ and $y$ are relative values in [0, 1000], computed as:

$$ x = round(x_{pixel} / W * 1000) \ y = round(y_{pixel}/H*1000) $$

where $x_{pixel}, y_{pixel}$ are pixel coordinates with origin (0, 0) at the top-left corner of the image, and W/H are the image width/height.

Unless otherwise specified, grounding results should use the following Python data formats:

  • 2D bounding boxes: [[x1, y1, x2, y2], ...], extracted grounding result is a list of boxes, each box has 4 coordinate values
  • 2D points: [[x, y], ...], extracted grounding result is a list of points, each point has 2 coordinate values
  • 2D polygon: [[x1, y1], [x2, y2], ...], extracted grounding result is a polygon coordinate list, each vertex has 2 coordinate values
  • 3D bounding boxes: [{"bbox_3d":[x_center, y_center, z_center, x_size, y_size, z_size, roll, pitch, yaw],"label":"category"}, ...], extracted grounding result is a JSON list where each object contains a category label and one 3D box with 8 coordinate values
  • Objects Detection JSON: [{'label': 'category', 'bbox_2d': [x1, y1, x2, y2]}, ...], extracted grounding result is a JSON list where each object contains a category label and one box
  • Video Objects Tracking JSON: {0: [{'label': 'car-1', 'bbox_2d': [1,2,3,4]}, {'label': 'car-2', 'bbox_2d': [2,3,4,5]}], 1: [{'label': 'car-2', 'bbox_2d': [4,5,6,7]}, {'label': 'person-1', 'bbox_2d': [10,20,30,40]}]}, extracted grounding result is a JSON object whose keys are video frame indices and values are lists of JSON objects, each containing a category label and one 2D box

Python example


# 1. User grounding request and your reply
image=https://example.com/image.jpg
prompt="Please box all people wearing Santa hats in the image and tell me their coordinates. Use red boxes, line thickness 3, and label format 'SantaHat-i'."


# 2. Get grounding results
python scripts/glm_grounding_cli.py --image-url $image --prompt $prompt --visualize --visualization-dir "./vis"

#  {
#         "ok": True,
#         "grounding_result": [[100, 200, 300, 400], [500, 600, 700, 800]],
#         "visualizations_result": (
#             {"visualized_image": "./vis/image_vis.jpg"}
#         ),
#         "raw_result": "1. Person 1: box [100, 200, 300, 400]\n2. Person 2: box [500, 600, 700, 800]. The box format is [x1, y1, x2, y2], where (x1, y1) is the top-left corner and (x2, y2) is the bottom-right corner.",
#         "error": None,
#         "source": source,
#     }

Utility function quick reference

Function Purpose
parse_coordinates_from_response(response_str, coords_type='bbox', init_context_window=2000, max_context_window=-1) Parse and extract all coordinate results from model responses (supports 2D bbox, point, polygon)
parse_3d_boxes_from_response(response_str, max_context_window=-1) Parse and extract all 3D boxes and labels from model responses (strict and loose matching)
parse_detection_from_response(response_str, max_context_window=-1) Parse and extract all 2D detection results from model responses (Objects Detection JSON format)
parse_mot_from_response(response_str, max_context_window=-1) Parse and extract all video object tracking results from model responses (Video Objects Tracking JSON format)
visualize_boxes(img_path=None, img_bytes=None, boxes=[], labels=None, renormalize=False, save_path=None, return_b64=False, save_optimized=True, **kwargs) Draw 2D boxes on images with labels, custom colors, and line thickness
visualize_points(img_path=None, img_bytes=None, points=[], labels=None, renormalize=False, diameters=None, save_path=None, return_b64=False, save_optimized=True, distinct_colors=False, colors=None) Draw points on images with labels, custom size, and colors
visualize_3d_boxes_glmv_simple(image_path, cam_params, bbox_3d_list, image_bytes=None, coord_format='xyzwhlpyr', save_path=None, save_optimized=False, return_b64=False, **kwargs) Draw projected 3D boxes on images using camera intrinsics (supports rotation and multiple coordinate formats)
visualize_mot(video_path=None, video_bytes=None, mot_js=None, renormalize=False, save_path=None, return_b64=False, distinct_colors=True, **kwargs) Draw Video Objects Tracking boxes on each video frame with labels

Common errors

  • Coordinate values exceed 1000: if extracted coordinate values are greater than 1000, the model may have produced unnormalized coordinates due to prompt effects. Extract the target phrase from the user request (for example, "people wearing Santa hats"), then query the model again and explicitly require output coordinates to be relative values normalized to 0-1000 based on image size (for example, "Please box all people wearing Santa hats in the image and tell me their coordinates. Ensure the output coordinates are relative values normalized to 0-1000 based on image size.").

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

没有标签

同类 Skill