leonardoaguiar.com

Face Mesh

468 points on your face, live in your browser.

Start the camera or drop a photo. A face detector finds you, a second network reads 468 landmarks with depth, a third finds your irises and a fourth reads the emotion, all in plain JavaScript in your browser, many times a second. Draw the mesh, wear a 3D mask or turn your own face around, watch your mood on a timeline, see where you are looking and how far you sit from the camera. Nothing leaves the tab.

  • Web
  • Free
  • Private
A face drawn as a wireframe of 468 glowing points and 898 triangles
  • 468 landmarks with depth, found on every frame from a 192 pixel crop
  • 4 neural networks, run in plain JavaScript in Web Workers
  • 8 emotions, read four times a second by a network trained for this page
  • 0 frames sent to a server

Five areas. Mesh, mask, mood, gaze, inside.

The camera or a photo at the top of every area, with the same face shared by all of them. The first draws the landmarks; the second makes a surface of them; the third reads the emotion; the fourth follows the eyes; the last shows what runs, how long it takes and where it comes from.

Mesh

468 points with depth, drawn as glowing points, a wireframe of 898 triangles, the contours of the eyes, brows, lips, nose and oval, or a shaded face lit by its own normals. With the irises, the head's axes and each landmark's number if you want them, and a PNG of the view.

Mask

A 3D surface that follows every expression: wear neon lines, a grid, chrome, gold or clay over your face, or project the live picture onto the mesh and drag to turn your own face around, with the depth exaggerated and the head's yaw, pitch and roll read from the fit of a canonical face.

Mood

Eight emotions from a classifier trained for this page on 28,000 labelled faces: the scores as bars, the strongest one large, a timeline of the last minutes you can save as CSV, the 48 pixel square the network actually saw, and meters measured on the landmarks alone: smile, mouth, brows, eyes. Then a game that asks for a face and times you.

Gaze

Each iris found and measured: the direction of gaze from its place in the eye and the head's pose, the distance to the camera from its size, blinks and winks counted from the eyelids. Calibrate on nine dots and a ring follows your eyes across the page, with a test that says how close it gets.

Inside

The pipeline frame by frame, the four networks and what each one looks at and answers, how long each takes in your browser, what sits in the cache and how to remove it, and where the models and the training data come from.

The camera stays in the tab. So does everything read from it.

The weights are downloaded from this site once and kept in your browser's cache. The frames, the landmarks, the emotions and the calibration are computed in this tab and never sent anywhere; nothing is recorded. There is no server behind the page.

  • The networks run on your machine, in Web Workers
  • The camera is used only while the page shows it, and stops when you leave
  • No account, no upload, no server behind the models

Requirements

Runs in
A recent browser with a camera, or any browser with a photo; a desktop is faster than a phone
Downloads
3.3 MB of weights, the first time, kept in the browser's cache
Tracks
One face live from the camera, up to six in a photo
Account
Not needed
Price
Free

Questions

Do I need to install anything?

No. The four networks run in the page, in plain JavaScript inside Web Workers. Their weights, 3.3 MB in all, are downloaded the first time the camera starts or a photo is chosen and kept in the browser's cache.

How fast is it?

On a recent laptop the mesh comes back in about 25 milliseconds and the page runs at 20 to 30 frames a second; the irises and the emotion run in parallel in other workers. A phone is slower, and the page drops frames instead of lagging behind.

Where do the models come from?

The face detector, the mesh and the iris networks are Google's MediaPipe models (BlazeFace, Face Mesh and Iris), open under the Apache 2.0 licence, re-exported weight by weight into this page's own format and run by its own code, with no library behind it. The emotion network was trained for this page on FER2013 with the FER+ labels; it agrees with the human majority on 83 of 100 unseen faces.

How accurate is the emotion?

It is a reading of a 48 pixel grey square, not of you. It is good at happy, surprised, neutral and angry, poor at disgust, fear and contempt, and moved by lighting, glasses, a hand near the mouth or a turned head. The meters beside it come from distances between landmarks and do not use the network at all.

How does it know the distance?

The iris is about 11.7 millimetres across in almost every adult, so its size in pixels and the lens's focal length give the distance. The lens is assumed to see 60 degrees across until you calibrate it by typing how far you are once; then the reading is exact for that camera.

Can it track where I look on the screen?

After a calibration of nine dots, roughly: a ring follows your eyes across the page and a test tells you how far it lands from a dot, typically a few per cent of the screen when the head stays still. The map comes from the iris's place in the eye and the head's pose; move your chair and calibrate again.

Does it work on a photo?

Yes. Drop a photo or choose one, and every area reads it instead of the camera: up to six faces in the Mesh area, the first of them in the others. Photos are read in the tab and never uploaded.

Privacy · Terms of Service