Stage 1–3: Image Ingestion, Exposure Gating & Face Localization

When you capture or upload a photograph, the server ingests the raw image into volatile memory via Sharp. Linear sRGB color conversion is performed without compression loss. Before running any facial analysis, Stage 2 conducts pre-flight quality checks: measuring mean illuminance, over-exposure clipping (>250), crushed shadows (<15), and Laplacian gradient sharpness.

Once illumination passes, Stage 3 executes MediaPipe BlazeFace (a single-shot multi-box detector optimized for mobile selfies) to pinpoint the face bounding box and 6 key anchor coordinates. If multiple faces or no face are found, the scan halts immediately.

Stage 4–6: 478 Landmark Regression, Expression Check & Alignment

Stage 4 feeds the normalized face crop into the MediaPipe Face Mesh V2 model, extracting 478 3D facial landmarks with sub-millimeter precision, including dense eyelid, eyebrow, nasal, lip, and iris boundaries.

Stage 5 evaluates facial expression and facial muscle tension. By computing eye openness ratios, mouth aspect ratio (MAR), and lip corner displacement, the engine verifies whether the subject is holding a neutral expression. Excessive smiling or squinting causes skin folding that mimics premature wrinkles; if detected, the scan instructs the user to relax facial muscles.

Stage 6 applies Procrustes similarity transformation to rotate and scale the face to canonical frontal alignment with standard Interocular Distance (63mm standard human average).

Stage 7–8: Multi-Class Segmentation Veto & 24 Anatomical Regions

Stage 7 employs MediaPipe Selfie Multiclass Segmentation to distinguish hair, clothing, background, and eyeglasses. Dr Maher Vision AI v4.0 uses it only as a "veto": non-skin pixels are masked out, while the analysed areas are drawn from the face landmarks. The segmentation model is less accurate on the darkest skin tones, so it never decides on its own what counts as skin.

Stage 8 constructs 24 canonical, mutually exclusive anatomical facial regions (Forehead, Glabella, Cheeks, Periorbital zones, Nasolabial folds, Chin, etc.). Priority-based polygon clipping guarantees exactly zero pixel overlap between adjacent regions.

Stage 9–13: Quality Gating, Multi-Scale Feature Extraction & Synthesis

In Stage 9, each individual region undergoes independent quality assessment: local sharpness, exposure clipping, signal-to-noise ratio, and physical resolution in pixels per millimeter (px/mm).

Stages 10 and 11 compute spatial features: single-pass multiscale Difference-of-Gaussians (DoG) bandpass filters detect circular spots, while Hessian eigenvalue curvature matrices verify roundness. Pigmentation is measured via localized CIE L*a*b* delta, erythema via illumination-normalized a* channels, and shine via specular luminance reflection.

Stages 12 and 13 aggregate regional measurements into area-weighted overall scores and generate a deterministic, bilingual clinical report.

Frequently Asked Questions

Why doesn’t Dr Maher Vision AI use generative AI (LLMs/Diffusion) to guess skin conditions?

Generative models hallucinate plausible-looking details that do not exist in reality. For a medical clinic, hallucination is dangerous. We rely solely on deterministic, explainable computer vision signal processing.

How fast is the 13-stage pipeline?

Thanks to single-pass whole-face filtering and cached Gaussian convolutions (getCachedBlur), the entire 13-stage pipeline runs in under 1.8 seconds on standard server CPUs.