Files
kinect/tracker-native/README.md
T

71 lines
3.6 KiB
Markdown

# kinect-tracker (native, zero-Python)
Native replacement for the Python/MediaPipe `tracker/`. See
`docs/native-tracker.md` for the architecture. One `kinect-tracker.exe`:
camera + resolution picker, live preview, native pose + segmentation, and the
shared-memory publish the `Kinect10.dll` shim reads.
No binaries are committed. Fetch the models and ONNX Runtime (no Python needed):
```sh
scripts/fetch_models.sh # pose models: prebuilt .onnx + .tflite, checksum-verified
scripts/fetch_ort.sh # prebuilt ONNX Runtime 1.20.1 (linux + win x64)
./build.sh # headless Linux build (currently the ORT smoke test)
```
After fetching, verify every artifact against the pinned manifest:
```sh
sha256sum -c MANIFEST.sha256 # run from this directory (tracker-native/)
```
## Models & ONNX Runtime acquisition
The player path is Python-free: `fetch_models.sh` downloads a prebuilt
`pose_landmarks_detector.onnx` and extracts the `.tflite` files from the
MediaPipe bundle with `unzip`; it never runs `tf2onnx`. Every download is
pinned by SHA256 (`MANIFEST.sha256` and the `*_SHA256` constants in the
scripts) and any mismatch aborts with a non-zero exit.
| Artifact | Version / source | License |
| --- | --- | --- |
| `pose_landmarks_detector.onnx` (runtime-required) | project mirror asset, tf2onnx export of the bundle's landmark `.tflite` | Apache-2.0 (MediaPipe BlazePose) |
| `pose_landmarks_detector.tflite`, `pose_detector.tflite` | MediaPipe `pose_landmarker_full` bundle, Google model storage (`.../float16/1/pose_landmarker_full.task`) | Apache-2.0 (MediaPipe BlazePose) |
| `onnxruntime.dll` / `.lib`, `libonnxruntime.so` | ONNX Runtime 1.20.1, project mirror `cga-management/third-party-mirror` (tag `onnxruntime-1.20.1`) | MIT |
Upstream `microsoft/onnxruntime` GitHub releases were removed on 2026-11-17, so
ONNX Runtime is pinned to the project mirror's unchanged 1.20.1 assets.
The runtime loads only `pose_landmarks_detector.onnx` (see
`src/win_main.cpp` `kModelName`); the `.tflite` files are kept for development
and reference. The ROI detector model is not converted (`tf2onnx` cannot
convert it), so the tracker bootstraps the ROI instead.
**Publishing the prebuilt `.onnx`:** `fetch_models.sh` fetches the landmark
`.onnx` from `MODEL_ONNX_URL` (default: the project mirror). Publish the file
whose SHA256 is in `MANIFEST.sha256` as that mirror asset (the same way the ORT
assets are mirrored), or point `MODEL_ONNX_URL` at a local copy
(`file:///path/...`). Regenerating that `.onnx` from the `.tflite` is a DEV-only
step via `scripts/setup_models.sh` (needs Python + `tf2onnx`).
## Status
**Working**, verified on the user's Windows box: DEA renders the skeleton and the
menu hand-cursor covers the screen. The full pipeline is in place:
- faithful MediaPipe BlazePose landmark weights (`pose_landmarks_detector`, 33
landmarks + world + 256x256 mask) converted to ONNX and running under the ONNX
Runtime C++ API (mask <=1.2% in probability space vs TFLite; `build/ort_smoke`
vs `scripts/ort_smoke_ref.py`),
- BlazePose pre/post (ROI bootstrap, letterbox, landmark/mask un-transform)
validated against the MediaPipe reference,
- Media Foundation capture with camera + 4:3-resolution pickers and a live Win32/GDI
preview, remembering the last camera + resolution,
- guided **Calibrate cursor** step writing per-camera arm-reach gains to the shared
config the shim reads (see `docs/calibration.md`),
- the native shared-memory writer feeding the `kinect_virtual_frames` contract the
`Kinect10.dll` shim reads.
The ROI detector model is still bootstrapped rather than converted (tf2onnx can't
convert it yet), which the tracker handles without it.