CoolFace
Apppublic

HuggerInChief/crowd-anomaly-detection

sourceHugging Facemitupdated 3mo agoView on Hugging Face
0likes
App README

Crowd Anomaly Detection — YOLOv8, 100% in the browser

A Static Hugging Face Space — no Python server. The YOLOv8s model is exported to ONNX and runs entirely client-side via onnxruntime-web (WASM). Nothing you upload or stream from your webcam ever leaves your machine.

Try it

  • Image — click/drop a photo, or use one of the bundled examples.
  • Live Webcam — click "Start webcam"; detection re-runs continuously.

Why static + ONNX instead of Gradio

Docker/Gradio Spaces require Hugging Face account verification (not a Pro subscription) and weren't available on this account yet. Gradio's in-browser option ("Gradio-Lite") runs Python via Pyodide/WebAssembly, which does not support PyTorch — so it can't run this model at all. Exporting to ONNX and running it with onnxruntime-web is the option that actually works on a Static Space and, as a side effect, needs no server/GPU at all: it's free to host indefinitely and scales to any number of visitors at zero cost.

Files

  • index.html / style.css / main.js — the whole app
  • best_model.onnx — YOLOv8s exported with baked-in NMS (nms=True), output shape [1, 300, 6] = [x1, y1, x2, y2, confidence, class]
  • examples/ — sample frames from the training datasets

Model

YOLOv8s, 640×640, single class anomaly. Test-set: ROC-AUC 0.7941, PR-AUC 0.7823, EER 0.2599, F1 0.7417, mAP50 0.5345. See the "Model & Metrics" tab in the app.