\section{Method}
\label{sec:method}

The core challenge for retail edge tracking is bridging the gap between detector-sparse operation (necessitated by CPU constraints) and tracking continuity (requiring frame-by-frame motion evidence). Classical background subtraction provides continuous foreground masks but absorbs stationary people within 100 frames, fragmenting tracks. Continuous YOLO invocation maintains detection accuracy but saturates RPi5 CPU at 82\% per camera, precluding multi-camera deployment. We introduce CHURI (Figure~\ref{fig:overview}), a detector-gated architecture that employs zone-level background subtraction with occupancy-aware learning rates to sustain tracks across 50+ frame detector gaps while consuming 6.1 KB memory per camera. The method comprises four components: zone-level spatial discretization for memory efficiency (\S3.1), dual learning rates conditioned on YOLO occupancy masks to prevent stationary absorption (\S3.2), sticky tracking to bridge detector dropouts (\S3.3), and oscillation-aware noise suppression for environmental robustness (\S3.4).

\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{figures/overview}
\caption{CHURI architecture overview. \textit{Top}: Zone-level background subtraction pipeline divides frames into $16\times16$ grid, detects active zones (red/orange), extracts ROIs, and generates person contours. \textit{Bottom}: Sticky tracking across frames $t$, $t+n$, $t+2n$ showing trajectory persistence when YOLO fails on overhead occlusions. Track ID=0 demonstrates YOLO invoked only 2/90 frames while maintaining continuous tracking via zone-BGS contour-velocity propagation.}
\label{fig:overview}
\end{figure*}

\subsection{Zone-Level Background Subtraction Architecture}

CHURI divides each frame into a $16\times16$ spatial grid (256 zones), storing background statistics (mean $\mu_{bg}$ and variance $\sigma^2_{bg}$) at the zone level rather than per pixel. At $1440\times1080$ resolution, each zone spans $90\times67.5$ pixels. For zone $z(r,c)$ at frame $t$, we compute the spatial average color vector $\mu_{frame}(r,c,t)$ and detect foreground when:

\begin{align}
\text{diff}(r,c) &= |\mu_{frame}(r,c,t) - \mu_{bg}(r,c)| \\
\text{threshold}(r,c) &= k \times \sqrt{\sigma^2_{bg}(r,c)} \quad \text{where } k = 2.0 \\
\text{Foreground} &\text{ if: any}(\text{diff}(r,c) > \text{threshold}(r,c))
\end{align}

This zone-level storage requires $16\times16\times3$ floats = 6.1 KB per camera, versus $1440\times1080\times3$ floats = 37.4 MB for per-pixel methods, resulting in a $6{,}131\times$ memory reduction. This enables 8-camera deployment on a Raspberry Pi 5 (8GB RAM), whereas per-pixel methods saturate at 2 cameras.

\subsection{Occupancy-Aware Dual Learning Rates}

To prevent stationary people from being absorbed into the background model, we introduce dual learning rates conditioned on YOLO-derived occupancy masks. Zones overlapping person detections use $\text{LR}_{slow} = 0.0003$ to preserve foreground responsiveness; without this mechanism, stationary shoppers disappear within 100 frames (8.3 seconds at 12 FPS) as classical BGS methods absorb them. Background zones adapt rapidly with $\text{LR}_{fast} = 0.5$ to handle lighting changes and camera adjustments. The background model updates via exponential moving average with occupancy-conditional learning rates:

\begin{align}
\mu_{bg}(r,c) &\leftarrow \mu_{bg}(r,c) + \text{LR}(r,c) \times (\mu_{frame}(r,c) - \mu_{bg}(r,c)) \\
\sigma^2_{bg}(r,c) &\leftarrow \sigma^2_{bg}(r,c) + \text{LR}(r,c) \times (\text{diff}^2(r,c) - \sigma^2_{bg}(r,c))
\end{align}

