> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/workflows/ja/gaido/developer-guide/kinds/keypoint-detection-prediction.md).

# keypointdetectionprediction 型

検出されたバウンディングボックスと検出されたキーポイントを含む、sv.Detections(...) オブジェクト形式の予測

## データ表現

{% hint style="warning" %}
**データ表現**

この種類は内部表現と外部表現が異なります。 **外部** 表現はワークフローとの統合に関係し、 **内部** 一方は、Workflowsブロックの開発に役立つ実装上の詳細です。
{% endhint %}

### 外部

外部データ表現は Workflows クライアントに関連します。これは、データの入力および出力形式を規定します。

型: `dict`

### 内部

内部データ表現は Workflows ブロック作成者に関連します。これは、実行エンジンが実行時に、この種類の入力を受け取るブロックへ提供する型です。

型: `sv.Detections`

## 詳細

この種類は、次の形式の単一キーポイント予測を表します: [`sv.Detections(...)`](https://supervision.roboflow.com/latest/detection/core/) オブジェクト。

例:

```
sv.Detections(
    xyxy=array([[        127,         189,         322,         303]]), 
    mask=None, 
    confidence=array([    0.95898]), 
    class_id=array([6]), 
    tracker_id=None, 
    data={
        'class_name': array(['G'], dtype='<U1'),
        'detection_id': array(['51dfa8d5-261c-4dcb-ab30-9aafe9b52379'], dtype='<U36'),
        'parent_id': array(['image.[0]'], dtype='<U9'),
        'image_dimensions': array([[425, 640]]),
        'inference_id': array(['51dfa8d5-261c-4dcb-ab30-9aafe9b52379'], dtype='<U36'),
        'prediction_type': array(['instance-segmentation'], dtype='<U16'),
        'root_parent_id': array(['image.[0]'], dtype='<U9'),
        'root_parent_coordinates': array([[0, 0]]),
        'root_parent_dimensions': array([[425, 640]]),
        'parent_coordinates': array([[0, 0]]),
        'parent_dimensions': array([[425, 640]]),
        'scaling_relative_to_parent': array([1]),
        'scaling_relative_to_root_parent': array([1]),
        'keypoints_class_name': array(),  # 可変長の object 型配列 - 各ボックスごとに 1 つの str の 1 次元配列
        'keypoints_class_id': array(),  # 可変長の object 型配列 - 各ボックスごとに 1 つの int の 1 次元配列
        'keypoints_confidence': array(),  # 可変長の object 型配列 - 各ボックスごとに 1 つの float の 1 次元配列
        'keypoints_xy': array(),  # 可変長の object 型配列 - (x, y) 座標を持つ bbox ごとに 1 つの 2 次元配列
    }
)
```

～以前は [sv.Keypoints(...)](https://supervision.roboflow.com/0.21.0/keypoint/core/) 私たちは、〜に基づくキーポイント検出を導入しました [`sv.Detections(...)`](https://supervision.roboflow.com/latest/detection/core/) オブジェクトです。この決定は最適ではなかったため、将来的には元に戻す必要がありますが、現時点ではこれがキーポイント検出用データの形式です。

メタデータの設計も最適ではありません（画像全体に関するメタデータがすべてのバウンディングボックスに複製され、空の予測のメタデータを保存する方法がありません）。私たちは [GH issue](https://github.com/roboflow/inference/issues/567) でこの問題について伝えています。

**追加フィールドの詳細：**

* `detection_id` - 各検出に対する一意の識別子。特定の検出に基づいて依存要素が作成される場合に使用されます（例：Dynamic Crop はこの値を新しい画像の親 ID として使用します）
* `parent_id` - 予測を生成した画像の識別子（ `WorkflowImageData` object
* `image_dimensions` - 予測の基準となった画像のサイズ - 形式： `(height, width)`
* `inference_id` - 推論リクエストの識別子（任意。Roboflow モデルに関連）
* `予測タイプ` - 予測の種類
* `root_parent_id` - 下流の予測の責任を負う主要な Workflow 入力の識別子（ `WorkflowImageData` object
* `root_parent_coordinates` - 元の入力に関するオフセット - 形式 (`offset_x`, `offset_y`)
* `root_parent_dimensions` - 元の入力画像のサイズ `(height, width)`
* `parent_coordinates` - 親に関するオフセット - 形式 (`offset_x`, `offset_y`)
* `parent_dimensions` - 親画像のサイズ `(height, width)`
* `scaling_relative_to_parent` - 親画像に対するスケーリング係数
* `scaling_relative_to_root_parent` - 元の入力画像に対するスケーリング係数
* `keypoints_class_name` キーポイントのクラス名を含む、可変サイズの文字列1次元配列の配列
* `keypoints_class_id` キーポイントのクラスIDを含む、可変サイズの int 1 次元配列の配列
* `keypoints_confidence` キーポイントの信頼度を含む、可変サイズの float 1 次元配列の配列
* `keypoints_xy` 〜内のキーポイント座標を含む、可変サイズの 2 次元配列の配列 `(x, y)` 形式

**シリアライズ：**

API の背後にある Execution Engine は、この種類のセレクタが Workflow の出力として宣言されると、基礎データをシリアライズします。シリアライズは次のように実行されます `sv.Detections.from_inference(...)` 出力をデコードできますが、 **キーポイントの詳細が失われます** — 出力 JSON フィールドを解析すれば復元できます。エンティティの詳細: [KeypointsDetectionInferenceResponse](https://detect.roboflow.com/docs)
