A high-performance, client-side video segmentation engine running in the browser. This project replaces heavy, battery-draining Convolutional Neural Networks (CNNs) and Vision Transformers with Online Robust Principal Component Analysis (OR-PCA) executed entirely on the GPU via WebGPU compute shaders.
Modern video conferencing platforms rely on heavy deep learning models running on the client device to segment user silhouettes for background blurring and virtual replacements.
This Proof of Concept (POC) demonstrates that real-time video stream background subtraction and privacy blurring can be achieved with near-zero host CPU utilization (~1.3% vs. ~35%+ in production web apps) by casting background subtraction as an online low-rank matrix decomposition problem (
Platforms like Google Meet execute client-side deep learning pipelines (typically MobileNet/TFLite-based semantic segmentation models delivered via WebAssembly with SIMD acceleration or WebGL/WebGPU compute backends).
While effective at identifying generic human silhouettes, this approach suffers from two foundational flaws:
- Massive Compute & Energy Overhead: Evaluating millions of neural network weights per frame at 30–60 FPS forces sustained high CPU and GPU pipeline usage. This causes thermal throttling, loud fan noise, and severe battery drain during video calls.
- Semantic Rigidity ("The Disappearing Object Problem"): Semantic segmentation models are strictly supervised: they are trained on datasets labeling human anatomy (hair, face, torso, arms). Because the model has no concept of physical motion or transient foreground, any non-human object held by the user (such as a pen, notepad, book, or product prototype) is classified as background and aggressively blurred out when moved away from the torso.
- Google Research: Background Features in Google Meet Powered by Web ML
- MediaPipe Selfie Segmentation Architecture Overview
- CPU Overhead: Open Google Meet in Chrome, turn on Background Blur, and press
Shift + Escto open the Chrome Task Manager. Observe the dedicated Meet tab consuming 30%–45%+ CPU. - Object Disappearance: Hold a pen close to your chest (it remains visible). Slowly extend your arm outward to the side of the frame. The neural network will fail to classify the pen as a human feature, instantly blurring it into the background.
Instead of inferring semantic classes, we model the video feed through Online Robust PCA (OR-PCA):
-
$M_t$ : The incoming video frame matrix. -
$L_t$ : The low-rank static background subspace ($L_t = U_t \cdot c_t$ ). -
$S_t$ : The sparse foreground matrix representing active motion/variance.
+--------------------------+ +----------------------------+
| Camera Feed Ingestion | ----> | WebGPU Compute Shaders |
| (importExternalTexture) | | (Projection -> Residual |
+--------------------------+ | -> Update -> Smoothing) |
+----------------------------+
|
v
+--------------------------+ +----------------------------+
| 60 FPS Viewport Render | <---- | Branchless Strided Blur |
| (Zero-Copy Framebuffer) | | (Foreground-Aware Mask) |
+--------------------------+ +----------------------------+
By leveraging importExternalTexture, video frames are ingested directly into VRAM with zero-copy CPU serialization. Parallel reduction and gradient descent update passes calculate the background basis
- Detailed Specification: Read the Complete System Design Document
- A browser with native WebGPU support enabled (Google Chrome 113+ or Microsoft Edge 113+ on Windows, macOS, or Linux).
- Node.js (v18.0.0 or higher) and
npm.
# 1. Clone the repository
git clone [https://github.com/](https://github.com/)<your-username>/zero-shot-orpca.git
cd zero-shot-orpca
# 2. Install dependencies
npm install
# 3. Start local development server
npm run devOpen your browser and navigate to the local Vite URL (typically http://localhost:5173).
To profile hardware efficiency accurately:
- Open the application tab alongside Google Chrome Task Manager (
Shift + Esc) and Windows Task Manager (Performance tab) in a side-by-side configuration. (Note: Avoid completely overlaying or minimizing the application window, as Chrome's Window Occlusion Culling will automatically throttle or pause the render loop). - Compare the main-thread Tab CPU utilization of this WebGPU pipeline (~1.3%) against Google Meet's segmentation tab (~35%+).
- Test the Peripheral Object Presentation Test: Extend a handheld pen or object away from your body. Observe that the object remains in the foreground without disappearing into the blur.
- Verification Video: Watch the Benchmarking Walkthrough
While the pipeline delivers low compute overhead and solves peripheral object tracking, variance-based segmentation has fundamental trade-offs:
-
First-Principles Variance Bias: OR-PCA identifies foreground by measuring the reconstruction error
$|m_t - L_t|$ against a variance threshold$\tau$ . When initialized with an unpopulated basis matrix$U_0$ , high-contrast static fixtures (such as a black wall clock on a white wall) produce a massive initial error spike. If the learning rate$\alpha$ is conservative, the engine requires several frames of zero motion to fully project that high-contrast fixture into the low-rank subspace$L_t$ . -
Uniform Color Interior Holes: When a user wears clothing that perfectly matches the luminance/chrominance of the wall behind them, the mathematical difference drops below the threshold
$\tau$ , causing the interior of the silhouette to momentarily classify as background.
-
Dynamic Variance Adaptation: Replace hardcoded thresholds with a compute-driven global variance reduction pass to automatically adjust
$\tau$ and$\alpha$ during sudden scene or lighting changes. -
Separable Dual-Pass Gaussian Blur: Transition the single-pass strided kernel to a two-pass ping-pong compute blur (Horizontal + Vertical) to allow deep, frosted-glass diffusion at large radii with
$\mathcal{O}(2N)$ complexity. - Temporal Consistency Filters: Introduce edge-preserving bilateral filtering across sequential mask buffers to eliminate boundary edge crawling while preserving sub-pixel hair and hand contours.