Skip to content
Guides3 min read

Potatoデータフォーマットの理解

テキスト、画像、音声、マルチモーダルアノテーションのためのJSONおよびJSONLデータフォーマットの詳細ガイド。

Potato Team·

Potatoデータフォーマットの理解

Potatoは入力データと出力アノテーションにJSONおよびJSONL形式を使用します。このガイドでは、すべてのデータタイプのフォーマット仕様、例、ベストプラクティスを説明します。

入力データフォーマット

JSON Lines (JSONL) - 推奨

1行に1つのJSONオブジェクト:

json
{"id": "001", "text": "First document text here."}
{"id": "002", "text": "Second document text here."}
{"id": "003", "text": "Third document text here."}

利点:

  • ストリーム処理(メモリ効率が良い)
  • 追記が簡単
  • 1行が壊れてもファイル全体には影響しない

JSON配列

標準的なJSON配列:

json
[
  {"id": "001", "text": "First document."},
  {"id": "002", "text": "Second document."},
  {"id": "003", "text": "Third document."}
]

設定:

yaml
data_files:
  - data/items.json

テキストアノテーションデータ

基本テキスト

json
{"id": "doc_001", "text": "The product quality exceeded my expectations."}

メタデータ付き

json
{
  "id": "review_001",
  "text": "Great product, fast shipping!",
  "metadata": {
    "source": "amazon",
    "date": "2024-01-15",
    "author": "user123",
    "rating": 5
  }
}

事前アノテーション付き

json
{
  "id": "ner_001",
  "text": "Apple announced new products in Cupertino.",
  "pre_annotations": {
    "entities": [
      {"start": 0, "end": 5, "label": "ORG", "text": "Apple"},
      {"start": 31, "end": 40, "label": "LOC", "text": "Cupertino"}
    ]
  }
}

設定:

yaml
data_files:
  - data/texts.json
 
item_properties:
  id_key: id
  text_key: text

画像アノテーションデータ

ローカル画像

json
{
  "id": "img_001",
  "image_path": "/data/images/photo_001.jpg",
  "caption": "Street scene in Paris"
}

リモート画像

json
{
  "id": "img_002",
  "image_url": "https://example.com/images/photo.jpg"
}

バウンディングボックス付き

json
{
  "id": "detection_001",
  "image_path": "/images/street.jpg",
  "pre_annotations": {
    "objects": [
      {"bbox": [100, 150, 200, 300], "label": "person"},
      {"bbox": [350, 200, 450, 280], "label": "car"}
    ]
  }
}

設定:

yaml
data_files:
  - data/images.json
 
item_properties:
  id_key: id
  image_key: image_path  # or image_url

音声アノテーションデータ

ローカル音声

json
{
  "id": "audio_001",
  "audio_path": "/data/audio/recording.wav",
  "duration": 45.5,
  "transcript": "Hello, how are you today?"
}

セグメント付き

json
{
  "id": "audio_002",
  "audio_path": "/audio/meeting.mp3",
  "segments": [
    {"start": 0.0, "end": 5.5, "speaker": "Speaker1"},
    {"start": 5.5, "end": 12.0, "speaker": "Speaker2"}
  ]
}

設定:

yaml
data_files:
  - data/audio.json
 
item_properties:
  audio_key: audio_path
  text_key: transcript

マルチモーダルデータ

テキスト + 画像

json
{
  "id": "mm_001",
  "text": "What is shown in this image?",
  "image_path": "/images/scene.jpg"
}

テキスト + 音声

json
{
  "id": "mm_002",
  "text": "Transcribe this audio:",
  "audio_path": "/audio/clip.wav",
  "reference_transcript": "Expected transcription here"
}

出力アノテーションフォーマット

基本出力

json
{
  "id": "doc_001",
  "text": "Great product!",
  "annotations": {
    "sentiment": "Positive",
    "confidence": 5
  },
  "annotator": "user123",
  "timestamp": "2024-11-05T10:30:00Z"
}

スパンアノテーション

json
{
  "id": "ner_001",
  "text": "Apple CEO Tim Cook visited Paris.",
  "annotations": {
    "entities": [
      {"start": 0, "end": 5, "label": "ORG", "text": "Apple"},
      {"start": 10, "end": 18, "label": "PERSON", "text": "Tim Cook"},
      {"start": 27, "end": 32, "label": "LOC", "text": "Paris"}
    ]
  }
}

複数アノテーター

json
{
  "id": "item_001",
  "text": "Sample text",
  "annotations": [
    {
      "annotator": "ann1",
      "labels": {"sentiment": "Positive"},
      "timestamp": "2024-11-05T10:00:00Z"
    },
    {
      "annotator": "ann2",
      "labels": {"sentiment": "Positive"},
      "timestamp": "2024-11-05T11:00:00Z"
    }
  ],
  "aggregated": {
    "sentiment": "Positive",
    "agreement": 1.0
  }
}

設定リファレンス

yaml
data_files:
  - data/items.json
 
item_properties:
  id_key: id
  text_key: text
  image_key: image_path
  audio_key: audio_path

ベストプラクティス

  1. 常にIDを含める:追跡のための一意の識別子
  2. 大規模データセットにはJSONLを使用:メモリ効率が良い
  3. ロード前にバリデーション:JSON構文をチェック
  4. メタデータを含める:ソース、日付、著者がデバッグに役立つ
  5. フィールド名の一貫性:下流処理が容易に

データフォーマットの完全なドキュメントは/docs/core-concepts/data-formatsをご覧ください。