视频标注
标注视频的时间片段、分类帧、标记关键帧和跟踪对象。
视频标注
Potato 提供全面的视频标注功能,包括时间分割、帧分类、关键帧标记和对象跟踪。
标注模式
| 模式 | 描述 | 使用场景 |
|---|---|---|
segment | 标记时间范围 | 场景检测、说话人轮次 |
frame | 分类单个帧 | 帧级标注 |
keyframe | 标记重要时刻 | 高亮检测 |
tracking | 跨帧跟踪对象 | 对象跟踪 |
combined | 在一个界面中使用所有模式 | 复杂标注任务 |
基本配置
yaml
annotation_schemes:
- name: "video_segments"
description: "Mark segments where the speaker changes"
annotation_type: "video_annotation"
labels:
- name: "Speaker A"
color: "#FF6B6B"
- name: "Speaker B"
color: "#4ECDC4"配置选项
| 字段 | 类型 | 默认值 | 描述 |
|---|---|---|---|
name | string | 必填 | 标注的唯一标识符 |
description | string | 必填 | 显示给标注者的说明 |
annotation_type | string | 必填 | 必须为 "video_annotation" |
labels | list | 必填 | 可用的标注标签 |
mode | string | "segment" | 标注模式 |
min_segments | integer | 0 | 最少所需标注数 |
max_segments | integer | null | 最大允许标注数 |
timeline_height | integer | 70 | 时间轴高度(像素) |
overview_height | integer | 40 | 概览栏高度(像素) |
zoom_enabled | boolean | true | 启用时间轴缩放 |
playback_rate_control | boolean | true | 显示播放速度选择器 |
frame_stepping | boolean | true | 启用逐帧导航 |
show_timecode | boolean | true | 显示帧号和时间 |
video_fps | integer | 30 | 用于计算的视频帧率 |
标签配置
标签可以是简单字符串或带颜色和键盘快捷键的详细对象:
yaml
labels:
- name: "intro"
color: "#4ECDC4"
key_value: "1"
- name: "content"
color: "#3B82F6"
key_value: "2"
- name: "outro"
color: "#8B5CF6"
key_value: "3"按模式的示例
片段模式(默认)
标记带有开始和结束时间的时间范围:
yaml
annotation_schemes:
- name: "scene_detection"
description: "Mark each scene in the video"
annotation_type: "video_annotation"
mode: "segment"
labels:
- name: "indoor"
color: "#3B82F6"
key_value: "1"
- name: "outdoor"
color: "#22C55E"
key_value: "2"
- name: "transition"
color: "#F59E0B"
key_value: "3"
zoom_enabled: true
playback_rate_control: true帧模式
分类单个帧:
yaml
annotation_schemes:
- name: "frame_quality"
description: "Classify each frame's quality"
annotation_type: "video_annotation"
mode: "frame"
labels:
- name: "good"
color: "#22C55E"
- name: "blurry"
color: "#F59E0B"
- name: "occluded"
color: "#EF4444"
frame_stepping: true
show_timecode: true关键帧模式
标记重要时刻:
yaml
annotation_schemes:
- name: "highlights"
description: "Mark key moments in the video"
annotation_type: "video_annotation"
mode: "keyframe"
labels:
- name: "goal"
color: "#22C55E"
- name: "foul"
color: "#EF4444"
- name: "highlight"
color: "#F59E0B"
frame_stepping: true跟踪模式
使用边界框跨帧跟踪对象:
yaml
annotation_schemes:
- name: "object_tracking"
description: "Track the ball throughout the video"
annotation_type: "video_annotation"
mode: "tracking"
labels:
- name: "ball"
color: "#3B82F6"
- name: "player"
color: "#22C55E"
frame_stepping: true
video_fps: 30组合模式
在一个界面中使用多种标注类型:
yaml
annotation_schemes:
- name: "comprehensive"
description: "Full video annotation"
annotation_type: "video_annotation"
mode: "combined"
labels:
- name: "action"
color: "#3B82F6"
- name: "dialogue"
color: "#22C55E"
- name: "transition"
color: "#F59E0B"
zoom_enabled: true
playback_rate_control: true
frame_stepping: true
show_timecode: true视频显示
用于简单视频播放而不进行标注(例如与其他标注类型配合),使用 video 类型:
yaml
annotation_schemes:
- name: "video_player"
description: "Watch the video clip"
annotation_type: "video"
video_path: "{{video_url}}"
controls: true
autoplay: false
loop: false
muted: false键盘快捷键
| 按键 | 操作 |
|---|---|
Space | 播放/暂停 |
, / . | 上一帧/下一帧 |
[ | 标记片段起始 |
] | 标记片段结束 |
Enter | 创建片段 |
K | 标记关键帧 |
C | 分类当前帧 |
Delete | 删除选中的标注 |
1-9 | 选择标签 |
+ / - | 放大/缩小 |
数据格式
输入数据
数据文件应包含视频路径或 URL:
json
[
{
"id": "video_1",
"video_url": "https://example.com/videos/sample1.mp4",
"description": "Meeting recording - identify speakers"
},
{
"id": "video_2",
"video_url": "/data/videos/sample2.mp4",
"description": "Activity video - label actions"
}
]输出格式
输出因模式而异:
片段模式:
json
{
"id": "video_1",
"annotations": {
"scene_detection": [
{
"start": 0.0,
"end": 5.2,
"start_frame": 0,
"end_frame": 156,
"label": "indoor"
}
]
}
}帧模式:
json
{
"id": "video_1",
"annotations": {
"frame_quality": [
{
"frame": 120,
"time": 4.0,
"label": "good"
}
]
}
}关键帧模式:
json
{
"id": "video_1",
"annotations": {
"highlights": [
{
"frame": 450,
"time": 15.0,
"label": "goal",
"note": "First goal of the match"
}
]
}
}跟踪模式:
json
{
"id": "video_1",
"annotations": {
"object_tracking": [
{
"id": "track_1",
"label": "ball",
"frames": [
{"frame": 0, "bbox": {"x": 100, "y": 200, "w": 30, "h": 30}},
{"frame": 1, "bbox": {"x": 105, "y": 198, "w": 30, "h": 30}}
]
}
]
}
}支持的视频格式
- MP4(推荐)
- WebM
- MOV
- OGG
视频对象跟踪与关键帧插值
v2.2.0 新增
跟踪模式现在支持关键帧插值,允许标注者在关键帧标记对象位置,中间帧会自动插值。这显著加快了对象跟踪任务。
yaml
annotation_schemes:
- name: "tracking"
description: "Track objects with keyframe interpolation"
annotation_type: "video_annotation"
mode: "tracking"
labels:
- name: "person"
color: "#3B82F6"
- name: "vehicle"
color: "#22C55E"
frame_stepping: true
video_fps: 30工作流程
- 导航到关键帧并在对象周围绘制边界框
- 跳过几帧并重新定位边界框
- 系统自动插值中间帧的位置
- 根据需要查看和调整插值位置
完整的有效标注模式集为:segment、frame、keyframe、tracking 和 combined。
技术说明
- 使用 Peaks.js 进行时间轴可视化
- 标准 HTML5 视频元素(无需额外服务器依赖)
- 时间轴支持拖动选择创建片段
最佳实践
- 使用压缩视频 - 大文件会减慢加载速度
- 设置合适的帧率 - 使
video_fps与实际视频帧率匹配 - 启用逐帧步进 - 精确帧级标注所必需
- 使用播放速率控制 - 慢动作有助于精细工作
- 提供清晰的片段定义 - 明确什么构成片段边界
- 使用独特的颜色 - 使标签在视觉上容易区分
- 考虑时间轴高度 - 对于复杂的分割任务可以增加高度