- Python 49.3%
- HTML 46.2%
- Dockerfile 2.7%
- Shell 1.8%
| app | ||
| data | ||
| models | ||
| scripts | ||
| .gitignore | ||
| docker-compose.webcam.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| README.md | ||
| requirements.txt | ||
| run-mac.sh | ||
speedcam v2 (YOLO + tracking, offline-capable)
Any COCO object (person, bike, car, dog, …): Ultralytics YOLO detects, ByteTrack tracks, Python turns ground-plane movement into km/h. UI is plain HTML/CSS/JS, no CDNs.
MacBook (M2) – recommended: native, uses the Apple GPU (MPS)
./run-mac.sh # http://localhost:8000
First run needs internet (pip packages + weights into ./models). After that it runs fully offline.
The browser camera is the default source (the page asks for camera access on load). Source 0 = native webcam via OpenCV; RTSP/HTTP URLs and video files work too. A config already saved in ./data keeps its old source.
Docker (server / Raspberry Pi 64-bit)
docker compose up --build
Weights are downloaded at build time and baked into the image; the running container needs no internet.
Docker on a Mac runs CPU-only inside a Linux VM (no MPS, no webcam passthrough) – use "Browser camera" there, or run natively.
Linux/Pi webcam: docker compose -f docker-compose.yml -f docker-compose.webcam.yml up --build.
Pi: model yolo11n.pt, inference size 320, processing width 640. GPU (NVIDIA): --build-arg TORCH_INDEX=https://download.pytorch.org/whl/cu124 + compose GPU reservation.
Other models
Drop any Ultralytics .pt into ./models (native) or /data/models (Docker volume); it appears in the model picker.
Scale (auto-scale = no setup, rough; calibration = accurate)
Line (2 points + distance) or plane (4 ground corners, handles perspective). A banner warns if the camera view moved afterwards. Detections log to ./data/detections.csv. Ultralytics is AGPL-3.0.
Resolution: defaults are tuned for a Mac (browser cam 1280×720, processing width 1280, inference size 960). RAM is not the limit, compute is: raise inference size / model size until fps drops, then back off. On a Pi use the lower values above.