56 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2026-05-20 21:39:12 +08:00
---
name: best-frame-selector
description: 汽车旧伤去重与最佳展示帧筛选。用于 best_frame_selector 能力:读取 damage-grounding 生成的 workspace/grounding.json先对跨批次重复的同一物理损伤进行合并再从多张红框标注帧中选择最清晰的最佳展示帧输出 workspace/best_frames.json前置条件是已有 taskId 和 grounding.json。
license: MIT
metadata:
version: "1.0.0"
category: vehicle-inspection
skillType: compute-entry
aliases: ["best_frame_selector"]
tags: ["vehicle", "best-frame", "dedupe", "旧伤去重", "最佳帧"]
---
# 旧伤最佳帧选择
前置条件:已完成 `damage-grounding`workspace 中存在 `grounding.json`
```json
{
"name": "best-frame-selector",
"input": {
"taskId": "order_10001",
"topN": 1
}
}
```
## 工作流程
1. 读取 `grounding.json` 的损伤定位与标注帧。
2. 先合并跨批次重复的同一物理损伤。
3. 对每组损伤:
- 帧数 `<=3` 时全部作为最佳帧;
- 帧数 `>3` 时优先调用模型筛选;
- 模型不可用或失败时使用 bbox 精准度、面积、居中程度、文件大小等启发式评分兜底。
4. 将最佳帧复制到 `best_frames/`,写入 `best_frames.json`
## 输入
- `taskId`: 必填。
- `topN`: 可选,默认 `1`
- `dedupeResult`: 可选,外部模型去重结果,格式见 `references/dedupe-prompt.md`
- `bestFrameResults`: 可选,外部模型最佳帧结果。
## 输出
返回 `totalDamages``bestFrameCount`
## 注意
- 需要 Node.js 18+。
- 共享 workspace 根目录优先读取 `VEHICLE_SCRATCH_WORKSPACE_ROOT`,其次兼容 `RZYX_AI_WORKSPACE_ROOT`,否则使用 `RZYX_AI_DATA_DIR/workspace/vehicle-scratch-inspection`
- 配置 `ARK_API_KEY` 时会优先调用模型做损伤去重和最佳帧选择;没有模型配置或模型失败时使用启发式兜底。
- `best_frames.json` 中的 `damages` 是去重合并后的最终旧伤列表。
- 不要把未被 grounding 到 bbox 的候选帧优先作为最佳帧,除非没有其它可用帧。
- 用中文回答所有内容。