{"slug": "how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4", "title": "How We Built a Real-Time Edge-AI Theft Detection System on a Raspberry Pi 4 + Telegram Alerts", "summary": "A computer engineering student team at FUTMinna built an edge-AI theft detection system that runs entirely on a Raspberry Pi 4 Model B (4GB) and pushes Telegram alerts in an average of 2.1 seconds. The system combines three concurrent detection pipelines — Haar cascade masked-face detection, a MobileNetV2 weapon and sharp-object classifier, and MOG2 background-subtraction pocketing detection — processing 640x480 video locally at 25–31 FPS, with a Flask MJPEG server for remote viewing. The team reports the project demonstrates real-time edge AI is feasible on budget hardware without cloud dependencies.", "body_md": "Traditional surveillance systems often rely on heavy cloud infrastructure or manual monitoring, which introduces latency and high bandwidth costs. \n\nFor retail environments, security needs to be instantaneous, local, and cost-effective. To solve this, we developed an Intelligent Video-Based Theft Detection and Alert System as part of our Computer Engineering final year project at FUTMinna. \n\nWe built an edge-computing solution running entirely on a Raspberry Pi 4 Model B (4GB) that detects retail threats and pushes instant alerts to Telegram in an average of 2.1 seconds.\n\nHere is a breakdown of how the system architecture, hybrid AI pipeline, and alert mechanisms were engineered.\n\nRunning heavy neural networks on resource-constrained hardware is challenging. We chose the Raspberry Pi 4 Model B (4GB RAM) paired with the Raspberry Pi Camera Module v2 (connected natively via the CSI port for low CPU overhead). By processing video locally at 640x480 resolution, the system achieved a steady 25–31 FPS without requiring external cooling or cloud dependencies.\n\nInstead of relying on a single heavy model that would choke a Raspberry Pi, we engineered a three-detection pipeline that runs concurrently:\n\n**Pipeline 1 - Masked-Face Detection (Haar Cascades)**:\n\nIt Rapidly localizes frontal faces using lightweight Haar cascades adn then extracts the lower 40% of the bounding box (mouth/chin area) and calculates mean pixel intensity to flag hidden identities.   \n\n**Pipeline 2 - Weapon & Sharp Object Detection (MobileNetV2)**:\n\nUses a custom Haar cascade to isolate hand regions, resizing ROIs to 224 X 224 pixels which passes the region through a MobileNetV2 model trained via transfer learning on a balanced dataset of weapon and non-weapon hand images.   \n\n**Pipeline 3 - Pocketing & Concealment Detection (MOG2 Background Subtraction)**:\n\nWhen any of these three modules trigger a positive detection, the system elevates into a global \"THEFT ALERT\" state.\n\nInstead of relying on clunky email protocols or expensive SMS gateways, we integrated the Telegram Bot API.\n\nTo allow remote monitoring without an attached HDMI monitor, we built a lightweight web server using the Flask micro-framework. Using classic MJPEG streaming (multipart/x-mixed-replace), store owners can view the live camera feed, bounding boxes, and alert statuses straight from any smartphone or laptop browser connected to the local network.\n\nThis project proved that high-accuracy, real-time edge AI is entirely feasible on budget-friendly hardware like the Raspberry Pi without sacrificing performance or relying on expensive cloud subscriptions.", "url": "https://wpnews.pro/news/how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4", "canonical_source": "https://dev.to/devdestiny/how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4-telegram-alerts-20p1", "published_at": "2026-11-04 07:51:36+00:00", "updated_at": "2026-11-04 07:56:37.700976+00:00", "lang": "en", "topics": ["computer-vision", "artificial-intelligence", "ai-tools", "machine-learning"], "entities": ["FUTMinna", "Raspberry Pi 4 Model B", "Telegram", "MobileNetV2", "Flask", "Haar cascades", "MOG2"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4", "markdown": "https://wpnews.pro/news/how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4.md", "text": "https://wpnews.pro/news/how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4.txt", "jsonld": "https://wpnews.pro/news/how-we-built-a-real-time-edge-ai-theft-detection-system-on-a-raspberry-pi-4.jsonld"}}