Skip to content

视频标注

标注视频的时间片段、分类帧、标记关键帧和跟踪对象。

视频标注

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"

配置选项

字段类型默认值描述
namestring必填标注的唯一标识符
descriptionstring必填显示给标注者的说明
annotation_typestring必填必须为 "video_annotation"
labelslist必填可用的标注标签
modestring"segment"标注模式
min_segmentsinteger0最少所需标注数
max_segmentsintegernull最大允许标注数
timeline_heightinteger70时间轴高度(像素)
overview_heightinteger40概览栏高度(像素)
zoom_enabledbooleantrue启用时间轴缩放
playback_rate_controlbooleantrue显示播放速度选择器
frame_steppingbooleantrue启用逐帧导航
show_timecodebooleantrue显示帧号和时间
video_fpsinteger30用于计算的视频帧率

标签配置

标签可以是简单字符串或带颜色和键盘快捷键的详细对象:

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

工作流程

  1. 导航到关键帧并在对象周围绘制边界框
  2. 跳过几帧并重新定位边界框
  3. 系统自动插值中间帧的位置
  4. 根据需要查看和调整插值位置

完整的有效标注模式集为:segmentframekeyframetrackingcombined

技术说明

  • 使用 Peaks.js 进行时间轴可视化
  • 标准 HTML5 视频元素(无需额外服务器依赖)
  • 时间轴支持拖动选择创建片段

最佳实践

  1. 使用压缩视频 - 大文件会减慢加载速度
  2. 设置合适的帧率 - 使 video_fps 与实际视频帧率匹配
  3. 启用逐帧步进 - 精确帧级标注所必需
  4. 使用播放速率控制 - 慢动作有助于精细工作
  5. 提供清晰的片段定义 - 明确什么构成片段边界
  6. 使用独特的颜色 - 使标签在视觉上容易区分
  7. 考虑时间轴高度 - 对于复杂的分割任务可以增加高度