Tutorials3 min read
为目标检测绘制边界框
完整的边界框标注设置指南,适用于计算机视觉任务,包括标签颜色和验证规则。
Potato Team·
为目标检测绘制边界框
边界框标注是训练目标检测模型的基础。本教程涵盖从基本设置到预标注和验证规则等高级功能的全部内容。
基本边界框设置
最简配置
yaml
annotation_task_name: "Object Detection Annotation"
data_files:
- "data/images.json"
annotation_schemes:
- annotation_type: image_annotation
name: objects
description: "Draw boxes around all objects"
tools:
- bbox
labels:
- name: car
color: "#FF6B6B"
- name: person
color: "#4ECDC4"
- name: bicycle
color: "#45B7D1"工作流程
- 从工具栏选择标签
- 点击并拖动绘制框
- 调整角点以精确框选
- 根据需要添加更多框
- 完成后提交
详细标签配置
yaml
annotation_schemes:
- annotation_type: image_annotation
name: objects
description: "Annotate all visible objects"
tools:
- bbox
labels:
- name: person
color: "#FF6B6B"
description: "Any human, partial or full"
keyboard_shortcut: "p"
- name: car
color: "#4ECDC4"
description: "Cars, trucks, SUVs"
keyboard_shortcut: "c"
- name: motorcycle
color: "#45B7D1"
description: "Motorcycles and scooters"
keyboard_shortcut: "m"
- name: bicycle
color: "#96CEB4"
description: "Bicycles of all types"
keyboard_shortcut: "b"
- name: traffic_light
color: "#FFEAA7"
description: "Traffic signals"
keyboard_shortcut: "t"
- name: stop_sign
color: "#DDA0DD"
description: "Stop signs"
keyboard_shortcut: "s"添加目标属性
为每个框捕获额外信息:
yaml
annotation_schemes:
- annotation_type: image_annotation
name: objects
tools:
- bbox
labels:
- name: person
color: "#FF6B6B"
attributes:
- name: occlusion
type: radio
options: [none, partial, heavy]
- name: truncated
type: checkbox
description: "Object extends beyond image"
- name: difficult
type: checkbox
description: "Hard to identify"当标注者绘制框时,系统会提示他们填写这些属性。
验证规则
通过验证确保标注质量:
yaml
annotation_schemes:
- annotation_type: image_annotation
name: objects
tools:
- bbox
labels: [...]
min_annotations: 1键盘快捷键
Potato 包含内置键盘快捷键以提高标注效率:
- 数字键选择标签
- Delete 键删除选中的标注
- 方向键在项目间导航
显示选项
配置图像显示设置:
yaml
image_display:
width: 800
height: 600完整的生产配置
yaml
annotation_task_name: "Autonomous Driving - Object Detection"
data_files:
- "data/driving_frames.json"
annotation_schemes:
- annotation_type: image_annotation
name: objects
description: "Annotate all traffic participants and objects"
tools:
- bbox
min_annotations: 1
labels:
- name: vehicle
color: "#FF6B6B"
keyboard_shortcut: "v"
attributes:
- name: type
type: radio
options: [car, truck, bus, motorcycle, bicycle]
- name: occlusion
type: radio
options: [0%, 1-25%, 26-50%, 51-75%, 76-99%]
- name: pedestrian
color: "#4ECDC4"
keyboard_shortcut: "p"
attributes:
- name: pose
type: radio
options: [standing, walking, sitting, lying]
- name: age_group
type: radio
options: [child, adult, elderly]
- name: cyclist
color: "#45B7D1"
keyboard_shortcut: "c"
- name: traffic_sign
color: "#FFEAA7"
keyboard_shortcut: "t"
attributes:
- name: sign_type
type: radio
options: [stop, yield, speed_limit, warning, other]
- name: traffic_light
color: "#DDA0DD"
keyboard_shortcut: "l"
attributes:
- name: state
type: radio
options: [red, yellow, green, off, unknown]输出格式
json
{
"frame_id": "frame_0001",
"frame_path": "/images/frame_0001.jpg",
"image_dimensions": {"width": 1920, "height": 1080},
"annotations": {
"objects": [
{
"label": "vehicle",
"bbox": [450, 380, 680, 520],
"attributes": {
"type": "car",
"occlusion": "0%"
}
},
{
"label": "pedestrian",
"bbox": [820, 400, 870, 550],
"attributes": {
"pose": "walking",
"age_group": "adult"
}
}
]
}
}高质量边界框技巧
- 紧凑的框:最小化框中的背景
- 一致的规则:清晰记录边缘情况
- 校准会议:团队一起审查示例
- 跟踪指标:监控框的数量和大小分布
下一步
完整文档请参阅 /docs/features/image-annotation。