AKSHAR
AKSHAR
A Chrome extension that classifies and blurs explicit content on-device, in real time, before it renders.

The Challenge
A content-safety extension has one shot to get the overlay in place — if the image renders before the classifier fires, the damage is done. But classification is expensive: a cold TensorFlow.js model load takes ~4 seconds, GPU context thrashing under concurrent requests destroys throughput, and a persistent offscreen document holds 150–250 MB of WebGL memory for the entire browsing session. The extension also operates across Chrome's four isolated contexts — popup, background service worker, offscreen document, and content script — each with different lifetimes, APIs, and restart behaviours. Keeping state consistent across a service worker that sleeps and an offscreen document that gets torn down is a coordination problem most extension tutorials don't cover.
The Approach
Classification lives in an ephemeral offscreen document that Chrome MV3 allows for GPU access. It's created on the first classify request and torn down after 30 seconds of idle — releasing WebGL memory without losing state, because all durable state lives in chrome.storage.local on the background service worker. The inference queue serialises all GPU calls through a Promise chain (queueTail), preventing context thrashing under concurrent requests; URL coalescing merges duplicate requests for the same image into one classify call. The LRU verdict cache stores raw MobileNet probability scores rather than binary verdicts — so when a user changes sensitivity, all 500 cached entries re-derive instantly without re-running inference. The overlay is injected as a position-relative wrapper that mirrors the original element's CSS, so adding it never shifts layout. Every message between contexts is a TypeScript discriminated union — no stringly-typed postMessage calls, no runtime surprises across context restarts.
What was built
Deliverables
The Outcome
BlurGuard ships at 1.0.0 production quality with the full detection pipeline working end-to-end: DOM scan on load, MutationObserver for injected content, video frame sampling at 4-second intervals, viewport-priority queueing, GPU inference, overlay injection, and reveal-on-click. Steady-state inference runs at ~80ms per image; cache hits resolve at ~3ms. The popup dashboard shows real-time classification counts, a timestamped detection feed with confidence scores, and CSV/JSON export. Privacy is structural: the offscreen document fetches images as chrome-extension:// origin with credentials omitted — no session cookies forwarded, no URLs or pixel data leave the device.
Results
Built with