Spaces:
Running
Running
Reorder the page; add What it says; state the real cloud cost
Browse files- README.md +18 -18
- index.html +92 -66
- style.css +3 -3
README.md
CHANGED
|
@@ -17,15 +17,15 @@ tags:
|
|
| 17 |

|
| 18 |
|
| 19 |
A [Reachy Mini](https://huggingface.co/pollen-robotics) app that sits on your desk, watches
|
| 20 |
-
for the small habits that break your focus
|
| 21 |
-
onto your phone
|
| 22 |
|
| 23 |
**It runs offline and free.** The default backend uses no model at all: face-touching and
|
| 24 |
-
nail-biting are a distance question, so it measures the distance
|
| 25 |
frame, with no API key and no frame ever leaving the machine. Most apps of this kind bill you
|
| 26 |
per frame to a hosted vision model; this one does not have to.
|
| 27 |
|
| 28 |
-
▶ **[Watch the demo](media/demo.mp4)** (28 s)
|
| 29 |
|
| 30 |
It is deliberately not a productivity dashboard. There is no score, nothing is uploaded, and
|
| 31 |
the only record is a per-day tally that resets at midnight.
|
|
@@ -76,7 +76,7 @@ Everything is set through environment variables, usually via `.env`. See
|
|
| 76 |
|
| 77 |
| Variable | Default | Meaning |
|
| 78 |
|---|---|---|
|
| 79 |
-
| `OPENAI_API_KEY` |
|
| 80 |
| `FOCUS_BUDDY_BACKEND` | `cloud` | `cloud` or `edge` (see below) |
|
| 81 |
| `FOCUS_BUDDY_LANDMARK_PYTHON` | auto | interpreter for the landmark sidecar |
|
| 82 |
| `FOCUS_BUDDY_SPEECH` | `openai` | `openai`, `macos`, or `none` |
|
|
@@ -107,7 +107,7 @@ spend API calls on speech.
|
|
| 107 |
|
| 108 |
Face-touching and nail-biting are distance questions, so they are answered with
|
| 109 |
landmark geometry rather than by a vision model. On a labelled set of 24 frames from
|
| 110 |
-
a Reachy Mini, every small VLM tried scored at chance
|
| 111 |
Qwen2.5-VL-3B each answered "yes, touching" on *every* frame, including the ones with
|
| 112 |
hands in the user's lap. Hand-to-face distance separates the same frames perfectly:
|
| 113 |
|
|
@@ -145,9 +145,9 @@ What each backend measures:
|
|
| 145 |
|
| 146 |
| | contact habits | gaze | at desk | phone | posture | per frame |
|
| 147 |
|---|---|---|---|---|---|---|
|
| 148 |
-
| `edge` | geometry | geometry | geometry |
|
| 149 |
| `cloud` | cloud | cloud | cloud | cloud | cloud | ~1.5-3 s |
|
| 150 |
-
| `edge-vlm` | *(at chance)* | *(at chance)* | *(at chance)* | *(at chance)* |
|
| 151 |
|
| 152 |
`edge-vlm` is the old quantised-VLM backend. It is kept because it runs, not because it
|
| 153 |
works: see the table further down. Use `edge`.
|
|
@@ -155,7 +155,7 @@ works: see the table further down. Use `edge`.
|
|
| 155 |
Gaze comes from where the irises sit inside the eyes; being at the desk comes from
|
| 156 |
whether a face or a body is found at all, which is what separates "turned away" from
|
| 157 |
"got up". Measured over 24 labelled frames: gaze 23/24, at-desk 41/43. Note the margin
|
| 158 |
-
is nothing like the contact one
|
| 159 |
screen work. That is tolerable because gaze never triggers a nudge; it only feeds the
|
| 160 |
spoken summary.
|
| 161 |
|
|
@@ -169,12 +169,12 @@ and its own labelled frames.
|
|
| 169 |
**There is no local phone detection, and that is a measured decision.** On 8 frames of a
|
| 170 |
phone plainly in hand against 8 without, the local 2.2B VLM scored 0/8 true positives with
|
| 171 |
the prose prompt (it always answers "no phone") and 8/8 true positives but 5/8 false
|
| 172 |
-
positives with a labelled one
|
| 173 |
discriminate. `gpt-4o-mini` scored 16/16 on the same frames. So phone use is either
|
| 174 |
answered by the cloud or not at all, and `edge` chooses not at all.
|
| 175 |
|
| 176 |
Worth knowing if you want to revisit it: a hand raised holding a phone is geometrically
|
| 177 |
-
distinctive
|
| 178 |
0.00 while touching the face and 0.5+ or no hand at all while typing. That is enough of a
|
| 179 |
signal to gate an expensive call on, so a backend that only asks the cloud when a hand is
|
| 180 |
raised is a plausible future addition.
|
|
@@ -183,7 +183,7 @@ raised is a plausible future addition.
|
|
| 183 |
|
| 184 |
> [!IMPORTANT]
|
| 185 |
> **Edge mode requires macOS on Apple Silicon. There is no supported way to run it anywhere
|
| 186 |
-
> else**
|
| 187 |
> wireless*. It runs quantised models through [MLX](https://github.com/ml-explore/mlx), which
|
| 188 |
> is built for Apple GPUs and publishes no ARM-Linux or x86-Linux builds. If you are running
|
| 189 |
> the app on the robot itself, you want `cloud`.
|
|
@@ -191,10 +191,10 @@ raised is a plausible future addition.
|
|
| 191 |
**`cloud`** (default) sends each frame to an OpenAI vision model. Works on every platform,
|
| 192 |
needs a network connection and an API key, and costs roughly a fraction of a cent per frame.
|
| 193 |
|
| 194 |
-
**`edge`** is landmark geometry and needs no model, no key and no extra
|
| 195 |
above. **`edge-vlm`** is the older local-VLM path, kept for comparison: a 4-bit SmolVLM2-2.2B
|
| 196 |
for vision and optionally a 4-bit Llama-3.2-1B to phrase nudges. It is the only backend that
|
| 197 |
-
needs the optional dependency, and it is not recommended
|
| 198 |
chance for every habit.
|
| 199 |
|
| 200 |
```bash
|
|
@@ -204,7 +204,7 @@ FOCUS_BUDDY_BACKEND=edge-vlm focus-buddy --desktop --speech macos
|
|
| 204 |
|
| 205 |
The first run downloads several gigabytes of weights. Set `HF_HOME` to control where they
|
| 206 |
land. On an 8GB Mac, expect a few seconds per frame and keep `FOCUS_BUDDY_USE_LLM_NUDGES=false`
|
| 207 |
-
unless you have memory to spare
|
| 208 |
|
| 209 |
Edge mode does not send the whole frame to the model. It finds your face with an OpenCV Haar
|
| 210 |
cascade and crops around it, biased downward and toward the direction your head is turned, so
|
|
@@ -216,7 +216,7 @@ model is being shown; if detection is behaving strangely, look there first.
|
|
| 216 |
|
| 217 |
| Module | Responsibility |
|
| 218 |
|---|---|
|
| 219 |
-
| `observations.py` | `Observation` and `Habit`
|
| 220 |
| `perception/` | frame → `Observation`. `framing` crops, `captions` classifies prose |
|
| 221 |
| `perception/landmarks.py` | hand-to-face geometry, and the MediaPipe sidecar client |
|
| 222 |
| `settings_page.py` | the dashboard settings page: what it saves, and live run state |
|
|
@@ -237,7 +237,7 @@ Two design choices worth knowing about:
|
|
| 237 |
|
| 238 |
**Nudges are templates by default.** A language model can rephrase them
|
| 239 |
(`FOCUS_BUDDY_USE_LLM_NUDGES=true`), but anything it produces has to pass `nudges.is_valid`
|
| 240 |
-
first
|
| 241 |
contradict the frame. Whatever fails is replaced by the template. A buddy that is confidently
|
| 242 |
wrong about you is worse than one that repeats itself.
|
| 243 |
|
|
@@ -276,7 +276,7 @@ counts live in memory only and reset at midnight.
|
|
| 276 |
|
| 277 |
## Contributing
|
| 278 |
|
| 279 |
-
Issues and pull requests are welcome
|
| 280 |
|
| 281 |
## License
|
| 282 |
|
|
|
|
| 17 |

|
| 18 |
|
| 19 |
A [Reachy Mini](https://huggingface.co/pollen-robotics) app that sits on your desk, watches
|
| 20 |
+
for the small habits that break your focus - touching your face, biting your nails, drifting
|
| 21 |
+
onto your phone - and says something about it. Once an hour it tells you how the day is going.
|
| 22 |
|
| 23 |
**It runs offline and free.** The default backend uses no model at all: face-touching and
|
| 24 |
+
nail-biting are a distance question, so it measures the distance - 24/24 accurate at ~50 ms a
|
| 25 |
frame, with no API key and no frame ever leaving the machine. Most apps of this kind bill you
|
| 26 |
per frame to a hosted vision model; this one does not have to.
|
| 27 |
|
| 28 |
+
▶ **[Watch the demo](media/demo.mp4)** (28 s) - the phone comes out, the Mini notices.
|
| 29 |
|
| 30 |
It is deliberately not a productivity dashboard. There is no score, nothing is uploaded, and
|
| 31 |
the only record is a per-day tally that resets at midnight.
|
|
|
|
| 76 |
|
| 77 |
| Variable | Default | Meaning |
|
| 78 |
|---|---|---|
|
| 79 |
+
| `OPENAI_API_KEY` | - | required unless you run fully local on a Mac |
|
| 80 |
| `FOCUS_BUDDY_BACKEND` | `cloud` | `cloud` or `edge` (see below) |
|
| 81 |
| `FOCUS_BUDDY_LANDMARK_PYTHON` | auto | interpreter for the landmark sidecar |
|
| 82 |
| `FOCUS_BUDDY_SPEECH` | `openai` | `openai`, `macos`, or `none` |
|
|
|
|
| 107 |
|
| 108 |
Face-touching and nail-biting are distance questions, so they are answered with
|
| 109 |
landmark geometry rather than by a vision model. On a labelled set of 24 frames from
|
| 110 |
+
a Reachy Mini, every small VLM tried scored at chance - SmolVLM2-2.2B, Qwen2-VL-2B and
|
| 111 |
Qwen2.5-VL-3B each answered "yes, touching" on *every* frame, including the ones with
|
| 112 |
hands in the user's lap. Hand-to-face distance separates the same frames perfectly:
|
| 113 |
|
|
|
|
| 145 |
|
| 146 |
| | contact habits | gaze | at desk | phone | posture | per frame |
|
| 147 |
|---|---|---|---|---|---|---|
|
| 148 |
+
| `edge` | geometry | geometry | geometry | - | - | **~0.05 s** |
|
| 149 |
| `cloud` | cloud | cloud | cloud | cloud | cloud | ~1.5-3 s |
|
| 150 |
+
| `edge-vlm` | *(at chance)* | *(at chance)* | *(at chance)* | *(at chance)* | - | ~7.5 s |
|
| 151 |
|
| 152 |
`edge-vlm` is the old quantised-VLM backend. It is kept because it runs, not because it
|
| 153 |
works: see the table further down. Use `edge`.
|
|
|
|
| 155 |
Gaze comes from where the irises sit inside the eyes; being at the desk comes from
|
| 156 |
whether a face or a body is found at all, which is what separates "turned away" from
|
| 157 |
"got up". Measured over 24 labelled frames: gaze 23/24, at-desk 41/43. Note the margin
|
| 158 |
+
is nothing like the contact one - a head turned away while the eyes stay put reads as
|
| 159 |
screen work. That is tolerable because gaze never triggers a nudge; it only feeds the
|
| 160 |
spoken summary.
|
| 161 |
|
|
|
|
| 169 |
**There is no local phone detection, and that is a measured decision.** On 8 frames of a
|
| 170 |
phone plainly in hand against 8 without, the local 2.2B VLM scored 0/8 true positives with
|
| 171 |
the prose prompt (it always answers "no phone") and 8/8 true positives but 5/8 false
|
| 172 |
+
positives with a labelled one - it can be pushed to detect or to stay quiet, but not to
|
| 173 |
discriminate. `gpt-4o-mini` scored 16/16 on the same frames. So phone use is either
|
| 174 |
answered by the cloud or not at all, and `edge` chooses not at all.
|
| 175 |
|
| 176 |
Worth knowing if you want to revisit it: a hand raised holding a phone is geometrically
|
| 177 |
+
distinctive - 1.50-1.64 face widths from the face box across all eight frames, against
|
| 178 |
0.00 while touching the face and 0.5+ or no hand at all while typing. That is enough of a
|
| 179 |
signal to gate an expensive call on, so a backend that only asks the cloud when a hand is
|
| 180 |
raised is a plausible future addition.
|
|
|
|
| 183 |
|
| 184 |
> [!IMPORTANT]
|
| 185 |
> **Edge mode requires macOS on Apple Silicon. There is no supported way to run it anywhere
|
| 186 |
+
> else** - not on Linux, not on Windows, and *not on the Raspberry Pi inside a Reachy Mini
|
| 187 |
> wireless*. It runs quantised models through [MLX](https://github.com/ml-explore/mlx), which
|
| 188 |
> is built for Apple GPUs and publishes no ARM-Linux or x86-Linux builds. If you are running
|
| 189 |
> the app on the robot itself, you want `cloud`.
|
|
|
|
| 191 |
**`cloud`** (default) sends each frame to an OpenAI vision model. Works on every platform,
|
| 192 |
needs a network connection and an API key, and costs roughly a fraction of a cent per frame.
|
| 193 |
|
| 194 |
+
**`edge`** is landmark geometry and needs no model, no key and no extra - see the section
|
| 195 |
above. **`edge-vlm`** is the older local-VLM path, kept for comparison: a 4-bit SmolVLM2-2.2B
|
| 196 |
for vision and optionally a 4-bit Llama-3.2-1B to phrase nudges. It is the only backend that
|
| 197 |
+
needs the optional dependency, and it is not recommended - on a labelled set it scored at
|
| 198 |
chance for every habit.
|
| 199 |
|
| 200 |
```bash
|
|
|
|
| 204 |
|
| 205 |
The first run downloads several gigabytes of weights. Set `HF_HOME` to control where they
|
| 206 |
land. On an 8GB Mac, expect a few seconds per frame and keep `FOCUS_BUDDY_USE_LLM_NUDGES=false`
|
| 207 |
+
unless you have memory to spare - the two models compete for unified memory.
|
| 208 |
|
| 209 |
Edge mode does not send the whole frame to the model. It finds your face with an OpenCV Haar
|
| 210 |
cascade and crops around it, biased downward and toward the direction your head is turned, so
|
|
|
|
| 216 |
|
| 217 |
| Module | Responsibility |
|
| 218 |
|---|---|
|
| 219 |
+
| `observations.py` | `Observation` and `Habit` - the typed result every backend returns |
|
| 220 |
| `perception/` | frame → `Observation`. `framing` crops, `captions` classifies prose |
|
| 221 |
| `perception/landmarks.py` | hand-to-face geometry, and the MediaPipe sidecar client |
|
| 222 |
| `settings_page.py` | the dashboard settings page: what it saves, and live run state |
|
|
|
|
| 237 |
|
| 238 |
**Nudges are templates by default.** A language model can rephrase them
|
| 239 |
(`FOCUS_BUDDY_USE_LLM_NUDGES=true`), but anything it produces has to pass `nudges.is_valid`
|
| 240 |
+
first - right length, actually mentions the habit it is supposed to be about, and does not
|
| 241 |
contradict the frame. Whatever fails is replaced by the template. A buddy that is confidently
|
| 242 |
wrong about you is worse than one that repeats itself.
|
| 243 |
|
|
|
|
| 276 |
|
| 277 |
## Contributing
|
| 278 |
|
| 279 |
+
Issues and pull requests are welcome - see [CONTRIBUTING.md](CONTRIBUTING.md).
|
| 280 |
|
| 281 |
## License
|
| 282 |
|
index.html
CHANGED
|
@@ -4,9 +4,9 @@
|
|
| 4 |
<head>
|
| 5 |
<meta charset="utf-8" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
-
<title>Focus Buddy
|
| 8 |
<meta name="description"
|
| 9 |
-
content="A Reachy Mini desk companion that catches face-touching and nail-biting with landmark geometry
|
| 10 |
<link rel="stylesheet" href="style.css" />
|
| 11 |
</head>
|
| 12 |
|
|
@@ -18,7 +18,7 @@
|
|
| 18 |
<h1>Focus Buddy</h1>
|
| 19 |
<p class="tagline">
|
| 20 |
A Reachy Mini that notices when you touch your face, bite your nails or drift onto your
|
| 21 |
-
phone
|
| 22 |
</p>
|
| 23 |
<div class="pill-row">
|
| 24 |
<span class="pill strong">Runs offline · no API key</span>
|
|
@@ -30,6 +30,62 @@
|
|
| 30 |
|
| 31 |
<main class="container">
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
<section class="card">
|
| 34 |
<h2>See it work</h2>
|
| 35 |
<video class="demo" controls playsinline preload="none" poster="media/demo-poster.jpg">
|
|
@@ -48,7 +104,7 @@
|
|
| 48 |
<p>
|
| 49 |
Most Reachy Mini apps that watch you send every frame to a hosted vision model. That
|
| 50 |
works, and it bills you per frame forever. Focus Buddy's default backend runs
|
| 51 |
-
<strong>no model at all</strong>
|
| 52 |
question, so it measures the distance.
|
| 53 |
</p>
|
| 54 |
<div class="cost-grid">
|
|
@@ -60,41 +116,25 @@
|
|
| 60 |
</div>
|
| 61 |
<div class="cost">
|
| 62 |
<span class="cost-label">cloud</span>
|
| 63 |
-
<span class="cost-value">
|
| 64 |
-
<span class="cost-note">a hosted vision model
|
| 65 |
-
|
|
|
|
| 66 |
</div>
|
| 67 |
</div>
|
| 68 |
</section>
|
| 69 |
|
| 70 |
<section class="card">
|
| 71 |
-
<h2>
|
| 72 |
-
<
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
<span>A hand resting on your cheek, chin or forehead.</span>
|
| 77 |
-
<span class="tag ok">offline</span>
|
| 78 |
-
</div>
|
| 79 |
-
<div class="habit">
|
| 80 |
-
<span class="habit-icon">💅</span>
|
| 81 |
-
<strong>Nail biting</strong>
|
| 82 |
-
<span>Fingertips at or in your mouth.</span>
|
| 83 |
-
<span class="tag ok">offline</span>
|
| 84 |
-
</div>
|
| 85 |
-
<div class="habit">
|
| 86 |
-
<span class="habit-icon">📱</span>
|
| 87 |
-
<strong>Phone drift</strong>
|
| 88 |
-
<span>Phone in hand, eyes on it instead of the screen.</span>
|
| 89 |
-
<span class="tag">cloud only</span>
|
| 90 |
-
</div>
|
| 91 |
-
</div>
|
| 92 |
<p class="fine">
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
midnight.
|
| 98 |
</p>
|
| 99 |
</section>
|
| 100 |
|
|
@@ -102,12 +142,12 @@
|
|
| 102 |
<h2>Why geometry beat every vision model I tried</h2>
|
| 103 |
<p>
|
| 104 |
This is the finding the project is really about. "Is a hand touching your face" reads
|
| 105 |
-
like a job for a vision-language model. It isn't
|
| 106 |
local VLMs answer it at chance.
|
| 107 |
</p>
|
| 108 |
<p>
|
| 109 |
Measured on 16 labelled frames from the robot's own camera: eight with a hand at the
|
| 110 |
-
face, eight without. Every 2
|
| 111 |
</p>
|
| 112 |
<table class="bench">
|
| 113 |
<thead>
|
|
@@ -141,16 +181,16 @@
|
|
| 141 |
</tbody>
|
| 142 |
</table>
|
| 143 |
<p class="fine">
|
| 144 |
-
The same frames separate cleanly by distance: <strong>0.000
|
| 145 |
-
from the face box while touching, <strong>0.528
|
| 146 |
where the models had none. Thresholds are ratios of the face width, so they do not care
|
| 147 |
how close you sit or what resolution the camera runs at. Gaze scored 23/24 from iris
|
| 148 |
position; at-the-desk 41/43.
|
| 149 |
</p>
|
| 150 |
<p class="fine">
|
| 151 |
The models were not merely wrong, they were <em>not looking</em>. SmolVLM2 returned a
|
| 152 |
-
character-identical sentence
|
| 153 |
-
mouth"
|
| 154 |
</p>
|
| 155 |
</section>
|
| 156 |
|
|
@@ -169,8 +209,8 @@
|
|
| 169 |
</div>
|
| 170 |
<p>
|
| 171 |
Every vision backend returns the same typed <code>Observation</code>, so swapping
|
| 172 |
-
geometry for a cloud model changes nothing downstream. The four backend families
|
| 173 |
-
perception, brain, speech, hardware
|
| 174 |
small factory from <code>Settings</code>, which is what lets the whole loop be tested
|
| 175 |
against fakes with no camera, no network and no models.
|
| 176 |
</p>
|
|
@@ -178,7 +218,7 @@
|
|
| 178 |
<p class="fine">
|
| 179 |
<strong>The model never gets the last word.</strong> Nudges come from fixed phrasings by
|
| 180 |
default. A language model may rewrite them, but whatever it produces must pass
|
| 181 |
-
validation first
|
| 182 |
contradict the frame. Small models love to append "…and you're not even looking at your
|
| 183 |
screen", which is often flatly untrue. Anything that fails is replaced by the template.
|
| 184 |
</p>
|
|
@@ -193,7 +233,7 @@
|
|
| 193 |
<h2>Getting a VLM onto an 8 GB Mac</h2>
|
| 194 |
<p>
|
| 195 |
Before geometry won, a lot of work went into making local vision models fit. That work
|
| 196 |
-
is why the comparison above is fair
|
| 197 |
allows.
|
| 198 |
</p>
|
| 199 |
<p>
|
|
@@ -223,7 +263,7 @@
|
|
| 223 |
<tr class="win">
|
| 224 |
<td>4-bit quantized</td>
|
| 225 |
<td>0.5</td>
|
| 226 |
-
<td>~1.1
|
| 227 |
</tr>
|
| 228 |
</tbody>
|
| 229 |
</table>
|
|
@@ -231,7 +271,7 @@
|
|
| 231 |
<p class="fine">
|
| 232 |
4-bit weights are packed on disk and unpacked to 16-bit floats on the fly, which needs a
|
| 233 |
specialised kernel. In the Hugging Face ecosystem that kernel is
|
| 234 |
-
<code>bitsandbytes</code>, written in CUDA
|
| 235 |
use Metal, so the code cannot compile or run; it falls back to CPU or crashes. Apple's
|
| 236 |
answer is <strong>MLX</strong>, written against Metal from the ground up, and
|
| 237 |
<code>mlx-vlm</code> ships its own 4-bit kernels for Apple Silicon. That is the route
|
|
@@ -239,9 +279,9 @@
|
|
| 239 |
</p>
|
| 240 |
<h3>Bigger and quantized beats smaller and pristine</h3>
|
| 241 |
<p class="fine">
|
| 242 |
-
4-bit quantization keeps roughly 95
|
| 243 |
memory; 3-bit starts to degrade and 2-bit tends toward gibberish. Dropping to a 500M
|
| 244 |
-
model instead lowers the ceiling structurally
|
| 245 |
reasoning and stops respecting output formats. For "are the fingers at the lips or just
|
| 246 |
near the jaw", a 4-bit 2.2B beats a pristine 500M. Confirmed here: the 500M checkpoint
|
| 247 |
hallucinated hands onto the monitor.
|
|
@@ -250,7 +290,7 @@
|
|
| 250 |
<p class="fine">
|
| 251 |
During inference the model touches essentially all of its weights for every token. If
|
| 252 |
the working set exceeds RAM, the machine spends its time moving pages between disk and
|
| 253 |
-
memory instead of computing
|
| 254 |
take seconds takes hours. The fingerprint is unmistakable: low CPU, tiny resident set,
|
| 255 |
and swap climbing into the gigabytes. At its worst this build showed ~10 GB of swap in
|
| 256 |
use on an 8 GB machine. The higher-precision SmolVLM2 convert took
|
|
@@ -270,7 +310,7 @@
|
|
| 270 |
Getting usable output from a 2B model is its own discipline. A cloud-style prompt asking
|
| 271 |
for <code>"looking_at_screen": True | …</code> made SmolVLM echo the template back,
|
| 272 |
placeholders included. A filled-in example made it emit the trailing fragment of the
|
| 273 |
-
example. A numbered Yes/No checklist produced a stuck prior
|
| 274 |
regardless of the image.
|
| 275 |
</p>
|
| 276 |
<p class="fine">
|
|
@@ -278,7 +318,7 @@
|
|
| 278 |
one or two plain sentences about hands, mouth and gaze, then let Python turn that prose
|
| 279 |
into the typed <code>Observation</code>. The format is the deterministic part, so it
|
| 280 |
should not be spent on the model's limited capability. Every regex in that classifier
|
| 281 |
-
exists because a real model said something the previous version got wrong
|
| 282 |
the one that stopped "no indication of nail-biting" from registering as nail-biting.
|
| 283 |
</p>
|
| 284 |
<p class="fine">
|
|
@@ -291,7 +331,7 @@
|
|
| 291 |
<h2>On the robot</h2>
|
| 292 |
<p class="fine">
|
| 293 |
The Mini's camera is wide-angle and its view is not a webcam's, so frames are cropped
|
| 294 |
-
around the face before anything looks at them
|
| 295 |
and toward whichever way the head is turned. Face detection uses OpenCV Haar cascades
|
| 296 |
rather than MediaPipe Tasks, which aborts in <code>DrishtiMetalHelper</code> on Apple
|
| 297 |
Silicon. The head sways in time with speech by hooking the SDK's audio pipeline, which
|
|
@@ -300,25 +340,11 @@
|
|
| 300 |
<p class="fine">
|
| 301 |
MediaPipe itself runs in a <strong>separate interpreter</strong>. Its only working API on
|
| 302 |
Apple Silicon needs <code>numpy<2</code>, while <code>reachy-mini</code> needs
|
| 303 |
-
<code>numpy>=2.2.5</code>
|
| 304 |
speaks over a pipe. The sidecar returns raw landmarks and the parent applies every
|
| 305 |
threshold, so the geometry has exactly one tested copy.
|
| 306 |
</p>
|
| 307 |
</section>
|
| 308 |
-
|
| 309 |
-
<section class="card">
|
| 310 |
-
<h2>Try it</h2>
|
| 311 |
-
<p>Install it from the Reachy Mini dashboard, or run it against a laptop webcam:</p>
|
| 312 |
-
<pre><code>pip install -e .
|
| 313 |
-
focus-buddy-setup-sidecar <span class="comment"># builds the MediaPipe environment, once</span>
|
| 314 |
-
focus-buddy --desktop --backend edge</code></pre>
|
| 315 |
-
<p class="fine">
|
| 316 |
-
That needs no API key and no network. For phone detection and posture, set an
|
| 317 |
-
<code>OPENAI_API_KEY</code> and use <code>--backend cloud</code> — from the dashboard,
|
| 318 |
-
the app has a settings page for it. <code>edge-vlm</code> runs the old local VLM path
|
| 319 |
-
and is kept for comparison, not recommended; see the table above for why.
|
| 320 |
-
</p>
|
| 321 |
-
</section>
|
| 322 |
</main>
|
| 323 |
|
| 324 |
<footer class="footer">
|
|
|
|
| 4 |
<head>
|
| 5 |
<meta charset="utf-8" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
<title>Focus Buddy - a Reachy Mini that notices your habits</title>
|
| 8 |
<meta name="description"
|
| 9 |
+
content="A Reachy Mini desk companion that catches face-touching and nail-biting with landmark geometry - 24/24 accurate, 50ms a frame, no model, no API key, no cost." />
|
| 10 |
<link rel="stylesheet" href="style.css" />
|
| 11 |
</head>
|
| 12 |
|
|
|
|
| 18 |
<h1>Focus Buddy</h1>
|
| 19 |
<p class="tagline">
|
| 20 |
A Reachy Mini that notices when you touch your face, bite your nails or drift onto your
|
| 21 |
+
phone - and says something about it.
|
| 22 |
</p>
|
| 23 |
<div class="pill-row">
|
| 24 |
<span class="pill strong">Runs offline · no API key</span>
|
|
|
|
| 30 |
|
| 31 |
<main class="container">
|
| 32 |
|
| 33 |
+
<section class="card">
|
| 34 |
+
<h2>What it watches for</h2>
|
| 35 |
+
<div class="habit-grid">
|
| 36 |
+
<div class="habit">
|
| 37 |
+
<span class="habit-icon">🤦</span>
|
| 38 |
+
<strong>Face touching</strong>
|
| 39 |
+
<span>A hand resting on your cheek, chin or forehead.</span>
|
| 40 |
+
<span class="tag ok">offline</span>
|
| 41 |
+
</div>
|
| 42 |
+
<div class="habit">
|
| 43 |
+
<span class="habit-icon">💅</span>
|
| 44 |
+
<strong>Nail biting</strong>
|
| 45 |
+
<span>Fingertips at or in your mouth.</span>
|
| 46 |
+
<span class="tag ok">offline</span>
|
| 47 |
+
</div>
|
| 48 |
+
<div class="habit">
|
| 49 |
+
<span class="habit-icon">📱</span>
|
| 50 |
+
<strong>Phone drift</strong>
|
| 51 |
+
<span>Phone in hand, eyes on it instead of the screen.</span>
|
| 52 |
+
<span class="tag">cloud only</span>
|
| 53 |
+
</div>
|
| 54 |
+
</div>
|
| 55 |
+
<p class="fine">
|
| 56 |
+
It also tracks gaze and whether you are at the desk at all, both from geometry. Nudges
|
| 57 |
+
are rate-limited - once a minute by default - and counted as <em>episodes</em>, not
|
| 58 |
+
frames: a thirty-second phone check is one distraction, not thirty. Once an hour it
|
| 59 |
+
tells you how the day is going. No score, no dashboard, no upload; the tally resets at
|
| 60 |
+
midnight.
|
| 61 |
+
</p>
|
| 62 |
+
</section>
|
| 63 |
+
|
| 64 |
+
<section class="card">
|
| 65 |
+
<h2>What it says</h2>
|
| 66 |
+
<p>
|
| 67 |
+
Spoken nudges come from a small set of fixed phrasings - several per habit, so a repeat
|
| 68 |
+
offender does not hear the same line four times running. That is the default because it
|
| 69 |
+
is instant, free, and never says anything strange to you.
|
| 70 |
+
</p>
|
| 71 |
+
<p>
|
| 72 |
+
A <strong>language model can rewrite them</strong> if you turn it on
|
| 73 |
+
(<code>FOCUS_BUDDY_USE_LLM_NUDGES</code>): a 4-bit Llama-3.2-1B running locally through
|
| 74 |
+
MLX on the <code>edge-vlm</code> path, or a hosted model otherwise. Whatever it writes
|
| 75 |
+
has to pass validation before it reaches a speaker - right length, actually mentions the
|
| 76 |
+
habit that was seen, and does not contradict the frame. Anything that fails is replaced
|
| 77 |
+
by the fixed phrasing. A buddy that is confidently wrong about you is worse than one
|
| 78 |
+
that repeats itself.
|
| 79 |
+
</p>
|
| 80 |
+
<p class="fine">
|
| 81 |
+
The hourly summary is not written by a model at all. "You've been working 2h,
|
| 82 |
+
nail-biting 3 times" is formatted straight from the counters, because those numbers are
|
| 83 |
+
facts about your day and should not be paraphrased by anything that can hallucinate.
|
| 84 |
+
The voice is OpenAI text-to-speech, or the macOS <code>say</code> command, which is
|
| 85 |
+
offline and free like the rest of the default path.
|
| 86 |
+
</p>
|
| 87 |
+
</section>
|
| 88 |
+
|
| 89 |
<section class="card">
|
| 90 |
<h2>See it work</h2>
|
| 91 |
<video class="demo" controls playsinline preload="none" poster="media/demo-poster.jpg">
|
|
|
|
| 104 |
<p>
|
| 105 |
Most Reachy Mini apps that watch you send every frame to a hosted vision model. That
|
| 106 |
works, and it bills you per frame forever. Focus Buddy's default backend runs
|
| 107 |
+
<strong>no model at all</strong> - face-touching and nail-biting are a distance
|
| 108 |
question, so it measures the distance.
|
| 109 |
</p>
|
| 110 |
<div class="cost-grid">
|
|
|
|
| 116 |
</div>
|
| 117 |
<div class="cost">
|
| 118 |
<span class="cost-label">cloud</span>
|
| 119 |
+
<span class="cost-value">a few $ / day</span>
|
| 120 |
+
<span class="cost-note">a hosted vision model, billed per frame. Watching a full
|
| 121 |
+
working day runs to a few dollars, every day. Adds phone detection, which
|
| 122 |
+
geometry cannot do, and posture.</span>
|
| 123 |
</div>
|
| 124 |
</div>
|
| 125 |
</section>
|
| 126 |
|
| 127 |
<section class="card">
|
| 128 |
+
<h2>Try it</h2>
|
| 129 |
+
<p>Install it from the Reachy Mini dashboard, or run it against a laptop webcam:</p>
|
| 130 |
+
<pre><code>pip install -e .
|
| 131 |
+
focus-buddy-setup-sidecar <span class="comment"># builds the MediaPipe environment, once</span>
|
| 132 |
+
focus-buddy --desktop --backend edge</code></pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
<p class="fine">
|
| 134 |
+
That needs no API key and no network. For phone detection and posture, set an
|
| 135 |
+
<code>OPENAI_API_KEY</code> and use <code>--backend cloud</code> - from the dashboard,
|
| 136 |
+
the app has a settings page for it. <code>edge-vlm</code> runs the old local VLM path
|
| 137 |
+
and is kept for comparison, not recommended; see the table above for why.
|
|
|
|
| 138 |
</p>
|
| 139 |
</section>
|
| 140 |
|
|
|
|
| 142 |
<h2>Why geometry beat every vision model I tried</h2>
|
| 143 |
<p>
|
| 144 |
This is the finding the project is really about. "Is a hand touching your face" reads
|
| 145 |
+
like a job for a vision-language model. It isn't - it's a distance, and the small
|
| 146 |
local VLMs answer it at chance.
|
| 147 |
</p>
|
| 148 |
<p>
|
| 149 |
Measured on 16 labelled frames from the robot's own camera: eight with a hand at the
|
| 150 |
+
face, eight without. Every 2-3B checkpoint answered <em>yes</em> to all sixteen.
|
| 151 |
</p>
|
| 152 |
<table class="bench">
|
| 153 |
<thead>
|
|
|
|
| 181 |
</tbody>
|
| 182 |
</table>
|
| 183 |
<p class="fine">
|
| 184 |
+
The same frames separate cleanly by distance: <strong>0.000-0.015</strong> face widths
|
| 185 |
+
from the face box while touching, <strong>0.528-2.102</strong> while not. A 35× gap,
|
| 186 |
where the models had none. Thresholds are ratios of the face width, so they do not care
|
| 187 |
how close you sit or what resolution the camera runs at. Gaze scored 23/24 from iris
|
| 188 |
position; at-the-desk 41/43.
|
| 189 |
</p>
|
| 190 |
<p class="fine">
|
| 191 |
The models were not merely wrong, they were <em>not looking</em>. SmolVLM2 returned a
|
| 192 |
+
character-identical sentence - "there is a hand touching the face, specifically near the
|
| 193 |
+
mouth" - for three different frames and for a picture of coloured rectangles.
|
| 194 |
</p>
|
| 195 |
</section>
|
| 196 |
|
|
|
|
| 209 |
</div>
|
| 210 |
<p>
|
| 211 |
Every vision backend returns the same typed <code>Observation</code>, so swapping
|
| 212 |
+
geometry for a cloud model changes nothing downstream. The four backend families -
|
| 213 |
+
perception, brain, speech, hardware - each sit behind a <code>Protocol</code> built by a
|
| 214 |
small factory from <code>Settings</code>, which is what lets the whole loop be tested
|
| 215 |
against fakes with no camera, no network and no models.
|
| 216 |
</p>
|
|
|
|
| 218 |
<p class="fine">
|
| 219 |
<strong>The model never gets the last word.</strong> Nudges come from fixed phrasings by
|
| 220 |
default. A language model may rewrite them, but whatever it produces must pass
|
| 221 |
+
validation first - right length, actually mentions the habit it saw, and does not
|
| 222 |
contradict the frame. Small models love to append "…and you're not even looking at your
|
| 223 |
screen", which is often flatly untrue. Anything that fails is replaced by the template.
|
| 224 |
</p>
|
|
|
|
| 233 |
<h2>Getting a VLM onto an 8 GB Mac</h2>
|
| 234 |
<p>
|
| 235 |
Before geometry won, a lot of work went into making local vision models fit. That work
|
| 236 |
+
is why the comparison above is fair - the models were given every advantage the hardware
|
| 237 |
allows.
|
| 238 |
</p>
|
| 239 |
<p>
|
|
|
|
| 263 |
<tr class="win">
|
| 264 |
<td>4-bit quantized</td>
|
| 265 |
<td>0.5</td>
|
| 266 |
+
<td>~1.1-1.5 GB</td>
|
| 267 |
</tr>
|
| 268 |
</tbody>
|
| 269 |
</table>
|
|
|
|
| 271 |
<p class="fine">
|
| 272 |
4-bit weights are packed on disk and unpacked to 16-bit floats on the fly, which needs a
|
| 273 |
specialised kernel. In the Hugging Face ecosystem that kernel is
|
| 274 |
+
<code>bitsandbytes</code>, written in CUDA - Nvidia's proprietary language. Apple GPUs
|
| 275 |
use Metal, so the code cannot compile or run; it falls back to CPU or crashes. Apple's
|
| 276 |
answer is <strong>MLX</strong>, written against Metal from the ground up, and
|
| 277 |
<code>mlx-vlm</code> ships its own 4-bit kernels for Apple Silicon. That is the route
|
|
|
|
| 279 |
</p>
|
| 280 |
<h3>Bigger and quantized beats smaller and pristine</h3>
|
| 281 |
<p class="fine">
|
| 282 |
+
4-bit quantization keeps roughly 95-98% of a model's accuracy while removing 75% of its
|
| 283 |
memory; 3-bit starts to degrade and 2-bit tends toward gibberish. Dropping to a 500M
|
| 284 |
+
model instead lowers the ceiling structurally - it loses the capacity for spatial
|
| 285 |
reasoning and stops respecting output formats. For "are the fingers at the lips or just
|
| 286 |
near the jaw", a 4-bit 2.2B beats a pristine 500M. Confirmed here: the 500M checkpoint
|
| 287 |
hallucinated hands onto the monitor.
|
|
|
|
| 290 |
<p class="fine">
|
| 291 |
During inference the model touches essentially all of its weights for every token. If
|
| 292 |
the working set exceeds RAM, the machine spends its time moving pages between disk and
|
| 293 |
+
memory instead of computing - and disk is ~100× slower than RAM, so a task that should
|
| 294 |
take seconds takes hours. The fingerprint is unmistakable: low CPU, tiny resident set,
|
| 295 |
and swap climbing into the gigabytes. At its worst this build showed ~10 GB of swap in
|
| 296 |
use on an 8 GB machine. The higher-precision SmolVLM2 convert took
|
|
|
|
| 310 |
Getting usable output from a 2B model is its own discipline. A cloud-style prompt asking
|
| 311 |
for <code>"looking_at_screen": True | …</code> made SmolVLM echo the template back,
|
| 312 |
placeholders included. A filled-in example made it emit the trailing fragment of the
|
| 313 |
+
example. A numbered Yes/No checklist produced a stuck prior - the same answers
|
| 314 |
regardless of the image.
|
| 315 |
</p>
|
| 316 |
<p class="fine">
|
|
|
|
| 318 |
one or two plain sentences about hands, mouth and gaze, then let Python turn that prose
|
| 319 |
into the typed <code>Observation</code>. The format is the deterministic part, so it
|
| 320 |
should not be spent on the model's limited capability. Every regex in that classifier
|
| 321 |
+
exists because a real model said something the previous version got wrong - including
|
| 322 |
the one that stopped "no indication of nail-biting" from registering as nail-biting.
|
| 323 |
</p>
|
| 324 |
<p class="fine">
|
|
|
|
| 331 |
<h2>On the robot</h2>
|
| 332 |
<p class="fine">
|
| 333 |
The Mini's camera is wide-angle and its view is not a webcam's, so frames are cropped
|
| 334 |
+
around the face before anything looks at them - biased downward toward hands and desk,
|
| 335 |
and toward whichever way the head is turned. Face detection uses OpenCV Haar cascades
|
| 336 |
rather than MediaPipe Tasks, which aborts in <code>DrishtiMetalHelper</code> on Apple
|
| 337 |
Silicon. The head sways in time with speech by hooking the SDK's audio pipeline, which
|
|
|
|
| 340 |
<p class="fine">
|
| 341 |
MediaPipe itself runs in a <strong>separate interpreter</strong>. Its only working API on
|
| 342 |
Apple Silicon needs <code>numpy<2</code>, while <code>reachy-mini</code> needs
|
| 343 |
+
<code>numpy>=2.2.5</code> - there is no overlap, so it gets its own virtualenv and
|
| 344 |
speaks over a pipe. The sidecar returns raw landmarks and the parent applies every
|
| 345 |
threshold, so the geometry has exactly one tested copy.
|
| 346 |
</p>
|
| 347 |
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
</main>
|
| 349 |
|
| 350 |
<footer class="footer">
|
style.css
CHANGED
|
@@ -81,7 +81,7 @@ code {
|
|
| 81 |
}
|
| 82 |
|
| 83 |
.container {
|
| 84 |
-
max-width:
|
| 85 |
margin: 0 auto;
|
| 86 |
padding: 2rem 1.5rem 3rem;
|
| 87 |
display: grid;
|
|
@@ -215,8 +215,8 @@ pre code {
|
|
| 215 |
.hero-art {
|
| 216 |
display: block;
|
| 217 |
width: 100%;
|
| 218 |
-
max-width:
|
| 219 |
-
margin: 0 auto
|
| 220 |
border-radius: var(--radius);
|
| 221 |
border: 1px solid var(--border);
|
| 222 |
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
.container {
|
| 84 |
+
max-width: 64rem;
|
| 85 |
margin: 0 auto;
|
| 86 |
padding: 2rem 1.5rem 3rem;
|
| 87 |
display: grid;
|
|
|
|
| 215 |
.hero-art {
|
| 216 |
display: block;
|
| 217 |
width: 100%;
|
| 218 |
+
max-width: 440px;
|
| 219 |
+
margin: 0 auto 22px;
|
| 220 |
border-radius: var(--radius);
|
| 221 |
border: 1px solid var(--border);
|
| 222 |
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
|