Scaffold the zero-Python native tracker. Convert the real MediaPipe BlazePose landmark weights (from pose_landmarker_full.task) to ONNX and prove the ONNX Runtime C++ API runs them bit-identically to Python (ort_smoke vs ort_smoke_ref.py; landmarks match to 6dp, mask <=1.2% prob vs TFLite). Reproducible setup scripts (setup_models.sh, fetch_ort.sh) and a Linux build. No binaries committed (ORT + onnx/tflite are fetched/generated).
21 lines
656 B
Python
21 lines
656 B
Python
import math
|
|
import numpy as np
|
|
import onnxruntime as ort
|
|
|
|
n = 1 * 256 * 256 * 3
|
|
x = (np.arange(n) % 1000).astype(np.float32) / 1000.0
|
|
x = x.reshape(1, 256, 256, 3)
|
|
|
|
sess = ort.InferenceSession(
|
|
"models/pose_landmarks_detector.onnx", providers=["CPUExecutionProvider"]
|
|
)
|
|
out = dict(zip([o.name for o in sess.get_outputs()], sess.run(None, {"input_1": x})))
|
|
lm = out["Identity"].ravel()
|
|
pres = out["Identity_1"].ravel()
|
|
mask = out["Identity_2"].ravel()
|
|
msum = float((1.0 / (1.0 + np.exp(-mask))).sum())
|
|
|
|
print("lm0..4: %.6f %.6f %.6f %.6f %.6f" % (lm[0], lm[1], lm[2], lm[3], lm[4]))
|
|
print("presence: %.6f" % pres[0])
|
|
print("mask_prob_sum: %.3f" % msum)
|