<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mobile | Dat Viet Thanh Nguyen</title><link>https://datvtn.github.io/tags/mobile/</link><atom:link href="https://datvtn.github.io/tags/mobile/index.xml" rel="self" type="application/rss+xml"/><description>Mobile</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Wed, 01 Dec 2021 00:00:00 +0000</lastBuildDate><image><url>https://datvtn.github.io/media/icon_hu82c06b08a282889123d30d9b11b05ced_13465_512x512_fill_lanczos_center_3.png</url><title>Mobile</title><link>https://datvtn.github.io/tags/mobile/</link></image><item><title>Real-Time Portrait Segmentation on Mobile</title><link>https://datvtn.github.io/project/portrait-segmentation/</link><pubDate>Wed, 01 Dec 2021 00:00:00 +0000</pubDate><guid>https://datvtn.github.io/project/portrait-segmentation/</guid><description>&lt;p>&lt;strong>Aug 2021 – Dec 2021&lt;/strong>&lt;/p>
&lt;h2 id="problem">Problem&lt;/h2>
&lt;p>Portrait effects — background blur, replacement, relighting — need a person mask computed every frame, on a phone, inside the camera&amp;rsquo;s frame budget, without draining the battery. A model that is accurate but too slow is useless here, and so is a fast model that flickers between frames or cuts through someone&amp;rsquo;s hair.&lt;/p>
&lt;h2 id="approach">Approach&lt;/h2>
&lt;p>Two halves, and the data half mattered as much as the model:&lt;/p>
&lt;p>&lt;strong>The network.&lt;/strong> A deliberately small segmentation architecture designed against the mobile inference budget rather than trimmed down afterwards. Design decisions were driven by what the target runtime could actually execute efficiently, not just by parameter count — an operation that is cheap on paper is not cheap if the on-device runtime falls back to CPU for it.&lt;/p>
&lt;p>&lt;strong>The data pipeline.&lt;/strong> I built the full pipeline: collection, annotation, quality control, and augmentation. Boundary quality is where portrait segmentation visibly succeeds or fails, so the annotation standard around hair and edges drove most of the final result.&lt;/p>
&lt;p>The model was quantized and deployed through the mobile inference stack used for VinSmart devices, alongside the other lightweight face analysis networks (FaceID, Masked FaceID, camera effects) our team shipped.&lt;/p>
&lt;h2 id="tech-stack">Tech stack&lt;/h2>
&lt;p>&lt;code>PyTorch&lt;/code> · &lt;code>TFLite&lt;/code> · &lt;code>SNPE&lt;/code> · &lt;code>NCNN&lt;/code> · &lt;code>INT8 quantization&lt;/code> · &lt;code>Python&lt;/code> · &lt;code>C++&lt;/code>&lt;/p>
&lt;h2 id="outcome">Outcome&lt;/h2>
&lt;p>A portrait segmentation network running in real time on target mobile hardware.&lt;/p>
&lt;!-- TODO: add the model size, on-device latency, and IoU if these can be shared publicly. --></description></item></channel></rss>