Spaces:
Sleeping
Sleeping
|
Download docs/DESIGN.md from SandeepChakka/store-intelligence: direct link, hf CLI and curl.
- Browser
- Download file 2.16 kB
-
https://huggingface.co/spaces/SandeepChakka/store-intelligence/resolve/main/docs/DESIGN.md
- Command line
-
hf download hf://spaces/SandeepChakka/store-intelligence/docs/DESIGN.md
-
curl -L -o DESIGN.md https://huggingface.co/spaces/SandeepChakka/store-intelligence/resolve/main/docs/DESIGN.md
2.16 kB
DESIGN — Store Intelligence System
Architecture
CCTV Footage (5× MP4)
→ discover_cameras.py → camera_profile.json
→ run_pipeline.py (YOLOv8n + ByteTrack + ReID)
→ output.jsonl
→ POST /events/ingest
→ SQLite (sessions, events, transactions)
→ metrics / funnel / heatmap / anomalies
→ WebSocket + React dashboard
Event flow
- Detection: Ultralytics YOLOv8n
personclass,track()with ByteTrack. - Tracking: Per-clip
track_id→ globalvisitor_idvia HSV histogram Re-ID bank. - Semantics: Role-based rules (entry line, zone polygons, billing queue counter).
- Staff: Persistence + movement + multi-zone heuristics →
is_staff,staff_confidence. - Ingestion: Idempotent insert on
event_id; session_id attached on ENTRY/EXIT lifecycle. - POS: Orders loaded from derived CSV; conversion within 5-minute window after billing visit.
Database (SQLite default)
| Table | Role |
|---|---|
| events | Raw ingested stream |
| sessions | Visitor visit unit for funnel |
| transactions | POS orders |
| anomalies | Last detected operational issues |
ER (logical):
stores (implicit ST1008) 1—* sessions 1—* events
sessions *—* transactions (time-window conversion)
stores 1—* anomalies
API layer
- FastAPI + async SQLAlchemy
- Structured JSON logs:
trace_id,store_id,endpoint,latency_ms,status_code - Partial ingest success (per-event validation)
/healthSTALE_FEED if last event > 10 minutes
AI-assisted decisions
- Camera roles: AI suggested scoring motion/brightness; human validation noted CAM 5 billing vs auto CAM 2 — documented in
CAMERA_ANALYSIS.md, no hardcoded overrides in code. - Zone polygons: AI proposed normalized ROIs per role; rejected pixel-perfect CAD mapping due to raster-only layout.
- Staff detection: AI proposed uniform color classifier; chose trajectory persistence + multi-zone rules for CPU budget on i5.
Deployment
docker compose up builds API image, mounts CCTV + data volumes, runs discovery + pipeline + uvicorn; dashboard via Node service.