2026-05-20 21:39:12 +08:00

54 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: damage-grounding
description: 汽车旧伤视觉定位标注。用于 damage_grounding 能力:读取 damage-detector 生成的 workspace/damages.json对每处损伤在时间窗口内调用豆包 grounding 获取 0-1000 bbox并在图片上绘制红色标注框输出 workspace/grounding.json 和 marked_frames前置条件是已有 taskId 和 damages.json。
license: MIT
metadata:
version: "1.0.0"
category: vehicle-inspection
skillType: compute-entry
aliases: ["damage_grounding"]
tags: ["vehicle", "grounding", "bbox", "doubao", "旧伤定位", "标注"]
---
# 旧伤视觉定位标注
前置条件:已完成 `video-frame-extractor``damage-detector`workspace 中存在 `damages.json`
```json
{
"name": "damage-grounding",
"input": {
"taskId": "order_10001",
"groundingWindow": 2
}
}
```
## 工作流程
1. 读取 `damages.json` 的损伤列表和 `video_info.json` 的帧列表。
2. 对每处损伤选择 `timeSecond ± groundingWindow` 秒内的帧。
3. 固定使用豆包/火山方舟模型进行 grounding解析 `<bbox>x1 y1 x2 y2</bbox>`
4. 将 0-1000 归一化 bbox 转成像素坐标,在图片上绘制红色标注框。
5. 写入 `workspace/grounding.json``marked_frames/`
## 输入
- `taskId`: 必填。
- `groundingWindow`: 可选,默认 `2` 秒。
- `groundingResults`: 可选,外部豆包 grounding 结果;传入后本技能只解析 bbox 并画框。
## 输出
返回 `totalDamages``totalMarked`
## 重要约束
- 需要 Node.js 18+。
- 共享 workspace 根目录优先读取 `VEHICLE_SCRATCH_WORKSPACE_ROOT`,其次兼容 `RZYX_AI_WORKSPACE_ROOT`,否则使用 `RZYX_AI_DATA_DIR/workspace/vehicle-scratch-inspection`
- 本技能固定用于豆包 grounding其他模型可用于检测但 grounding 阶段按豆包输出格式解析。
- bbox 坐标是 0-1000 归一化坐标,最终同时保存 normalized 和 pixel 两种坐标。
- 标注优先使用 `sharp`,未安装时回退 `ffmpeg drawbox`;两者都不可用时生成 SVG 标注占位,保证 `grounding.json` 仍可被后续报告读取。
- 不使用百度 OCR API。
- 用中文回答所有内容。