branchsight / index.html
Sheeda's picture
BranchSight project overview
b37bf05 verified
Raw History Blame Contribute Delete
19.6 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Privacy-first CCTV analytics for restaurants and retail: what it does, how it works and measured results.">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 32 32%27%3E%3Crect width=%2732%27 height=%2732%27 rx=%276%27 fill=%27%231F2A33%27/%3E%3Cpath d=%27M6 22h20%27 stroke=%27%23E8B500%27 stroke-width=%274%27/%3E%3Ccircle cx=%2716%27 cy=%2712%27 r=%274%27 fill=%27%23FBFBFA%27/%3E%3C/svg%3E">
<title>BranchSight</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,400;0,500;0,600;1,400&family=Barlow+Semi+Condensed:wght@500;600;700&display=swap" rel="stylesheet">
<style>
/* Layout: one reading column with wide breakout figures and tables; palette borrowed from shop-floor markings, same as the app. */
:root {
--concrete: #E6E9E8;
--paper: #FBFBFA;
--ink: #1F2A33;
--ink-2: #51606B;
--rule: #CDD3D3;
--tape: #C99A00; /* queue zones (darkened for text on light) */
--tape-fill: #E8B500;
--belt: #2F5BD3; /* counting lines */
--staff: #11806A; /* staff zones */
--stop: #C7362A;
--font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
--font-num: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--concrete: #171C20; --paper: #20272C; --ink: #E8ECEC; --ink-2: #A3AFB6; --rule: #34404A;
--tape: #F0C232; --tape-fill: #E8B500; --belt: #7C9CF4; --staff: #2DB295; --stop: #F0625A;
color-scheme: dark;
}
}
:root[data-theme="dark"] {
--concrete: #171C20; --paper: #20272C; --ink: #E8ECEC; --ink-2: #A3AFB6; --rule: #34404A;
--tape: #F0C232; --tape-fill: #E8B500; --belt: #7C9CF4; --staff: #2DB295; --stop: #F0625A;
color-scheme: dark;
}
* { box-sizing: border-box; }
body {
background: var(--concrete); color: var(--ink);
font: 400 17px/1.6 var(--font);
padding-left: max(16px, env(safe-area-inset-left, 0px));
padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--belt); text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--belt); outline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding-block: 40px 64px; display: grid; gap: 56px; }
.prose { max-width: 68ch; }
h1, h2, h3 { font-family: var(--font-num); line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6vw, 3.6rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.75rem; font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0; }
section { display: grid; gap: 18px; min-width: 0; }
.muted { color: var(--ink-2); }
small, .note { font-size: 0.9rem; color: var(--ink-2); }
/* header */
header { display: grid; gap: 18px; }
.tape { height: 10px; width: 120px; background: repeating-linear-gradient(-45deg, var(--tape-fill) 0 12px, var(--ink) 12px 24px); border-radius: 2px; }
.lede { font-size: 1.3rem; line-height: 1.45; max-width: 52ch; }
.links { display: flex; flex-wrap: wrap; gap: 10px 22px; font-weight: 500; }
.links span { color: var(--ink-2); font-weight: 400; }
.byline { color: var(--ink-2); font-size: 0.95rem; }
/* use cases */
.uses { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.use { background: var(--paper); border-radius: 6px; padding: 16px 18px; border-left: 5px solid var(--rule); display: grid; gap: 6px; align-content: start; }
.use[data-k="line"] { border-color: var(--belt); }
.use[data-k="queue"] { border-color: var(--tape-fill); }
.use[data-k="staff"] { border-color: var(--staff); }
.use[data-k="heat"] { border-color: var(--stop); }
.use p { font-size: 0.97rem; }
/* figures */
figure { margin: 0; display: grid; gap: 8px; }
figure img { width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--rule); display: block; }
figcaption { font-size: 0.92rem; color: var(--ink-2); }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.shots figure:first-child { grid-column: 1 / -1; }
/* diagram */
.diagram { background: var(--paper); border-radius: 6px; padding: 16px; overflow-x: auto; }
/* tables */
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { font-weight: 600; color: var(--ink-2); font-size: 0.85rem; }
td.num, th.num { text-align: right; }
tr.hl td { font-weight: 600; }
tr:last-child td { border-bottom: none; }
/* bar chart */
.bars { background: var(--paper); border-radius: 6px; padding: 18px; display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: 12px; align-items: center; }
.bar-row .label { font-size: 0.92rem; }
.bar-track { position: relative; display: grid; gap: 4px; }
.bar { height: 14px; border-radius: 2px; display: flex; align-items: center; }
.bar span { font: 600 0.8rem var(--font-num); margin-left: calc(100% + 6px); white-space: nowrap; color: var(--ink); font-variant-numeric: tabular-nums; }
.bar.mota { background: var(--belt); }
.bar.idf1 { background: var(--tape-fill); }
.axis { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: 12px; font-size: 0.78rem; color: var(--ink-2); }
.axis .ticks { display: flex; justify-content: space-between; border-top: 1px solid var(--rule); padding-top: 4px; }
.legend { display: flex; gap: 18px; font-size: 0.85rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
/* stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { display: grid; gap: 2px; padding-left: 12px; border-left: 4px solid var(--rule); }
.stat b { font: 600 2rem/1.05 var(--font-num); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.88rem; color: var(--ink-2); }
ul { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
li { padding-left: 2px; }
code { font-size: 0.9em; background: var(--paper); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--rule); }
@media (max-width: 640px) {
body { font-size: 16px; }
.shots { grid-template-columns: 1fr; }
.bar-row, .axis { grid-template-columns: 1fr; gap: 4px; }
.axis .spacer { display: none; }
.bar span { margin-left: 6px; }
.bar { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flow .step { background: var(--concrete); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 12px; font-size: 0.92rem; line-height: 1.3; }
.flow .step b { display: block; font-family: var(--font-num); font-weight: 600; }
.flow .arrow { color: var(--ink-2); font-size: 1.1rem; }
.flow .store { border-style: dashed; }
</style>
</head>
<body>
<div class="wrap">
<header>
<div class="tape" aria-hidden="true"></div>
<h1>BranchSight</h1>
<p class="lede">Turns the CCTV cameras a restaurant or shop already has into live operational numbers, without identifying anyone.</p>
<div class="links">
<a href="http://136.111.241.235" target="_blank" rel="noopener">Live demo (recorded footage, analysed live)</a>
<a href="https://github.com/Crypto47/branchsight" target="_blank" rel="noopener">Source code on GitHub</a>
<span>Python, YOLO26, ByteTrack, ONNX Runtime, FastAPI, Docker, Google Cloud</span>
</div>
<p class="byline">Built by Musaab, October 2026.</p>
</header>
<section>
<h2>What it does</h2>
<p class="prose">Chains have cameras in every branch, but nobody watches them. BranchSight watches the feeds continuously and answers the questions a branch manager actually asks: how many people came in, how long the queue is, whether the counter has been left empty, and where customers spend their time.</p>
<div class="uses">
<div class="use" data-k="line"><h3>Footfall</h3><p>Counts people crossing a line drawn across the door, in each direction, minute by minute.</p></div>
<div class="use" data-k="queue"><h3>Queue and wait time</h3><p>Measures how many people are waiting at the counter and how long they waited. Raises an alert if the queue stays too long.</p></div>
<div class="use" data-k="staff"><h3>Unattended counter</h3><p>Alerts when nobody has been behind the counter for a set time during opening hours. It checks presence, never who.</p></div>
<div class="use" data-k="heat"><h3>Heatmap and dwell</h3><p>Shows which parts of the floor people spend time in and the average time spent in each zone.</p></div>
</div>
</section>
<section>
<h2>What it looks like</h2>
<div class="shots">
<figure>
<img src="img/live.png" alt="Live page: three camera feeds with people boxed and faces pixelated, count readouts under each feed, and an alert list on the right" width="1440" height="900">
<figcaption>Live view. Three demo cameras playing recorded public footage, analysed live. Faces are pixelated on the server before any frame is sent.</figcaption>
</figure>
<figure>
<img src="img/zones.png" alt="Zone editor: a queue area drawn as a yellow polygon over a blurred snapshot, with settings for the alert threshold" width="1440" height="900">
<figcaption>Zone editor. A manager draws the queue area with the mouse and sets the alert threshold. It applies to the running stream on save.</figcaption>
</figure>
<figure>
<img src="img/dashboard.png" alt="Dashboard: charts of footfall per minute and minutes the staff desk was empty" width="1440" height="900">
<figcaption>Dashboard. Per-minute footfall, queue length, wait time, unattended minutes, occupancy and the heatmap, with CSV export.</figcaption>
</figure>
</div>
</section>
<section>
<h2>How it works</h2>
<p class="prose">Each camera has its own worker. It always takes the newest frame, so delay never builds up. It finds people, follows each one across frames with a temporary ID, updates the counts, and pixelates faces before the frame goes to the browser. Only per-minute numbers and alert events are saved.</p>
<div class="diagram">
<div class="flow" role="img" aria-label="Pipeline: camera, newest frame, find people, follow each person, counts and zones, pixelate faces, then live video and per-minute numbers">
<div class="step"><b>Camera</b>or demo video</div><span class="arrow" aria-hidden="true">&rarr;</span>
<div class="step"><b>Newest frame</b>older ones dropped</div><span class="arrow" aria-hidden="true">&rarr;</span>
<div class="step"><b>Find people</b>YOLO26n, ONNX Runtime</div><span class="arrow" aria-hidden="true">&rarr;</span>
<div class="step"><b>Follow each person</b>ByteTrack</div><span class="arrow" aria-hidden="true">&rarr;</span>
<div class="step"><b>Counts and zones</b>waits, alerts, heatmap</div><span class="arrow" aria-hidden="true">&rarr;</span>
<div class="step"><b>Pixelate faces</b>and heads</div><span class="arrow" aria-hidden="true">&rarr;</span>
<div class="step"><b>Live video</b>in the browser</div>
<div class="step store"><b>Saved</b>per-minute numbers and alerts only</div>
</div>
</div>
</section>
<section>
<h2>Privacy by design</h2>
<ul class="prose">
<li><strong>No identification.</strong> No face recognition and no matching people across cameras or days. A person's ID exists only while they are in view.</li>
<li><strong>Faces never leave the server.</strong> Every frame shown or saved has detected faces and the head area of every person pixelated, on by default.</li>
<li><strong>Numbers, not video.</strong> The database holds per-minute counts and alert events only, and deletes them after 30 days.</li>
<li><strong>Staff analytics are presence-only.</strong> The unattended alert checks whether anyone is at the counter, not who.</li>
</ul>
</section>
<section>
<h2>Results</h2>
<p class="prose">Every number here comes from a script in the repository and can be re-run. The weak results are reported along with the strong ones.</p>
<div class="stats">
<div class="stat" style="border-color: var(--belt)"><b>21.9 FPS</b><span>full pipeline, one camera, laptop CPU</span></div>
<div class="stat" style="border-color: var(--belt)"><b>1.76x</b><span>faster with ONNX Runtime than PyTorch on CPU</span></div>
<div class="stat" style="border-color: var(--tape-fill)"><b>34.7</b><span>MOTA on MOT17 at 960 px (24.3 at the default 640)</span></div>
<div class="stat" style="border-color: var(--staff)"><b>55</b><span>automated tests, including a real-footage run</span></div>
</div>
<h3>Tracking accuracy on MOT17</h3>
<p class="prose">MOT17 is the standard public benchmark for following people in video, with every person hand-annotated. The system was run on all 7 training sequences and scored with an evaluator that matches the official TrackEval rules. The detector is the off-the-shelf nano model; it was not trained on this data.</p>
<div class="bars" role="img" aria-label="Bar chart of MOTA and IDF1 for four configurations; YOLO26n at 960 pixels scores highest with MOTA 34.7 and IDF1 45.1">
<div class="legend"><span><i style="background: var(--belt)"></i>MOTA (overall tracking accuracy)</span><span><i style="background: var(--tape-fill)"></i>IDF1 (keeps the same ID on the same person)</span></div>
<div class="bar-row"><div class="label">Nano model, 640 px (default)</div><div class="bar-track"><div class="bar mota" style="width: 48.6%"><span>24.3</span></div><div class="bar idf1" style="width: 68%"><span>34.0</span></div></div></div>
<div class="bar-row"><div class="label">Nano, 640 px, low-confidence boxes kept</div><div class="bar-track"><div class="bar mota" style="width: 49.2%"><span>24.6</span></div><div class="bar idf1" style="width: 67.2%"><span>33.6</span></div></div></div>
<div class="bar-row"><div class="label">Small model, 640 px</div><div class="bar-track"><div class="bar mota" style="width: 58.4%"><span>29.2</span></div><div class="bar idf1" style="width: 80.4%"><span>40.2</span></div></div></div>
<div class="bar-row"><div class="label"><strong>Nano model, 960 px</strong></div><div class="bar-track"><div class="bar mota" style="width: 69.4%"><span>34.7</span></div><div class="bar idf1" style="width: 90.2%"><span>45.1</span></div></div></div>
<div class="axis"><div class="spacer"></div><div class="ticks"><span>0</span><span>10</span><span>20</span><span>30</span><span>40</span><span>50</span></div></div>
</div>
<p class="prose note">Almost all errors are missed people (82,559 missed boxes against 2,299 false alarms), mostly small and distant figures in crowded scenes. Giving the model more pixels helps more than a bigger model, but costs 2.3x the compute. On the shop-entrance sequence the default setup scores MOTA 56.4.</p>
<h3>Counting accuracy</h3>
<p class="prose">Instead of counting by hand, the true number of line crossings was computed by running the same counting code over the benchmark's annotated tracks. That gave 76 real crossings on 8 lines across the three fixed-camera sequences.</p>
<div class="table-wrap"><table>
<thead><tr><th>Setup</th><th class="num">Crossings counted (true: 76)</th><th class="num">Total error</th></tr></thead>
<tbody>
<tr><td>Nano model, 640 px (default)</td><td class="num">50</td><td class="num">-34%</td></tr>
<tr><td>Small model, 640 px</td><td class="num">69</td><td class="num">-9%</td></tr>
<tr class="hl"><td>Nano model, 960 px</td><td class="num">74</td><td class="num">-3%</td></tr>
</tbody>
</table></div>
<p class="prose note">At 960 px the total is close, but individual lines are still off in both directions, so per-line accuracy is lower than the total suggests. The sample is small.</p>
<h3>Speed</h3>
<div class="table-wrap"><table>
<thead><tr><th>Hardware</th><th>Setup</th><th class="num">Time per frame (median)</th></tr></thead>
<tbody>
<tr><td>Laptop CPU (AMD Ryzen AI 9 HX 370)</td><td>PyTorch, detection only</td><td class="num">51.1 ms</td></tr>
<tr class="hl"><td>Laptop CPU</td><td>ONNX Runtime, detection only</td><td class="num">29.0 ms</td></tr>
<tr><td>Laptop CPU</td><td>Full pipeline, one camera</td><td class="num">44.4 ms (21.9 FPS)</td></tr>
<tr><td>Laptop GPU (RTX 5070 Ti)</td><td>PyTorch, network only, 1 frame</td><td class="num">18.9 ms</td></tr>
<tr><td>Laptop GPU</td><td>PyTorch, network only, 3 cameras batched</td><td class="num">9.0 ms per frame</td></tr>
<tr><td>Cloud VM (2 shared vCPUs)</td><td>Full pipeline, one camera</td><td class="num">274 ms (3.2 FPS)</td></tr>
</tbody>
</table></div>
<ul class="prose note">
<li>The app ships with ONNX Runtime on CPU: it is 1.76x faster than PyTorch and keeps the server image free of PyTorch.</li>
<li>On the GPU, a single frame takes about 19 ms whatever the image size, which means the time goes on launching work from Python, not on the GPU itself. Batching three cameras into one call doubles throughput. A compiled TensorRT engine is the next step.</li>
<li>The public demo runs on the smallest practical cloud machine, so each of its three cameras gets about one frame per second. It works, but counts there are coarser than on a laptop.</li>
</ul>
</section>
<section>
<h2>Engineering</h2>
<ul class="prose">
<li>One Python service: per-camera worker threads, a REST API, live video streams, a WebSocket for live counts, and a three-page web app with no build step.</li>
<li>Streams reconnect on their own with exponential backoff, and tracking restarts cleanly after a reconnect so no false counts appear.</li>
<li>Storage is SQLite by default or Postgres through one setting, with a 30-day retention job.</li>
<li>One Docker image with the model export in a separate build stage, deployed to Google Cloud with a single script.</li>
<li>55 automated tests cover counting logic, zones, alerts, privacy pixelation, the API, and an end-to-end run on real footage.</li>
</ul>
</section>
<section>
<h2>Limitations and next steps</h2>
<ul class="prose">
<li>The off-the-shelf detector misses small and distant people. Fine-tuning on CCTV-angle footage, with a before-and-after comparison, is the next step.</li>
<li>GPU inference with TensorRT and batching across cameras, and running on edge devices so video never leaves the branch.</li>
<li>The demo uses plain HTTP and a single admin password; a production deployment needs HTTPS and proper user accounts.</li>
</ul>
</section>
<section>
<p class="prose note">Demo footage: MOT17 sequences from MOTChallenge (CC BY-NC-SA 3.0, non-commercial) and a Pexels stock clip, both with faces pixelated. The code is AGPL-3.0 because it uses Ultralytics YOLO.</p>
</section>
</div>
</body>
</html>