Full face stack that runs entirely in the browser. Detection, 576-point 3D mesh, recognition, anti-spoof, smile — all WebAssembly, zero server. Apache 2.0.
C avx-512avx2biometricsc99computer-visioncpu-inferencedeep-learningedge-aiembedded-aiface-embeddingface-recognitionface-verificationlow-latencyonnx-runtimeproduction-readysimdzero-dependencies
gitignore nn2 + reframe references as proprietary engine
facex025cc57eada1
diff --git a/.gitignore b/.gitignoreindex 1766829..3e1e686 100644--- a/.gitignore+++ b/.gitignore@@ -21,6 +21,9 @@ training/runs/training/Silent-Face-Anti-Spoofing/training/nn2-mirror/+# === Proprietary inference engine — never publish ===+nn2/+# === Caches ===__pycache__/*.pycdiff --git a/README.md b/README.mdindex 400fc74..14263b1 100644--- a/README.md+++ b/README.md@@ -46,7 +46,7 @@ FaceX is one piece of a larger pure-C stack we built for IP-camera workloads. Ev| **NexusDecode** | H.264 + H.265 decoder, RTSP client | **184 KB** | 6,300 fps, **46× FFmpeg** | libav / FFmpeg || **NexusEncode** | H.265/HEVC encoder | ~250 KB | x265-medium quality, 131 fps | x265 || **NXV codec** | Surveillance-tuned video format | 121 KB | **3× smaller** than H.265, instant seek, change-map | H.265 + custom container |-| **nn2** | YOLOv8 + MiniFASNet inference engine | 520 KB | 8.5 ms @ 320, **1.5–2× ONNX RT** | onnxruntime |+| **nn2** (proprietary) | YOLOv8 + MiniFASNet inference engine | 520 KB | 8.5 ms @ 320, **1.5–2× ONNX RT** | onnxruntime || **FaceX (this repo)** | Detect + landmarks + embed + spoof | 148 KB native / 17 MB WASM | 3 ms/face | dlib, FaceNet, InsightFace |**Pipeline numbers (one Intel i5 CPU):**@@ -159,7 +159,7 @@ Measured on Intel i5-11500 (6 cores, AVX-512 + VNNI):| Engine | Median | Min | vs FaceX ||--------|-------:|----:|:--------:|-| **FaceX (nn2)** | **3.0 ms** | **2.87 ms** | -- |+| **FaceX (native nn2)** | **3.0 ms** | **2.87 ms** | -- || ONNX Runtime 1.23 | 3.9 ms | 3.18 ms | 1.30× slower || InsightFace (R34) | 17 ms | -- | 5.7× slower || FaceNet (PyTorch) | 30 ms | -- | 10× slower |@@ -167,11 +167,11 @@ Measured on Intel i5-11500 (6 cores, AVX-512 + VNNI):### Speed — anti-spoof (MiniFASNet V2+V1SE ensemble)-Same model, ported to our nn2 engine:+Same model, ported to our proprietary nn2 engine:| Engine | Single model | Ensemble | Speedup ||--------|-------------:|---------:|--------:|-| **nn2** (this repo) | **0.70 ms** | **1.43 ms** | -- |+| **nn2** (ours) | **0.70 ms** | **1.43 ms** | -- || ONNX Runtime 1.23 | 1.33 ms | 2.92 ms | **2.03× slower** |Byte-identical predictions to PyTorch / ONNX on the same input.@@ -400,8 +400,8 @@ touch disk in plaintext on the target machine.## Limitations- **Native build** — currently x86-64 (AVX2 / AVX-512 / VNNI). ARM NEON- paths exist in `nn2/src/gemm_neon.h`; full ARM build script is on the- roadmap, ESP32 / RISC-V PIE 128 next.+ paths exist; full ARM build script is on the roadmap, ESP32 / RISC-V+ PIE 128 next.- **Browser pipeline** — uses `onnxruntime-web` with WebCrypto-decryptedONNX. WebGPU backend is supported by ORT but not yet wired into thedemo; would drop inference by another 3–5×.@@ -462,11 +462,6 @@ predictions at **2× speed** vs ONNX Runtime.```include/ — public C API (facex.h, facex_mfn.h, ...)src/ — recognition engine + AES weight crypto-nn2/ — pure-C YOLO + MiniFASNet inference engine- (1.5× ONNX for YOLO, 2× ONNX for MiniFASNet)- src/ — gemm, conv, ops, antispoof_ops, minifasnet- tools/ — PyTorch → .bin converters- weights/ — encrypted .bin checkpointswasm/ — browser demo (demo_mesh.html, encrypt tool)tools/encrypt_models.py — AES-256-GCM encrypt all .onnxdocs/demo/ — GitHub Pages live demo + encrypted weights@@ -474,12 +469,15 @@ training/ — all training pipelines, datasets, exportersscripts/ — MobileFaceNet recognition (nano/tiny/standard/xs)landmark/ — 98-point WFLWlandmark3d/ — 576-point MediaPipe distillation- face_detect/ — own YuNet-style face detector on WIDER FACE- antispoof/ — MiniFASNet integration + own synth experiments+ face_detect/ — own FCOS face detector trained on WIDER FACE+ antispoof/ — MiniFASNet integrationgo/facex/ — Go binding (subprocess protocol)python/facex/ — Python binding (ctypes)```+The nn2 inference engine (1.5–2× ONNX, used in commercial deployments)+is closed-source. Contact for licensing.+---## FAQ