The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
face-shape-rule-set
A machine-readable face-shape classifier rule set, plus a dependency-free reference implementation of it.
Seven face shapes, five facial measurements, every threshold, every standard deviation, every weight, and the 26 published bounds — as CSV and JSON you can load, and a classifier you can run and test against.
These are the constants the live detector at knowyourfaceshape.com runs on.
Why this exists
Face-shape tools disagree with each other constantly, and almost none of them publish the numbers they disagree about. Ask four of them about the same face and you can get four different answers, because each one drew its cut-offs in a different place and none of them say where.
This rule set is published in full, including the parts that are unflattering. The constants have not been fitted to a labelled photo set. Fitting them properly needs 30 to 50 faces, each rated independently by at least two people, and nobody has collected that set yet. The publisher says so on the site rather than printing an accuracy number that cannot be defended, and this repository carries the same disclaimer on the front of the data file.
If you want to know what a face-shape classifier is actually doing, or you want to build one and would rather not invent your own thresholds from nothing, this is a complete working starting point with its limitations stated rather than hidden.
The data
| File | What it holds |
|---|---|
data/rule-set.json |
Everything. Single source of truth; the CSVs are generated from it. |
data/prototypes.csv |
One row per feature: prototype mean for each of the 7 shapes, σ, and all 5 weight sets. |
data/hard-constraints.csv |
The 26 published bounds, flattened to one row per condition, with the publisher's own gloss for each. |
data/quiz-weights.csv |
The 7-question quiz: every option's per-shape weights and the spec it carries. |
data/share-url-params.csv |
Every query parameter in the site's result URLs and what it encodes. |
data/landmarks.csv |
MediaPipe Face Landmarker indices, and which are actually used. |
data/measurement-lines.csv |
Which two landmarks each measurement is taken between. |
data/landmarks.json |
The same geometry, with the angle formula and the open questions. |
data/upstream-extract.json |
The committed extraction of the site's shipped constants — the evidence check 1 reads. |
data/provenance.md |
Which chunk, which minified identifier, which JSON path, for every value. |
docs/verification.md |
What was checked, how, what it proved, and what was not verified. |
NOT-PUBLISHED.md |
The gaps: what could not be read, and what would close each one. |
CITATION.cff |
How to cite the data. |
LICENSE / LICENSE-DATA |
MIT for the code, CC BY 4.0 for the data. |
REUSE.toml |
The same split, per path, in machine-readable SPDX. |
LICENSES/ |
Both licence texts under their SPDX identifiers, as the REUSE Specification requires. |
The five features:
| Key | Name | Definition |
|---|---|---|
R1 |
Face length ratio | face length ÷ cheekbone width |
R2 |
Forehead ratio | forehead width ÷ cheekbone width |
R3 |
Jaw ratio | jaw width ÷ cheekbone width |
A |
Jaw angle | angle at the jaw corner, in degrees |
C |
Chin taper | chin width ÷ jaw width |
Regenerate the CSVs from the JSON after editing it:
node scripts/build-csv.mjs
Running it
No dependencies, no build step. Node 18 or newer.
node src/cli.mjs --features R1=1.42 R2=0.91 R3=0.79 A=121 C=0.44
result Oval (oval)
confidence 92.2%
shape distance probability match
Oval 0.392 92.2% 91.7%
Diamond 2.444 5.0% 48.5%
...
published bounds for Oval: 5 of 5 satisfied
From tape-measure numbers instead, the way a person without a camera would use it:
node src/cli.mjs --tape --length 24 --forehead 15.5 --cheekbone 16.5 --jaw 13
Leave off --angle and you get the interesting path: the jaw angle is estimated from the three width ratios, and confidence is then capped at 70 percent no matter how clean the numbers look, because one of the inputs was invented rather than measured.
node src/cli.mjs --table # print the whole rule set
node src/cli.mjs --constraints R1=... ... # which shapes' bounds does this face satisfy
node src/cli.mjs --batch examples/sample-tape-measurements.csv
As a library:
import { classify, classifyFromTape } from './src/classify.mjs';
classify({ R1: 1.42, R2: 0.91, R3: 0.79, A: 121, C: 0.44 });
// -> { shape: 'oval', confidencePercent: 92, scores: [...], blend: {...}, criteria: [...] }
classifyFromTape({ faceLength: 24, foreheadWidth: 15.5, cheekboneWidth: 16.5, jawWidth: 13, unit: 'cm' });
// -> { features, result, angleProvided: false, estimatedAngle: 121.6 }
npm test
How it classifies
Each feature is compared to each of the seven prototypes in units of its own spread, weighted, and summed into one squared distance per shape:
d²(shape) = Σ_f weight_f · ((x_f − μ_f,shape) / σ_f)²
Features with a weight of zero are skipped entirely rather than contributing zero. The distances become probabilities through a softmax over exp(−(d² − min d²) / 2), and the highest probability wins.
A second, independent reading called match rescales the same distances against the worst shape instead of the best. When the two orderings disagree the probability wins, and the result carries an orderingMismatch flag saying so.
Four things worth knowing:
- There are five weight sets, not one. Only
fullis printed on the site.angleHeavyraises the jaw-angle weight from 0.8 to 1.2 and appears nowhere in the documentation. Two more zero out chin taper for the tape-measure path, and a fifth zeroes both the angle and the chin so it can rank on width ratios alone. All five are indata/rule-set.jsonwith apublishedflag and a note on where each is used. - Chin taper is deliberately dropped on the tape path. A tape measure cannot find the narrowest point of a chin. Rather than guess, the weight is set to zero. The site says this out loud on the result page, in a sentence stored verbatim at
publisherCopy.chinTaperUnmeasurable. - The hard bounds do not filter. The 26 constraints are reported next to the distance result and nothing more. The publisher's own fallback sentence proves it: when none of the winning shape's bounds hold, the result still stands and the page says "your measurements sit closest to the {shape} prototype, but none of its individual criteria fully hold — treat this as a rough read." See NOT-PUBLISHED.md.
classify()returns the sentence the result page prints.explanationlists the bounds that actually hold, capped at three phrases and joined with the publisher's own list rule — or the fallback above when none do. Assembled from strings read out of the bundle, not written here.
Verified against production
This is not a guess at how the site works, and it is not a reimplementation from the prose on the about page.
The site's classifier chunk loads and runs in Node with the browser globals stubbed, so the comparison is against the deployed code executing, not against a model of it. Two commands do the work:
node tools/verify-upstream.mjs --fetch # constants, the 26 rendered bounds, the publisher's prose
node tools/diff-against-bundle.mjs --fetch # run the shipped classifier against ours
What they printed on 2026-09-11, against /_next/static/chunks/result-query-BLypqv_T.js:
- Constants — 15 composite values matched as a whole (σ, all 7 prototype mean vectors, 4 of the 5 weight sets, the 30 numbers in the bounds table, the validation ranges, the URL parameter ranges), plus 19 bare scalars as supporting evidence. Nothing absent. The fifth weight set is built inline inside a function body rather than declared, so it is evidenced by its quoted source line instead — as are the angle-estimation, tape-validation and quiz numbers.
- The 26 published bounds — rendered with the publisher's own templates and glosses read out of the bundle at runtime, then compared to the sentences on
/about/: 26 identical, 0 differing. - The publisher's prose — 85 strings in
rule-set.jsonplus 46 held in place, rebuilt from a fresh download: 0 drifted. - The tape path — 3,000 random inputs across both unit systems and both jaw-angle branches, plus 4 pinned inputs. 2,418 accepted and compared field by field; 586 rejected, of which 241 hit the incomplete-form branch. Angle supplied 1,217 times, estimated 1,201, the 70 percent cap actually fired 862. 0 disagreements.
- The explanation sentence — 2,418 compared, 4 of them the fallback branch where no bound holds. 0 disagreements.
- The share-URL scheme — 400 URLs built by
src/share-url.mjsand compared character for character, then all 400 re-parsed by the production reader with all five features intact.
This checking found three real bugs, which is the reason to trust it more than a clean run would be:
classifyFromTape()was missing production's fifth return field,notice— the estimated-angle warning the result page prints.- On an incomplete form, production returns one aggregate error against
form; this implementation returned per-field errors with no message. Invisible for 3,000 runs, because every generated input happened to have four valid numbers. The harness now blanks a field deliberately. - Production's scoring function returns an
explanationsentence assembled from the bounds that hold. This implementation did not return it, and the field-by-field comparison could not see the gap because it worked from an allow-list of field names. The allow-list now reports any production field it does not know about.
npm test adds 30 tests, two of which are the URLs a real Chrome session produced on the live calculator that day, pinned so they can be re-checked offline.
Full record, including what was not verified: docs/verification.md.
The bundle is content-hashed, so that filename changes on the next deploy and some minified identifiers move with it. The tools locate exports by behaviour rather than by name, so they survive that — but every figure above is dated for a reason. Re-run before trusting it for a later version.
What is not published
NOT-PUBLISHED.md lists every gap found while building this, what the consequence is, and what would close it. Short version: the reduction of the two jaw angles into the single A feature, whether the 26 bounds are meant to filter, the source of the 60 percent "confident read" line, and the shape-pair table behind the site's "your two tools disagree" sentences — whose templates were recovered but whose data was not.
The open problem
The constants are initial values. Nobody has fitted them.
To do it properly you need a labelled set: 30 to 50 faces, each rated independently by at least two people, ideally with the four raw measurements recorded so the labels can be checked against the features rather than against someone's impression. Then σ becomes a measured spread instead of a chosen one, the weights become fitted instead of hand-set, and the classifier can report a real error rate rather than a distance.
The closest public labelled set is dsmlr/faceshape, which does not fit. Checked 2026-09-11: its published_dataset folder carries five categories — heart, oblong, oval, round, square — with no diamond and no triangle, so it cannot label all seven prototypes here. It also has no licence file, its last push was 2018-11-07, and it ships images only, not the four raw measurements. It accompanies Pasupa, Sunhem and Loo, A Hybrid Approach to Building Face Shape Classifier for Hairstyle Recommender System, Expert Systems With Applications (2018), doi:10.1016/j.eswa.2018.11.011, whose best reported result is 70.33 percent accuracy — a useful ceiling to compare against, not a training set for these seven.
If you fit these constants to real data, please say how — a pull request adding a fitted weight set alongside the existing ones, with the method and the sample described, is exactly what this repository is missing.
The publisher runs its own corrections channel, and it is the faster route if you spot a wrong number rather than a missing one. /about/ says: "If you are a licensed cosmetologist, a craniofacial researcher, or just someone who spotted a wrong number, write to hello@knowyourfaceshape.com. Corrections are credited on the page they fix."
Licence
Split, deliberately:
- Code — MIT, see LICENSE. Do what you like with it.
- Data — CC BY 4.0, see LICENSE-DATA. Every value in
data/is the publisher's, read out of the JavaScript their site serves, so reuse should carry attribution back to knowyourfaceshape.com rather than to whoever transcribed it.
data/rule-set.json records both, at licence and dataLicence, so the split travels with the file instead of staying in a README someone might not read. package.json declares MIT OR CC-BY-4.0.
Before LICENSES/ existed, GitHub's sidebar showed only MIT, because it read the root LICENSE and nothing else. With both texts in place the sidebar now lists the pair — MIT, CC-BY-4.0 licenses found — and the repository API keeps MIT as the primary licence. What neither of those can say is which files carry which licence. REUSE.toml says it, per path in SPDX terms: data/** is CC-BY-4.0, everything else MIT. To check that claim rather than take it:
pip install "reuse[charset-normalizer]"
reuse lint # compliant with version 3.3 of the REUSE Specification
Provenance
Constants, bounds, the publisher's own prose and the pipeline description were all read out of the shipped JavaScript at knowyourfaceshape.com, retrieved 2026-09-11 — not transcribed from rendered page text, and not inferred. Per-value detail, including which chunk and which minified identifier each came from, is in data/provenance.md. What was checked, how, and what was not verified is in docs/verification.md.
The landmark indices follow the MediaPipe Face Landmarker 478-point topology, which the site states and which the published index map confirms.
/about/ lists five references, reproduced here exactly as cited there:
- Farkas, L. G. (1994). Anthropometry of the Head and Face, 2nd ed. Raven Press.
- Farkas, L. G., Katic, M. J., & Forrest, C. R. (2005). International anthropometric study of facial morphology in various ethnic groups/races. Journal of Craniofacial Surgery, 16(4).
- Lugaresi, C., et al. (2019). MediaPipe: A Framework for Building Perception Pipelines. arXiv:1906.08172.
- Kartynnik, Y., et al. (2019). Real-time Facial Surface Geometry from Monocular Video on Mobile GPUs. arXiv:1907.06724.
- Milady Standard Cosmetology, 14th ed. Cengage Learning.
None of the five was independently consulted to confirm any threshold, and the site does not claim the numbers were derived from them — so they are context, not sources for the values in this repository.
This repository is a transcription of published values plus an independent implementation, not an official mirror. If the site's constants change, this file set is stale until someone re-runs the tools.
- Downloads last month
- 19