23 lines
1.0 KiB
Bash
Executable File
23 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# setup_models.sh - DEV ONLY. Regenerates pose_landmarks_detector.onnx from the
|
|
# MediaPipe .task via tf2onnx (needs Python + tf2onnx). Players do NOT run this;
|
|
# the no-Python player path is scripts/fetch_models.sh + scripts/fetch_ort.sh.
|
|
# Use this only to produce a new prebuilt .onnx to publish to the project mirror
|
|
# (then update ONNX_SHA256 in fetch_models.sh and MANIFEST.sha256).
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
TASK="${1:-${HERE}/../tracker/models/pose_landmarker_full.task}"
|
|
PY="${PY:-${HERE}/../tracker/.venv/bin/python}"
|
|
mkdir -p "${HERE}/models"
|
|
|
|
"${PY}" -c "import zipfile; zipfile.ZipFile('${TASK}').extractall('${HERE}/models')"
|
|
|
|
for m in pose_detector pose_landmarks_detector; do
|
|
if [ -f "${HERE}/models/${m}.onnx" ]; then continue; fi
|
|
if ! "${PY}" -m tf2onnx.convert --tflite "${HERE}/models/${m}.tflite" \
|
|
--output "${HERE}/models/${m}.onnx" --opset 17; then
|
|
echo "note: ${m} tflite->onnx conversion not supported by tf2onnx; skipping" >&2
|
|
fi
|
|
done
|
|
ls -la "${HERE}/models"
|