ml.postprocessing.mediapipe — Google Mediapipe
The ml.postprocessing.mediapipe module contains post-processors for Google
Mediapipe models.
class mediapipe_detection_postprocess – Generic Mediapipe Detector
Base class shared by BlazeFace and BlazePalm. Decodes
anchor-based bounding boxes and keypoints, then performs 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)
Create a generic Mediapipe detection post-processor.
thresholdScore threshold applied to raw logits before sigmoid.anchorsOptional pre-built anchor array of shape(N, 2)containing(cx, cy)centers normalized to[0, 1]. IfNone, anchors are generated fromanchor_grid.anchor_gridList of(grid_size, scales)tuples used to generate anchors whenanchorsisNone.scoresList of model output indices that contain score tensors.cordsList of model output indices that contain box/keypoint tensors.nms_thresholdIoU threshold for non-maximum suppression.nms_sigmaSigma for soft-NMS score decay.
class BlazeFace – Face Detection
Post-processes BlazeFace model output.
- class ml.postprocessing.mediapipe.BlazeFace(threshold: float = 0.6, anchors: ndarray | None = None, nms_threshold: float = 0.1, nms_sigma: float = 0.1)
Create a BlazeFace post-processor. Uses an anchor grid of
[(16, 2), (8, 6)]with score outputs[1, 2]and box outputs[0, 3].thresholdScore threshold for detections.anchorsOptional pre-built anchor array; generated automatically ifNone.nms_thresholdIoU threshold for non-maximum suppression.nms_sigmaSigma for soft-NMS score decay.Returns
[((x, y, w, h), score, keypoints)]from__call__, wherekeypointsis a list of(x, y)points.
class BlazePalm – Palm Detection
Post-processes BlazePalm model output.
- class ml.postprocessing.mediapipe.BlazePalm(threshold: float = 0.6, anchors: ndarray | None = None, nms_threshold: float = 0.1, nms_sigma: float = 0.1)
Create a BlazePalm post-processor. Uses an anchor grid of
[(24, 2), (12, 6)]with score outputs[0]and box outputs[1].thresholdScore threshold for detections.anchorsOptional pre-built anchor array; generated automatically ifNone.nms_thresholdIoU threshold for non-maximum suppression.nms_sigmaSigma for soft-NMS score decay.Returns
[((x, y, w, h), score, keypoints)]from__call__, wherekeypointsis a list of(x, y)points.
class FaceLandmarks – Face Landmarks
Post-processes FaceLandmarks model output.
- class ml.postprocessing.mediapipe.FaceLandmarks(threshold: float = 0.6, nms_threshold: float = 0.1, nms_sigma: float = 0.1)
Create a FaceLandmarks post-processor.
thresholdScore threshold (after sigmoid) for accepting a detection.nms_thresholdIoU threshold for non-maximum suppression.nms_sigmaSigma for soft-NMS score decay.Returns
((x, y, w, h), score, keypoints)from__call__, wherekeypointsis a list of(x, y, z)points.
class HandLandmarks – Hand Landmarks
Post-processes HandLandmarks model output.
- class ml.postprocessing.mediapipe.HandLandmarks(threshold: float = 0.6, nms_threshold: float = 0.1, nms_sigma: float = 0.1)
Create a HandLandmarks post-processor.
thresholdScore threshold for accepting a detection.nms_thresholdIoU threshold for non-maximum suppression.nms_sigmaSigma for soft-NMS score decay.Returns
[[((x, y, w, h), score, keypoints)]]from__call__, with one inner list per handedness class (left=0, right=1).keypointsis a list of(x, y, z)points. Empty class lists are preserved so each list’s index matches the class index.
class MoveNet – Pose Estimation
Post-processes MoveNet single-pose model output.
- class ml.postprocessing.mediapipe.MoveNet(threshold: float = 0.6, nms_threshold: float = 0.1, nms_sigma: float = 0.1)
Create a MoveNet post-processor.
thresholdPer-keypoint confidence threshold; keypoints below this value are excluded from the bounding box and mean score.nms_thresholdIoU threshold for non-maximum suppression.nms_sigmaSigma for soft-NMS score decay.Returns
((x, y, w, h), score, keypoints)from__call__, wherekeypointsis a list of(x, y, score)points in input pixel coordinates.