"""Headless batch video annotation. Reads a video, draws detection boxes above the confidence threshold, and writes the annotated copy next to it as _out.mp4. Run from the repo root: uv run python scripts/predict_video.py uv run python scripts/predict_video.py --video videos/3.mp4 --conf 0.5 --device mps """ from __future__ import annotations import argparse import logging import sys from pathlib import Path import cv2 sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from src import inference # noqa: E402 logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s: %(message)s") logger = logging.getLogger("predict_video") def main() -> None: p = argparse.ArgumentParser(description=__doc__) p.add_argument("--video", default="videos/2.mp4") p.add_argument("--weights", default=inference.DEFAULT_WEIGHTS) p.add_argument("--conf", type=float, default=0.7) p.add_argument("--device", default=None, help="cpu / mps / cuda; auto-picks when omitted") p.add_argument("--output", default=None, help="defaults to