Run RTMLib benchmark outside production startup

This commit is contained in:
Codex
2026-08-15 11:19:48 -07:00
parent aed8105d84
commit d77e456685
3 changed files with 39 additions and 3 deletions
@@ -65,6 +65,7 @@ class NDIReceiver(threading.Thread):
if self.source_name in names:
source = finder.get_source(self.source_name)
break
time.sleep(0.05)
if source is None:
raise RuntimeError(f"configured NDI source not discovered; last_sources={names}")
receiver = Receiver(color_format=RecvColorFormat.BGRX_BGRA,
@@ -18,7 +18,7 @@ def percentile(values: list[float], p: float) -> float:
def run_offline_benchmark(models, threshold: float, max_people: int) -> None:
path = "/logs/offline-benchmark-" + os.getenv("BENCHMARK_PROFILE", "unknown") + ".json"
path = os.getenv("BENCHMARK_OUTPUT", "/logs/offline-benchmark-" + os.getenv("BENCHMARK_PROFILE", "unknown") + ".json")
if os.path.exists(path):
return
try:
@@ -48,9 +48,12 @@ def run_offline_benchmark(models, threshold: float, max_people: int) -> None:
"p95_ms": round(percentile(vals, .95), 3),
"p99_ms": round(percentile(vals, .99), 3)}
for name, vals in stages.items()}}
with open(path, "x", encoding="utf-8") as fh:
with open(path, "w", encoding="utf-8") as fh:
json.dump(report, fh, indent=2)
print(f"benchmark profile people={requested} complete", flush=True)
os.chmod(path, 0o666)
except Exception as exc:
with open(path, "w", encoding="utf-8") as fh:
json.dump({"error": f"{type(exc).__name__}: {str(exc)[:240]}", "source_url": DEMO_URL,
"image_retained": False}, fh, indent=2)
os.chmod(path, 0o666)
@@ -166,6 +166,38 @@ services:
} > "$$out/process-map.csv"
chmod -R a+rX,u+w "$$out"
benchmark-rtmlib-body:
image: tail2-pose-server:0.1.0
container_name: tail2-pose-benchmark-rtmlib-body
gpus: all
restart: "no"
entrypoint: ["/bin/bash", "-lc"]
depends_on:
models:
condition: service_completed_successfully
volumes:
- /mnt/user/appdata/tail2-pose-server/app:/app:ro
- /mnt/user/appdata/tail2-pose-server/models:/models:ro
- ./validation:/validation
environment:
PYTHONPATH: /app
CUDA_VISIBLE_DEVICES: "1"
MODEL_BACKEND: rtmlib_body
BENCHMARK_PROFILE: rtmlib_body_yolox-m_rtmpose-m_gpu1_threads2
BENCHMARK_OUTPUT: /validation/benchmark-rtmlib-body.json
DETECTION_THRESHOLD: "0.35"
NMS_IOU_THRESHOLD: "0.60"
MAX_PEOPLE: "4"
DET_CHECKPOINT: /models/yolox-m-humanart.onnx
POSE_CHECKPOINT: /models/rtmpose-m-body17.onnx
OMP_NUM_THREADS: "2"
MKL_NUM_THREADS: "2"
OPENBLAS_NUM_THREADS: "2"
CV2_NUM_THREADS: "2"
command:
- |
python -c 'from tail2.models import Models; from tail2.offline_benchmark import run_offline_benchmark; m=Models(); m.load(); run_offline_benchmark(m, .35, 4)'
validate:
profiles: ["validation"]
image: tail2-pose-server:0.1.0