ml.postprocessing.mediapipe --- Google Mediapipe¶
ml.postprocessing.mediapipe 模組包含用於 Google Mediapipe 模型的後處理器。
class mediapipe_detection_postprocess -- 通用 Mediapipe 偵測器¶
BlazeFace 與 BlazePalm 共用的基底類別。它解碼基於錨框的邊界框與關鍵點,然後執行 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在 sigmoid 之前套用於原始 logits 的分數閾值。anchors選用的預先建構的錨框陣列,形狀為(N, 2),包含正規化至[0, 1]的(cx, cy)中心點。若為None,則由anchor_grid產生錨框。anchor_grid當anchors為None時,用於產生錨框的(grid_size, scales)元組清單。scores包含分數張量的模型輸出索引清單。cords包含框/關鍵點張量的模型輸出索引清單。nms_threshold非極大值抑制的 IoU 閾值。nms_sigmasoft-NMS 分數衰減的 Sigma 值。
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 後處理器。使用
[(16, 2), (8, 6)]的錨框網格,分數輸出為[1, 2],框輸出為[0, 3]。threshold偵測的分數閾值。anchors選用的預先建構的錨框陣列;若為None則自動產生。nms_threshold非極大值抑制的 IoU 閾值。nms_sigmasoft-NMS 分數衰減的 Sigma 值。從
__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 後處理器。使用
[(24, 2), (12, 6)]的錨框網格,分數輸出為[0],框輸出為[1]。threshold偵測的分數閾值。anchors選用的預先建構的錨框陣列;若為None則自動產生。nms_threshold非極大值抑制的 IoU 閾值。nms_sigmasoft-NMS 分數衰減的 Sigma 值。從
__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接受一個偵測所用的分數閾值(sigmoid 之後)。nms_threshold非極大值抑制的 IoU 閾值。nms_sigmasoft-NMS 分數衰減的 Sigma 值。從
__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_sigmasoft-NMS 分數衰減的 Sigma 值。從
__call__回傳[[((x, y, w, h), score, keypoints)]],每個慣用手類別(左=0、右=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_sigmasoft-NMS 分數衰減的 Sigma 值。從
__call__回傳一個((x, y, w, h), score, keypoints)元組清單,其中keypoints是一個以輸入像素座標表示的(x, y, score)點清單。