where the learning rate adapts to occupancy:
\begin{equation}
\text{LR}(r,c) = \begin{cases}
\text{LR}_{slow} = 0.0003 & \text{if } \Omega(r,c) = 1 \text{ (person present)} \\
\text{LR}_{fast} = 0.5 & \text{if } \Omega(r,c) = 0 \text{ (background)}
\end{cases}
\end{equation}

The occupancy mask $\Omega$ derives from YOLO detections with 10\% bounding box expansion to prevent edge absorption, maintaining foreground integrity during stationary periods while allowing rapid background adaptation elsewhere.

\subsection{Gated YOLO Verification with Sticky Tracking}

Building on the zone-level foreground mask, we employ gated detector verification to reduce inference budget while maintaining tracking continuity. Unlike continuous detection methods that invoke YOLO every frame (saturating RPi5 CPU at 82\% per camera), CHURI employs a three-stage cascade: (1) zone-BGS produces coarse foreground mask at 2 FPS, (2) YOLO verifies candidates every frame but only for regions flagged by zone-BGS (8\% invocation rate), (3) sticky tracking sustains trajectories for 50+ frames from single YOLO confirmation through contour-velocity propagation.

The sticky tracking mechanism is critical for handling detector dropouts common in overhead fisheye scenarios. Once YOLO confirms a candidate (IoU $\geq$ 0.3 with zone-BGS detection), the track becomes ``sticky'' and survives on zone-BGS detections alone even when YOLO fails due to occlusion, low confidence, or viewpoint distortion. This reduces the detector budget by $12\times$ while maintaining tracking continuity across detection gaps. A track confirmed at frame $t$ persists until frame $t+50$ on zone-BGS evidence alone, enabling recovery from temporary YOLO failures.

\begin{table*}[t]
\centering
\caption{Cross-dataset performance with Precision-Recall analysis. \textit{CHURI} achieves highest recall while maintaining competitive precision, improving from 86.3\% precision at high density to 95.1\% at low density.}
\label{tab:cross_dataset}
\small
\resizebox{\textwidth}{!}{%
\begin{tabular}{@{}lcccccccccccc@{}}
\toprule
\multirow{2}{*}{Dataset} & \multirow{2}{*}{Type} & \multirow{2}{*}{Frames} & \multirow{2}{*}{Density} & \multicolumn{2}{c}{YOLO} & \multicolumn{2}{c}{MOG2} & \multicolumn{2}{c}{KNN} & \multicolumn{2}{c}{\textit{CHURI}} \\
\cmidrule(lr){5-6} \cmidrule(lr){7-8} \cmidrule(lr){9-10} \cmidrule(lr){11-12}
& & & & R & P & R & P & R & P & R & P \\
\midrule
WEPDTOF & Overhead & 1,687 & 7.9 & 52.1 & 94.2 & 40.5 & 76.1 & 54.8 & 79.4 & \textbf{78.2} & 86.3 \\
MERL Shopping & Frontal & 9,500 & 3.2 & 35.0 & 91.5 & 42.3 & 80.8 & 38.7 & 83.7 & \textbf{87.6} & 91.9 \\
Innovatiana & Behavioral & 13,200 & 1.4 & 84.5 & 94.8 & 71.2 & 82.6 & 73.8 & 85.9 & \textbf{92.1} & 95.1 \\
\bottomrule
\end{tabular}%
}
\end{table*}

\subsection{Oscillation-Aware Noise Suppression}

Zone-level foreground detection can trigger false positives from environmental noise (ceiling fans, flickering lights, monitor reflections). To address this, zones exhibiting $>$8 foreground/background oscillations per 30-frame window are marked as noisy and suppressed. A 40-second sliding cycle removes unstable zones while retaining persistent motion zones. This temporal filtering distinguishes transient clutter from genuine person motion. Combined with morphological closing ($3\times3$ kernel) to fill zone boundary gaps, this reduces false positive rate by 35\% on WEPDTOF clutter scenarios while preserving true detections.
