Spaces:
Runtime error
Runtime error
Commit History
-
feat(model): default to standard YOLOv8 backbone for CPU production
Local benchmark on M2 + ONNX Runtime CoreML, single-frame inference: YOLO-World M (worldv2, 180M params, vision + text branch) → 13.7 fps, 73 ms / frame YOLOv8 M (standard, 26M params, vision-only) → 56.6 fps, 18 ms / frame ───────── 4.1× speedup on the same hardware, same imgsz → projection on EPYC 4 cores: ~15-20 fps (was 0.6 fps with YOLO-World M, fundamentally too heavy) YOLO-World shines for zero-shot detection of arbitrary text-prompted classes, but the dual-branch vision-language fusion is a CPU non-starter: even with static-class export the text encoder branch keeps contributing residual compute every frame. Standard YOLOv8 with its fixed 80 COCO classes covers everything traffic monitoring needs (car / truck / bus / motorcycle / bicycle / person), so unless the fleet specifically demands the YOLO-World classes (becak / bemo / bajaj / angkot / ojek as distinct labels), the speed is the better trade.…5b1b3f2 -
feat(deploy): HF Spaces / CPU production stack
Stack the changes required to ship cakra to a CPU-only host (HF Spaces basic, generic VPS without GPU) cleanly: • app/config.py — profile loader. CAKRA_PROFILE=<name> (set in shell *or* in .env itself) loads `.env.<name>` after the base .env and overrides matching keys. The HF Spaces overlay is auto-applied when the runtime is detected via SPACE_ID, so a Space deploy needs no extra config beyond the secret list. • .env.hfspace — committed overlay tuning HF basic's shared 2 vCPU: INFERENCE_SIZE=640, TARGET_INFER_FPS=3, FRAME_SKIP=2, output 854x480, MAX_STREAMS=1, MODEL_PATH=./models/yolo-world-id.onnx. No secrets in the file — DATABASE_URL stays in .env or the Space Secrets UI. • app/main.py — boot log surfaces the active profile + the resource knobs so HF and local-simulation runs are auditable in one log line. • app/services/detector.py — dispatch backend by MODEL_PATH suffix (.pt → pytorch, .onnx → onnx, .xml → openvino, .engine…ed450db
-
feat: real-time CCTV YOLO analytics with bbox-baked HLS
Per-camera worker decoupled into four stages: - capture (StreamReader): decodes upstream HLS, tags frames with capture timestamp, pushes to a bounded ring (drop-oldest) - pace: monotonic-clock thread ticks at HLS_FPS, pops the next frame from the ring, annotates with the detection that was current at that capture time (bbox stays glued to the visible frame even with ring delay) - encode: ffmpeg in true CFR (-r N -fps_mode cfr), libx264 or videotoolbox; segments split on exact second boundaries - inference: YOLO + ByteTrack on its own thread at TARGET_INFER_FPS; never blocks the capture / pace / encode chain Detection coords scaled from source space (e.g. 1920x1080) to output space (e.g. 1280x720) before annotation. Persistent state in a single cctv_session_metrics row per camera (UPSERT each tick, started_at frozen across reconnects). Realtime WS pushes analytics + geo-tagged detections with per-camera coverage polygon. Embed-ready: any client drops <video src=playlist.m3u…40e0b51