Back to Portfolio
Smart Store Analytics AI: Computer Vision & Retail Spatial Intelligence
Computer Vision & Spatial AI

Smart Store Analytics AI: Computer Vision & Retail Spatial Intelligence

Open Source Package / Self-Hosted GitHub Repository
Python 3.10-3.14 FastAPI OpenCV YOLOv8 Person Detection Multi-Object Tracking (MOT) Ray-Casting Point-in-Polygon Gaussian Density Heatmaps HTML5 Canvas 2D Floorplan Typer CLI Docker Pytest
Executive Summary

A production-grade Computer Vision and Retail Spatial Intelligence platform performing Multi-Object Tracking, interactive zone editing, shopper conversion funnels, 2D heatmaps, and checkout queue SLA monitoring with zero biometric retention.

Tests Passing
63 / 63
Sub-second deterministic unit and integration test suite executing without GPU dependencies
Zero-Cloud Privacy
100%
On-premise edge inference discarding video frames immediately with strict GDPR and CCPA compliance
Trajectory Latency
< 1.2 s
Continuous real-time shopper motion trails and spatial heatmap overlays rendered in-browser
Spatial Containment
Jordan Curve
Horizontal ray-casting point-in-polygon engine calculating exact dwell duration per department

The Physical Retail Telemetry Divide: Bringing Web Analytics to the Physical Aisle

In modern digital commerce, operators enjoy complete visibility over customer journeys. Every click, scroll depth, session duration, and funnel drop-off is tracked and analyzed via platforms like Google Analytics and Hotjar, enabling rapid layout iteration and conversion optimization. In stark contrast, physical brick-and-mortar retail stores—which continue to drive more than eighty percent of total global commerce—have historically operated blindly. Operations teams invest millions in interior remodeling and visual merchandising while relying on coarse entrance counters that register headcounts but provide zero insight into what happens past the doorway.

This operational divide creates three critical vulnerabilities for retail operators. First, entrance beam counters fail to track internal footfall paths, leaving management unaware of which promotional displays capture genuine shopper interest and which aisles suffer from total abandonment. Second, unmonitored checkout queue bottlenecks trigger cart abandonment, as frustrated customers walk out when lines exceed acceptable thresholds without management receiving proactive notice to deploy relief cashiers. Third, privacy regulations rightfully ban intrusive biometric harvesting, preventing operators from deploying cloud-based facial recognition systems in public commercial spaces.

Privacy-First Vision Pipeline & Occlusion-Resilient Multi-Object Tracking

To resolve these challenges without compromising visitor privacy, I engineered Smart Store Analytics AI as a high-performance computer vision platform that executes inference entirely on edge hardware without streaming raw video to external cloud providers. The object detection module leverages a lightweight YOLO model restricted strictly to bounding box coordinates for people, stripping away all facial, gender, and biometric features at the moment of optical acquisition.

Each detected individual is mapped to a ground contact point calculated at the bottom-center of their bounding box coordinates. The Multi-Object Tracking engine pairs active tracks with candidate detections through an Intersection over Union cost matrix with a baseline threshold of 0.30. When fast movement or momentary camera occlusions drop overlap scores, the system automatically falls back to Euclidean centroid proximity matching within an eighty-pixel radius, preserving track continuity. Track states are governed by a deterministic state machine requiring two consecutive frame confirmations before graduating from tentative to confirmed status, and purging records from active memory after thirty consecutive unobserved frames.

Mathematical Foundations: Jordan Curve Point-in-Polygon & Gaussian Density Kernels

Optical tracking coordinates are transformed into commercial business intelligence through rigorous computational geometry:

Commercial zone dwell time is calculated using a horizontal ray-casting point-in-polygon algorithm grounded in the Jordan Curve Theorem. The algorithm casts an infinite horizontal ray from the shopper ground contact point and tallies the total number of intersections with the edges of configured department polygons. An odd intersection count confirms that the visitor is physically positioned inside the department boundary, triggering continuous frame-accurate dwell accumulation until an exit event occurs.

Spatial traffic concentration is modeled through a two-dimensional Gaussian kernel density accumulator operating over a discrete 128 by 72 grid. Every point recorded along an active trajectory injects a smooth density weight into the surrounding coordinate space. The accumulated density matrix is normalized and rendered through thermal colormap palettes, producing high-contrast spatial heatmaps that instantly differentiate prime commercial corridors from stagnant display corners.

Shopper Conversion Funnels & The AI Retail Copilot Engine

The platform features an end-to-end conversion funnel module that quantifies visitor progression across four distinct retail zones: the entrance foyer, the promotional showcase, the high-value electronics department, and the point-of-sale checkout counter. The funnel engine computes drop-off percentages between successive zones, flags the primary operational leakage bottlenecks where shopper interest collapses, and constructs directional Markov migration matrices that reveal shopper transit probabilities across departments.

Complementing the funnel engine is the AI Retail Copilot, an automated heuristic advisory system that evaluates the spatial health of the store floor on a scale from 0 to 100. The copilot analyzes footfall concentration, dwell time dispersion, and department traversal ratios to detect dead merchandise showcases suffering from traffic volumes forty percent below store averages. When an underperforming zone is identified, the copilot generates actionable merchandising recommendations—such as shifting seasonal endcaps toward primary transit corridors—and highlights the target area on the live dashboard with an attention-guiding visual flash.

In-Browser Interactive Canvas Zone Editor & Queue Bottleneck Telemetry

To eliminate developer dependency when store layouts shift, the platform provides an interactive zone editor built on the HTML5 Canvas element. Floor managers can visually drag polygon vertex handles directly within their browser viewport, create custom department zones, modify existing boundaries, and commit updated floorplans directly to JSON configuration files without restarting server processes.

To safeguard customer retention at point-of-sale, the platform incorporates an automated queue bottleneck state machine. The system continuously evaluates checkout zone occupancy and customer wait duration, dispatching immediate SLA breach warnings when customer counts exceed five individuals or dwell times exceed three minutes. Alerts are transmitted asynchronously through an integrated notification engine supporting Slack, Discord, and Telegram bots, complete with configurable cooldown throttling to prevent notification flooding while ensuring prompt staff mobilization.

Multi-Source Stream Ingestion, Live Webhooks, and Enterprise API Integration

Designed for flexible field deployment, the streaming infrastructure supports three operational ingestion modes: a zero-GPU synthetic simulation generator that produces realistic shopper trajectories for headless development, a video file uploader compatible with recorded MP4, AVI, and MOV files for retrospective store audits, and a direct RTSP video capture pipeline that interfaces natively with enterprise IP cameras and network video recorders.

The backend exposes high-throughput FastAPI REST endpoints structured to OpenAPI standards, enabling seamless integration with external ERP, CRM, and business intelligence systems. Operators can export printable executive A4 PDF audit summaries and RFC-compliant CSV dwell datasets with a single click. Supported by a comprehensive test suite of sixty-three unit and integration tests executing deterministically in sub-second runtimes, the platform delivers enterprise-grade reliability and mathematical precision for physical retail intelligence.

Interactive System Studio & Architecture Screens

Click any screen below to inspect in high-resolution with zoom in, zoom out, pan, and full screen controls.

7 Displays

Interested in a similar project?

We can build a tailored solution customized to your business goals.

Contact Me Now