How would you design an end-to-end surveillance system that automatically detects and alerts security personnel to ‘anomalous events’ (e.g., break-ins, fainting, or prohibited movements) in a large shopping mall?

The Problem: dozens of cameras stream continuously. Spot the rare anomalous event (break-in, fainting, prohibited movement) in real time, knowing you have no labeled anomalies to train on.
Answer
A surveillance anomaly detection system captures video streams, preprocesses them into clips, and uses a deep learning model (typically a pretrained video backbone plus a lightweight anomaly scoring head) to identify unusual behavior. It operates in a semi-supervised setup trained on normal data, runs in real time with sliding windows and temporal smoothing, and wraps the model in alerting, monitoring, and a human-in-the-loop feedback loop for calibration and retraining.
(1) Ingestion & Preprocessing: Capture real-time streams from many cameras; resize frames and normalize pixels before clipping them into short windows.
(2) Feature Extraction: A pretrained backbone (2D CNN (EfficientNet), optical flow, 3D CNN (I3D), or a Video Transformer (Swin, TimeSformer)) turns each clip into features.
(3) Semi-Supervised Normal Model: An autoencoder or GAN trained on months of “normal” mall activity; high reconstruction error on new footage flags an anomaly against a calibrated threshold.
(4) Alerting & Human-In-The-Loop: Real-time alerts send anomalous frames to operators, whose “Not an Anomaly” clicks feed recalibration and retraining.
(5) System Design: Edge devices do preliminary processing to save bandwidth, the cloud does heavy computation; evaluation tracks precision, recall, F1 and false-alarm rates.

Figure 1: The detection mechanism: backbone features feed a model trained to reconstruct normal activity; when reconstruction error crosses the calibrated threshold, the clip is flagged anomalous.
Clarify Before Designing:
(1) Scale: how many cameras, what fps and resolution, and how many concurrent clips must be scored?
(2) Alert Latency: how many seconds from event to operator notification?
(3) Anomaly Definition: a closed list of event types, or anything unusual; and are any labels available (frame-level, video-level, none)?
(4) False-Alarm Budget: how many false alerts per camera per day can guards tolerate before they start ignoring the system?
(5) Deployment: on-prem edge hardware available, or cloud-only?
Leave a Reply