Potatoによる画像分類
Potatoで画像分類を設定する方法。instance_displayで画像を表示し、radioとmultiselectのスキームでラベルを収集します。品質チェックの設定も扱います。
コンピュータビジョンのプロジェクトの多くは、遅かれ早かれ大量のラベル付き画像を必要とし、誰かがそのラベル付けをしなければなりません。商品写真の仕分け、コンテンツのスクリーニング、医療画像の分類のいずれであっても、インターフェースはPotatoが引き受けるので、ラベルそのものに集中できます。このチュートリアルでは、よく使われる構成を扱います。単一ラベル分類とマルチラベル分類、入れ子になったカテゴリ構造、そして画像タスクの信頼性を保つための品質チェックです。
画像を表示してから質問する
Potatoでは分類と描画は別の作業であり、この二つを混同するのが最初によくある間違いです。instance_displayは画像を画面に表示します。annotation_schemesは質問を投げかけます。image_annotationタイプは画像上にボックスやマスクを描くためのものなので、分類タスクではまったく使いません。
annotation_task_name: "Product Image Classification"
task_dir: "."
data_files:
- data/products.json
item_properties:
id_key: product_id
text_key: image_url
instance_display:
fields:
- key: image_url
type: image
label: "Product image"
display_options:
max_width: 600
zoomable: true
annotation_schemes:
- annotation_type: radio
name: category
description: "What type of product is shown?"
labels:
- Electronics
- Clothing
- Home & Garden
- Sports & Outdoors
- Books & Media
- Other
sequential_key_binding: true
output_annotation_dir: annotation_output/
export_annotation_format: jsonlsequential_key_bindingは6つのラベルに1から6のキーを割り当てます。一目見て一回クリックするだけのタスクでは、作業速度の大部分をキーボードが左右します。
インターフェースには画像が表示され、その下にカテゴリラベルが並びます。
商品画像と分類ラベル、キーボードショートカットを表示している画像アノテーションインターフェース
データフォーマット
data/products.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を使えます。text_keyはパスを保持するフィールドを指し、これがPotatoが表示に渡すフィールドです。
マルチラベル分類
1枚の画像が同時に複数のカテゴリに属する場合は、multiselectを使います。
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入れ子のカテゴリ
Potatoにはラジオボタン用の入れ子ラベルタイプがないため、2階層の分類体系は2つのスキームで表します。スキームごとに独自のlabelsが必要で、サブカテゴリのリストはすべての親カテゴリをカバーしなければなりません。
annotation_schemes:
- annotation_type: radio
name: main_category
description: "Primary category"
labels:
- Apparel
- Electronics
- Home
- annotation_type: radio
name: subcategory
description: "Subcategory within the primary category"
labels:
- Tops
- Bottoms
- Footwear
- Phones & Tablets
- Computers
- Audio
- Furniture
- Kitchen
- Decor2つ目のリストが長くなる場合は、hierarchical_multiselectを使えば2つのスキームの代わりに1つのウィジェットにまとめられます。
分類と並行する品質チェック
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
tooltip: "Clear, well-lit, product is visible"
- name: Needs review
tooltip: "Minor issues but potentially usable"
- name: Rejected
tooltip: "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ラベルごとの説明はtooltipに書きます。ラベルが読むキーはこれです。ラベルにdescription:として書くと、そのテキストはアノテーターの目に入る場所のどこにも表示されません。
完全な例
annotation_task_name: "E-commerce Image Classification"
task_dir: "."
data_files:
- data/images.json
item_properties:
id_key: sku
text_key: image_path
instance_display:
fields:
- key: image_path
type: image
label: "Product image"
display_options:
max_width: 700
zoomable: true
annotation_schemes:
- annotation_type: radio
name: primary_category
description: "Select the main product category"
labels:
- Electronics
- Clothing & Accessories
- Home & Living
- Beauty & Personal Care
- Sports & Fitness
- Toys & Games
- Other
sequential_key_binding: true
- annotation_type: multiselect
name: image_attributes
description: "Select all that apply"
labels:
- White background
- Lifestyle shot
- Multiple angles
- Model wearing or using
- Size reference included
- Brand visible
label_requirement:
required: false
- annotation_type: radio
name: listing_ready
description: "Is this image ready for the product listing?"
labels:
- Ready to publish
- Needs editing
- Reshoot required
label_requirement:
required: true
annotation_instructions: |
## Image Classification Guidelines
### Category selection
Choose the most specific category that fits the product.
### Image quality
- Ready to publish: clear, professional, meets standards
- Needs editing: good photo that needs cropping or color correction
- Reshoot required: fundamentally unsuitable
output_annotation_dir: annotation_output/
export_annotation_format: jsonl画像アノテーションのヒント
色や明るさはモニターによって異なるため、それが重要なタスクでは、アノテーターがある程度キャリブレーションされたディスプレイを使っているか確認してください。カテゴリを言葉で説明するより、ガイドラインにサンプル画像を載せましょう。1枚の画像は、1段落の説明よりも多くの議論に決着をつけます。曖昧な画像の扱いも文書にしておいてください。曖昧な画像は必ず出てきます。そして時々、チーム全員に同じバッチをラベル付けしてもらって結果を比較し、ずれを早めに見つけましょう。
実装の詳細は画像アノテーションのドキュメントを参照してください。
次のステップ
- 物体検出のバウンディングボックスアノテーションを学ぶ
- セグメンテーションのポリゴンアノテーションを設定
- 時間的タスクのビデオアノテーションを探索
画像アノテーションの完全なドキュメントは画像アノテーションをご覧ください。