Skip to content

Commit f14d63c

Browse files
committed
let the football demo find its venv on its own
1 parent c89ae87 commit f14d63c

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

demo/football/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,28 @@ ball is tracked for contact counting but its marker is off by default.
1515
The detector weights (`football.pt`, `football.onnx`, `football_fp16.onnx`,
1616
`football_int8.onnx`) are hosted on the Hugging Face Hub at
1717
`collabora/gst-python-ml-football`, not in git. `run.sh` downloads the one its
18-
`BACKEND` needs into `models/football/` on first use. To fetch by hand:
18+
`BACKEND` needs into `models/football/` on first use. To fetch by hand, or to
19+
use weights you already have, put them in that directory. Files already there
20+
are not downloaded again.
1921

2022
```bash
2123
python demo/football/fetch_models.py # pt + fp16
2224
python demo/football/fetch_models.py all
2325
```
2426

27+
## Local setup
28+
29+
`run.sh` expects the repo venv at `.venv` and the system `gst-launch-1.0` with
30+
the gst-python loader. It puts `plugins/` on `GST_PLUGIN_PATH` and the venv's
31+
site-packages on `PYTHONPATH` itself, so nothing needs exporting first. On an
32+
NVIDIA host `decodebin` picks `nvh264dec` and the detector runs on `cuda:0`.
33+
34+
```bash
35+
cd gst-python-ml
36+
uv sync
37+
demo/football/run.sh display # data/soccer_tracking.mp4, on screen
38+
```
39+
2540
## Run
2641

2742
```bash

demo/football/run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ REPO="$(cd "$(dirname "$0")/../.." && pwd)"
1414
cd "$REPO"
1515
source .venv/bin/activate
1616
export GST_PLUGIN_PATH="$REPO/plugins:${GST_PLUGIN_PATH:-}"
17+
# gst-launch's python loader runs the system interpreter, so hand it the venv.
18+
VENV_SITE="$(python -c 'import site; print(":".join(site.getsitepackages()))')"
19+
export PYTHONPATH="$REPO/plugins/python:$VENV_SITE:${PYTHONPATH:-}"
1720

1821
BACKEND="${BACKEND:-pt}"
1922
# The weights live on the Hugging Face Hub; this is a no-op once cached.

0 commit comments

Comments
 (0)