BlazeFaceDecoder

Pure Kotlin decoder for Google MediaPipe BlazeFace detection tensors.

Implements SSD anchor generation, bounding box & 6-landmark decoding, non-maximum suppression (NMS), and 3D head pose estimation from 2D keypoints.

Properties

Link copied to clipboard
Link copied to clipboard
const val DEFAULT_IOU_THRESHOLD: Float = 0.3f
Link copied to clipboard
const val DEFAULT_SCORE_THRESHOLD: Float = 0.6f
Link copied to clipboard
const val INPUT_SIZE: Int = 128
Link copied to clipboard
const val NUM_ANCHORS: Int = 896
Link copied to clipboard
const val NUM_COORDS: Int = 16

Functions

Link copied to clipboard
fun computePose(rightEye: FacePoint2D, leftEye: FacePoint2D, noseTip: FacePoint2D, mouthCenter: FacePoint2D): Triple<Float, Float, Float>

Estimates head pose (yaw, pitch, roll in degrees) from 2D facial keypoints.

Link copied to clipboard
fun decode(rawBoxes: FloatArray, rawScores: FloatArray, imageWidth: Double, imageHeight: Double, scoreThreshold: Float = DEFAULT_SCORE_THRESHOLD, iouThreshold: Float = DEFAULT_IOU_THRESHOLD): List<BlazeFaceDetection>

Decodes raw regressor and classificator output tensors into structured detections.

Link copied to clipboard

Generates canonical 896 SSD anchors for 128x128 BlazeFace short-range model.