Computer Vision Β· Face Analysis
Face Mapping Lab
Real neural face mapping β 68-point landmarks, 478-point neural mesh, and a CCTV face-recognition system that tells the truth about tiny faces. Built by Usman Kalera.
01 Β· Landmark detection
68-Point Face Mapping
Classic facial landmark detection with a neural 2D-FAN model β jaw, brows, eyes, nose and mouth mapped with a Delaunay mesh. Works on single faces and groups.
02 Β· Dense 3D-style mesh
478-Point Neural Mesh
A dense βneurological-styleβ face mesh β 478 landmarks per face from a neural face-landmarker model, rendered as a glowing wireframe. Then tracked across every video frame.
03 Β· Beyond the face
Full-Body Pose + 3D Mesh
Face mapping is only the start. YOLOv8-pose maps 17 body keypoints β shoulders, elbows, wrists, hips, knees, ankles β and the 478-point neural mesh carries real depth (x, y, z), rendered here as a rotating 3D point cloud.
Why it matters: pose unlocks gait analysis, fall detection and activity recognition β and 3D landmarks enable head-pose estimation and AR face filters. Same lab, bigger canvas.
04 Β· Real-world system
CCTV Face Recognition v2
A complete pipeline: YuNet detection β tracking β SachiEnhance β SFace recognition β best-frame selection β quality gate. Tested honestly on night-vision CCTV frames.
The honest test
β swipe to see full table β
| Test | Similarity | Result |
|---|---|---|
| Parking-lot frame (person too far) | β | 0 faces detected β genuinely undetectable |
| Entrance frame, raw 32Γ40 px face | 0.342 | UNKNOWN (threshold 0.40) |
| + SachiEnhance (denoise + faithful SR) | 0.365 | UNKNOWN β improved, still below threshold |
| + Real-ESRGAN (GAN hallucination) | 0.182 | WORSE β GAN invents fake identity details |
| Best-frame over 12-frame track | 0.365 | UNKNOWN β flagged for review |
Key finding: at 32 px, software can help a little β but it cannot invent missing identity. A good system says βI donβt know, a human should checkβ instead of guessing wrong. That honesty is the feature.
05 Β· The enhancement method
SachiEnhance v2
Sachi means βtruthfulβ. A faithful tiny-face enhancer for recognition: light denoise + FSRCNN super-resolution. No hallucination, no contrast tricks β because for recognition, pretty lies hurt and honest pixels help.
What helped vs what hurt
β swipe to see full table β
| Technique | Ξ similarity | Verdict |
|---|---|---|
| Light denoise + FSRCNN (SachiEnhance) | +0.031 | β helps β faithful only |
| Flip-averaged embeddings (TTA) | small + | β helps |
| Best-frame over track | +0.010 | β helps slightly |
| Real-ESRGAN hallucination | β0.161 | β invents wrong identity |
| CLAHE contrast boost | β0.111 | β amplifies noise |
| Enhancing the enrollment photo | very β | β never enhance clean references |
06 Β· Lab tests & proofs
Stress-Tested, On Video
Real benchmark runs, not claims. YuNet detection was stress-tested against blur, noise and distance β and the full pipeline was timed on CPU. Watch the live execution.
Benchmark results
β swipe to see full table β
| Stress test | Result | Limit found |
|---|---|---|
| Gaussian blur k = 0 β 21 | β 6/6 detected | None β detected even at extreme blur |
| Gaussian noise Ο = 0 β 60 | β 3/5 detected | Fails at Ο β₯ 40 |
| Simulated distance (face 573 β 51 px) | β 5/5 detected | Detected down to 51 px wide |
| YuNet detect (CPU) | 216.4 ms | Full pipeline: 347.7 ms = 2.9 FPS on CPU |
| SFace embedding | 36.7 ms | |
| Denoise | 83.0 ms | |
| FSRCNN Γ4 super-resolution | 11.6 ms |
Honest note: detection is tougher than it looks here β recognition (telling who) is the harder problem, as the CCTV tests above show. Detection = βa face is thereβ; recognition = βwhose faceβ.
Biometric accuracy: genuine vs impostor
Same person (with rotation, brightness, blur, downscale changes) vs different people β scored by SFace. The ranges overlap: no perfect threshold exists, which is exactly why the quality gate matters.
β swipe to see full table β
| Condition | Similarity | Reading |
|---|---|---|
| Rotation Β±5Β° | 0.92 / 0.31 | β οΈ asymmetric β direction matters to SFace |
| Rotation Β±10Β° | 0.27 / 0.72 | β beyond Β±5Β° is unreliable |
| Darkened β30 | 0.23 | β poor lighting breaks it |
| Brightened +30 | 0.89 | β fine |
| Heavy blur | 0.82 | β fine |
| 4Γ downscale | 0.30 | β tiny faces fail (the CCTV problem) |
| Eyes hidden | 0.77 | β surprisingly robust |
| Mouth hidden | 0.96 | β barely affected |
Landmark accuracy: repeatability test
Same face, 12 variants (rotation, brightness, blur, noise, JPEG, downscale) β how far do the 68 points wander? Mean drift β 9 px on a 1024-px image; the model is fully deterministic (clean repeat = 0.00 px). Jawline and brow points drift most.
β swipe β
| Variant | Mean drift | Max drift |
|---|---|---|
| Rotation Β±5Β° | 8.5 px | 20.8 px |
| Brightness Β±20 | 9.0 px | 38.0 px |
| Blur k=7/15 | 7.6 px | 19.0 px |
| Noise Ο=15 | 8.1 px | 17.0 px |
| JPEG q=50/20 | 11.1 px | 39.1 px |
| 3Γ downscale | 10.6 px | 42.1 px |
| Clean repeat | 0.00 px | 0.00 px |
Detection check (YuNet): found the face at every blur and noise level. Score held 0.48β0.67 β but the box wanders under heavy blur (IoU 1.00 β 0.22), so alignment quality drops before detection fails.
08 Β· Live training
Face-ID training, for real
Not a mockup β a real classifier trained in this lab: 5 identities Γ 30 augmented samples (rotation, brightness, blur, flip) β 128-dim SFace embeddings β SVC. Train/test split 80/20.
Honest scope: 100% is on augmented variants of the same base photos β it proves robustness to imaging changes, not new-photo generalization. And one identity (a 32-px CCTV face) couldn't even be enrolled β the detector found nothing to train on. That failure is the finding.
09 Β· Open code
Run it yourself
Two small Python modules. Models download automatically from public sources (YuNet, SFace, FSRCNN).
cctv_software.py
Full v2 system: enroll β identify_frame β identify_track with quality gate.
from cctv_software import CCTVFaceRecognition
s = CCTVFaceRecognition()
s.enroll("person-1", clean_photo)
print(s.identify_frame(cctv_frame))
# (None, 0.365, 0.63, 'UNKNOWN -> flag for review')
print(s.identify_track(frames_12))
sachi_enhance.py
The faithful enhancer in 10 lines.
def sachi_enhance(crop):
d = cv2.fastNlMeansDenoisingColored(
crop, None, 4, 4, 7, 21)
return sr_model().upsample(d) # FSRCNN x4
Note: all faces shown are AI-generated test faces, never a real personβs photo. The pipeline works on any face image or video.