Spaces:
Runtime error
Runtime error
Commit History
-
feat(scan): right-click scan-mode alerting + per-camera pose
Scan mode runs parallel low-fps inference sessions per CCTV with no HLS overhead, triggered via right-click on the FE map. Each session owns a RuleEngine that fires on sustained_count rules and persists alerts (JPEG snapshot + H.264 MP4 clip from a ring buffer) into the shared `alerts` table with source='cctv-scan'. Backbone: - ScanSessionWorker: capture -> infer -> rules -> ring buffer - RuleEngine: sustained_count with cold-start guard + per-rule cooldown + progress_snapshot() for the FE probability bar - FrameRingBuffer: deque + JPEG snapshot + H.264 MP4 encode via ffmpeg subprocess (cv2 mp4v fallback when ffmpeg absent) - AlertsDAO: INSERT/UPDATE/query against the Prisma-owned `alerts` table - ScanEventBus: thread-safe pub/sub bridging worker threads to async WS - Registry: second worker pool (MAX_SCAN_STREAMS) sharing the detector Pose pipeline: coverage polygon + per-detection geo projection now use heading_deg / fov_deg from cctv_streams when present (falls back to GEO_* e…d6b1333
-
chore(deploy): only install CLIP when building yolo-world
CLIP is dead weight for the default yolov8 build path — the COCO classes are baked into the YOLOv8 checkpoint at training time, no text-encoder branch involved. Move the dep out of requirements.txt and only resolve it inside the Dockerfile's yoloworld bake case, so the production yolov8 image ships ~50 MB lighter and skips a CDN git clone at build time.d6d0769 -
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 -
fix(deploy): ship .env.vps and .env.hfspace inside the image
The deploy log showed `profile=vps | inference=960px max_streams=50` even though .env.vps sets 768 / 4 — the Dockerfile only copied app/, scripts/, docs/, and run.sh, so the profile overlay files were absent inside the container. The loader fell through to hard-coded defaults silently, with no warning at the surface. Copy both committed profile overlays at the same layer as the rest of the source. Container can now flip behaviour through CAKRA_PROFILE alone, no env-file gymnastics required.29909d6 -
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
-
fix(deploy): unblock Dockerfile build + slim image for HF CPU spaces
- Add `git` to apt deps so pip can install `clip` from its git URL. YOLO-World's `model.set_classes(...)` lazy-imports CLIP at runtime and Ultralytics' auto-installer relies on git+pip; without git in the image the build crashed inside `scripts.setup_yolo_world` with ModuleNotFoundError: No module named 'clip'. - Pin clip in requirements.txt so the dependency is explicit + the resolver doesn't try the auto-install path at runtime. - Install CPU-only torch/torchvision wheels from https://download.pytorch.org/whl/cpu before the rest of pip requirements. The default PyPI torch bundles CUDA (~700 MB) which a CPU Hugging Face space can't use; this cuts ~700 MB off the final image. Subsequent `pip install -r requirements.txt` sees torch>=2.2 already satisfied and skips reinstall. - Drop unused deps: aiortc (WebRTC was removed), ffmpeg-python (we spawn ffmpeg via subprocess), pandas (never imported), httpx (removed with the HLS proxy).f1803be -
fix(conflict): readme conflict
8653aff