ml.postprocessing.mediapipe --- Google Mediapipe

ml.postprocessing.mediapipe モジュールには、Google Mediapipe モデル用の後処理クラスが含まれています。

class mediapipe_detection_postprocess -- 汎用 Mediapipe 検出器

BlazeFaceBlazePalm で共有される基底クラス。アンカーベースのバウンディングボックスとキーポイントをデコードし、その後 NMS を実行します。

class ml.postprocessing.mediapipe.mediapipe_detection_postprocess(threshold: float = 0.6, anchors: ndarray | None = None, anchor_grid: list[tuple[int, int]] | None = None, scores: list[int] = [], cords: list[int] = [], nms_threshold: float = 0.1, nms_sigma: float = 0.1)

汎用 Mediapipe 検出の後処理関数を作成します。

threshold シグモイドの前に生のロジットに適用されるスコアのしきい値。

anchors [0, 1] に正規化された (cx, cy) の中心を含む、形状 (N, 2) のオプションの構築済みアンカー配列。None の場合、アンカーは anchor_grid から生成されます。

anchor_grid anchorsNone のときにアンカーを生成するために使用される (grid_size, scales) タプルのリスト。

scores スコアテンソルを含むモデル出力インデックスのリスト。

cords ボックス/キーポイントテンソルを含むモデル出力インデックスのリスト。

nms_threshold 非最大抑制用の IoU しきい値。

nms_sigma soft-NMS のスコア減衰用のシグマ。

__call__(model: ml.Model, inputs: list, outputs: list) list

モデル出力に対して後処理を実行し、((x, y, w, h), score, keypoints) タプルのリストを返します。スコアのしきい値を超える検出がない場合は、空のタプル () を返します。

detection_post_process(ih: int, iw: int, nms: ml.utils.NMS, model: ml.Model, inputs: list, outputs: list, score_idx: int, cords_idx: int, t: float, anchors: ndarray) None

単一の (score, cords) 出力ペアからバウンディングボックスをデコードし、指定された NMS アキュムレータに追加します。

class BlazeFace -- 顔検出

BlazeFace モデル出力を後処理します。

class ml.postprocessing.mediapipe.BlazeFace(threshold: float = 0.6, anchors: ndarray | None = None, nms_threshold: float = 0.1, nms_sigma: float = 0.1)

BlazeFace の後処理関数を作成します。スコア出力 [1, 2] とボックス出力 [0, 3] を持つ [(16, 2), (8, 6)] のアンカーグリッドを使用します。

threshold 検出用のスコアのしきい値。

anchors オプションの構築済みアンカー配列。None の場合は自動的に生成されます。

nms_threshold 非最大抑制用の IoU しきい値。

nms_sigma soft-NMS のスコア減衰用のシグマ。

__call__ から ((x, y, w, h), score, keypoints) タプルのリストを返します。keypoints(x, y) 点のリストです。

class BlazePalm -- 手のひら検出

BlazePalm モデル出力を後処理します。

class ml.postprocessing.mediapipe.BlazePalm(threshold: float = 0.6, anchors: ndarray | None = None, nms_threshold: float = 0.1, nms_sigma: float = 0.1)

BlazePalm の後処理関数を作成します。スコア出力 [0] とボックス出力 [1] を持つ [(24, 2), (12, 6)] のアンカーグリッドを使用します。

threshold 検出用のスコアのしきい値。

anchors オプションの構築済みアンカー配列。None の場合は自動的に生成されます。

nms_threshold 非最大抑制用の IoU しきい値。

nms_sigma soft-NMS のスコア減衰用のシグマ。

__call__ から ((x, y, w, h), score, keypoints) タプルのリストを返します。keypoints(x, y) 点のリストです。

class FaceLandmarks -- 顔ランドマーク

FaceLandmarks モデル出力を後処理します。

class ml.postprocessing.mediapipe.FaceLandmarks(threshold: float = 0.6, nms_threshold: float = 0.1, nms_sigma: float = 0.1)

FaceLandmarks の後処理関数を作成します。

threshold 検出を受け入れるための(シグモイド後の)スコアのしきい値。

nms_threshold 非最大抑制用の IoU しきい値。

nms_sigma soft-NMS のスコア減衰用のシグマ。

__call__ から ((x, y, w, h), score, keypoints) タプルのリストを返します。keypoints(x, y, z) 点のリストです。

class HandLandmarks -- 手のランドマーク

HandLandmarks モデル出力を後処理します。

class ml.postprocessing.mediapipe.HandLandmarks(threshold: float = 0.6, nms_threshold: float = 0.1, nms_sigma: float = 0.1)

HandLandmarks の後処理関数を作成します。

threshold 検出を受け入れるためのスコアのしきい値。

nms_threshold 非最大抑制用の IoU しきい値。

nms_sigma soft-NMS のスコア減衰用のシグマ。

__call__ から [[((x, y, w, h), score, keypoints)]] を返します。利き手クラス(左=0、右=1)ごとに 1 つの内側リストがあります。keypoints(x, y, z) 点のリストです。各リストのインデックスがクラスインデックスと一致するよう、空のクラスリストも保持されます。

class MoveNet -- 姿勢推定

MoveNet 単一姿勢モデル出力を後処理します。

class ml.postprocessing.mediapipe.MoveNet(threshold: float = 0.6, nms_threshold: float = 0.1, nms_sigma: float = 0.1)

MoveNet の後処理関数を作成します。

threshold キーポイントごとの信頼度しきい値。この値を下回るキーポイントは、バウンディングボックスおよび平均スコアから除外されます。

nms_threshold 非最大抑制用の IoU しきい値。

nms_sigma soft-NMS のスコア減衰用のシグマ。

__call__ から ((x, y, w, h), score, keypoints) タプルのリストを返します。keypoints は入力ピクセル座標における (x, y, score) 点のリストです。