Computer Vision · Retail

Smart Retail Analytics MVP

A CPU-only footfall counter for small retailers — with a hand-written track-stitching engine that fixes the double-counting problem every occluded scene creates.

Prototype → MVPPublic on GitHubCPU-only
21×less compute than a GPU-class model — YOLOv8n at 8.7 GFLOPs vs YOLOv8x at 184.9
0GPUs required — the pipeline runs explicitly with device='cpu'
100%local processing — video never leaves the store, no cloud involved
2interface languages: English and Persian (full RTL)

The problem

CONTEXT

Retail analytics assumes GPU infrastructure

Typical footfall deployments run large detection models on GPU servers or cloud inference — infrastructure a small shop can't justify. The question: how much accuracy survives on the laptop-class hardware they already own?

Occlusion breaks the count

When a shopper walks behind a shelf, the tracker loses their ID. When they reappear, the system sees a "new" person — the same customer gets counted twice, and every downstream metric inherits the error.

What I built

BUILD

A CPU-only pipeline

YOLOv8n (the 3.2M-parameter nano model) with ByteTrack tracking, explicitly pinned to device='cpu' in the code. Real-time footfall counting on an ordinary laptop — no GPU server, no cloud, no inference bill.

A hand-written track-stitching engine

When a track disappears, its last position is kept as a ghost ID. If a new detection appears within the stitch distance inside the memory window, the engine re-links it to the original person — one ID, one count. The double-counting problem is solved in logic, not hardware.

A virtual gate line

Counting happens by line-crossing geometry: the installer draws the entrance gate with sliders, and only tracks crossing it are counted. No fixed camera assumptions — the line adapts to each store.

How it works in practice

DETAIL

Human-in-the-loop calibration

Instead of a black box, the installer tunes the behavior per store: stitch distance (how far to search for a lost person), stitch memory (how long a ghost stays alive), and detection confidence — each with plain-language guidance in both languages.

Live KPIs, including repairs

The dashboard shows total visitors — and a second number most tools hide: path repairs, how many times the engine re-linked a returning customer. Making the fix visible builds trust in the count.

The decision

OUTCOME

Privacy as the default, not a feature

All processing is local and offline — video never leaves the store. The constraint that saved money (no cloud) also removed the hardest objection small retailers have about cameras.

Hardware budget as a design constraint

The MVP proved the position: the answer to "we can't afford GPU analytics" isn't cheaper GPUs — it's better logic on standard hardware. That constraint shaped every technical choice in the build.

Stack & links

TECH

Stack

YOLOv8nByteTrackOpenCVStreamlitCPU inferencePython

Links

← PreviousAdQuest Next →Prompt Packer