Theft Detection
A video surveillance system that spots shoplifting and loitering across live camera feeds.
- Role
- Contributor
- Year
- 2026

Problem
Shoplifting in shops and supermarkets often goes unnoticed because nobody can watch every camera feed all the time. Theft Detection watches the feeds instead. It flags shoplifting, loitering, intrusions into restricted areas and fighting, then sounds an alarm and sends an alert.
My role
vahapogut (opens in a new tab) started Theft Detection and wrote most of it: the camera pipeline, the detection logic, the dashboard and the alerts described below. I worked on it after that and added:
- Video file analysis. Upload a recorded clip and run it through the same detection pipeline to get back an annotated video and its alerts. It loads its own model instances so it never disturbs the live feeds' tracking. It also measures the alert cooldown in video time, not clock time, because files are processed faster than real time.
- Deleting alerts. Delete alerts from the history one at a time or all at once, along with their snapshot images.
- English throughout. I translated the remaining Turkish interface text and log messages.
- A presentation deck. A script generates a slide deck about the project with python-pptx.
Constraints
- Someone else's codebase. My changes had to fit the existing structure: a FastAPI backend, a SQLite database and a Next.js dashboard.
- Running beside live feeds. Video file analysis had to run alongside the live cameras without breaking their person tracking.
Process
Several cameras at once. Each camera, whether a local webcam or an RTSP network camera, reads frames on its own thread. One slow feed doesn't hold up the others or freeze the dashboard. People are tracked per camera, keyed by camera and track ID, so IDs from different feeds never clash.
Behaviour, not just objects. YOLOv8 detects people and items, and a YOLOv8 pose model tracks their posture. Together they catch:
- a hand moving from a picked-up item to a pocket or bag
- someone staying in a zone longer than a set threshold
- a wrist crossing into a restricted area, such as behind the till
- sudden bending in low-visibility aisles
Zones drawn on the live feed. Operators draw security zones as polygons over the live video in the dashboard. The coordinates are mapped to a fixed 1280×720 grid, so a zone stays in the same place whatever screen it was drawn on.
Alerts that always play. The siren is synthesised in the browser with the Web Audio API instead of loading an audio file, with a 3-second cooldown to avoid alarm fatigue. Alerts and snapshots also go out by email and Telegram.
Optional face recognition. Faces can be registered on a blacklist, which raises a high-priority alarm, or a whitelist for staff and regular customers. If the face recognition library isn't installed, that panel turns off and everything else keeps working.
Outcome
-
A FastAPI backend that streams detections over WebSockets to a Next.js dashboard.
-
The dashboard shows live feeds, a heatmap of activity per camera, CPU and memory use, weekly alert trends, and a searchable alert history that exports to CSV.
-
Recorded clips can be analysed from the dashboard, with an annotated video to review or download.
What I'd do differently
My video file analysis copies the live loop's detection logic instead of sharing it, so a fix in one doesn't reach the other. I'd pull that logic into one shared module.
I'd also measure how often it's right on a set of labelled clips. There are no accuracy or false-alarm numbers yet.
Technologies used
- Python
- FastAPI
- OpenCV
- YOLOv8
- Next.js
- SQLite