Ship the three eye-state models beside the face pair

2d106det for the eye contours, OCEC for open or closed, SGC for
sunglasses — all three pinned to a batch of one by the same script as
the pair, and installed by every packager so the eyes-open filter works
out of the box. The two classifiers are MIT, code and weights; the
README records their provenance, SGC's undocumented training set, and
the hashes as fetched and as shipped.
This commit is contained in:
2026-09-19 14:04:08 +02:00
parent 54b543fb77
commit 6aae4c3eb0
11 changed files with 94 additions and 9 deletions
+52
View File
@@ -15,10 +15,19 @@ by every platform:
scrfd_2.5g_640.onnx 3.3 MB "Balanced" — 14% more faces for 12% more time (faces.md §12.3)
scrfd_10g_640.onnx 17 MB "Thorough" — a further 12% for 3× the time
arcface_mbf_b1.onnx 13 MB
2d106det_b1.onnx 4.8 MB 106 landmarks, for the eye boxes (faces.md §17)
ocec_s_b1.onnx 483 KB eyes open or closed, per eye
sgc_l_48_b1.onnx 6.1 MB sunglasses or not, per head
Which detector runs is a per-device setting (`FaceSettings::detector`); all three are installed so
the choice exists on every platform. Each is its own `faces.model_id`, so changing it re-indexes.
The last three are optional to the app: `library::face_models` reports them beside the pair when
all three are there, and a library without them indexes faces and simply has no eye readings —
every reader treats "never read" as unknown, never as closed. They are found in the *same*
directory as the pair, so a hand-placed pair does not pick up a package's eye models from a
directory it otherwise outranks.
**A clone without git-lfs gets a ~130-byte pointer where each model should be.** Both packagers check
for exactly that and refuse, rather than shipping the pointer and failing inside tract on the user's
machine. Fix it with `git lfs pull`.
@@ -31,7 +40,50 @@ cannot parse any of the graphs while they are dynamic:
./tools/fix-face-model-shapes.sh det_2.5g.onnx models/face/scrfd_2.5g_640.onnx --input input.1=1,3,640,640
./tools/fix-face-model-shapes.sh det_10g.onnx models/face/scrfd_10g_640.onnx --input input.1=1,3,640,640
./tools/fix-face-model-shapes.sh w600k_mbf.onnx models/face/arcface_mbf_b1.onnx --dim None=1
./tools/fix-face-model-shapes.sh 2d106det.onnx models/face/2d106det_b1.onnx --dim None=1
`2d106det_b1.onnx` is from the same `buffalo_l.zip` as `det_10g.onnx` and under the same grant: the
106-point landmark model whose lid contours the eye boxes are cut from (docs/faces.md §17.2).
sha256 as fetched `f001b856…a7109dbf`, as shipped `afc2984c…03368ef26`.
The weights carry a non-commercial research-only grant. They are here because this is a private
repository and self-installed builds; they come back out before anything is published, and the
restriction binds whoever uses the app, not only the project. docs/faces.md §2.2a is the decision.
## The two classifiers are a different matter
`ocec_s_b1.onnx` and `sgc_l_48_b1.onnx` are **MIT, code and weights**, from Katsuya Hyodo's
ultra-lightweight classifier series — the same author as the whole-body detector the reference
pipeline uses. They are not under the InsightFace grant and do not come out when the project
publishes. Read 2026-09-19:
| | OCEC — open/closed eyes | SGC — sunglasses |
|---|---|---|
| Source | `github.com/PINTO0309/OCEC`, release `onnx`, `ocec_s.onnx` | `github.com/PINTO0309/SGC`, release `onnx`, `sgc_is_l_48x48.onnx` |
| Licence | MIT (repository `LICENSE`; no separate grant on the weights) | MIT, likewise |
| Training data | *Open and Closed Eyes* (Młodawski 2024, HF, **ODC-By 1.0** — attribution only), crops cut by DEIMv2-Wholebody34 (Apache 2.0) | **Not stated.** The README names no dataset and carries no acknowledgement; `data/` holds a class-ratio plot and nothing else. |
| Input | one eye, 40×24, RGB, `x/255` | one head, 48×48, RGB, `x/255` |
| Output | `prob_open`, a sigmoid | `prob_sunglasses`, a sigmoid |
| sha256 as fetched | `9a346a08…c604ba9b64` | `9c13d937…a4063c73` |
| sha256 as shipped | `c848d34c…4b29d04c7c` | `d49b6206…7e9538525c6` |
Both shipped with a dynamic batch dimension that tract loads but the project pins anyway, with the
same script as the pair:
./tools/fix-face-model-shapes.sh ocec_s.onnx models/face/ocec_s_b1.onnx --dim batch=1
./tools/fix-face-model-shapes.sh sgc_is_l_48x48.onnx models/face/sgc_l_48_b1.onnx --dim batch=1
The one thing D13's discipline turns up here is SGC's undocumented training set. The weights'
grant is MIT and that is what binds a redistributor; but "trained on what" is the question this
project reads first, and for SGC it has no answer. Recorded so it is a known gap rather than an
assumption, and so that whoever finds a sunglasses classifier with a stated dataset knows what to
replace.
Attribution, as ODC-By asks for the eye dataset:
> Michał Młodawski, *Open and Closed Eyes Dataset*, July 2024,
> https://huggingface.co/datasets/MichalMlodawski/closed-open-eyes
The variant choice was measured, not taken from the F1 column: on family snapshots the S variant
of OCEC read more open eyes as open than M or L did, which overfit their own domain
(docs/faces.md §17).