{
  "id": 1485922,
  "title": "The GPU that says yes and does nothing: debugging real-time hair segmentation on mid-range Android",
  "url": "https://urgent.news/2026/08/17/the-gpu-that-says-yes-and-does-nothing-debugging-real-time-hair",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-17T13:14:55.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/gabbrowick/the-gpu-that-says-yes-and-does-nothing-debugging-real-time-hair-segmentation-on-mid-range-android-2990"
  },
  "original_language": "en",
  "account": "We created a virtual mirror for hair salons using a tablet camera feed, where the customer's hair changes color in real-time as they move their head. Two constraints shaped every decision: privacy (no frame leaves the device) and hardware (salons don't buy flagship tablets). The team optimized the process by measuring frame rates on real Android devices using diagnostic tools. A Pixel 8 Pro ran at 9 fps while a Samsung A56 (Exynos 1580, Mali GPU) showed no color at all.\n\nThe issue turned out to be the MediaPipe's ImageSegmenter with GPU delegate, which ran in 5 ms and returned zero hair pixels. The fallback to CPU-only triggered on exceptions, but there were no exceptions. The team discovered that a delegate that constructed successfully might not work, and it's crucial to check the output, not just the exit code. They implemented a fallback that rebuilds the engine on CPU after five consecutive empty masks.\n\nThe team also found that the per-pixel JavaScript loop was a significant contributor to the frame budget. They moved the recolouring into a fragment shader, reducing the time from 66 ms to 0. They decoupled the mask from the draw, drawing the video on all frames using the most recent mask. This change fixed the A56, and the Pixel 8 Pro went from 9 fps to 15 fps. They also shared the WebGL context with MediaPipe, eliminating the CPU round trip for the mask. Finally, they switched to a specialised model, reducing the APK size and improving performance.",
  "summary": "We build a virtual mirror for hair salons : a tablet camera feed where the customer's hair changes colour in real time while they move their head. Two constraints shaped every decision. The first is privacy: no frame ever leaves the device. Everything runs locally — the model, the fonts, the runtime — with no CDN dependency, because a CDN request would both break offline use and leak the salon's…",
  "key_points": [
    "Virtual mirror for hair salons created using tablet camera feed",
    "MediaPipe's ImageSegmenter with GPU delegate returned zero hair pixels",
    "Recolouring moved to fragment shader, improving performance"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}