图像标注
使用边界框、多边形、自由绘制和标记点标注图像。
图像标注
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配置选项
| 字段 | 类型 | 默认值 | 描述 |
|---|---|---|---|
name | string | 必填 | 标注的唯一标识符 |
description | string | 必填 | 显示给标注者的说明 |
annotation_type | string | 必填 | 必须为 "image_annotation" |
tools | list | 必填 | 启用的标注工具(bbox、polygon、freeform、landmark、fill、eraser、brush) |
labels | list | 必填 | 标注的类别标签 |
zoom_enabled | boolean | true | 启用缩放控制 |
pan_enabled | boolean | true | 启用拖动导航 |
min_annotations | integer | 0 | 最少所需标注数 |
max_annotations | integer | null | 最大允许标注数(null = 无限制) |
freeform_brush_size | integer | 5 | 自由绘制的笔刷大小 |
freeform_simplify | float | 2.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 新增
fill、eraser 和 brush 工具支持像素级分割掩码标注。这些工具非常适合需要精确区域边界的语义分割任务。
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"最佳实践
- 使用合适的工具 - 快速检测用边界框,精确边界用多边形,分割用填充/画笔
- 定义清晰的标签 - 使用独特、不重叠的类别
- 设置标注限制 - 使用
min_annotations确保完整性 - 启用缩放 - 对高分辨率图像的详细标注至关重要
- 使用键盘快捷键 - 显著加快标注速度
- 提供标签颜色 - 使视觉区分标注更容易