{"slug":"mediapipe-ai-detection-explained","title":"How MediaPipe AI Detection Works in Stop Biting: A Technical Explainer","seoTitle":"How MediaPipe AI Nail Biting Detection Works","description":"Stop Biting runs Google's MediaPipe in WebAssembly: a 21-point hand model and a 478-point face mesh, on your device five times a second. The detection stack.","tag":"Technology","readingMinutes":5,"datePublished":"2026-04-07","dateModified":"2026-10-30","ogImage":"/og/mediapipe-ai-detection-explained.png","related":[{"slug":"webcam-privacy-nail-biting-app","title":"Is It Safe to Use a Webcam App to Stop Nail Biting? Privacy Explained","tag":"Technology"},{"slug":"nail-biting-camera-setup","title":"Getting Your Camera Setup Right for Nail Biting Detection","tag":"Technology"},{"slug":"nail-biting-app-battery-performance","title":"Does Running Nail Biting Detection Slow Down Your Computer?","tag":"Technology"},{"slug":"how-to-stop-nail-biting","title":"How to Stop Nail Biting: The Complete Guide (2026)","tag":"Treatment"}],"productLink":{"href":"/how-it-works","label":"How Stop Biting detects nail biting on your device"},"sections":[{"heading":"What is MediaPipe and why does it matter?","body":"MediaPipe is Google's open-source toolkit for running machine-learning models on live and streaming media. Its repository describes it as \"cross-platform, customizable ML solutions for live and streaming media\" and lists the Apache-2.0 license. Google researchers described it in a 2019 paper as a framework for building perception pipelines (Lugaresi et al., 2019), and Google's research blog says Google Meet's background blur and replacement are built with MediaPipe and WebAssembly (Hou & Mullen, 2020).\n\nStop Biting uses two MediaPipe Tasks models, Hand Landmarker and Face Landmarker, through the @mediapipe/tasks-vision web library (version 0.10.33 at the time of writing). The models run on your device, so analysing video does not need a cloud service: the model files are served from stopbiting.today and downloaded when detection first starts, and once they have downloaded nothing carrying camera data is sent while it watches. Detection samples about five times a second, not on every video frame.","html":"<p><strong>Sources:</strong></p><ul><li><a href=\"https://arxiv.org/abs/1906.08172\" target=\"_blank\" rel=\"noopener noreferrer\">Lugaresi C, Tang J, Nash H, et al. MediaPipe: A Framework for Building Perception Pipelines. arXiv:1906.08172. 2019.</a></li><li><a href=\"https://github.com/google-ai-edge/mediapipe\" target=\"_blank\" rel=\"noopener noreferrer\">Google AI Edge. MediaPipe (source repository and README).</a></li><li><a href=\"https://research.google/blog/background-features-in-google-meet-powered-by-web-ml/\" target=\"_blank\" rel=\"noopener noreferrer\">Hou T, Mullen T. Background Features in Google Meet, Powered by Web ML. Google Research blog. 30 October 2020.</a></li></ul>"},{"heading":"The two models used for detection","body":"The Hand Landmarker finds a hand in the frame and returns 21 keypoints, which MediaPipe calls landmarks: the fingertips, knuckle joints and wrist. Google's documentation describes its bundle as two packaged models, a palm detector and a hand-landmark model. The Face Landmarker returns 478 three-dimensional face landmarks, including 10 iris landmarks that a September 2022 model update added to the 468 face-surface points; its bundle also holds a face detector and a blendshape model, and Stop Biting reads only the landmark positions. The app asks MediaPipe for one hand and one face at a time, with a minimum confidence of 0.5 for detection and 0.4 for presence and tracking.\n\nThe detection rule is geometry on those landmarks. On each sampled frame, the app takes the midpoint between the inner upper-lip and inner lower-lip landmarks and measures its distance to each of the five fingertips, in normalised image coordinates (a fraction of the picture size). At the default Medium setting, a fingertip within 0.12 of that point counts as a positive frame; the setting labelled High uses the smallest distance, 0.08, and Low the largest, 0.18. Three positive frames in a row, about 0.6 seconds at five checks a second, start the alert, and two frames without contact end it. In the default rule these distances are fixed numbers per setting, not measurements of your own face, and optional detection settings can change what triggers an alert.","html":"<p><strong>Sources:</strong></p><ul><li><a href=\"https://developers.google.com/edge/mediapipe/solutions/vision/hand_landmarker\" target=\"_blank\" rel=\"noopener noreferrer\">Google AI Edge. Hand landmarks detection guide.</a></li><li><a href=\"https://developers.google.com/edge/mediapipe/solutions/vision/face_landmarker\" target=\"_blank\" rel=\"noopener noreferrer\">Google AI Edge. Face landmark detection guide.</a></li><li><a href=\"https://storage.googleapis.com/mediapipe-assets/Model%20Card%20MediaPipe%20Face%20Mesh%20V2.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Google. Model Card: MediaPipe Face Mesh V2 (release notes: 10 iris landmarks added, model version 15 September 2022).</a></li></ul>"},{"heading":"WebAssembly: how the models run in a browser","body":"WebAssembly (WASM) describes itself as a \"binary instruction format for a stack-based virtual machine\" that \"aims to execute at native speed\" and runs in browsers. It is not as fast as native code. A 2019 benchmark study found WebAssembly programs ran slower than native code by an average of 45% (Firefox) to 55% (Chrome), with peak slowdowns of 2.08x and 2.5x (Jangda et al., 2019). Those are general benchmark figures for 2019 browsers, not measurements of MediaPipe, and we have not benchmarked Stop Biting's models on desktop hardware. For scale, Google's documentation reports an average latency of 17.12 ms on a Pixel 6 CPU and 12.27 ms on its GPU for the full Hand Landmarker pipeline, on a phone, against the 200 ms between Stop Biting's checks.\n\nMediaPipe's web build ships SIMD and non-SIMD WebAssembly builds, and its loader tests whether the browser supports SIMD before choosing one; Stop Biting serves both. SIMD (single instruction, multiple data) lets one instruction work on several values at once. Google reported that Chrome 84's WebAssembly SIMD support gave a performance boost of more than 2x for Meet's background features (Hou & Mullen, 2020).","html":"<p><strong>Sources:</strong></p><ul><li><a href=\"https://webassembly.org/\" target=\"_blank\" rel=\"noopener noreferrer\">WebAssembly.org. WebAssembly.</a></li><li><a href=\"https://arxiv.org/abs/1901.09056\" target=\"_blank\" rel=\"noopener noreferrer\">Jangda A, Powers B, Berger ED, Guha A. Not So Fast: Analyzing the Performance of WebAssembly vs. Native Code. USENIX Annual Technical Conference. 2019.</a></li><li><a href=\"https://developers.google.com/edge/mediapipe/solutions/vision/hand_landmarker\" target=\"_blank\" rel=\"noopener noreferrer\">Google AI Edge. Hand landmarks detection guide (task benchmarks).</a></li><li><a href=\"https://research.google/blog/background-features-in-google-meet-powered-by-web-ml/\" target=\"_blank\" rel=\"noopener noreferrer\">Hou T, Mullen T. Background Features in Google Meet, Powered by Web ML. Google Research blog. 30 October 2020.</a></li></ul>"},{"heading":"Model size and what is downloaded","body":"These are the sizes on disk of the files Stop Biting serves for detection, before any compression in transfer: the hand model bundle is 7,819,105 bytes (about 7.8 MB), the face model bundle 3,758,596 bytes (about 3.8 MB), and the WebAssembly binary about 11.5 MB for a SIMD build (11,504,102 bytes; the module-worker variant differs by 12 bytes) or 10.7 MB for the non-SIMD build (10,700,239 bytes). A browser fetches one of the two binaries plus the two model bundles, roughly 23 MB on the SIMD path. Stop Biting's service worker does not store these files, so a repeat visit relies on the browser's own cache.\n\nWe have not timed the first load or the start-up on different machines, so we give no load-time figure: it depends on your connection and your hardware."},{"heading":"Accuracy and detection limitations","body":"Google publishes model cards for both models. The Hand Tracking card reports a mean error of about 10% of palm size across 14 geographic regions (10.09% for the full pipeline, 12.02% for the lite pipeline), measured on smartphone photos, and says the error is larger toward the fingertips and larger for blurry or occluded joints (Google, 2021). The Face Mesh V2 card reports a mean error of 2.62% of the distance between the eyes in tracking mode (Google, 2022). Both cards also report results by skin tone and gender. The hand card says its authors \"didn't find any error pattern\" by skin tone or gender, and the authors of the face card consider the model to perform well across groups, but both evaluations used smartphone photos from the same source as the training data, not webcam footage of people biting their nails.\n\nThe cards also state limits. The hand card says the model \"has not been tested\" in conditions such as low light and motion blur, that quality \"can degrade in extreme conditions\", and that predicting landmarks when the hand is holding objects is out of scope. The face card lists faces looking away by more than 80 degrees, partly visible (less than 50% of the face) or too far from the camera as unsuitable, and expects degraded quality in poor light, noise, motion or \"face overlapping\" conditions. A hand in front of the mouth partly covers the face, and we have no measurement of how often that affects Stop Biting.\n\nOn top of the landmarks, Stop Biting applies a proximity rule, and its errors are separate from the models' errors. A fingertip near the lips counts as a positive frame whether or not biting is happening, so eating, resting a finger near the lips or another sustained movement can meet the rule, and a brief movement can end before three frames are recorded. We have not published a validated accuracy figure. The descriptions of Stop Biting's own detector on this page were checked against its implementation on 30 October 2026; they are a technical description, not a clinical validation.","html":"<p>What is and is not measured about the alerts is set out in <a href=\"/blog/nail-biting-detection-accuracy\">how accurate AI nail biting detection is</a>.</p><p><strong>Sources:</strong></p><ul><li><a href=\"https://storage.googleapis.com/mediapipe-assets/Model%20Card%20Hand%20Tracking%20(Lite_Full)%20with%20Fairness%20Oct%202021.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Google. Model Card: Hand Tracking (Lite/Full) with Fairness. October 2021.</a></li><li><a href=\"https://storage.googleapis.com/mediapipe-assets/Model%20Card%20MediaPipe%20Face%20Mesh%20V2.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Google. Model Card: MediaPipe Face Mesh V2. 15 September 2022.</a></li></ul>"},{"heading":"Related reading","body":"","html":"<ul><li><a href=\"/blog/nail-biting-detection-accuracy\">How accurate is AI nail biting detection?</a></li><li><a href=\"/blog/webcam-privacy-nail-biting-app\">Is it safe to use a webcam app to stop nail biting?</a></li><li><a href=\"/blog/nail-biting-camera-setup\">Getting your camera setup right for nail biting detection</a></li><li><a href=\"/blog/how-ai-can-help-stop-nail-biting\">How AI can help you stop biting your nails</a></li></ul>"}]}