Tutorials3 min read
使用 Potato 進行影像分類
學習如何設定帶有縮圖預覽、縮放控制和多標籤支援的影像分類任務。
Potato Team
影像分類是計算機視覺的基石。無論你是在構建產品分類系統、內容稽核流程還是醫學影像分類器,Potato 都提供了高效影像標註所需的工具。
你將學到
- 設定影像標註任務
- 單標籤和多標籤分類
- 層級分類結構
- 影像任務的品質控制
基本影像分類
讓我們從一個簡單的單標籤分類任務開始。
配置
yaml
annotation_task_name: "Product Image Classification"
# Image data
data_files:
- data/products.json
item_properties:
id_key: product_id
text_key: image_url
# Classification labels
annotation_schemes:
- annotation_type: image_annotation
name: category
description: "What type of product is shown?"
labels:
- Electronics
- Clothing
- Home & Garden
- Sports & Outdoors
- Books & Media
- Other資料格式
建立 data/products.json:
json
{"product_id": "P001", "image_url": "/images/products/laptop.jpg"}
{"product_id": "P002", "image_url": "/images/products/tshirt.jpg"}
{"product_id": "P003", "image_url": "/images/products/garden_tools.jpg"}
{"product_id": "P004", "image_url": "https://example.com/images/basketball.jpg"}影像可以是本地路徑或 URL。
多標籤分類
對於屬於多個類別的影像:
yaml
annotation_schemes:
- annotation_type: multiselect
name: attributes
description: "Select all attributes that apply to this image"
labels:
- Contains people
- Outdoor scene
- Indoor scene
- Contains text
- Product photo
- Lifestyle photo
- Close-up shot
- Wide angle層級分類
對於複雜的分類體系,使用巢狀標籤:
yaml
annotation_schemes:
- annotation_type: radio
name: main_category
description: "Primary category"
labels:
- Apparel
- Electronics
- Home
- annotation_type: radio
name: subcategory
description: "Subcategory"影像品質評估
在分類旁新增品質檢查:
yaml
annotation_schemes:
- annotation_type: radio
name: category
description: "Product category"
labels: [Electronics, Clothing, Home, Other]
- annotation_type: radio
name: image_quality
description: "Is this image suitable for the product catalog?"
labels:
- name: Approved
description: "Clear, well-lit, product is visible"
- name: Needs review
description: "Minor issues but potentially usable"
- name: Rejected
description: "Poor quality, wrong product, or inappropriate"
- annotation_type: multiselect
name: quality_issues
description: "If not approved, what issues are present?"
labels:
- Blurry or out of focus
- Poor lighting
- Wrong product shown
- Watermark or text overlay
- Inappropriate content
- Multiple products in frame高階影像設定
對於高階影像顯示自定義,在標註方案中配置 image_annotation 類型,並根據需要使用 CSS 或自定義樣式。
完整示例
以下是一個生產就緒的配置:
yaml
annotation_task_name: "E-commerce Image Classification"
data_files:
- data/images.json
item_properties:
id_key: sku
text_key: image_path
annotation_schemes:
- annotation_type: image_annotation
name: primary_category
description: "Select the main product category"
labels:
- Electronics
- Clothing & Accessories
- Home & Living
- Beauty & Personal Care
- Sports & Fitness
- Toys & Games
- Other
- annotation_type: multiselect
name: image_attributes
description: "Select all that apply"
labels:
- White background
- Lifestyle shot
- Multiple angles
- Model wearing/using
- Size reference included
- Brand visible
label_requirement:
required: false
- annotation_type: radio
name: listing_ready
description: "Is this image ready for product listing?"
labels:
- Yes - Ready to publish
- No - Needs editing
- No - Reshoot required
label_requirement:
required: true
annotation_guidelines:
title: "Image Classification Guidelines"
content: |
## Category Selection
Choose the most specific category that fits the product.
## Image Quality
- "Ready to publish": Clear, professional, meets standards
- "Needs editing": Good photo but needs cropping/color correction
- "Reshoot required": Fundamentally unsuitable影像標註技巧
- 一致的顯示器設定:確保標註者使用校準過的顯示器
- 清晰的類別定義:在指南中包含示例圖片
- 處理邊緣案例:記錄如何處理模糊影像
- 定期校準:團隊一起審查樣本
下一步
完整的影像標註文件請參閱 影像標註。