Skip to content

图像标注

使用边界框、多边形、自由绘制和标记点标注图像。

图像标注

Potato 的图像标注系统支持多种标注方法,适用于计算机视觉任务,包括目标检测、分割和关键点标注。

支持的工具

工具描述使用场景
bbox矩形边界框目标检测
polygon多点多边形实例分割
freeform自由手绘不规则形状
landmark点标记关键点检测
fill像素级填充工具分割掩码
eraser擦除绘制区域分割掩码修正
brush画笔工具精细分割

基本配置

yaml
annotation_schemes:
  - name: "objects"
    description: "Draw boxes around all objects"
    annotation_type: "image_annotation"
    tools:
      - bbox
    labels:
      - person
      - car
      - bicycle

配置选项

字段类型默认值描述
namestring必填标注的唯一标识符
descriptionstring必填显示给标注者的说明
annotation_typestring必填必须为 "image_annotation"
toolslist必填启用的标注工具(bboxpolygonfreeformlandmarkfilleraserbrush
labelslist必填标注的类别标签
zoom_enabledbooleantrue启用缩放控制
pan_enabledbooleantrue启用拖动导航
min_annotationsinteger0最少所需标注数
max_annotationsintegernull最大允许标注数(null = 无限制)
freeform_brush_sizeinteger5自由绘制的笔刷大小
freeform_simplifyfloat2.0路径简化因子

标签配置

标签可以是简单字符串或详细对象:

yaml
# Simple labels (auto-colored)
labels:
  - person
  - car
  - tree
 
# Detailed labels with custom colors and shortcuts
labels:
  - name: "person"
    color: "#FF6B6B"
    key_value: "1"
  - name: "car"
    color: "#4ECDC4"
    key_value: "2"
  - name: "bicycle"
    color: "#45B7D1"
    key_value: "3"

示例

目标检测(边界框)

yaml
annotation_schemes:
  - name: "detection"
    description: "Draw bounding boxes around all vehicles"
    annotation_type: "image_annotation"
    tools:
      - bbox
    labels:
      - name: "car"
        color: "#3B82F6"
        key_value: "1"
      - name: "truck"
        color: "#10B981"
        key_value: "2"
      - name: "motorcycle"
        color: "#F59E0B"
        key_value: "3"
    min_annotations: 1
    zoom_enabled: true

实例分割(多边形)

yaml
annotation_schemes:
  - name: "segmentation"
    description: "Draw polygons around each object"
    annotation_type: "image_annotation"
    tools:
      - polygon
    labels:
      - name: "building"
        color: "#8B5CF6"
      - name: "road"
        color: "#64748B"
      - name: "vegetation"
        color: "#22C55E"
    zoom_enabled: true
    pan_enabled: true

关键点标注(标记点)

yaml
annotation_schemes:
  - name: "facial_landmarks"
    description: "Mark facial keypoints"
    annotation_type: "image_annotation"
    tools:
      - landmark
    labels:
      - name: "left_eye"
        color: "#3B82F6"
      - name: "right_eye"
        color: "#3B82F6"
      - name: "nose"
        color: "#10B981"
      - name: "left_mouth"
        color: "#F59E0B"
      - name: "right_mouth"
        color: "#F59E0B"

多工具

yaml
annotation_schemes:
  - name: "mixed_annotation"
    description: "Use boxes for objects and polygons for regions"
    annotation_type: "image_annotation"
    tools:
      - bbox
      - polygon
    labels:
      - name: "object"
        color: "#3B82F6"
      - name: "region"
        color: "#10B981"

键盘快捷键

按键操作
b激活边界框工具
p激活多边形工具
f激活自由绘制工具
l激活标记点工具
1-9选择标签
Delete删除选中的标注
Ctrl+Z撤销
Ctrl+Y重做
+ / -放大/缩小

数据格式

输入数据

数据文件应包含图像路径或 URL:

json
[
  {
    "id": "img_001",
    "image_url": "https://example.com/images/photo1.jpg"
  },
  {
    "id": "img_002",
    "image_url": "/data/images/photo2.png"
  }
]

在配置中设置图像字段:

yaml
item_properties:
  id_key: id
  text_key: image_url

输出格式

标注包含每个标注的几何数据:

json
{
  "id": "img_001",
  "annotations": {
    "objects": [
      {
        "id": "ann_1",
        "type": "bbox",
        "label": "car",
        "geometry": {
          "x": 100,
          "y": 150,
          "width": 200,
          "height": 100
        }
      },
      {
        "id": "ann_2",
        "type": "polygon",
        "label": "building",
        "geometry": {
          "points": [
            [50, 50],
            [150, 50],
            [150, 200],
            [50, 200]
          ]
        }
      }
    ]
  }
}

支持的图像格式

  • JPEG / JPG
  • PNG
  • GIF
  • WebP

分割掩码

v2.2.0 新增

filleraserbrush 工具支持像素级分割掩码标注。这些工具非常适合需要精确区域边界的语义分割任务。

yaml
annotation_schemes:
  - name: "segmentation"
    description: "Paint segmentation masks"
    annotation_type: "image_annotation"
    tools:
      - fill
      - eraser
      - brush
    labels:
      - name: "foreground"
        color: "#3B82F6"
      - name: "background"
        color: "#6B7280"
    freeform_brush_size: 10
按键操作
i激活填充工具
e激活橡皮擦工具
r激活画笔工具

PDF/文档边界框

v2.2.0 新增

在 PDF 页面和文档图像上绘制边界框。当与 instance_display 中的 pdf 显示类型结合使用时,标注者可以在 PDF 文档的各个页面上绘制框。

yaml
instance_display:
  fields:
    - key: pdf_url
      type: pdf
 
annotation_schemes:
  - name: "document_regions"
    description: "Draw boxes around figures and tables"
    annotation_type: "image_annotation"
    tools:
      - bbox
    labels:
      - name: "figure"
        color: "#3B82F6"
      - name: "table"
        color: "#10B981"
      - name: "equation"
        color: "#F59E0B"

最佳实践

  1. 使用合适的工具 - 快速检测用边界框,精确边界用多边形,分割用填充/画笔
  2. 定义清晰的标签 - 使用独特、不重叠的类别
  3. 设置标注限制 - 使用 min_annotations 确保完整性
  4. 启用缩放 - 对高分辨率图像的详细标注至关重要
  5. 使用键盘快捷键 - 显著加快标注速度
  6. 提供标签颜色 - 使视觉区分标注更容易