Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 4 min read

What one photo can and can't tell you about eye shape

We added an eye shape test to How Attractive Am I, which runs face analysis in the browser with MediaPipe Face Landmarker. The obvious plan was to copy what most eye shape detectors do: measure the eye, map the numbers t

We added an eye shape test to How Attractive Am I, which runs face analysis in the browser with MediaPipe Face Landmarker. The obvious plan was to copy what most eye shape detectors do: measure the eye, map the numbers to one of eight or ten named shapes (almond, round, hooded, monolid, downturned…), and print the label.

Before building that, we checked two things: does each measurement come out the same when the same person takes another photo, and does it actually separate the shapes it claims to? About half the labels didn't survive.

Step 1: is the number stable for the same person?

We used 102 photos of 74 people from our local test set, 10 of them with more than one photo. We kept only photos that passed our quality checks and had the head turned 10Β° or less.

For each measurement we compared two spreads:

  • within a person: how much it moves between two photos of the same face;
  • between people: the interquartile range across all 74 people.

The ratio of the two is the number that matters. Near 0 means a new photo barely moves you; near 1 means a new photo can move you as far as the gap between a typical pair of strangers.

Measurement Median ratio Worst ratio Between people p10 / p50 / p90
Canthal tilt (degrees) 0.15 0.69 βˆ’0.5 / 3.2 / 6.1
Brow-to-eye gap Γ· eye width 0.20 0.64 0.68 / 0.79 / 0.91
Openness (height Γ· width) 0.34 0.97 0.24 / 0.32 / 0.38
Lid over iris (height Γ· iris diameter) 0.33 0.98 0.52 / 0.70 / 0.85

Tilt (the line from inner to outer eye corner) is steady. Openness, the number behind "round vs almond", is not: how wide someone happens to have their eyes open in that shot moves it about as much as the difference between two people. With cut-offs at the 33rd and 67th percentiles, roughly one person in ten lands on the other side of round/almond from one photo to the next.

Step 2: does it separate the shapes?

Stability isn't enough; the number also has to point the right way. We generated 12 AI faces with known eye types (two each of downturned, round, narrow-long, hooded, monolid and a reference), about $0.22 of image credits, and ran them through the same pipeline.

  • Both "downturned" faces measured 5.1Β° and 1.9Β°, which is upturned or level, not downturned.
  • "Round" and "narrow" overlapped on openness: 0.38 / 0.36 vs 0.36 / 0.31.
  • Hooded and monolid showed no signal in any landmark measurement.

An honest caveat: image models don't always draw what the prompt asks for, and one of the "downturned" faces doesn't look very downturned to a human either. So this step doesn't prove the measurements are wrong. It shows we had no positive evidence that they were right.

Hooding and monolids failing makes sense once you look at the mesh. Face Landmarker places points on the lid margin and around the eye, but a lid crease, and a fold of skin that covers it, is a shading feature a few pixels high. There is no landmark for it, and nothing in the point geometry changes when it's there.

Step 3: check the thresholds against real faces

A common way to label tilt is Β±8Β°: above is upturned, below is downturned, in between is straight. In our 74 people, 90% fall between βˆ’0.5Β° and 6.1Β°. With a Β±8Β° rule almost everyone is "straight", and the label carries no information.

We set the cut-offs from the sample instead:

// shape = eye height Γ· width, 33rd / 67th percentile of the sample
// tilt = mean of both eyes; ~lowest 15% count as downturned, top 20% as upturned
// spacing = inner-corner gap Γ· one eye width, 20th / 80th percentile
export const EYE_CUTS = { form: [0.29, 0.34], tilt: [0.5, 5], spacing: [1.21, 1.39] };

These are relative to one sample and we say so. They put the boundaries where people actually are, rather than where a diagram says they should be.

What we shipped

  • From the photo, three measurements: shape (almond, almond-round, round), tilt (downturned, straight, upturned) and spacing (close-set, average, wide-set). Each is drawn as a point on a scale, not only as a name, so a result sitting right next to a boundary looks like one.
  • Shape is labelled "in this photo", because Step 1 says a different photo can flip it.
  • Hooded and monolid come from the user: an optional three-question mirror check (Can you see a crease with your eyes open? Does skin from the brow bone cover it? Partly or mostly?). The answers stay in the browser; only the fact that the check was used is counted.
  • The two parts combine into one line, for example Upturned almond, wide-set, hooded.

It's a less impressive output than ten shapes with a confidence score. But a label the user can't reproduce with their next selfie isn't worth much, and asking about lids gets a better answer than guessing them from points that can't see them.

Takeaways if you're building something similar

  1. Measure repeatability before accuracy. A within-person Γ· between-person ratio is quick to compute and tells you which features are worth showing at all.
  2. Calibrate thresholds on your own users' faces. Cut-offs copied from a chart can collapse almost everyone into one bucket.
  3. Know what your landmarks can't see. If a feature is shading or texture rather than geometry, a point model won't find it. Ask the user instead.
  4. Show positions, not only labels. A dot on a scale is honest about "almost round".

This article was generated by AI from our own test notes and code, and reviewed by a human before publishing.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.