← Todd Ivon Case study 06 · BATvision (Vision AI) · BAT / Reynolds · 2026 All work
DISPLAY · MALE · APEX CARBON
Interactive simulation of BATvision's real assets, silhouettes, demo clips, and PlaylistEngine priority (CHILD > WOMAN > MAN > NONE).

BATvision The screen that looks back.

A nicotine ad on a store screen is legal for the adult in front of it, and wrong for the child beside them. BATvision is a working full-stack prototype I built in June 2026: YOLOv8n tracks people in real time, a vision LLM classifies each new track once, and a server-side playlist engine keeps every public screen synchronized — switching campaigns by audience or locking down immediately when a minor walks in.

Company
BAT · Reynolds American
Year
2026 (June)
Architecture
4-route React SPA + FastAPI
Role
Concept, design & build
Stack
YOLOv8n, Gemini 2.5 Flash / Claude, SQLite
Hardware
iPad HUD · Raspberry Pi 4/5 kiosk
01 · The problem

A screen cannot check ID.

In the United States, nicotine is restricted to adults 21 and over by federal law since December 2019. Print and digital ads carry the mandatory warning block across the top, which is what the Warning Generator solves.

A screen above a retail counter still plays blindly to whoever is standing in line. BATvision closes that loop: it does not replace the warning; it stops adult product media from playing at all whenever a minor is present.

A Vuse in-store screen wall. Every panel carries the federal warning, yet none of them knows who is standing in front of it.
02 · The real system

Four routes, one authoritative engine.

The prototype is a complete multi-screen application. An operator opens the Live HUD on an iPad or desktop browser; public displays run full-bleed on /display synchronized over WebSockets; marketers upload clips and toggle child-safety rules in /library; and /demographics logs detections, dwell time, and local context.

All screenshots below come directly from the compiled BATvision frontend backed by its June 2026 local test database in Winston-Salem, North Carolina.

BATvision · / · Operator HUD (Adult read)
BATvision Operator HUD tracking a male adult and cell phone with live WebSocket bounding boxes and playing Male Apex Carbon in the PiP display
/ · Operator HUD — Live camera feed with 60 fps lerped bounding boxes, PiP display monitor, Playlist Engine state, target inventory, and diagnostic console.
BATvision · / · Operator HUD (Child lockdown)
BATvision Operator HUD detecting a child alongside an adult, immediately switching the Playlist Engine and PiP monitor to LOCKDOWN
/ · Child override — The moment TRK_015 resolves as CHILD, the Playlist Engine bypasses the 15 s ad lock and flips every screen to LOCKDOWN.
BATvision · /display · Virtual Public Display
BATvision public /display route in Lockdown state showing Minor Detected, Ads Suspended
/display · Public signage screen — Dual-slot crossfade video player synced over /ws/display (re-seeks if drift exceeds 1.5 s), plus procedural lockdown and ambient screens.
BATvision · /library · Playlist & Policy Manager
BATvision /library interface showing playlist upload dropzone, FEMALE and MALE clip cards, and System Settings with Kids Playlist vs Lockdown toggle
/library · Content & policy manager — Drag-and-drop MP4/WEBM/MOV ingestion (≤ 500 MB), playlist assignment, 15 s dwell-lock tuning, and kids_playlist vs lockdown switch.
03 · Under the hood

Track once, ask once, sync every screen.

Running a vision LLM on every video frame would stall playback and burn tokens. Instead, YOLOv8-nano runs locally on every frame inside an asyncio.Lock worker thread so WebSocket display sync never drops, while the vision LLM is called strictly once per new track_id.

  1. CaptureWebSocket /ws/vision

    Browser HUD or headless camera_agent.py streams 640 × 480 JPEG frames. A second client supersedes the first cleanly (WS_SUPERSEDED 4001).

  2. TrackYOLOv8-nano

    model.track(persist=True) assigns persistent track IDs to people and secondary objects; unseen tracks flush after 3.5 s via track_reaper().

  3. ClassifyGemini / Claude

    First crop (padded 15% for head-and-shoulders context) is sent once to gemini-2.5-flash or claude-haiku-4-5 and cached in vision.track_history.

  4. SynchronizePlaylistEngine

    Evaluates the last 1.5 s of presence (CHILD > WOMAN > MAN > NONE), honors a 15 s ad lock, and pushes state over /ws/display.

# backend/playlist.py — authoritative server-side PlaylistEngine
PRESENCE_WINDOW = 1.5     # seconds of recent presence considered "in front of screen"
DEMO_TO_PLAYLIST = {"MAN": "MALE", "WOMAN": "FEMALE", "CHILD": "KIDS", "NONE": "AMBIENT"}

# Priority: CHILD (safety -> lockdown or kids_playlist) > WOMAN > MAN > NONE
if "CHILD" in recent:
    target = "LOCKDOWN" if child_policy == "lockdown" else "KIDS"
    # child-triggered switches and manual overrides bypass the 15 s ad lock
04 · Site intelligence & edge

Built for a store kiosk, logged to SQLite.

Every resolved track and clip playback is written to a local SQLite WAL database (batvision.db) enriched by context.py with live Open-Meteo weather and local events. A dedicated docker-compose.pi.yml stack packages the backend, nginx frontend, and headless OpenCV /dev/video0 camera agent for a Raspberry Pi 4/5 kiosk.

BATvision · /demographics · Site Intelligence (Local Test Session)
BATvision /demographics dashboard showing Winston-Salem local test session metrics: 39 tracked people, 8.4s avg dwell, and 92°F clear sky weather
/demographics rendered from the June 2026 local test database in Winston-Salem, NC (8 demo clips, 39 tracked detections in that day's test run, 8.4 s average dwell).
05 · Built to be defensible

Careful about what it sees.

A camera beside a retail screen requires strict boundaries. BATvision was built as an internal working prototype to prove that AI compliance can operate without storing personal video or identity records.

No footage saved

JPEG frames are decoded with cv2.imdecode in memory and discarded after inference. Only anonymized track labels and dwell durations hit SQLite.

Safety outranks rotation

Demographic transitions respect a configurable ad-lock interval (default 15 s) so clips finish cleanly, but a CHILD detection bypasses the lock immediately.

Verified by unit tests

tests/test_engine.py verifies priority resolution, ad-lock hold vs child bypass, lockdown suspension, least-recently-played rotation, and impression counting.

1vision LLM call per track ID, cached in memory
1.5 spresence window before switching playback
0camera frames written to disk
4synchronized web routes in one stack

All architecture specs and constants verified directly against the BATvision V1 source repository (June 2026). This is a functional R&D prototype, not a deployed store network.

Credits

Concept, design & full-stack build

Todd Ivon

Context

BAT · Reynolds American · 2026 · working prototype