Skip to content
Tutorials3 min read

用於分割任務的多邊形標註

如何配置多邊形繪製工具進行影像分割,以及處理複雜形狀和重疊區域的技巧。

Potato Team

多邊形標註可以實現畫素級精確的目標邊界,用於語義分割和實例分割。本指南涵蓋配置、標註技術以及複雜分割任務的最佳實踐。

何時使用多邊形與邊界框

使用多邊形的場景使用邊界框的場景
需要精確邊界粗略定位即可
不規則目標形狀目標大致為矩形
訓練分割模型訓練檢測模型
重疊目標非重疊目標
需要更高精度速度優先

基本多邊形設定

yaml
annotation_task_name: "Image Segmentation"
 
data_files:
  - "data/images.json"
 
annotation_schemes:
  - annotation_type: image_annotation
    tools: [polygon]
    name: segments
    description: "Draw polygons around each object"
    labels:
      - name: road
        color: "#808080"
      - name: sidewalk
        color: "#F5F5DC"
      - name: building
        color: "#8B4513"
      - name: vegetation
        color: "#228B22"
      - name: sky
        color: "#87CEEB"
      - name: vehicle
        color: "#FF6B6B"
      - name: person
        color: "#4ECDC4"

繪製多邊形

基本工作流

  1. 從工具欄中選擇一個標籤
  2. 點選以在目標周圍放置頂點
  3. 雙擊或按 Enter 鍵閉合多邊形
  4. 通過拖動調整頂點
  5. 點選邊緣新增節點

鍵盤快捷鍵

Potato 為多邊形編輯提供內建鍵盤快捷鍵:

  • Enter:閉合當前多邊形
  • Escape:取消繪製或取消選擇
  • Delete:刪除選中的頂點或多邊形
  • +/-:放大/縮小
  • 空格 + 拖動:平移影像

處理複雜場景

重疊目標

對於包含重疊目標的任務,標註者可以繪製相互重疊的多個多邊形。每個多邊形在輸出中單獨儲存,允許在目標可能相互遮擋的情況下進行實例級標註。

複雜邊界處理技巧

當標註具有複雜邊界的目標時:

  1. 使用更多頂點以準確捕捉曲線邊緣的形狀
  2. 放大以描繪詳細邊界
  3. 系統地沿目標邊緣工作
  4. 使用編輯模式在初始繪製後最佳化頂點位置

語義分割設定

用於全影像分割:

yaml
annotation_task_name: "Semantic Segmentation"
 
data_files:
  - "data/images.json"
 
annotation_schemes:
  - annotation_type: image_annotation
    tools: [polygon]
    name: semantic_segments
    description: "Segment the entire image"
    labels:
      - name: background
        color: "#000000"
      - name: road
        color: "#808080"
      - name: sidewalk
        color: "#F5F5DC"
      - name: building
        color: "#8B4513"
      - name: vegetation
        color: "#228B22"
      - name: sky
        color: "#87CEEB"
      - name: person
        color: "#4ECDC4"
      - name: vehicle
        color: "#FF6B6B"

實例分割設定

用於單個目標實例:

yaml
annotation_task_name: "Instance Segmentation"
 
data_files:
  - "data/images.json"
 
annotation_schemes:
  - annotation_type: image_annotation
    tools: [polygon]
    name: instances
    description: "Draw polygons around each object instance"
    labels:
      - name: person
        color: "#4ECDC4"
      - name: car
        color: "#FF6B6B"
      - name: dog
        color: "#FFEAA7"

繪製的每個多邊形將作為單獨的標註儲存,使您能夠跟蹤每個目標類別的各個實例。

完整配置示例

yaml
annotation_task_name: "Cityscapes-style Segmentation"
 
data_files:
  - "data/urban_scenes.json"
 
annotation_schemes:
  - annotation_type: image_annotation
    tools: [polygon]
    name: segments
    description: "Segment all objects following Cityscapes protocol"
    labels:
      # Flat
      - name: road
        color: "#804080"
      - name: sidewalk
        color: "#F423E8"
      # Construction
      - name: building
        color: "#464646"
      - name: wall
        color: "#666666"
      - name: fence
        color: "#BE9999"
      # Nature
      - name: vegetation
        color: "#6B8E23"
      - name: terrain
        color: "#98FB98"
      # Sky
      - name: sky
        color: "#4682B4"
      # Human
      - name: person
        color: "#DC143C"
      - name: rider
        color: "#FF0000"
      # Vehicle
      - name: car
        color: "#00008B"
      - name: truck
        color: "#000046"
      - name: bus
        color: "#003C64"
      - name: motorcycle
        color: "#0000E6"
      - name: bicycle
        color: "#770B20"

輸出格式

多邊形標註以每個頂點的座標儲存在標註輸出中:

json
{
  "id": "img001",
  "annotations": {
    "segments": [
      {
        "label": "road",
        "points": [[0, 600], [100, 580], [200, 590], [0, 600]]
      },
      {
        "label": "car",
        "points": [[450, 400], [520, 400], [520, 480], [450, 480]]
      }
    ]
  }
}

高品質多邊形標註技巧

  1. 放大:在 2 倍或更高倍率下處理精細邊界
  2. 使用鍵盤快捷鍵:比使用滑鼠點選工具快得多
  3. 從主要特徵開始:先畫粗略輪廓,然後再細化
  4. 節約頂點:使用保證精度所需的最少頂點數
  5. 定期休息:精細的多邊形標註會導致疲勞

下一步


完整多邊形文件請見 影像標註